torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc Namespace Reference

Implementation of class to encapsulate micro-bitstream library generation code. More...

Namespaces

 architecture
 Namespace for the Torc architecture support, providing device logic and wiring information, and design usage tracking.
 
 bitstream
 Namespace for the Torc bitstream frame-level support, including packet parsing and writing.
 
 common
 
 generic
 Namespace for the Torc generic netlist, including EDIF and BLIF importers and exporters.
 
 packer
 
 physical
 Namespace for the Torc physical netlist, including the XDL importer, exporter, placer, router, unpacker, and packer.
 
 placer
 
 router
 
 utils
 

Data Structures

class  location
 Abstract a location. More...
 
class  LutParser
 A Bison parser. More...
 
class  LutScanner
 
class  position
 Abstract a position. More...
 
class  stack
 Bison stack class. More...
 
class  slice
 Present a slice of the top of a stack. More...
 
class  XdlParser
 A Bison parser. More...
 
class  XdlScanner
 
class  ArchitectureBrowser
 Utility class for exploring database contents. More...
 
class  MarkExtracter
 Diff utility class for comparing physical netlists. More...
 
class  PhysicalDiff
 Diff utility class for comparing physical netlists. More...
 

Functions

 BOOST_AUTO_TEST_CASE (XilinxDatabaseTypesUnitTest)
 Unit test for device database type sizes. More...
 
const location operator+ (const location &begin, const location &end)
 Join two location objects to create a location. More...
 
const location operator+ (const location &begin, unsigned int width)
 Add two location objects. More...
 
locationoperator+= (location &res, unsigned int width)
 Add and assign a location. More...
 
std::ostream & operator<< (std::ostream &ostr, const location &loc)
 Intercept output stream redirection. More...
 
const positionoperator+= (position &res, const int width)
 Add and assign a position. More...
 
const position operator+ (const position &begin, const int width)
 Add two position objects. More...
 
const positionoperator-= (position &res, const int width)
 Add and assign a position. More...
 
const position operator- (const position &begin, const int width)
 Add two position objects. More...
 
std::ostream & operator<< (std::ostream &ostr, const position &pos)
 Intercept output stream redirection. More...
 
 BOOST_AUTO_TEST_CASE (xdl_parsing)
 Unit test for the directory tree. More...
 
 BOOST_AUTO_TEST_CASE (ArchitectureBrowserUnitTest)
 Unit test for the design diff function. More...
 
 BOOST_AUTO_TEST_CASE (PhysicalDiffDesignUnitTest)
 Unit test for the design diff function. More...
 
 BOOST_AUTO_TEST_CASE (PhysicalDiffModuleUnitTest)
 Unit test for the module diff function. More...
 
 BOOST_AUTO_TEST_CASE (PhysicalDiffCircuitUnitTest)
 Unit test for the circuit diff function. More...
 
 BOOST_AUTO_TEST_CASE (PhysicalDiffConfigMapUnitTest)
 Unit test for the config_map diff function. More...
 
 BOOST_AUTO_TEST_CASE (PhysicalDiffInstanceUnitTest)
 Unit test for the instance diff function. More...
 
 BOOST_AUTO_TEST_CASE (PhysicalDiffNetUnitTest)
 Unit test for the net diff function. More...
 

Variables

const torc::common::DottedVersion cTorcVersion (1, 0, 1)
 The current Torc version as a DottedVersion object. More...
 
const std::string cTorcVersionString = "1.0.1"
 The current Torc version as a constant string. More...
 

Detailed Description

Implementation of class to encapsulate micro-bitstream library generation code.

Top-level Torc namespace.

Class to encapsulate micro-bitstream library generation code for Virtex5 family.

Class to encapsulate micro-bitstream library generation code.

Base class to encapsulate micro-bitstream library generation code.

Author
Ritesh Kumar Soni
Todo:
remove <iostream>
Todo:
Warning: this will need to be moved elsewhere.
Todo:
Warning: this will need to be moved elsewhere.
Todo:
Warning: this will need to be moved elsewhere.
Todo:
Warning: this will need to be moved elsewhere.
Todo:
Warning: this will need to be moved elsewhere.
Todo:
Warning: this will need to be moved elsewhere.
Todo:
Warning: this will need to be moved elsewhere.
Todo:
Warning: this will need to be moved elsewhere.
Todo:
Remove this #include
Todo:
Warning: this will need to be moved elsewhere.

