2020-01-12 19:11:00 -06:00
|
|
|
/********************************************************************
|
|
|
|
* Unit test functions to validate the correctness of
|
|
|
|
* 1. parser of data structures
|
|
|
|
* 2. writer of data structures
|
|
|
|
*******************************************************************/
|
2020-01-16 13:32:29 -06:00
|
|
|
/* Headers from vtrutils */
|
|
|
|
#include "vtr_assert.h"
|
2020-01-13 22:05:58 -06:00
|
|
|
#include "vtr_log.h"
|
|
|
|
|
2020-01-16 13:32:29 -06:00
|
|
|
/* Headers from readarchopenfpga */
|
2020-01-16 21:25:00 -06:00
|
|
|
#include "check_circuit_library.h"
|
2020-01-15 21:28:04 -06:00
|
|
|
#include "read_xml_openfpga_arch.h"
|
2020-01-16 13:32:29 -06:00
|
|
|
#include "write_xml_openfpga_arch.h"
|
2020-01-12 19:11:00 -06:00
|
|
|
|
|
|
|
int main(int argc, const char** argv) {
|
2020-01-16 13:32:29 -06:00
|
|
|
/* Ensure we have only one or two argument */
|
|
|
|
VTR_ASSERT((2 == argc) || (3 == argc));
|
|
|
|
|
2020-01-12 19:11:00 -06:00
|
|
|
/* Parse the circuit library from an XML file */
|
2020-01-16 21:22:56 -06:00
|
|
|
const openfpga::Arch& openfpga_arch = read_xml_openfpga_arch(argv[1]);
|
2020-01-13 22:52:13 -06:00
|
|
|
VTR_LOG("Parsed %lu circuit models from XML into circuit library.\n",
|
2020-01-15 21:28:04 -06:00
|
|
|
openfpga_arch.circuit_lib.num_models());
|
2020-01-12 19:11:00 -06:00
|
|
|
|
2020-01-16 21:25:00 -06:00
|
|
|
/* Check the circuit library */
|
|
|
|
check_circuit_library(openfpga_arch.circuit_lib);
|
2020-01-12 19:11:00 -06:00
|
|
|
|
2020-01-16 13:32:29 -06:00
|
|
|
/* Output the circuit library to an XML file
|
|
|
|
* This is optional only used when there is a second argument
|
|
|
|
*/
|
|
|
|
if (3 <= argc) {
|
|
|
|
write_xml_openfpga_arch(argv[2], openfpga_arch);
|
|
|
|
VTR_LOG("Echo the OpenFPGA architecture to an XML file: %s.\n",
|
|
|
|
argv[2]);
|
|
|
|
}
|
2020-01-12 19:11:00 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|