@@ -196,6 +196,12 @@ CStr BLIF_file::BNode::cPrimType() const noexcept {
196196 return ptype_ == prim::A_ZERO ? " {e}" : pr_enum2str (ptype_);
197197}
198198
199+ CStr BLIF_file::BNode::cPortName () const noexcept {
200+ if (isTopPort () and not data_.empty ())
201+ return data_.front ().c_str ();
202+ return " {np}" ;
203+ }
204+
199205bool BLIF_file::BNode::isDanglingTerm (uint term) const noexcept {
200206 if (dangTerms_.empty ())
201207 return false ;
@@ -1336,13 +1342,6 @@ bool BLIF_file::createNodes() noexcept {
13361342 continue ;
13371343 assert (!nd.is_mog_ );
13381344
1339- // if (nd.lnum_ == 48) {
1340- // string delWire1151 = "$delete_wire$1151";
1341- // lputs8();
1342- // int dTerm = findTermByNet(nd.data_, delWire1151);
1343- // lprintf(" dTerm= %i\n", dTerm);
1344- // }
1345-
13461345 s_is_MOG (nd, V);
13471346 bool is_mog = V.size () > 1 ;
13481347 if (is_mog) {
@@ -2152,10 +2151,15 @@ bool BLIF_file::createPinGraph() noexcept {
21522151
21532152 if (trace_ >= 5 ) {
21542153 lputs ();
2155- lprintf (" TopInput: lnum_= %u %s PAR.size()= %zu\n " ,
2156- port.lnum_ , port.out_ .c_str (), PAR.size ());
2154+ lprintf (" TopInput: id_= %u lnum_= %u %s PAR.size()= %zu\n " ,
2155+ port.id_ , port.lnum_ , port.out_ .c_str (), PAR.size ());
2156+ if (trace_ >= 6 )
2157+ lprintf (" %s\n " , port.cPortName ());
21572158 }
21582159
2160+ // if (port.id_ == 24)
2161+ // lputs1();
2162+
21592163 for (const upair& pa : PAR) {
21602164 if (pa.first == port.id_ )
21612165 continue ;
@@ -2213,10 +2217,17 @@ bool BLIF_file::createPinGraph() noexcept {
22132217 eid = pg_.linK (port.id_ , key);
22142218 assert (eid);
22152219
2220+ if (trace_ >= 8 )
2221+ pg_.printEdge (eid);
2222+
22162223 Q.emplace_back (kid, par_realId, pinIndex, par.out_ .c_str ());
22172224 }
22182225 }
22192226
2227+ // if (0) {
2228+ // writePinGraph("111_G_afterLinkTopInp.dot", true, false);
2229+ // }
2230+
22202231 // -- link cell-edges and next level
22212232 if (trace_ >= 5 ) {
22222233 lprintf (" |Q| .sz= %zu\n " , Q.size ());
@@ -2278,8 +2289,19 @@ bool BLIF_file::createPinGraph() noexcept {
22782289 uint cn_realId = cn.realId (*this );
22792290 key = hashCantor (cn_realId, i + 1 ) + max_key1;
22802291 assert (key);
2281- kid = pg_.insK (key);
2282- assert (kid);
2292+ // if (key == 110)
2293+ // lputs3();
2294+ kid = pg_.findNode (key);
2295+ if (kid) {
2296+ if (trace_ >= 8 ) {
2297+ lprintf (" \t\t ___ found nid %u '%s' for key %zu" ,
2298+ kid, pg_.cnodeName (kid), key);
2299+ }
2300+ }
2301+ else {
2302+ kid = pg_.insK (key);
2303+ assert (kid);
2304+ }
22832305 pg_.nodeRef (kid).markClk (true );
22842306
22852307 ::snprintf (nm_buf, 510 , " nd%u_L%u_cn" ,
@@ -2522,16 +2544,20 @@ bool BLIF_file::createPinGraph() noexcept {
25222544 return true ;
25232545}
25242546
2525- string BLIF_file::writePinGraph (CStr fn0) const noexcept {
2547+ string BLIF_file::writePinGraph (CStr fn0, bool nodeTable, bool noDeg0 ) const noexcept {
25262548 auto & ls = lout ();
25272549 if (trace_ >= 5 ) {
25282550 flush_out (true );
2529- pg_.print (ls, " \t *** pin_graph for clock-data separation ***" );
2551+ if (trace_ >= 6 )
2552+ pg_.print (ls, " \t *** pin_graph for clock-data separation ***" );
2553+ else
2554+ lputs (" \t --- pin_graph for clock-data separation ---" );
25302555 lprintf (" \t pg_. numN()= %u numE()= %u\n " , pg_.numN (), pg_.numE ());
25312556 lputs ();
25322557 pg_.printSum (ls, 0 );
25332558 lputs ();
2534- pg_.printEdges (ls, " |edges|" );
2559+ if (trace_ >= 6 )
2560+ pg_.printEdges (ls, " |edges|" );
25352561 flush_out (true );
25362562 }
25372563
@@ -2540,7 +2566,7 @@ string BLIF_file::writePinGraph(CStr fn0) const noexcept {
25402566
25412567 string fn = str::concat (topModel_.c_str (), " _" , fn0);
25422568
2543- bool wrDot_ok = pg_.writeDot (fn.c_str (), nullptr , true , true );
2569+ bool wrDot_ok = pg_.writeDot (fn.c_str (), nullptr , nodeTable, noDeg0 );
25442570 if (!wrDot_ok) {
25452571 flush_out (true ); err_puts ();
25462572 lprintf2 (" [Error] could not write pin_graph to file '%s'\n " , fn.c_str ());
0 commit comments