Function Documentation

torc::BOOST_AUTO_TEST_CASE ( xdl_parsing  )

Unit test for the directory tree.

Definition at line 18 of file XdlParsingUnitTest.cpp.

18  {
19  // look up the command line arguments
20  int& argc = boost::unit_test::framework::master_test_suite().argc;
21  char**& argv = boost::unit_test::framework::master_test_suite().argv;
22  // make sure that we at least have the name under which we were invoked
23  BOOST_REQUIRE(argc >= 1);
24  // resolve symbolic links if applicable
25  xdlmain(argc, argv);
26 }
int xdlmain(int argc, char *argv[])

+ Here is the call graph for this function:

torc::BOOST_AUTO_TEST_CASE ( PhysicalDiffDesignUnitTest  )

Unit test for the design diff function.

Definition at line 28 of file PhysicalDiffUnitTest.cpp.

28  {
29  std::ostringstream nullstream(std::ostringstream::out);
30  PhysicalDiff pd(nullstream);
31  // functions tested:
32  // bool diffDesign(const DesignSharedPtr& left, const DesignSharedPtr& right);
33 
34  std::string designName = "design";
35  std::string designName2 = "design2"; // not comparing differing names for the moment
36  std::string deviceName = "device";
37  std::string deviceName2 = "device2";
38  std::string devicePackage = "package";
39  std::string devicePackage2 = "package2";
40  std::string deviceSpeedGrade = "speed_grade";
41  std::string deviceSpeedGrade2 = "speed_grade2";
42  std::string xdlVersion = "xdl_version";
43  std::string xdlVersion2 = "xdl_version2";
44 
45  physical::DesignSharedPtr designPtrLeft = physical::Factory::newDesignPtr(designName,
46  deviceName, devicePackage, deviceSpeedGrade, xdlVersion);
47  BOOST_REQUIRE(designPtrLeft.get() != 0);
48  physical::DesignSharedPtr designPtrRight = physical::Factory::newDesignPtr(designName,
49  deviceName, devicePackage, deviceSpeedGrade, xdlVersion);
50  BOOST_REQUIRE(designPtrRight.get() != 0);
51 
52  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == true);
53  designPtrRight->setDevice(deviceName2);
54  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == false);
55  designPtrRight->setDevice(deviceName);
56  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == true);
57 
58  designPtrLeft->setPackage(devicePackage2);
59  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == false);
60  designPtrLeft->setPackage(devicePackage);
61  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == true);
62 
63  designPtrLeft->setSpeedGrade(deviceSpeedGrade2);
64  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == false);
65  designPtrLeft->setSpeedGrade(deviceSpeedGrade);
66  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == true);
67 
68  designPtrRight->setXdlVersion(xdlVersion2);
69  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == false);
70  designPtrRight->setXdlVersion(xdlVersion);
71  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == true);
72 
73  physical::ModuleSharedPtr module1PtrLeft
74  = physical::Factory::newModulePtr("module1", "anchor1");
75  physical::ModuleSharedPtr module2PtrLeft
76  = physical::Factory::newModulePtr("module2", "anchor2");
77  physical::ModuleSharedPtr module1PtrRight
78  = physical::Factory::newModulePtr("module1", "anchor1");
79  physical::ModuleSharedPtr module2PtrRight
80  = physical::Factory::newModulePtr("module2", "anchor2");
81 
82  BOOST_REQUIRE(designPtrLeft->addModule(module1PtrLeft) == true);
83  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == false);
84  BOOST_REQUIRE(designPtrRight->addModule(module1PtrRight) == true);
85  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == true);
86 
87  BOOST_REQUIRE(designPtrRight->addModule(module2PtrRight) == true);
88  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == false);
89  BOOST_REQUIRE(designPtrLeft->addModule(module2PtrLeft) == true);
90  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == true);
91 
92 }
std::string string
boost::shared_ptr< Design > DesignSharedPtr
boost::shared_ptr< Module > ModuleSharedPtr
Shared pointer encapsulation of a Module.
Definition: Module.hpp:114

+ Here is the call graph for this function:

