20 #include <boost/test/unit_test.hpp>
25 BOOST_AUTO_TEST_SUITE(utils)
29 std::ostringstream nullstream(std::ostringstream::out);
46 deviceName, devicePackage, deviceSpeedGrade, xdlVersion);
47 BOOST_REQUIRE(designPtrLeft.get() != 0);
49 deviceName, devicePackage, deviceSpeedGrade, xdlVersion);
50 BOOST_REQUIRE(designPtrRight.get() != 0);
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);
58 designPtrLeft->setPackage(devicePackage2);
59 BOOST_REQUIRE(pd.
diffDesign(designPtrLeft, designPtrRight) ==
false);
60 designPtrLeft->setPackage(devicePackage);
61 BOOST_REQUIRE(pd.
diffDesign(designPtrLeft, designPtrRight) ==
true);
63 designPtrLeft->setSpeedGrade(deviceSpeedGrade2);
64 BOOST_REQUIRE(pd.
diffDesign(designPtrLeft, designPtrRight) ==
false);
65 designPtrLeft->setSpeedGrade(deviceSpeedGrade);
66 BOOST_REQUIRE(pd.
diffDesign(designPtrLeft, designPtrRight) ==
true);
68 designPtrRight->setXdlVersion(xdlVersion2);
69 BOOST_REQUIRE(pd.
diffDesign(designPtrLeft, designPtrRight) ==
false);
70 designPtrRight->setXdlVersion(xdlVersion);
71 BOOST_REQUIRE(pd.
diffDesign(designPtrLeft, designPtrRight) ==
true);
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);
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);
96 std::ostringstream nullstream(std::ostringstream::out);
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);
134 modulePtrLeft->addPort(portLeft);
135 BOOST_REQUIRE(pd.
diffModule(modulePtrLeft, modulePtrRight) ==
false);
136 modulePtrRight->addPort(portRight);
137 BOOST_REQUIRE(pd.
diffModule(modulePtrLeft, modulePtrRight) ==
true);
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);
150 std::ostringstream nullstream(std::ostringstream::out);
162 deviceName, devicePackage, deviceSpeedGrade, xdlVersion);
163 BOOST_REQUIRE(designPtrLeft.get() != 0);
165 deviceName, devicePackage, deviceSpeedGrade, xdlVersion);
166 BOOST_REQUIRE(designPtrRight.get() != 0);
186 BOOST_REQUIRE(pd.
diffDesign(designPtrLeft, designPtrRight) ==
true);
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);
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);
210 std::ostringstream nullstream(std::ostringstream::out);
226 deviceName, devicePackage, deviceSpeedGrade, xdlVersion);
227 BOOST_REQUIRE(designPtrLeft.get() != 0);
229 deviceName, devicePackage, deviceSpeedGrade, xdlVersion);
230 BOOST_REQUIRE(designPtrRight.get() != 0);
232 BOOST_REQUIRE(pd.
diffDesign(designPtrLeft, designPtrRight) ==
true);
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);
249 std::ostringstream nullstream(std::ostringstream::out);
264 BOOST_REQUIRE(instancePtrLeft.get() != 0);
267 BOOST_REQUIRE(instancePtrRight.get() != 0);
269 BOOST_REQUIRE(pd.
diffInstance(instancePtrLeft, instancePtrRight) ==
true);
271 instancePtrLeft->setType(type2);
272 BOOST_REQUIRE(pd.
diffInstance(instancePtrLeft, instancePtrRight) ==
false);
273 instancePtrRight->setType(type2);
274 BOOST_REQUIRE(pd.
diffInstance(instancePtrLeft, instancePtrRight) ==
true);
276 instancePtrRight->setTile(tile2);
277 BOOST_REQUIRE(pd.
diffInstance(instancePtrLeft, instancePtrRight) ==
false);
278 instancePtrLeft->setTile(tile2);
279 BOOST_REQUIRE(pd.
diffInstance(instancePtrLeft, instancePtrRight) ==
true);
281 instancePtrLeft->setSite(site2);
282 BOOST_REQUIRE(pd.
diffInstance(instancePtrLeft, instancePtrRight) ==
false);
283 instancePtrRight->setSite(site2);
284 BOOST_REQUIRE(pd.
diffInstance(instancePtrLeft, instancePtrRight) ==
true);
287 BOOST_REQUIRE(pd.
diffInstance(instancePtrLeft, instancePtrRight) ==
false);
289 BOOST_REQUIRE(pd.
diffInstance(instancePtrLeft, instancePtrRight) ==
true);
295 std::ostringstream nullstream(std::ostringstream::out);
323 BOOST_REQUIRE(pd.
diffNet(netPtrLeft, netPtrRight) ==
true);
326 BOOST_REQUIRE(pd.
diffNet(netPtrLeft, netPtrRight) ==
false);
328 BOOST_REQUIRE(pd.
diffNet(netPtrLeft, netPtrRight) ==
true);
330 netPtrLeft->addSource(instPin1LeftPtr);
331 BOOST_REQUIRE(pd.
diffNet(netPtrLeft, netPtrRight) ==
false);
332 netPtrRight->addSource(instPin1RightPtr);
333 BOOST_REQUIRE(pd.
diffNet(netPtrLeft, netPtrRight) ==
true);
335 netPtrLeft->addSink(instPin2LeftPtr);
336 BOOST_REQUIRE(pd.
diffNet(netPtrLeft, netPtrRight) ==
false);
337 netPtrRight->addSink(instPin2RightPtr);
338 BOOST_REQUIRE(pd.
diffNet(netPtrLeft, netPtrRight) ==
true);
340 netPtrRight->addPip(pip1Right);
341 BOOST_REQUIRE(pd.
diffNet(netPtrLeft, netPtrRight) ==
false);
342 netPtrLeft->addPip(pip1Left);
343 BOOST_REQUIRE(pd.
diffNet(netPtrLeft, netPtrRight) ==
true);
346 BOOST_AUTO_TEST_SUITE_END()
ENetType
Enumeration of net power types.
static PortSharedPtr newPortPtr(const string &inName, InstanceSharedPtr inInstancePtr, const string &inPinName)
Create and return a new Port shared pointer.
bool diffDesign(const DesignSharedPtr &left, const DesignSharedPtr &right)
Diff design pointers and then recursively compare modules and inherited members.
bool diffInstance(const InstanceSharedPtr &left, const InstanceSharedPtr &right)
Diff instance pointers and then the underlying config map.
boost::shared_ptr< Port > PortSharedPtr
Shared pointer encapsulation of a Port.
PhysicalDiff class for comparing physical netlists.
static NetSharedPtr newNetPtr(const string &inName, ENetType inNetType=eNetTypeNormal)
Create and return a new Net share pointer.
boost::shared_ptr< class InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.
boost::shared_ptr< Module > ModuleSharedPtr
Shared pointer encapsulation of a Module.
bool diffNet(const NetSharedPtr &left, const NetSharedPtr &right)
Diff net pointers and then the underlying config map.
static torc::physical::Pip newPip(const string &inTileName, const string &inSourceWireName, const string &inSinkWireName, EPipDirection inPipDirection, RoutethroughSharedPtr inRoutethroughPtr=RoutethroughSharedPtr())
Construct a pip and return it.
boost::shared_ptr< Net > NetSharedPtr
Shared pointer encapsulation of a Net.
static InstanceSharedPtr newInstancePtr(const string &inName, const string &inType, const string &inTile, const string &inSite, EInstanceBonding inBonding=eInstanceBondingUnknown, InstanceReferenceSharedPtr inInstanceReferencePtr=InstanceReferenceSharedPtr())
Construct and return a new Instance shared pointer.
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance.
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
bool diffModule(const ModuleSharedPtr &left, const ModuleSharedPtr &right)
Diff module pointers and then recursively compare inherited members from circuit. ...
Physical design programmable interconnect point.
static InstancePinSharedPtr newInstancePinPtr(InstanceSharedPtr inInstancePtr, const string &inPinName)
Construct and return a new InstancePin shared pointer.
static ModuleSharedPtr newModulePtr(const string &inName, const string &inAnchor)
Create and return a new Module shared pointer.
Diff utility class for comparing physical netlists.
BOOST_AUTO_TEST_CASE(XilinxDatabaseTypesUnitTest)
Unit test for device database type sizes.
static DesignSharedPtr newDesignPtr(const string &inName, const string &inDevice, const string &inPackage, const string &inSpeedGrade, const string &inXdlVersion)
Create and return a new Design shared pointer.