torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UnpackerUnitTest.cpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 /// \file
17 /// \brief Unit test for the PrimitiveStructure class.
18 
19 #include <boost/test/unit_test.hpp>
20 #include "torc/packer/Unpacker.hpp"
27 #include "torc/physical/Net.hpp"
28 #include "torc/Physical.hpp"
29 #include <iostream>
30 #include <fstream>
31 
32 namespace torc {
33 namespace packer {
34 
35 BOOST_AUTO_TEST_SUITE(packer)
36 
37 
38 /// \brief Unit test for the PrimitiveStructure class.
39 BOOST_AUTO_TEST_CASE(UnpackerUnitTest) {
40 
41  std::string xdls[] = {
42  "torc/router/TraceRegressionTest.Virtex5.xdl",
43  "",
44  "torc/router/PathFinderRouter/PathFinderRegression.Virtex5.Test1.xdl",
45  "regression/PathFinderRegression.Virtex5.Test1.xdl",
46  "system.xdl",
47  "regression/cae_fpga_routed.xdl",
48  "regression/counter.xdl",
49  "regression/DesignUnitTest.reference.xdl",
50  "regression/PathFinderRegression.Virtex5.Test1.xdl",
51  "regression/TraceRegressionTest.Virtex5.xdl",
52  "regression/TraceRegressionTest.VirtexTbuf.xdl",
53  "regression/TraceVirtex5Test.xdl",
54  "regression/Virtex5UnitTest.reference.xdl",
55  "regression/a.xdl",
56  "regression/audio_test.xdl",
57  "regression/bitstreamTest.xdl",
58  "regression/blinker.xdl",
59  "regression/collatz1.xdl",
60  "regression/config_with_trailing_embedded_newline.xdl",
61  "regression/counter.xdl",
62  "regression/fullroutetest3_noio.xdl",
63  "regression/hardnets.xdl",
64  "regression/input.xdl",
65  "regression/loop154@24816_1_test0.xdl",
66  "regression/loop154@24816_1_test1.xdl",
67  "regression/minimips.xdl",
68  "regression/neil.xdl",
69  "regression/path276@24816_16.xdl",
70  "regression/pathfindertest1.xdl",
71  "regression/pathfindertest1_constrained.xdl",
72  "regression/pathfindertest1_onenet.xdl",
73  "regression/pathfindertest2.xdl",
74  "regression/powerandglobal.xdl",
75  "regression/prng_v0.xdl",
76  "regression/rfft.par.xdl",
77  "regression/routingtest1.xdl",
78  "regression/test.xdl",
79  "regression/test_noroute.xdl",
80  "regression/testsys_nopips.xdl",
81 // "regression/testsystem.xdl",
82  "regression/top_map.xdl",
83  "regression/twonet.xdl",
84 // "regression/xc5vlx30ff676-1.xdl",
85 // "regression/xc5vlx330tff1738-1.xdl",
86  "regression/xc5vlx50ff676_base_io_single_test.xdl",
87  ""
88  };
89 
90  // create the appropriate file paths
92  / "torc" / "router" / "PathFinderRouter" / "PathFinderRegression.Virtex5.Test1.xdl";
94  / "regression" / "UnpackerUnitTest.xdl";
95 std::cout << referencePath << std::endl;
96 
97  for(int i = 0; xdls[i].size(); i++) {
98  referencePath = xdls[i];
99  std::cerr << "Unpacking " << referencePath << std::endl;
100 
101  // import the XDL design
102  std::fstream fileStream(referencePath.string().c_str());
103  BOOST_REQUIRE(fileStream.good());
105  importer(fileStream, referencePath.string());
106 
107  // look up the design
108  torc::physical::DesignSharedPtr mDesignPtr = importer.getDesignPtr();
109  BOOST_REQUIRE(mDesignPtr.get() != 0);
110 
111  // invoking the unpacker
112  torc::packer::Unpacker unpacker(mDesignPtr);
113  unpacker.unpack();
114 
115  // export the XDL design
116  std::fstream xdlExport(generatedPath.string().c_str(), std::ios_base::out);
117  torc::physical::XdlExporter fileExporter(xdlExport);
118  fileExporter(mDesignPtr);
119  }
120 
121 }
122 
123 
124 BOOST_AUTO_TEST_SUITE_END()
125 
126 } // namespace architecture
127 } // namespace torc
DesignSharedPtr getDesignPtr(void)
Returns a shared pointer for the design.
Header for the DirectoryTree class.
Header for the Instance class.
Header for the PrimitiveStructure class.
std::string string
Header for Boost.Test helper functions.
Architecture aware importer from XDL format into a physical design.
Main torc::physical namespace header.
boost::filesystem::path path
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
BOOST_AUTO_TEST_CASE(PrimitiveStructureUnitTest)
Unit test for the PrimitiveStructure class.
Header for the DDB class.
Header for the Net class.
Header for the XdlImporter class.
static const boost::filesystem::path & getExecutablePath(void)
Returns the absolute path to the executable directory.
Physical design exporter for XDL.
Definition: XdlExporter.hpp:31