@@ -65,6 +65,7 @@ Recommended conclusion: use map for concrete cells. They are invariant.
6565#include " odb/dbSet.h"
6666#include " odb/dbTypes.h"
6767#include " sta/Liberty.hh"
68+ #include " sta/Network.hh"
6869#include " sta/NetworkClass.hh"
6970#include " sta/PatternMatch.hh"
7071#include " sta/PortDirection.hh"
@@ -4130,8 +4131,15 @@ void dbNetwork::accumulateFlatLoadPinsOnNet(
41304131}
41314132
41324133// Use this API to check if flat & hier connectivities are ok
4133- void dbNetwork::checkAxioms () const
4134+ void dbNetwork::checkAxioms (odb::dbObject* obj ) const
41344135{
4136+ // Check with an object if provided
4137+ if (obj != nullptr ) {
4138+ checkSanityNetConnectivity (obj);
4139+ return ;
4140+ }
4141+
4142+ // Otherwise, check the whole design
41354143 checkSanityModBTerms ();
41364144 checkSanityModITerms ();
41374145 checkSanityModInstTerms ();
@@ -4458,79 +4466,90 @@ void dbNetwork::checkSanityTermConnectivity() const
44584466 }
44594467}
44604468
4461- void dbNetwork::checkSanityNetConnectivity () const
4469+ void dbNetwork::checkSanityNetConnectivity (odb::dbObject* obj ) const
44624470{
4463- // Check for hier net and flat net connectivity
4464- dbSet<dbModNet> mod_nets = block ()->getModNets ();
4465- for (dbModNet* mod_net : mod_nets) {
4466- findRelatedDbNet (mod_net);
4467- }
4468-
4469- // Check for incomplete flat net connections
4470- for (odb::dbNet* net_db : block_->getNets ()) {
4471- // Check for multiple drivers.
4472- Net* net = dbToSta (net_db);
4473- PinSeq loads;
4474- PinSeq drvrs;
4475- PinSet visited_drvrs (this );
4476- FindNetDrvrLoads visitor (nullptr , visited_drvrs, loads, drvrs, this );
4477- NetSet visited_nets (this );
4478- visitConnectedPins (net, visitor, visited_nets);
4479-
4480- if (drvrs.size () > 1 ) {
4481- bool all_tristate = true ;
4482- for (const Pin* drvr : drvrs) {
4483- LibertyPort* port = libertyPort (drvr);
4484- if (!port || !port->direction ()->isAnyTristate ()) {
4485- all_tristate = false ;
4486- break ;
4471+ //
4472+ // Check for a specific object if provided
4473+ //
4474+ if (obj != nullptr ) {
4475+ // Collect relevant nets from the provided object
4476+ std::set<odb::dbNet*> nets_to_check;
4477+ std::set<odb::dbModNet*> mod_nets_to_check;
4478+
4479+ auto const obj_type = obj->getObjectType ();
4480+ if (obj_type == odb::dbNetObj) {
4481+ nets_to_check.insert (static_cast <odb::dbNet*>(obj));
4482+ } else if (obj_type == odb::dbModNetObj) {
4483+ mod_nets_to_check.insert (static_cast <odb::dbModNet*>(obj));
4484+ } else if (obj_type == odb::dbInstObj) {
4485+ auto inst = static_cast <odb::dbInst*>(obj);
4486+ for (auto iterm : inst->getITerms ()) {
4487+ if (iterm->getNet () != nullptr ) {
4488+ nets_to_check.insert (iterm->getNet ());
4489+ }
4490+ if (iterm->getModNet () != nullptr ) {
4491+ mod_nets_to_check.insert (iterm->getModNet ());
44874492 }
44884493 }
4489-
4490- if (!all_tristate) {
4491- std::string drivers_str;
4492- for ( const Pin* drvr : drvrs ) {
4493- drivers_str += " " + std::string ( pathName (drvr ));
4494+ } else if (obj_type == odb::dbModInstObj) {
4495+ auto mod_inst = static_cast <odb::dbModInst*>(obj);
4496+ for ( auto mod_iterm : mod_inst-> getModITerms ()) {
4497+ if (mod_iterm-> getModNet () != nullptr ) {
4498+ mod_nets_to_check. insert (mod_iterm-> getModNet ( ));
44944499 }
4495- logger_->error (
4496- ORD,
4497- 2049 ,
4498- " SanityCheck: Net '{}' has multiple non-tristate drivers:{}" ,
4499- name (net),
4500- drivers_str);
45014500 }
4502- }
4503- const uint iterm_count = net_db->getITerms ().size ();
4504- const uint bterm_count = net_db->getBTerms ().size ();
4505- if (iterm_count + bterm_count >= 2 ) {
4506- continue ;
4501+ } else if (obj_type == odb::dbITermObj) {
4502+ auto iterm = static_cast <odb::dbITerm*>(obj);
4503+ if (iterm->getNet () != nullptr ) {
4504+ nets_to_check.insert (iterm->getNet ());
4505+ }
4506+ if (iterm->getModNet () != nullptr ) {
4507+ mod_nets_to_check.insert (iterm->getModNet ());
4508+ }
4509+ } else if (obj_type == odb::dbBTermObj) {
4510+ auto bterm = static_cast <odb::dbBTerm*>(obj);
4511+ if (bterm->getNet () != nullptr ) {
4512+ nets_to_check.insert (bterm->getNet ());
4513+ }
4514+ if (bterm->getModNet () != nullptr ) {
4515+ mod_nets_to_check.insert (bterm->getModNet ());
4516+ }
4517+ } else if (obj_type == odb::dbModITermObj) {
4518+ auto mod_iterm = static_cast <odb::dbModITerm*>(obj);
4519+ if (mod_iterm->getModNet () != nullptr ) {
4520+ mod_nets_to_check.insert (mod_iterm->getModNet ());
4521+ }
4522+ } else if (obj_type == odb::dbModBTermObj) {
4523+ auto mod_bterm = static_cast <odb::dbModBTerm*>(obj);
4524+ if (mod_bterm->getModNet () != nullptr ) {
4525+ mod_nets_to_check.insert (mod_bterm->getModNet ());
4526+ }
45074527 }
45084528
4509- // Skip power/ground net
4510- if (net_db-> getSigType (). isSupply () ) {
4511- continue ; // OK: Unconnected power/ground net
4529+ // Now run checks on the collected nets.
4530+ for (odb::dbModNet* mod_net : mod_nets_to_check ) {
4531+ findRelatedDbNet (mod_net);
45124532 }
45134533
4514- // A net connected to 1 terminal
4515- if (iterm_count == 1 ) {
4516- odb::dbITerm* iterm = *(net_db->getITerms ().begin ());
4517- if (iterm->getIoType () == odb::dbIoType::OUTPUT) {
4518- continue ; // OK: Unconnected output pin
4519- }
4520- } else if (bterm_count == 1 ) { // This is a top level port
4521- odb::dbBTerm* bterm = *(net_db->getBTerms ().begin ());
4522- if (bterm->getIoType () == odb::dbIoType::INPUT) {
4523- continue ; // OK: Unconnected input port
4524- }
4534+ for (odb::dbNet* net_db : nets_to_check) {
4535+ net_db->checkSanity ();
45254536 }
4537+ return ;
4538+ }
45264539
4527- logger_->warn (ORD,
4528- 2039 ,
4529- " SanityCheck: Net '{}' has less than 2 connections (# of "
4530- " ITerms = {}, # of BTerms = {})." ,
4531- net_db->getName (),
4532- iterm_count,
4533- bterm_count);
4540+ //
4541+ // Check for all nets in the design
4542+ //
4543+
4544+ // Check for hier net and flat net connectivity
4545+ dbSet<dbModNet> mod_nets = block ()->getModNets ();
4546+ for (dbModNet* mod_net : mod_nets) {
4547+ findRelatedDbNet (mod_net);
4548+ }
4549+
4550+ // Check for incomplete flat net connections
4551+ for (odb::dbNet* net_db : block ()->getNets ()) {
4552+ net_db->checkSanity ();
45344553 }
45354554}
45364555
0 commit comments