From 1359fe4ba6c49ed2348637da57b346ffc0fbbc5d Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Wed, 31 Jul 2019 18:29:22 +0200 Subject: [PATCH] Change Net name merge policy in the Blif parser. * Change: In CRL/BlifParser::Model::mergeAlias(), do not always merge the net2 with net1 (RHS with LHS of the ".name" instruction). This may result in a name change in the design interface (external net). Instead, merge any internal net with the external, so keep the external net name. If both are external, keep the one with the lower id (which should have been created first). --- crlcore/src/ccore/blif/BlifParser.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/crlcore/src/ccore/blif/BlifParser.cpp b/crlcore/src/ccore/blif/BlifParser.cpp index 8e0531a9..77cee18b 100644 --- a/crlcore/src/ccore/blif/BlifParser.cpp +++ b/crlcore/src/ccore/blif/BlifParser.cpp @@ -506,10 +506,17 @@ namespace { Net* net2 = _cell->getNet( name2 ); if (net1 and (net1 == net2)) return net1; - if (net1 and net2) { net1->merge( net2 ); return net1; } + if (net1 and net2) { + if ( (not net1->isExternal() and net2->isExternal()) + or ( net1->isExternal() and net2->isExternal() and (net1->getId() > net2->getId()) ) ) { + std::swap( net1 , net2 ); + std::swap( name1, name2 ); + } + net1->merge( net2 ); return net1; + } if (net2) { - swap( net1 , net2 ); - swap( name1, name2 ); + std::swap( net1 , net2 ); + std::swap( name1, name2 ); } if (not net1) {