Skip to content

Commit c0967c4

Browse files
committed
Build FfInitVals for the entire module once and use it for every ABC run.
1 parent a54a673 commit c0967c4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

passes/techmap/abc.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ struct AbcModuleState {
156156
int map_autoidx = 0;
157157
std::vector<gate_t> signal_list;
158158
dict<RTLIL::SigBit, int> signal_map;
159-
FfInitVals initvals;
159+
FfInitVals &initvals;
160160
bool had_init = false;
161161
bool did_run_abc = false;
162162

@@ -171,7 +171,8 @@ struct AbcModuleState {
171171

172172
std::string tempdir_name;
173173

174-
AbcModuleState(const AbcConfig &config) : config(config) {}
174+
AbcModuleState(const AbcConfig &config, FfInitVals &initvals)
175+
: config(config), initvals(initvals) {}
175176

176177
int map_signal(const AbcSigMap &assign_map, RTLIL::SigBit bit, gate_type_t gate_type = G(NONE), int in1 = -1, int in2 = -1, int in3 = -1, int in4 = -1);
177178
void mark_port(const AbcSigMap &assign_map, RTLIL::SigSpec sig);
@@ -775,7 +776,6 @@ struct abc_output_filter
775776
void AbcModuleState::abc_module(RTLIL::Design *design, RTLIL::Module *module, AbcSigMap &assign_map, const std::vector<RTLIL::Cell*> &cells,
776777
bool dff_mode, std::string clk_str)
777778
{
778-
initvals.set(&assign_map, module);
779779
map_autoidx = autoidx++;
780780

781781
if (clk_str != "$")
@@ -2146,6 +2146,8 @@ struct AbcPass : public Pass {
21462146

21472147
AbcSigMap assign_map;
21482148
assign_map.set(mod);
2149+
FfInitVals initvals;
2150+
initvals.set(&assign_map, mod);
21492151

21502152
for (auto wire : mod->wires())
21512153
if (wire->port_id > 0)
@@ -2155,7 +2157,7 @@ struct AbcPass : public Pass {
21552157
std::vector<RTLIL::Cell*> cells = mod->selected_cells();
21562158
assign_cell_connection_ports(mod, {&cells}, assign_map);
21572159

2158-
AbcModuleState state(config);
2160+
AbcModuleState state(config, initvals);
21592161
state.abc_module(design, mod, assign_map, cells, dff_mode, clk_str);
21602162
state.extract(assign_map, design, mod);
21612163
state.finish();
@@ -2178,8 +2180,6 @@ struct AbcPass : public Pass {
21782180
dict<RTLIL::Cell*, pool<RTLIL::SigBit>> cell_to_bit, cell_to_bit_up, cell_to_bit_down;
21792181
dict<RTLIL::SigBit, pool<RTLIL::Cell*>> bit_to_cell, bit_to_cell_up, bit_to_cell_down;
21802182

2181-
FfInitVals initvals;
2182-
initvals.set(&assign_map, mod);
21832183
for (auto cell : all_cells)
21842184
{
21852185
clkdomain_t key;
@@ -2319,7 +2319,7 @@ struct AbcPass : public Pass {
23192319
assign_cell_connection_ports(mod, cell_sets, assign_map);
23202320
}
23212321
for (auto &it : assigned_cells) {
2322-
AbcModuleState state(config);
2322+
AbcModuleState state(config, initvals);
23232323
state.clk_polarity = std::get<0>(it.first);
23242324
state.clk_sig = assign_map(std::get<1>(it.first));
23252325
state.en_polarity = std::get<2>(it.first);

0 commit comments

Comments
 (0)