@@ -281,44 +281,34 @@ int counter_tryextract(
281
281
max_loads = 3 ;
282
282
if (cnout_loads.size () > max_loads)
283
283
{
284
- // If we specified a limited set of cells for parallel output, check that we only drive them
285
- if (!parallel_cells.empty ())
284
+ for (auto c : cnout_loads)
286
285
{
287
- for (auto c : cnout_loads)
288
- {
289
- if (c == underflow_inv)
290
- continue ;
291
- if (c == cell)
292
- continue ;
293
- if (c == muxload)
294
- continue ;
286
+ if (c == underflow_inv)
287
+ continue ;
288
+ if (c == cell)
289
+ continue ;
290
+ if (c == muxload)
291
+ continue ;
295
292
293
+ // If we specified a limited set of cells for parallel output, check that we only drive them
294
+ if (!parallel_cells.empty ())
295
+ {
296
296
// Make sure we're in the whitelist
297
297
if ( parallel_cells.find (c->type ) == parallel_cells.end ())
298
298
return 17 ;
299
+ }
299
300
300
- // Figure out what port(s) are driven by it
301
- // TODO: this can probably be done more efficiently w/o multiple iterations over our whole net?
302
- RTLIL::IdString portname;
303
- for (auto b : qport)
301
+ // Figure out what port(s) are driven by it
302
+ // TODO: this can probably be done more efficiently w/o multiple iterations over our whole net?
303
+ for (auto b : qport)
304
+ {
305
+ pool<ModIndex::PortInfo> ports = index .query_ports (b);
306
+ for (auto x : ports)
304
307
{
305
- pool<ModIndex::PortInfo> ports = index .query_ports (b);
306
- for (auto x : ports)
307
- {
308
- if (x.cell != c)
309
- continue ;
310
- if (portname == " " )
311
- portname = x.port ;
312
-
313
- // somehow our counter output is going to multiple ports
314
- // this makes no sense, don't allow inference
315
- else if (portname != x.port )
316
- return 17 ;
317
- }
308
+ if (x.cell != c)
309
+ continue ;
310
+ extract.pouts .insert (ModIndex::PortInfo (c, x.port , 0 ));
318
311
}
319
-
320
- // Save the other loads
321
- extract.pouts .insert (ModIndex::PortInfo (c, portname, 0 ));
322
312
}
323
313
}
324
314
}
@@ -529,10 +519,15 @@ void counter_worker(
529
519
string reset_type = " non-resettable" ;
530
520
if (extract.has_reset )
531
521
{
522
+ if (extract.rst_inverted )
523
+ reset_type = " negative" ;
524
+ else
525
+ reset_type = " positive" ;
526
+
532
527
// TODO: support other kind of reset
533
- reset_type = " async resettable" ;
528
+ reset_type + = " async resettable" ;
534
529
}
535
- log (" Found %d-bit %s down counter %s (counting from %d) for register %s declared at %s\n " ,
530
+ log (" Found %d-bit (%s) down counter %s (counting from %d) for register %s, declared at %s\n " ,
536
531
extract.width ,
537
532
reset_type.c_str (),
538
533
countname.c_str (),
0 commit comments