Skip to content

Commit

Permalink
opt_expr: In clkinv loop ignore irrelevant cells early
Browse files Browse the repository at this point in the history
Each call to `handle_clkpol_celltype_swap` has a conversion of the
cell's type ID to an allocated string. This can sum up to a
non-negligible time being spent in the clkpol code even for a design
which doesn't have any flip-flop gates.
  • Loading branch information
povik committed Feb 1, 2024
1 parent 5e86d98 commit 1bdb80d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions passes/opt/opt_expr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@ void replace_const_cells(RTLIL::Design *design, RTLIL::Module *module, bool cons
}
}

CellTypes ct_memcells;
ct_memcells.setup_stdcells_mem();

if (!noclkinv)
for (auto cell : module->cells())
if (design->selected(module, cell)) {
Expand All @@ -432,6 +435,9 @@ void replace_const_cells(RTLIL::Design *design, RTLIL::Module *module, bool cons
if (cell->type.in(ID($dffe), ID($adffe), ID($aldffe), ID($sdffe), ID($sdffce), ID($dffsre), ID($dlatch), ID($adlatch), ID($dlatchsr)))
handle_polarity_inv(cell, ID::EN, ID::EN_POLARITY, assign_map, invert_map);

if (!ct_memcells.cell_known(cell->type))
continue;

handle_clkpol_celltype_swap(cell, "$_SR_N?_", "$_SR_P?_", ID::S, assign_map, invert_map);
handle_clkpol_celltype_swap(cell, "$_SR_?N_", "$_SR_?P_", ID::R, assign_map, invert_map);

Expand Down

0 comments on commit 1bdb80d

Please sign in to comment.