00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <boost/test/unit_test.hpp>
00020 #include "torc/packer/Unpacker.hpp"
00021 #include "torc/packer/PrimitiveStructure.hpp"
00022 #include "torc/architecture/DDB.hpp"
00023 #include "torc/architecture/XdlImporter.hpp"
00024 #include "torc/common/DirectoryTree.hpp"
00025 #include "torc/common/TestHelpers.hpp"
00026 #include "torc/physical/Instance.hpp"
00027 #include "torc/physical/Net.hpp"
00028 #include "torc/Physical.hpp"
00029 #include <iostream>
00030 #include <fstream>
00031
00032 namespace torc {
00033 namespace packer {
00034
00035 BOOST_AUTO_TEST_SUITE(packer)
00036
00037
00038
00039 BOOST_AUTO_TEST_CASE(UnpackerUnitTest) {
00040
00041 std::string xdls[] = {
00042 "regression/PathFinderRegression.Virtex5.Test1.xdl",
00043 "",
00044
00045
00046 "system.xdl",
00047 "regression/cae_fpga_routed.xdl",
00048 "regression/counter.xdl",
00049
00050 "regression/DesignUnitTest.reference.xdl",
00051 "regression/PathFinderRegression.Virtex5.Test1.xdl",
00052 "regression/TraceRegressionTest.Virtex5.xdl",
00053 "regression/TraceRegressionTest.VirtexTbuf.xdl",
00054 "regression/TraceVirtex5Test.xdl",
00055 "regression/Virtex5UnitTest.reference.xdl",
00056 "regression/a.xdl",
00057 "regression/audio_test.xdl",
00058 "regression/bitstreamTest.xdl",
00059 "regression/blinker.xdl",
00060 "regression/collatz1.xdl",
00061 "regression/config_with_trailing_embedded_newline.xdl",
00062 "regression/counter.xdl",
00063 "regression/fullroutetest3_noio.xdl",
00064 "regression/hardnets.xdl",
00065 "regression/input.xdl",
00066 "regression/loop154@24816_1_test0.xdl",
00067 "regression/loop154@24816_1_test1.xdl",
00068 "regression/minimips.xdl",
00069 "regression/neil.xdl",
00070 "regression/path276@24816_16.xdl",
00071 "regression/pathfindertest1.xdl",
00072 "regression/pathfindertest1_constrained.xdl",
00073 "regression/pathfindertest1_onenet.xdl",
00074 "regression/pathfindertest2.xdl",
00075 "regression/powerandglobal.xdl",
00076 "regression/prng_v0.xdl",
00077 "regression/rfft.par.xdl",
00078 "regression/routingtest1.xdl",
00079 "regression/test.xdl",
00080 "regression/test_noroute.xdl",
00081 "regression/testsys_nopips.xdl",
00082
00083 "regression/top_map.xdl",
00084 "regression/twonet.xdl",
00085
00086
00087 "regression/xc5vlx50ff676_base_io_single_test.xdl",
00088 ""
00089 };
00090
00091
00092 boost::filesystem::path regressionPath
00093 = torc::common::DirectoryTree::getExecutablePath() / "regression";
00094 boost::filesystem::path generatedPath
00095 = regressionPath / "DesignUnitTest.generated.xdl";
00096 boost::filesystem::path referencePath
00097 = regressionPath / "PathFinderRegression.Virtex5.Test1.xdl";
00098
00099 for(int i = 0; xdls[i].size(); i++) {
00100 referencePath = xdls[i];
00101 std::cerr << "Unpacking " << referencePath << std::endl;
00102
00103
00104 std::fstream fileStream(referencePath.string().c_str());
00105 BOOST_REQUIRE(fileStream.good());
00106 torc::architecture::XdlImporter importer;
00107 importer(fileStream, referencePath.string());
00108
00109
00110 torc::physical::DesignSharedPtr mDesignPtr = importer.getDesignPtr();
00111 BOOST_REQUIRE(mDesignPtr.get() != 0);
00112
00113
00114 torc::packer::Unpacker unpacker(mDesignPtr);
00115 unpacker.unpack();
00116
00117
00118 std::string outFileName
00119 = boost::filesystem::path(referencePath).replace_extension().string() + ".xdl.unpacked";
00120 std::fstream xdlExport(outFileName.c_str(), std::ios_base::out);
00121 torc::physical::XdlExporter fileExporter(xdlExport);
00122 fileExporter(mDesignPtr);
00123 }
00124
00125 }
00126
00127
00128 BOOST_AUTO_TEST_SUITE_END()
00129
00130 }
00131 }