@@ -69,6 +69,15 @@ static inline bool starts_w_names(CStr z, size_t len) noexcept {
69
69
z[3 ] == ' e' and z[4 ] == ' s' and ::isspace (z[5 ]);
70
70
}
71
71
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
+
72
81
// "latch "
73
82
static inline bool starts_w_latch (CStr z, size_t len) noexcept {
74
83
assert (z);
@@ -444,7 +453,7 @@ bool BLIF_file::checkBlif() noexcept {
444
453
445
454
// 6. clock-data separation
446
455
if (!topInputs_.empty () and !topOutputs_.empty ()) {
447
- if (trace_ >= 5 )
456
+ if (trace_ >= 6 )
448
457
pg_.setTrace (trace_);
449
458
vector<BNode*> clocked;
450
459
collectClockedNodes (clocked);
@@ -660,6 +669,8 @@ void BLIF_file::collectClockedNodes(vector<BNode*>& V) noexcept {
660
669
uint t = nd.ptype_ ;
661
670
if (!t or t >= Prim_MAX_ID)
662
671
continue ;
672
+ if (nd.is_clockLess_DSP ())
673
+ continue ;
663
674
uint n_clocks = pr_num_clocks (nd.ptype_ );
664
675
if (n_clocks)
665
676
V.push_back (&nd);
@@ -1136,6 +1147,42 @@ bool BLIF_file::createNodes() noexcept {
1136
1147
nd.data_ .assign (V.begin () + 1 , V.end ());
1137
1148
nd.ptype_ = pr_str2enum (nd.data_front ());
1138
1149
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
+ }
1139
1186
}
1140
1187
continue ;
1141
1188
}
@@ -1186,6 +1233,7 @@ bool BLIF_file::createNodes() noexcept {
1186
1233
logVec (V, " [V-terms] " );
1187
1234
lputs ();
1188
1235
}
1236
+ // lputs9();
1189
1237
1190
1238
s_remove_MOG_terms (nd);
1191
1239
uint startVirtual = nodePool_.size ();
@@ -2058,15 +2106,17 @@ bool BLIF_file::createPinGraph() noexcept {
2058
2106
const BNode* driver = findDriverNode (cn_realId, inet);
2059
2107
if (!driver) {
2060
2108
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_ );
2063
2111
err_puts (); flush_out (true );
2112
+ err_lnum_ = cn.lnum_ ;
2113
+ err_lnum2_ = cn.lnum_ ;
2064
2114
return false ;
2065
2115
}
2066
2116
uint driver_realId = driver->realId (*this );
2067
2117
2068
2118
if (trace_ >= 5 ) {
2069
- lputs9 ();
2119
+ lputs ();
2070
2120
lprintf (" from cn#%u %s " ,
2071
2121
cn_realId, cn.cPrimType () );
2072
2122
lprintf ( " CLOCK_TRACE driver-> id_%u %s out_net %s\n " ,
@@ -2168,6 +2218,8 @@ bool BLIF_file::createPinGraph() noexcept {
2168
2218
dn.id_ , dn.cPrimType (), dn.lnum_ );
2169
2219
err_lnum_ = dn.lnum_ ;
2170
2220
err_puts (); flush_out (true );
2221
+ err_lnum_ = dn.lnum_ ;
2222
+ err_lnum2_ = dn.lnum_ ;
2171
2223
return false ;
2172
2224
}
2173
2225
0 commit comments