@@ -21,9 +21,10 @@ void BLIF_file::reset(CStr nm, uint16_t tr) noexcept {
21
21
constantNodes_.clear ();
22
22
rd_ok_ = chk_ok_ = false ;
23
23
inputs_lnum_ = outputs_lnum_ = 0 ;
24
- err_lnum_ = 0 ;
24
+ err_lnum_ = err_lnum2_ = 0 ;
25
25
err_msg_.clear ();
26
26
pg_.clear ();
27
+ pg2blif_.clear ();
27
28
}
28
29
29
30
// "model "
@@ -251,7 +252,7 @@ bool BLIF_file::readBlif() noexcept {
251
252
V.reserve (16 );
252
253
253
254
inputs_lnum_ = outputs_lnum_ = 0 ;
254
- err_lnum_ = 0 ;
255
+ err_lnum_ = err_lnum2_ = 0 ;
255
256
for (size_t i = 1 ; i < lsz; i++) {
256
257
CStr cs = lines_[i];
257
258
if (!cs || !cs[0 ]) continue ;
@@ -432,8 +433,10 @@ bool BLIF_file::checkBlif() noexcept {
432
433
bool separ_ok = checkClockSepar (clocked);
433
434
if (not separ_ok) {
434
435
string tmp = err_msg_;
435
- err_msg_ = " clock-data separation issue at line " ;
436
+ err_msg_ = " clock-data separation issue at lines: " ;
436
437
err_msg_ += std::to_string (err_lnum_);
438
+ err_msg_ += " , " ;
439
+ err_msg_ += std::to_string (err_lnum2_);
437
440
err_msg_ += " " ;
438
441
err_msg_ += tmp;
439
442
flush_out (true );
@@ -1478,9 +1481,11 @@ bool BLIF_file::checkClockSepar(vector<const Node*>& clocked) noexcept {
1478
1481
}
1479
1482
}
1480
1483
1481
- writePinGraph (" pin_graph_2.dot" );
1484
+ if (trace_ >= 4 )
1485
+ writePinGraph (" pin_graph_2.dot" );
1482
1486
1483
1487
bool color_ok = true ;
1488
+ CStr viol_prefix = " ===>>> clock color violation" ;
1484
1489
1485
1490
// -- check that end-points of red edges are red
1486
1491
for (NW::cEI E (pg_); E.valid (); ++E) {
@@ -1491,6 +1496,28 @@ bool BLIF_file::checkClockSepar(vector<const Node*>& clocked) noexcept {
1491
1496
const NW::Node& p2 = pg_.nodeRef (ed.n2_ );
1492
1497
if (!p1.isRed () or !p2.isRed ()) {
1493
1498
color_ok = false ;
1499
+ if (pg2blif_.count (p1.id_ ) and pg2blif_.count (p2.id_ )) {
1500
+ uint b1 = map_pg2blif (p1.id_ );
1501
+ uint b2 = map_pg2blif (p2.id_ );
1502
+ string nm1 = p1.getName ();
1503
+ string nm2 = p2.getName ();
1504
+ const Node& bnode1 = bnodeRef (b1);
1505
+ const Node& bnode2 = bnodeRef (b2);
1506
+ err_lnum_ = bnode1.lnum_ ;
1507
+ err_lnum2_ = bnode2.lnum_ ;
1508
+ flush_out (true );
1509
+ lprintf (" %s: pin-graph nodes: #%u:%s - #%u:%s\n " ,
1510
+ viol_prefix, p1.id_ , nm1.c_str (), p2.id_ , nm2.c_str ());
1511
+ flush_out (true );
1512
+ lprintf (" %s: blif lines: %u - %u\n " ,
1513
+ viol_prefix, err_lnum_, err_lnum2_);
1514
+ char B[512 ] = {};
1515
+ ::sprintf (B, " line %u : %s " , err_lnum_, bnode1.kw_.c_str());
1516
+ logVec (bnode1.data_ , B);
1517
+ ::sprintf (B, " line %u : %s " , err_lnum2_, bnode2.kw_.c_str());
1518
+ logVec (bnode2.data_ , B);
1519
+ flush_out (true );
1520
+ }
1494
1521
break ;
1495
1522
}
1496
1523
}
@@ -1519,6 +1546,7 @@ struct qTup {
1519
1546
1520
1547
bool BLIF_file::createPinGraph () noexcept {
1521
1548
pg_.clear ();
1549
+ pg2blif_.clear ();
1522
1550
if (!rd_ok_) return false ;
1523
1551
if (topInputs_.empty () and topOutputs_.empty ()) return false ;
1524
1552
if (fabricNodes_.empty ()) return false ;
@@ -1530,6 +1558,8 @@ bool BLIF_file::createPinGraph() noexcept {
1530
1558
vector<upair> PAR;
1531
1559
char nm_buf[512 ] = {};
1532
1560
1561
+ pg2blif_.reserve (2 * nodePool_.size () + 1 );
1562
+
1533
1563
// -- create pg-nodes for topInputs_
1534
1564
for (Node* p : topInputs_) {
1535
1565
Node& port = *p;
@@ -1539,6 +1569,7 @@ bool BLIF_file::createPinGraph() noexcept {
1539
1569
pg_.setNodeName (nid, port.out_ );
1540
1570
pg_.nodeRef (nid).markInp (true );
1541
1571
port.nw_id_ = nid;
1572
+ pg2blif_.emplace (nid, port.id_ );
1542
1573
}
1543
1574
1544
1575
// -- create pg-nodes for topOutputs_
@@ -1550,6 +1581,7 @@ bool BLIF_file::createPinGraph() noexcept {
1550
1581
pg_.setNodeName (nid, port.out_ );
1551
1582
pg_.nodeRef (nid).markOut (true );
1552
1583
port.nw_id_ = nid;
1584
+ pg2blif_.emplace (nid, port.id_ );
1553
1585
}
1554
1586
1555
1587
vector<qTup> Q;
@@ -1573,7 +1605,7 @@ bool BLIF_file::createPinGraph() noexcept {
1573
1605
for (const upair& pa : PAR) {
1574
1606
if (pa.first == port.id_ )
1575
1607
continue ;
1576
- const Node& par = nodeRef (pa.first );
1608
+ const Node& par = bnodeRef (pa.first );
1577
1609
uint pinIndex = pa.second ;
1578
1610
1579
1611
INP.clear ();
@@ -1601,6 +1633,7 @@ bool BLIF_file::createPinGraph() noexcept {
1601
1633
assert (kid);
1602
1634
assert (key != port.id_ ); // bc port.id_ is a key for port
1603
1635
assert (pg_.hasKey (port.id_ )); //
1636
+ pg2blif_.emplace (kid, par.id_ );
1604
1637
1605
1638
pg_.nodeRef (kid).setCid (par.id_ );
1606
1639
::snprintf (nm_buf, 510 , " %s_%uL_%up%u" ,
@@ -1634,8 +1667,9 @@ bool BLIF_file::createPinGraph() noexcept {
1634
1667
eid = pg_.linkNodes (q.inpNid_ , kid, true );
1635
1668
1636
1669
::snprintf (nm_buf, 510 , " nd%u_L%u_Q%u" ,
1637
- kid, nodeRef (q.cellId_).lnum_, q.cellId_);
1670
+ kid, bnodeRef (q.cellId_).lnum_, q.cellId_);
1638
1671
pg_.setNodeName (kid, nm_buf);
1672
+ pg2blif_.emplace (kid, q.cellId_ );
1639
1673
}
1640
1674
}
1641
1675
0 commit comments