From 0d7e0fa88bd8ad2e08f6122ed074c13973a654f8 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Wed, 23 Jun 2021 00:06:51 +0200 Subject: [PATCH] Correct the SPICE driver in case a Net is missing Spice::BitExtension. * Change: In Spice::Entity::toEntity(), add an error message if the Spice::Bit extension is missing. --- crlcore/src/ccore/gds/GdsParser.cpp | 4 +++ crlcore/src/ccore/spice/SpiceEntity.cpp | 37 ++++++++++++++++++++----- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/crlcore/src/ccore/gds/GdsParser.cpp b/crlcore/src/ccore/gds/GdsParser.cpp index f172f00f..9ea0a36f 100644 --- a/crlcore/src/ccore/gds/GdsParser.cpp +++ b/crlcore/src/ccore/gds/GdsParser.cpp @@ -1658,6 +1658,7 @@ namespace { << "\" in " << layer << " @" << ref._position << endl; + cdebug_log(101,0) << "| In " << net->getCell() << endl; if (not layer) continue; vector toDestroy; @@ -1675,6 +1676,7 @@ namespace { ); NetExternalComponents::setExternal( h ); toDestroy.push_back( component ); + cdebug_log(101,0) << "> external duplicate " << h << endl; } else { Vertical* vref = dynamic_cast( component ); if (vref) { @@ -1687,6 +1689,7 @@ namespace { ); NetExternalComponents::setExternal( v ); toDestroy.push_back( component ); + cdebug_log(101,0) << "> external duplicate " << v << endl; } else { Pad* pref = dynamic_cast( component ); if (pref) { @@ -1696,6 +1699,7 @@ namespace { ); NetExternalComponents::setExternal( p ); toDestroy.push_back( component ); + cdebug_log(101,0) << "> external duplicate " << p << endl; } } } diff --git a/crlcore/src/ccore/spice/SpiceEntity.cpp b/crlcore/src/ccore/spice/SpiceEntity.cpp index 4e5f8ac2..02657d9f 100644 --- a/crlcore/src/ccore/spice/SpiceEntity.cpp +++ b/crlcore/src/ccore/spice/SpiceEntity.cpp @@ -35,6 +35,7 @@ namespace { namespace Spice { using namespace std; + using Hurricane::Error; using Hurricane::Warning; using Hurricane::Property; using Hurricane::_TName; @@ -167,15 +168,37 @@ namespace Spice { for ( Plug* plug : sortedPlugs ) { Net* plugNet = plug->getNet(); if (plugNet) { - out << " " << BitExtension::getName(plugNet); + Bit* bit = BitExtension::get( plugNet ); + if (bit) + out << " " << bit->getName(); + else { + cerr << Error( "SpiceEntity::toEntity(): In %s, Net \"%s\" is missing a Spice::Bit extension.\n" + , getString(getCell()).c_str() + , getString(plugNet).c_str() + ) << endl; + } } else { - if (plug->getMasterNet()->isPower()) { - out << " " << _powerNode; - } else { - if (plug->getMasterNet()->isGround()) { - out << " " << _groundNode; - } else + Net* masterNet = plug->getMasterNet(); + if (masterNet->isGlobal()) { + plugNet = getCell()->getNet( masterNet->getName() ); + if (plugNet) { + Bit* bit = BitExtension::get( plugNet ); + if (bit) + out << " " << bit->getName(); + else { + cerr << Error( "SpiceEntity::toEntity(): In %s, Net \"%s\" is missing a Spice::Bit extension.\n" + , getString(getCell()).c_str() + , getString(plugNet).c_str() + ) << endl; + } + } else { + cerr << Error( "SpiceEntity::toEntity(): In %s, unconnected Plug,\n" + " %s" + , getString(getCell()).c_str() + , getString(plug).c_str() + ) << endl; out << " ?"; + } } } }