aboutsummaryrefslogtreecommitdiffstats
path: root/passes/techmap/abc9_ops.cc
diff options
context:
space:
mode:
authorEddie Hung <eddie@fpgeh.com>2020-04-16 10:24:02 -0700
committerEddie Hung <eddie@fpgeh.com>2020-05-14 10:33:56 -0700
commit48052ad813db3561a959a1921466d571bafa354c (patch)
tree9029ab8f94665a252449cfa4f0a0440ed0696815 /passes/techmap/abc9_ops.cc
parent7812a2959b9b23b44e8144f9edb139f282d623e1 (diff)
downloadyosys-48052ad813db3561a959a1921466d571bafa354c.tar.gz
yosys-48052ad813db3561a959a1921466d571bafa354c.tar.bz2
yosys-48052ad813db3561a959a1921466d571bafa354c.zip
abc9: add flop boxes to basic $_DFF_P_ and $_DFF_N_ too
Diffstat (limited to 'passes/techmap/abc9_ops.cc')
-rw-r--r--passes/techmap/abc9_ops.cc26
1 files changed, 16 insertions, 10 deletions
diff --git a/passes/techmap/abc9_ops.cc b/passes/techmap/abc9_ops.cc
index 62007c61e..976b6462e 100644
--- a/passes/techmap/abc9_ops.cc
+++ b/passes/techmap/abc9_ops.cc
@@ -128,7 +128,7 @@ void prep_dff_hier(RTLIL::Design *design)
Design *unmap_design = new Design;
- for (auto module : design->selected_modules())
+ for (auto module : design->modules())
for (auto cell : module->cells()) {
auto inst_module = design->module(cell->type);
if (inst_module && inst_module->attributes.count(ID::abc9_flop)) {
@@ -219,17 +219,23 @@ void prep_dff_map(RTLIL::Design *design)
D = dff_cell->getPort(ID::D);
- // Add a dummy enable mux feeding DFF.D to ensure that:
- // (i) a driving cell exists, so that 'submod' will have
- // an output port
- // (ii) DFF.Q will exist in this submodule
{
- auto c = module->addCell(NEW_ID, ID($_MUX_));
+ // Add dummy buffers for all module inputs/outputs
+ // to ensure that these ports exists in the flop box
+ // created by later submod pass
+ for (auto port_name : module->ports) {
+ auto port = module->wire(port_name);
+ log_assert(GetSize(port) == 1);
+ auto c = module->addBufGate(NEW_ID, port, module->addWire(NEW_ID));
+ // Need to set (* keep *) otherwise opt_clean
+ // inside submod will blow it away
+ c->set_bool_attribute(ID::keep);
+ }
+ // Add an additional buffer that drives $_DFF_[NP]_.D
+ // so that the flop box will have an output
auto w = module->addWire(NEW_ID);
- c->setPort(ID::A, D);
- c->setPort(ID::B, Q);
- c->setPort(ID::S, State::S0);
- c->setPort(ID::Y, w);
+ auto c = module->addBufGate(NEW_ID, D, w);
+ c->set_bool_attribute(ID::keep);
dff_cell->setPort(ID::D, w);
D = w;
}