torc::BOOST_AUTO_TEST_CASE ( XilinxDatabaseTypesUnitTest  )

Unit test for device database type sizes.

Definition at line 29 of file XilinxDatabaseTypesUnitTest.cpp.

29  {
30  // verify the sizes of device database types
31  // wires
32  BOOST_CHECK_EQUAL((size_t) 2, sizeof(WireCount));
33  BOOST_CHECK_EQUAL((size_t) 2, sizeof(WireIndex));
34  BOOST_CHECK_EQUAL((size_t) 2, sizeof(WireFlags));
35  // tiles
36  BOOST_CHECK_EQUAL((size_t) 4, sizeof(TileCount));
37  BOOST_CHECK_EQUAL((size_t) 4, sizeof(TileIndex));
38  BOOST_CHECK_EQUAL((size_t) 4, sizeof(TileOffset));
39  BOOST_CHECK_EQUAL((size_t) 2, sizeof(TileRow));
40  BOOST_CHECK_EQUAL((size_t) 2, sizeof(TileCol));
41  // tile types
42  BOOST_CHECK_EQUAL((size_t) 2, sizeof(TileTypeCount));
43  BOOST_CHECK_EQUAL((size_t) 2, sizeof(TileTypeIndex));
44  // compact segments
45  BOOST_CHECK_EQUAL((size_t) 4, sizeof(CompactSegmentCount));
46  BOOST_CHECK_EQUAL((size_t) 4, sizeof(CompactSegmentIndex));
47  // sites
48  BOOST_CHECK_EQUAL((size_t) 4, sizeof(SiteCount));
49  BOOST_CHECK_EQUAL((size_t) 4, sizeof(SiteIndex));
50  BOOST_CHECK_EQUAL((size_t) 2, sizeof(SiteFlags));
51  // site types
52  BOOST_CHECK_EQUAL((size_t) 2, sizeof(SiteTypeCount));
53  BOOST_CHECK_EQUAL((size_t) 2, sizeof(SiteTypeIndex));
54  // pins
55  BOOST_CHECK_EQUAL((size_t) 4, sizeof(PinCount));
56  BOOST_CHECK_EQUAL((size_t) 4, sizeof(PinIndex));
57  BOOST_CHECK_EQUAL((size_t) 2, sizeof(PinFlags));
58 }
Encapsulation of a tile index in an unsigned 32-bit integer.
Encapsulation of a tile row in an unsigned 16-bit integer.
Encapsulation of a tile column in an unsigned 16-bit integer.
Encapsulation of a compact segment count in an unsigned 32-bit integer.
Encapsulation of a pin count in an unsigned 32-bit integer.
Encapsulation of wire attribute flags in an unsigned 16-bit integer.
Encapsulation of a site count in an unsigned 32-bit integer.
Encapsulation of a pin index in an unsigned 32-bit integer.
Encapsulation of a wire index in an unsigned 16-bit integer.
Encapsulation of a tile offset in an unsigned 32-bit integer.
Encapsulation of a site type index in an unsigned 16-bit integer.
Encapsulation of a wire count in an unsigned 16-bit integer.
Encapsulation of a tile count in an unsigned 32-bit integer.
Encapsulation of pin attribute flags in an unsigned 16-bit integer.
Encapsulation of a compact segment index in an unsigned 32-bit integer.
Encapsulation of a site type count in an unsigned 16-bit integer.
Encapsulation of site attribute flags in an unsigned 16-bit integer.
Encapsulation of a tile type count in an unsigned 16-bit integer.
Encapsulation of a site index in an unsigned 32-bit integer.
Encapsulation of a tile type index in an unsigned 16-bit integer.
torc::BOOST_AUTO_TEST_CASE ( ArchitectureBrowserUnitTest  )

Unit test for the design diff function.

Definition at line 37 of file ArchitectureBrowserUnitTest.cpp.

