19 #ifndef TORC_UTILS_PHYSICALDIFF_HPP
20 #define TORC_UTILS_PHYSICALDIFF_HPP
31 class PhysicalDiffDesignUnitTest;
32 class PhysicalDiffModuleUnitTest;
33 class PhysicalDiffCircuitUnitTest;
34 class PhysicalDiffConfigMapUnitTest;
35 class PhysicalDiffInstanceUnitTest;
36 class PhysicalDiffNetUnitTest;
112 mStream <<
"WARNING: Pip comparison uses only tile, source, direction "
113 <<
"and sink!" << std::endl;
114 mStream <<
"WARNING: Port comparison does not use the port name!" << std::endl;
115 mStream <<
"WARNING: Config sequence index not used!" << std::endl;
116 mStream <<
"WARNING: Instance does not check reference pointer!" << std::endl;
127 string designNameLeft = left->getName();
128 string designNameRight = right->getName();
130 if (!(designNameLeft == designNameRight)) {
131 mStream <<
"! Design Name: " << designNameLeft <<
" | "
132 << designNameRight << std::endl;
135 if (!(left->getDevice() == right->getDevice())) {
136 mStream <<
"! Device: " << left->getDevice() <<
" | "
137 << right->getDevice() << std::endl;
140 if (!(left->getPackage() == right->getPackage())) {
141 mStream <<
"! Package: " << left->getPackage() <<
" | "
142 << right->getPackage() << std::endl;
145 if (!(left->getSpeedGrade() == right->getSpeedGrade())) {
146 mStream <<
"! Speed grade: " << left->getSpeedGrade()
147 <<
" | " << right->getSpeedGrade() << std::endl;
150 if (!(left->getXdlVersion() == right->getXdlVersion())) {
151 mStream <<
"! XDL version differs: " << left->getXdlVersion()
152 <<
" | " << right->getXdlVersion() << std::endl;
160 leftModules.push_back(*p);
163 rightModules.push_back(*p);
169 for (ileft = leftModules.begin(); ileft != leftModules.end(); ileft++) {
171 for (iright = rightModules.begin(); iright != rightModules.end(); iright++) {
172 if ((*ileft)->getName() == (*iright)->getName()) {
179 rightModules.erase(iright);
181 mStream <<
"< Module " << (*ileft)->getName() << std::endl;
186 for (iright = rightModules.begin(); iright != rightModules.end(); iright++) {
187 mStream <<
"> Module " << (*iright)->getName() << std::endl;
198 if (!(left->getAnchor() == right->getAnchor())) {
199 mStream <<
"! Module " << left->getName() <<
" anchor: " << left->getAnchor()
200 <<
" | " << right->getAnchor() << std::endl;
204 std::vector<string> leftPorts;
205 std::vector<string> rightPorts;
206 std::vector<string>::iterator leftport;
207 std::vector<string>::iterator rightport;
209 leftport != left->portsEnd(); leftport++) {
210 string t = (*leftport)->getInstancePtr().lock()->getName();
212 t.append((*leftport)->getPinName());
213 leftPorts.push_back(t);
216 rightport != right->portsEnd(); rightport++) {
217 string t = (*rightport)->getInstancePtr().lock()->getName();
219 t.append((*rightport)->getPinName());
220 rightPorts.push_back(t);
222 for (leftport = leftPorts.begin(); leftport != leftPorts.end(); leftport++) {
224 for (rightport = rightPorts.begin(); rightport != rightPorts.end(); rightport++) {
225 if (*leftport == *rightport) {
231 rightPorts.erase(rightport);
233 mStream <<
"< Module " << left->getName() <<
" port: "
234 << *leftport << std::endl;
238 for (rightport = rightPorts.begin(); rightport != rightPorts.end(); rightport++) {
239 mStream <<
"> Module " << right->getName() <<
" port: "
240 << *rightport << std::endl;
259 for (ileft = left->instancesBegin(); ileft!= left->instancesEnd(); ileft++) {
260 leftInstances.push_back(*ileft);
262 for (iright = right->instancesBegin(); iright!= right->instancesEnd(); iright++) {
263 rightInstances.push_back(*iright);
265 for (ileft = leftInstances.begin(); ileft != leftInstances.end(); ileft++) {
267 for (iright = rightInstances.begin(); iright != rightInstances.end(); iright++) {
268 if ((*ileft)->getName() == (*iright)->getName()) {
276 rightInstances.erase(iright);
278 mStream <<
"< Instance " << (*ileft)->getName() << std::endl;
282 for (iright = rightInstances.begin(); iright != rightInstances.end(); iright++) {
283 mStream <<
"> Instance " << (*iright)->getName() << std::endl;
286 leftInstances.clear();
287 rightInstances.clear();
294 for (nleft = left->netsBegin(); nleft!= left->netsEnd(); nleft++) {
295 leftNets.push_back(*nleft);
297 for (nright = right->netsBegin(); nright!= right->netsEnd(); nright++) {
298 rightNets.push_back(*nright);
300 for (nleft = leftNets.begin(); nleft != leftNets.end(); nleft++) {
302 for (nright = rightNets.begin(); nright != rightNets.end(); nright++) {
303 if ((*nleft)->getName() == (*nright)->getName()) {
309 rval =
diffNet(*nleft, *nright) && rval;
310 rightNets.erase(nright);
312 mStream <<
"< Net " << (*nleft)->getName() << std::endl;
316 for (nright = rightNets.begin(); nright != rightNets.end(); nright++) {
317 mStream <<
"> Net " << (*nright)->getName() << std::endl;
323 string circuitname =
"Circuit ";
324 circuitname.append(left->getName());
331 const string& parentStr) {
334 std::vector<string> leftConfigs;
335 std::vector<string> rightConfigs;
336 std::vector<string>::iterator ileft;
337 std::vector<string>::iterator iright;
348 leftConfigs.push_back(t);
351 p = right->configBegin();
352 e = right->configEnd();
360 rightConfigs.push_back(t);
363 for (ileft = leftConfigs.begin(); ileft != leftConfigs.end(); ileft++) {
365 for (iright = rightConfigs.begin(); iright != rightConfigs.end(); iright++) {
366 if (*ileft == *iright) {
373 rightConfigs.erase(iright);
375 mStream <<
"< " << parentStr <<
" Config " << *ileft << std::endl;
379 for (iright = rightConfigs.begin(); iright != rightConfigs.end(); iright++) {
380 mStream <<
"> " << parentStr <<
" Config " << *iright << std::endl;
384 rightConfigs.clear();
390 if (!(left->getType() == right->getType())) {
391 mStream <<
"! Instance " << left->getName() <<
" type: " << left->getType()
392 <<
" | " << right->getType() << std::endl;
395 if (!(left->getTile() == right->getTile())) {
396 mStream <<
"! Instance " << left->getName() <<
" tile: " << left->getTile()
397 <<
" | " << right->getTile() << std::endl;;
400 if (!(left->getSite() == right->getSite())) {
401 mStream <<
"! Instance " << left->getName() <<
"site: " << left->getSite()
402 <<
" | " << right->getSite() << std::endl;
405 if (!(left->getBonding() == right->getBonding())) {
406 mStream <<
"! Instance " << left->getName() <<
" bonding: " << left->getBonding()
407 <<
" | " << right->getBonding() << std::endl;
411 string instancename =
"Instance ";
412 instancename.append(left->getName());
420 if (!(left->getNetType() == right->getNetType())) {
421 mStream <<
"! Net " << left->getName() <<
" type: " << left->getNetType()
422 <<
" | " << right->getNetType() << std::endl;
426 std::vector<string> leftPins;
427 std::vector<string> rightPins;
428 std::vector<string>::iterator leftpin;
429 std::vector<string>::iterator rightpin;
432 leftpinPtr != left->sourcesEnd(); leftpinPtr++) {
433 string t = (*leftpinPtr)->getInstancePtr().lock()->getName();
435 t.append((*leftpinPtr)->getPinName());
436 leftPins.push_back(t);
439 rightpinPtr != right->sourcesEnd(); rightpinPtr++) {
440 string t = (*rightpinPtr)->getInstancePtr().lock()->getName();
442 t.append((*rightpinPtr)->getPinName());
443 rightPins.push_back(t);
445 for (leftpin = leftPins.begin(); leftpin != leftPins.end(); leftpin++) {
447 for (rightpin = rightPins.begin(); rightpin != rightPins.end(); rightpin++) {
448 if (*leftpin == *rightpin) {
454 rightPins.erase(rightpin);
456 mStream <<
"< Net " << left->getName() <<
" outpin: "
457 << *leftpin << std::endl;
461 for (rightpin = rightPins.begin(); rightpin != rightPins.end(); rightpin++) {
462 mStream <<
"> Net " << right->getName() <<
" outpin: "
463 << *rightpin << std::endl;
470 leftpinPtr != left->sinksEnd(); leftpinPtr++) {
471 string t = (*leftpinPtr)->getInstancePtr().lock()->getName();
473 t.append((*leftpinPtr)->getPinName());
474 leftPins.push_back(t);
477 rightpinPtr != right->sinksEnd(); rightpinPtr++) {
478 string t = (*rightpinPtr)->getInstancePtr().lock()->getName();
480 t.append((*rightpinPtr)->getPinName());
481 rightPins.push_back(t);
483 for (leftpin = leftPins.begin(); leftpin != leftPins.end(); leftpin++) {
485 for (rightpin = rightPins.begin(); rightpin != rightPins.end(); rightpin++) {
486 if (*leftpin == *rightpin) {
492 rightPins.erase(rightpin);
494 mStream <<
"< Net " << left->getName() <<
" inpin: "
495 << *leftpin << std::endl;
499 for (rightpin = rightPins.begin(); rightpin != rightPins.end(); rightpin++) {
500 mStream <<
"> Net " << right->getName() <<
" inpin: "
501 << *rightpin << std::endl;
507 std::vector<string> leftPips;
508 std::vector<string> rightPips;
509 std::vector<string>::iterator leftpip;
510 std::vector<string>::iterator rightpip;
512 leftpip != left->pipsEnd(); leftpip++) {
513 string t = leftpip->getTileName();
515 t.append(leftpip->getSourceWireName());
517 t.append(leftpip->getDirectionString());
519 t.append(leftpip->getSinkWireName());
520 leftPips.push_back(t);
523 rightpip != right->pipsEnd(); rightpip++) {
524 string t = rightpip->getTileName();
526 t.append(rightpip->getSourceWireName());
528 t.append(rightpip->getDirectionString());
530 t.append(rightpip->getSinkWireName());
531 rightPips.push_back(t);
533 for (leftpip = leftPips.begin(); leftpip != leftPips.end(); leftpip++) {
535 for (rightpip = rightPips.begin(); rightpip != rightPips.end(); rightpip++) {
536 if (*leftpip == *rightpip) {
542 rightPips.erase(rightpip);
544 mStream <<
"< Net " << left->getName() <<
" pip: "
545 << *leftpip << std::endl;
549 for (rightpip = rightPips.begin(); rightpip != rightPips.end(); rightpip++) {
550 mStream <<
"> Net " << right->getName() <<
" pip: "
551 << *rightpip << std::endl;
557 string netname =
"Net ";
558 netname.append(left->getName());
568 #endif // TORC_UTILS_PHYSICALDIFF_HPP
bool diffCircuit(const CircuitSharedPtr &left, const CircuitSharedPtr &right)
Diff circuit pointers, recursively compare nets, instances and config map.
torc::physical::InstanceSharedPtr InstanceSharedPtr
Imported type name.
torc::physical::DesignSharedPtr DesignSharedPtr
Imported type name.
torc::physical::Net::PipConstIterator PipConstIterator
Imported type name.
bool diffDesign(const DesignSharedPtr &left, const DesignSharedPtr &right)
Diff design pointers and then recursively compare modules and inherited members.
PortSharedPtrVector::const_iterator PortSharedPtrConstIterator
Constant iterator to Port shared pointers.
torc::physical::CircuitSharedPtr CircuitSharedPtr
Imported type name.
PipVector::const_iterator PipConstIterator
Constant iterator to Pip objects.
torc::physical::Design::ModuleSharedPtrIterator ModuleSharedPtrIterator
Imported type name.
bool diffInstance(const InstanceSharedPtr &left, const InstanceSharedPtr &right)
Diff instance pointers and then the underlying config map.
InstanceSharedPtrVector::const_iterator InstanceSharedPtrConstIterator
Constant iterator to Instance shared pointers.
std::vector< ModuleSharedPtr > ModuleSharedPtrVector
Imported type name.
torc::physical::Circuit::NetSharedPtrConstIterator NetSharedPtrConstIterator
Imported type name.
torc::physical::InstanceWeakPtr InstanceWeakPtr
Imported type name.
boost::shared_ptr< torc::physical::ConfigMap > ConfigMapSharedPtr
Imported type name.
ModuleSharedPtrVector::const_iterator ModuleSharedPtrConstIterator
Constant iterator for Module shared pointers.
torc::physical::Circuit::NetSharedPtrIterator NetSharedPtrIterator
Imported type name.
std::vector< NetSharedPtr > NetSharedPtrVector
Imported type name.
torc::physical::Module::PortSharedPtrConstIterator PortSharedPtrConstIterator
Imported type name.
friend class utils::PhysicalDiffConfigMapUnitTest
Unit test access to internal functions.
torc::physical::ModuleSharedPtr ModuleSharedPtr
Imported type name.
const_iterator const_iterator
Constant iterator to {setting,Config} pairs.
std::string string
Imported type name.
friend class utils::PhysicalDiffModuleUnitTest
Unit test access to internal functions.
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.
Main torc::physical namespace header.
Configuration. A {name:value} pair.
torc::physical::Circuit::InstanceSharedPtrIterator InstanceSharedPtrIterator
Imported type name.
Header for torc::physical output stream helpers.
const string & getName(void) const
Returns the object name.
boost::shared_ptr< Net > NetSharedPtr
Shared pointer encapsulation of a Net.
boost::shared_ptr< Circuit > CircuitSharedPtr
Shared pointer encapsulation of a Circuit.
const string & getValue(void) const
Return the configuration value.
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance.
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
torc::physical::ConfigMap::const_iterator ConfigMapConstIterator
Imported type name.
torc::physical::NetSharedPtr NetSharedPtr
Imported type name.
std::vector< InstanceSharedPtr > InstanceSharedPtrVector
Imported type name.
InstancePinSharedPtrVector::const_iterator InstancePinSharedPtrConstIterator
Constant iterator to InstancePin shared pointer objects.
NetSharedPtrVector::iterator NetSharedPtrIterator
Non-constant iterator to Net shared pointers.
friend class utils::PhysicalDiffDesignUnitTest
Unit test access to internal functions.
bool diffModule(const ModuleSharedPtr &left, const ModuleSharedPtr &right)
Diff module pointers and then recursively compare inherited members from circuit. ...
torc::physical::Circuit::InstanceSharedPtrConstIterator InstanceSharedPtrConstIterator
Imported type name.
friend class utils::PhysicalDiffCircuitUnitTest
Unit test access to internal functions.
std::ostream & mStream
Output stream to use for comparison results.
boost::shared_ptr< torc::physical::Named > NamedSharedPtr
Imported type name.
torc::physical::Design::ModuleSharedPtrConstIterator ModuleSharedPtrConstIterator
Imported type name.
torc::physical::Net::InstancePinSharedPtrConstIterator InstancePinSharedPtrConstIterator
Imported type name.
friend class utils::PhysicalDiffNetUnitTest
Unit test access to internal functions.
Diff utility class for comparing physical netlists.
ModuleSharedPtrVector::iterator ModuleSharedPtrIterator
Non-constant iterator for Module shared pointers.
PhysicalDiff(std::ostream &inOutStream)
bool diff(const DesignSharedPtr &left, const DesignSharedPtr &right)
Top level call to diff two designs.
friend class utils::PhysicalDiffInstanceUnitTest
Unit test access to internal functions.
boost::weak_ptr< Instance > InstanceWeakPtr
Weak pointer encapsulation of an Instance.
NetSharedPtrVector::const_iterator NetSharedPtrConstIterator
Constant iterator to Net shared pointers.
bool diffConfigMap(const ConfigMapSharedPtr &left, const ConfigMapSharedPtr &right, const string &parentStr)
Diff configuration information, this is called from circuits, instances and nets. ...
InstanceSharedPtrVector::iterator InstanceSharedPtrIterator
Non-constant iterator to Instance shared pointers.