2020-06-20 19:25:17 -05:00
|
|
|
/********************************************************************
|
|
|
|
* Unit test functions to validate the correctness of
|
|
|
|
* 1. parser of data structures
|
|
|
|
* 2. writer of data structures
|
|
|
|
*******************************************************************/
|
|
|
|
/* Headers from vtrutils */
|
|
|
|
#include "vtr_assert.h"
|
|
|
|
#include "vtr_log.h"
|
|
|
|
|
|
|
|
/* Headers from fabric key */
|
|
|
|
#include "read_xml_arch_bitstream.h"
|
2020-06-21 14:06:39 -05:00
|
|
|
#include "write_xml_arch_bitstream.h"
|
2021-05-07 12:22:01 -05:00
|
|
|
#include "report_arch_bitstream_distribution.h"
|
2020-06-20 19:25:17 -05:00
|
|
|
|
|
|
|
int main(int argc, const char** argv) {
|
2021-05-07 12:22:01 -05:00
|
|
|
/* Ensure we have only one or two or 3 argument */
|
|
|
|
VTR_ASSERT((2 == argc) || (3 == argc) || (4 == argc));
|
2020-06-20 19:25:17 -05:00
|
|
|
|
|
|
|
/* Parse the bitstream from an XML file */
|
|
|
|
openfpga::BitstreamManager test_bitstream = openfpga::read_xml_architecture_bitstream(argv[1]);
|
|
|
|
VTR_LOG("Read the bitstream from an XML file: %s.\n",
|
|
|
|
argv[1]);
|
|
|
|
|
2021-05-07 12:22:01 -05:00
|
|
|
/* Output the bitstream database to an XML file
|
2020-06-20 19:25:17 -05:00
|
|
|
* This is optional only used when there is a second argument
|
|
|
|
*/
|
|
|
|
if (3 <= argc) {
|
2020-06-21 14:06:39 -05:00
|
|
|
openfpga::write_xml_architecture_bitstream(test_bitstream, argv[2]);
|
2020-06-20 19:25:17 -05:00
|
|
|
VTR_LOG("Echo the bitstream to an XML file: %s.\n",
|
|
|
|
argv[2]);
|
|
|
|
}
|
2021-05-07 12:22:01 -05:00
|
|
|
/* Output the bitstream distribution to an XML file
|
|
|
|
* This is optional only used when there is a third argument
|
|
|
|
*/
|
|
|
|
if (4 <= argc) {
|
|
|
|
openfpga::report_architecture_bitstream_distribution(test_bitstream, argv[3]);
|
|
|
|
VTR_LOG("Echo the bitstream distribution to an XML file: %s.\n",
|
|
|
|
argv[3]);
|
|
|
|
}
|
|
|
|
|
2020-06-20 19:25:17 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|