37  {
38  /*
39  // setup a database for testing
40  //architecture::DDB db("torc/devices/xc5vlx30");
41  architecture::DDB db("devices/xc5vlx30");
42 
43  ArchitectureBrowser ab(db);
44 
45  ab.browse();
46  throw;
47 
48  boost::regex tileLine("\\s*\\(tile\\s\\d+\\s\\d+\\s(\\S+)\\s(\\S+)\\s\\d+\\s*");
49  boost::regex wireLine("\\s*\\(wire\\s(\\S+)\\s(\\d+)\\s*");
50  boost::regex connLine("\\s*\\(conn\\s(\\S+)\\s(\\S+)\\)\\s*");
51 
52  std::ifstream xdlrcFile("xc5vlx30.xdlrc", std::ifstream::in);
53  std::string inString;
54  int z = 0;
55  int numwires = 0;
56  char buf[16384];
57 
58  std::string currentTile("emptyTile");
59  std::string currentTileType("emptyTileType");
60  std::string currentWire("emptyWire");
61  std::string tilewirestring("emptyTilewire");
62  architecture::Tilewire tw;
63  architecture::Tilewire tw2;
64 
65  std::set<architecture::Tilewire> allwires;
66  std::map<architecture::Tilewire, int> currentsegment;
67 
68  boost::smatch matches;
69 
70  while (xdlrcFile.getline(buf, 16384)) {
71  inString = buf;
72  if (regex_match(inString, matches, tileLine)) {
73  currentTile = matches[1];
74  currentTileType = matches[2];
75  std::cout << "TILE: " << currentTile << " " << currentTileType << std::endl;
76  }
77  else if (regex_match(inString, matches, wireLine)) {
78  numwires++;
79 
80  currentWire = matches[1];
81  int segsize = boost::lexical_cast<int>(matches[2]);
82 
83  tilewirestring = currentWire + "@" + currentTile;
84  tw = ab.stringToTilewire(tilewirestring);
85  if (tw == architecture::Tilewire::sInvalid) {
86  std::cout << "Recovered bad tilewire from " << tilewirestring << std::endl;
87  throw;
88  }
89 
90  std::cout << "\tWIRE: " << tilewirestring << " ("
91  << currentTileType << ") " << tw << std::endl;
92 
93  if (allwires.find(tw) != allwires.end()) {
94  std::cout << "WIRE ALREADY EXISTS! " << tw << " " << tilewirestring << std::endl;
95  throw;
96  } else {
97  allwires.insert(tw);
98  }
99 
100  for (int i = 0; i < segsize; i++) {
101 //std::cout << " READING CONN " << i << std::endl;
102  xdlrcFile.getline(buf, 16384);
103  inString = buf;
104  if (regex_match(inString, matches, connLine)) {
105  tilewirestring = matches[2] + "@" + matches[1];
106 //std::cout << " " << tilewirestring << std::endl;
107  tw2 = ab.stringToTilewire(tilewirestring);
108 //std::cout << " " << tw2 << std::endl;
109  if (tw2 == architecture::Tilewire::sInvalid) {
110  std::cout << "Bad tilewire as part fo segment " << tilewirestring << std::endl;
111  throw;
112  }
113  std::cout << "\t\tCONN: " << tilewirestring << " " << tw2 << std::endl;
114 
115  } else {
116  std::cout << "ERROR, did not match a connection when expected "
117  << segsize << " " << i << " " << inString << std::endl;
118  throw;
119  }
120  }
121 
122  } else {
123  std::cout << "UNUSED: " << inString << std::endl;
124  }
125  z++;
126  }
127  std::cout << "Processed " << z << " lines" << std::endl;
128  std::cout << "Found " << numwires << std::endl;
129  std::cout << "DONE" << std::endl;
130 
131  */
132 
133 
134 
135 }
torc::BOOST_AUTO_TEST_CASE ( PhysicalDiffModuleUnitTest  )

Unit test for the module diff function.

Definition at line 95 of file PhysicalDiffUnitTest.cpp.

