@@ -69,6 +69,15 @@ static inline bool starts_w_names(CStr z, size_t len) noexcept {
6969 z[3 ] == ' e' and z[4 ] == ' s' and ::isspace (z[5 ]);
7070}
7171
72+ // "param "
73+ static inline bool starts_w_param (CStr z, size_t len) noexcept {
74+ assert (z);
75+ if (len < 6 )
76+ return false ;
77+ return z[0 ] == ' p' and z[1 ] == ' a' and z[2 ] == ' r' and
78+ z[3 ] == ' a' and z[4 ] == ' m' and ::isspace (z[5 ]);
79+ }
80+
7281// "latch "
7382static inline bool starts_w_latch (CStr z, size_t len) noexcept {
7483 assert (z);
@@ -444,7 +453,7 @@ bool BLIF_file::checkBlif() noexcept {
444453
445454 // 6. clock-data separation
446455 if (!topInputs_.empty () and !topOutputs_.empty ()) {
447- if (trace_ >= 5 )
456+ if (trace_ >= 6 )
448457 pg_.setTrace (trace_);
449458 vector<BNode*> clocked;
450459 collectClockedNodes (clocked);
@@ -660,6 +669,8 @@ void BLIF_file::collectClockedNodes(vector<BNode*>& V) noexcept {
660669 uint t = nd.ptype_ ;
661670 if (!t or t >= Prim_MAX_ID)
662671 continue ;
672+ if (nd.is_clockLess_DSP ())
673+ continue ;
663674 uint n_clocks = pr_num_clocks (nd.ptype_ );
664675 if (n_clocks)
665676 V.push_back (&nd);
@@ -1136,6 +1147,42 @@ bool BLIF_file::createNodes() noexcept {
11361147 nd.data_ .assign (V.begin () + 1 , V.end ());
11371148 nd.ptype_ = pr_str2enum (nd.data_front ());
11381149 nd.place_output_at_back (nd.data_ );
1150+ if (pr_is_DSP (nd.ptype_ )) {
1151+ // lputs9();
1152+ vector<string> TK;
1153+ // search for .param DSP_MODE "MULTIPLY"
1154+ // to flag clock-less DSP
1155+ uint m = 0 ;
1156+ for (uint L2 = L + 1 ; L2 < lines_.size (); L2++, m++) {
1157+ if (m > 50 )
1158+ break ;
1159+ CStr ps = lines_[L2];
1160+ if (!ps || !ps[0 ]) continue ;
1161+ ps = str::trimFront (ps);
1162+ assert (ps);
1163+ size_t ps_len = ::strlen (ps);
1164+ if (ps_len < 3 ) continue ;
1165+ if (ps[0 ] != ' .' ) continue ;
1166+ if (starts_w_subckt (ps + 1 , ps_len - 1 ))
1167+ break ;
1168+ if (starts_w_names (ps + 1 , ps_len - 1 ))
1169+ break ;
1170+ if (starts_w_param (ps + 1 , ps_len - 1 )) {
1171+ Fio::split_spa (ps, TK);
1172+ if (TK.size () == 3 and TK[1 ] == " DSP_MODE" and TK[2 ].length () > 3 ) {
1173+ CStr tk = TK[2 ].c_str ();
1174+ if (tk[0 ] == ' "' )
1175+ tk++;
1176+ if (::memcmp (tk, " MULTIPLY" , 8 ) == 0 ) {
1177+ nd.isClockLess_ = true ;
1178+ if (trace_ >= 5 )
1179+ lprintf (" \t marked clock-less DSP at line %u\n " , L);
1180+ break ;
1181+ }
1182+ }
1183+ }
1184+ }
1185+ }
11391186 }
11401187 continue ;
11411188 }
@@ -1186,6 +1233,7 @@ bool BLIF_file::createNodes() noexcept {
11861233 logVec (V, " [V-terms] " );
11871234 lputs ();
11881235 }
1236+ // lputs9();
11891237
11901238 s_remove_MOG_terms (nd);
11911239 uint startVirtual = nodePool_.size ();
@@ -2058,15 +2106,17 @@ bool BLIF_file::createPinGraph() noexcept {
20582106 const BNode* driver = findDriverNode (cn_realId, inet);
20592107 if (!driver) {
20602108 flush_out (true ); err_puts ();
2061- lprintf2 (" [Error] no driver for clock node #%u %s line:%u\n " ,
2062- cn_realId, cn.cPrimType (), cn.lnum_ );
2109+ lprintf2 (" [Error] no driver for clock node #%u %s pin:%s line:%u\n " ,
2110+ cn_realId, cn.cPrimType (), inp. c_str (), cn.lnum_ );
20632111 err_puts (); flush_out (true );
2112+ err_lnum_ = cn.lnum_ ;
2113+ err_lnum2_ = cn.lnum_ ;
20642114 return false ;
20652115 }
20662116 uint driver_realId = driver->realId (*this );
20672117
20682118 if (trace_ >= 5 ) {
2069- lputs9 ();
2119+ lputs ();
20702120 lprintf (" from cn#%u %s " ,
20712121 cn_realId, cn.cPrimType () );
20722122 lprintf ( " CLOCK_TRACE driver-> id_%u %s out_net %s\n " ,
@@ -2168,6 +2218,8 @@ bool BLIF_file::createPinGraph() noexcept {
21682218 dn.id_ , dn.cPrimType (), dn.lnum_ );
21692219 err_lnum_ = dn.lnum_ ;
21702220 err_puts (); flush_out (true );
2221+ err_lnum_ = dn.lnum_ ;
2222+ err_lnum2_ = dn.lnum_ ;
21712223 return false ;
21722224 }
21732225
0 commit comments