95  {
96  std::ostringstream nullstream(std::ostringstream::out);
97  PhysicalDiff pd(nullstream);
98  // functions tested:
99  // bool diffModule(const ModuleSharedPtr& left, const ModuleSharedPtr& right);
100 
101  std::string anchor = "anchor";
102  std::string anchor2 = "anchor2"; // not comparing differing names for the moment
103  std::string portname = "port";
104  std::string portname2 = "port2";
105  std::string pinname = "pinname";
106  std::string pinname2 = "pinname2";
107 
108  physical::InstanceSharedPtr instancePtrLeft
109  = physical::Factory::newInstancePtr("instname", "type", "tile", "site",
111  physical::InstanceSharedPtr instancePtrRight
112  = physical::Factory::newInstancePtr("instname", "type", "tile", "site",
114 
115  physical::ModuleSharedPtr modulePtrLeft
116  = physical::Factory::newModulePtr("module1", anchor);
117  physical::ModuleSharedPtr modulePtrRight
118  = physical::Factory::newModulePtr("module1", anchor);
119  physical::PortSharedPtr portLeft
120  = physical::Factory::newPortPtr(portname, instancePtrLeft, pinname);
121  physical::PortSharedPtr portLeft2
122  = physical::Factory::newPortPtr(portname, instancePtrLeft, pinname2);
123  physical::PortSharedPtr portRight
124  = physical::Factory::newPortPtr(portname, instancePtrRight, pinname);
125  physical::PortSharedPtr portRight2
126  = physical::Factory::newPortPtr(portname, instancePtrRight, pinname2);
127 
128  BOOST_REQUIRE(pd.diffModule(modulePtrLeft, modulePtrRight) == true);
129  modulePtrRight->setAnchor(anchor2);
130  BOOST_REQUIRE(pd.diffModule(modulePtrLeft, modulePtrRight) == false);
131  modulePtrRight->setAnchor(anchor);
132  BOOST_REQUIRE(pd.diffModule(modulePtrLeft, modulePtrRight) == true);
133 
134  modulePtrLeft->addPort(portLeft);
135  BOOST_REQUIRE(pd.diffModule(modulePtrLeft, modulePtrRight) == false);
136  modulePtrRight->addPort(portRight);
137  BOOST_REQUIRE(pd.diffModule(modulePtrLeft, modulePtrRight) == true);
138 
139  modulePtrRight->removePort(portRight);
140  modulePtrRight->addPort(portRight2);
141  BOOST_REQUIRE(pd.diffModule(modulePtrLeft, modulePtrRight) == false);
142  modulePtrLeft->removePort(portLeft);
143  modulePtrLeft->addPort(portLeft2);
144  BOOST_REQUIRE(pd.diffModule(modulePtrLeft, modulePtrRight) == true);
145 
146 }
boost::shared_ptr< Instance > InstanceSharedPtr
std::string string
boost::shared_ptr< Module > ModuleSharedPtr
Shared pointer encapsulation of a Module.
Definition: Module.hpp:114
boost::shared_ptr< Port > PortSharedPtr

+ Here is the call graph for this function:

torc::BOOST_AUTO_TEST_CASE ( PhysicalDiffCircuitUnitTest  )

Unit test for the circuit diff function.

Definition at line 149 of file PhysicalDiffUnitTest.cpp.

149  {
150  std::ostringstream nullstream(std::ostringstream::out);
151  PhysicalDiff pd(nullstream);
152  // functions tested:
153  // bool diffCircuit(const CircuitSharedPtr& left, const CircuitSharedPtr& right);
154 
155  std::string designName = "design";
156  std::string deviceName = "device";
157  std::string devicePackage = "package";
158  std::string deviceSpeedGrade = "speed_grade";
159  std::string xdlVersion = "xdl_version";
160 
161  physical::DesignSharedPtr designPtrLeft = physical::Factory::newDesignPtr(designName,
162  deviceName, devicePackage, deviceSpeedGrade, xdlVersion);
163  BOOST_REQUIRE(designPtrLeft.get() != 0);
164  physical::DesignSharedPtr designPtrRight = physical::Factory::newDesignPtr(designName,
165  deviceName, devicePackage, deviceSpeedGrade, xdlVersion);
166  BOOST_REQUIRE(designPtrRight.get() != 0);
167 
169  = physical::Factory::newInstancePtr("name1", "type1", "tile1", "site1");
171  = physical::Factory::newInstancePtr("name2", "type2", "tile2", "site2");
172  physical::InstanceSharedPtr inst1Right
173  = physical::Factory::newInstancePtr("name1", "type1", "tile1", "site1");
174  physical::InstanceSharedPtr inst2Right
175  = physical::Factory::newInstancePtr("name2", "type2", "tile2", "site2");
176 
177  physical::NetSharedPtr net1Left
178  = physical::Factory::newNetPtr("name1", physical::eNetTypeNormal);
179  physical::NetSharedPtr net2Left
180  = physical::Factory::newNetPtr("name2", physical::eNetTypeNormal);
181  physical::NetSharedPtr net1Right
182  = physical::Factory::newNetPtr("name1", physical::eNetTypeNormal);
183  physical::NetSharedPtr net2Right
184  = physical::Factory::newNetPtr("name2", physical::eNetTypeNormal);
185 
186  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == true);
187 
188  designPtrLeft->addInstance(inst1Left);
189  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == false);
190  designPtrRight->addInstance(inst1Right);
191  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == true);
192  designPtrRight->addInstance(inst2Right);
193  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == false);
194  designPtrLeft->addInstance(inst2Left);
195  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == true);
196 
197  designPtrRight->addNet(net1Right);
198  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == false);
199  designPtrLeft->addNet(net1Left);
200  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == true);
201  designPtrLeft->addNet(net2Left);
202  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == false);
203  designPtrRight->addNet(net2Right);
204  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == true);
205 
206 }
boost::shared_ptr< Instance > InstanceSharedPtr
std::string string
boost::shared_ptr< Design > DesignSharedPtr
boost::shared_ptr< Net > NetSharedPtr

+ Here is the call graph for this function:

torc::BOOST_AUTO_TEST_CASE ( PhysicalDiffConfigMapUnitTest  )

Unit test for the config_map diff function.

Definition at line 209 of file PhysicalDiffUnitTest.cpp.

209  {
210  std::ostringstream nullstream(std::ostringstream::out);
211  PhysicalDiff pd(nullstream);
212  // functions tested:
213  // bool diffConfigMap(const ConfigMapSharedPtr& left, const ConfigMapSharedPtr& right,
214  // const string& parentStr);
215 
216  std::string designName = "design";
217  std::string deviceName = "device";
218  std::string devicePackage = "package";
219  std::string deviceSpeedGrade = "speed_grade";
220  std::string xdlVersion = "xdl_version";
221 
222  std::string setting1 = "setting1";
223  std::string setting2 = "setting2";
224 
225  physical::DesignSharedPtr designPtrLeft = physical::Factory::newDesignPtr(designName,
226  deviceName, devicePackage, deviceSpeedGrade, xdlVersion);
227  BOOST_REQUIRE(designPtrLeft.get() != 0);
228  physical::DesignSharedPtr designPtrRight = physical::Factory::newDesignPtr(designName,
229  deviceName, devicePackage, deviceSpeedGrade, xdlVersion);
230  BOOST_REQUIRE(designPtrRight.get() != 0);
231 
232  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == true);
233 
234  designPtrLeft->setConfig("setting1", "name1", "value1");
235  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == false);
236  designPtrRight->setConfig("setting1", "name1", "value1");
237  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == true);
238  designPtrRight->setConfig("setting2", "name2", "value2");
239  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == false);
240  designPtrLeft->setConfig("setting2", "name2", "value3");
241  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == false);
242  designPtrLeft->setConfig("setting2", "name2", "value2");
243  BOOST_REQUIRE(pd.diffDesign(designPtrLeft, designPtrRight) == true);
244 
245 }
std::string string
boost::shared_ptr< Design > DesignSharedPtr

+ Here is the call graph for this function:

torc::BOOST_AUTO_TEST_CASE ( PhysicalDiffInstanceUnitTest  )

Unit test for the instance diff function.

Definition at line 248 of file PhysicalDiffUnitTest.cpp.

248  {
249  std::ostringstream nullstream(std::ostringstream::out);
250  PhysicalDiff pd(nullstream);
251  // functions tested:
252  // bool diffInstance(const InstanceSharedPtr& left, const InstanceSharedPtr& right);
253 
254  std::string name = "name";
255  std::string type = "type";
256  std::string type2 = "type2";
257  std::string tile = "tile";
258  std::string tile2 = "tile2";
259  std::string site = "site";
260  std::string site2 = "site2";
261 
262  physical::InstanceSharedPtr instancePtrLeft
263  = physical::Factory::newInstancePtr(name, type, tile, site);
264  BOOST_REQUIRE(instancePtrLeft.get() != 0);
265  physical::InstanceSharedPtr instancePtrRight
266  = physical::Factory::newInstancePtr(name, type, tile, site);
267  BOOST_REQUIRE(instancePtrRight.get() != 0);
268 
269  BOOST_REQUIRE(pd.diffInstance(instancePtrLeft, instancePtrRight) == true);
270 
271  instancePtrLeft->setType(type2);
272  BOOST_REQUIRE(pd.diffInstance(instancePtrLeft, instancePtrRight) == false);
273  instancePtrRight->setType(type2);
274  BOOST_REQUIRE(pd.diffInstance(instancePtrLeft, instancePtrRight) == true);
275 
276  instancePtrRight->setTile(tile2);
277  BOOST_REQUIRE(pd.diffInstance(instancePtrLeft, instancePtrRight) == false);
278  instancePtrLeft->setTile(tile2);
279  BOOST_REQUIRE(pd.diffInstance(instancePtrLeft, instancePtrRight) == true);
280 
281  instancePtrLeft->setSite(site2);
282  BOOST_REQUIRE(pd.diffInstance(instancePtrLeft, instancePtrRight) == false);
283  instancePtrRight->setSite(site2);
284  BOOST_REQUIRE(pd.diffInstance(instancePtrLeft, instancePtrRight) == true);
285 
286  instancePtrLeft->setBonding(physical::eInstanceBondingBonded);
287  BOOST_REQUIRE(pd.diffInstance(instancePtrLeft, instancePtrRight) == false);
288  instancePtrRight->setBonding(physical::eInstanceBondingBonded);
289  BOOST_REQUIRE(pd.diffInstance(instancePtrLeft, instancePtrRight) == true);
290 
291 }
boost::shared_ptr< Instance > InstanceSharedPtr
std::string string

+ Here is the call graph for this function:

torc::BOOST_AUTO_TEST_CASE ( PhysicalDiffNetUnitTest  )

Unit test for the net diff function.

Definition at line 294 of file PhysicalDiffUnitTest.cpp.

294  {
295  std::ostringstream nullstream(std::ostringstream::out);
296  PhysicalDiff pd(nullstream);
297  // functions tested:
298  // bool diffNet(const NetSharedPtr& left, const NetSharedPtr& right);
299 
300  physical::InstanceSharedPtr instPtrLeft
301  = physical::Factory::newInstancePtr("inst1", "itype", "tile", "site");
302  physical::InstanceSharedPtr instPtrRight
303  = physical::Factory::newInstancePtr("inst1", "itype", "tile", "site");
304  physical::InstancePinSharedPtr instPin1LeftPtr
305  = physical::Factory::newInstancePinPtr(instPtrLeft, "pin1");
306  physical::InstancePinSharedPtr instPin2LeftPtr
307  = physical::Factory::newInstancePinPtr(instPtrLeft, "pin2");
308  physical::InstancePinSharedPtr instPin1RightPtr
309  = physical::Factory::newInstancePinPtr(instPtrRight, "pin1");
310  physical::InstancePinSharedPtr instPin2RightPtr
311  = physical::Factory::newInstancePinPtr(instPtrRight, "pin2");
312  physical::Pip pip1Left = physical::Factory::newPip(
313  "tile1", "source1", "sink1", physical::ePipUnidirectionalBuffered);
314  physical::Pip pip1Right = physical::Factory::newPip(
315  "tile1", "source1", "sink1", physical::ePipUnidirectionalBuffered);
316 
317  std::string name = "name";
319 
320  physical::NetSharedPtr netPtrLeft = physical::Factory::newNetPtr(name, type);
321  physical::NetSharedPtr netPtrRight = physical::Factory::newNetPtr(name, type);
322 
323  BOOST_REQUIRE(pd.diffNet(netPtrLeft, netPtrRight) == true);
324 
325  netPtrRight->setNetType(physical::eNetTypeNormal);
326  BOOST_REQUIRE(pd.diffNet(netPtrLeft, netPtrRight) == false);
327  netPtrLeft->setNetType(physical::eNetTypeNormal);
328  BOOST_REQUIRE(pd.diffNet(netPtrLeft, netPtrRight) == true);
329 
330  netPtrLeft->addSource(instPin1LeftPtr);
331  BOOST_REQUIRE(pd.diffNet(netPtrLeft, netPtrRight) == false);
332  netPtrRight->addSource(instPin1RightPtr);
333  BOOST_REQUIRE(pd.diffNet(netPtrLeft, netPtrRight) == true);
334 
335  netPtrLeft->addSink(instPin2LeftPtr);
336  BOOST_REQUIRE(pd.diffNet(netPtrLeft, netPtrRight) == false);
337  netPtrRight->addSink(instPin2RightPtr);
338  BOOST_REQUIRE(pd.diffNet(netPtrLeft, netPtrRight) == true);
339 
340  netPtrRight->addPip(pip1Right);
341  BOOST_REQUIRE(pd.diffNet(netPtrLeft, netPtrRight) == false);
342  netPtrLeft->addPip(pip1Left);
343  BOOST_REQUIRE(pd.diffNet(netPtrLeft, netPtrRight) == true);
344 }
ENetType
Enumeration of net power types.
boost::shared_ptr< Instance > InstanceSharedPtr
std::string string
boost::shared_ptr< Net > NetSharedPtr
boost::shared_ptr< InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.

+ Here is the call graph for this function:

const location torc::operator+ ( const location &  begin,
const location &  end 
)
inline

Join two location objects to create a location.

Definition at line 100 of file bitstream/assembler/lut/location.hh.

101  {
102  location res = begin;
103  res.end = end.end;
104  return res;
105  }
const location torc::operator+ ( const location &  begin,
unsigned int  width 
)
inline

Add two location objects.

Definition at line 108 of file bitstream/assembler/lut/location.hh.

109  {
110  location res = begin;
111  res.columns (width);
112  return res;
113  }

+ Here is the call graph for this function:

const position torc::operator+ ( const position &  begin,
const int  width 
)
inline

Add two position objects.

Definition at line 109 of file bitstream/assembler/lut/position.hh.

110  {
111  position res = begin;
112  return res += width;
113  }
const position & torc::operator+= ( position &  res,
const int  width 
)
inline

Add and assign a position.

Definition at line 101 of file bitstream/assembler/lut/position.hh.

102  {
103  res.columns (width);
104  return res;
105  }

+ Here is the call graph for this function:

location & torc::operator+= ( location &  res,
unsigned int  width 
)
inline

Add and assign a location.

Definition at line 116 of file bitstream/assembler/lut/location.hh.

117  {
118  res.columns (width);
119  return res;
120  }

+ Here is the call graph for this function:

const position torc::operator- ( const position &  begin,
const int  width 
)
inline

Add two position objects.

Definition at line 124 of file bitstream/assembler/lut/position.hh.

125  {
126  return begin + -width;
127  }
const position & torc::operator-= ( position &  res,
const int  width 
)
inline

Add and assign a position.

Definition at line 117 of file bitstream/assembler/lut/position.hh.

118  {
119  return res += -width;
120  }
std::ostream & torc::operator<< ( std::ostream &  ostr,
const location &  loc 
)
inline

Intercept output stream redirection.

Parameters
ostrthe destination output stream
loca reference to the location to redirect

Avoid duplicate information.

Definition at line 128 of file bitstream/assembler/lut/location.hh.

129  {
130  position last = loc.end - 1;
131  ostr << loc.begin;
132  if (last.filename
133  && (!loc.begin.filename
134  || *loc.begin.filename != *last.filename))
135  ostr << '-' << last;
136  else if (loc.begin.line != last.line)
137  ostr << '-' << last.line << '.' << last.column;
138  else if (loc.begin.column != last.column)
139  ostr << '-' << last.column;
140  return ostr;
141  }
std::ostream & torc::operator<< ( std::ostream &  ostr,
const position &  pos 
)
inline

Intercept output stream redirection.

Parameters
ostrthe destination output stream
posa reference to the position to redirect

Definition at line 134 of file bitstream/assembler/lut/position.hh.

135  {
136  if (pos.filename)
137  ostr << *pos.filename << ':';
138  return ostr << pos.line << '.' << pos.column;
139  }

Variable Documentation

const torc::common::DottedVersion torc::cTorcVersion

The current Torc version as a DottedVersion object.

Definition at line 28 of file Version.hpp.

const std::string torc::cTorcVersionString = "1.0.1"

The current Torc version as a constant string.

Definition at line 25 of file Version.cpp.