@@ -156,7 +156,7 @@ struct AbcModuleState {
156
156
int map_autoidx = 0 ;
157
157
std::vector<gate_t > signal_list;
158
158
dict<RTLIL::SigBit, int > signal_map;
159
- FfInitVals initvals;
159
+ FfInitVals & initvals;
160
160
bool had_init = false ;
161
161
bool did_run_abc = false ;
162
162
@@ -171,7 +171,8 @@ struct AbcModuleState {
171
171
172
172
std::string tempdir_name;
173
173
174
- AbcModuleState (const AbcConfig &config) : config(config) {}
174
+ AbcModuleState (const AbcConfig &config, FfInitVals &initvals)
175
+ : config(config), initvals(initvals) {}
175
176
176
177
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);
177
178
void mark_port (const AbcSigMap &assign_map, RTLIL::SigSpec sig);
@@ -777,7 +778,6 @@ struct abc_output_filter
777
778
void AbcModuleState::abc_module (RTLIL::Design *design, RTLIL::Module *module , AbcSigMap &assign_map, const std::vector<RTLIL::Cell*> &cells,
778
779
bool dff_mode, std::string clk_str)
779
780
{
780
- initvals.set (&assign_map, module );
781
781
map_autoidx = autoidx++;
782
782
783
783
if (clk_str != " $" )
@@ -2148,6 +2148,11 @@ struct AbcPass : public Pass {
2148
2148
2149
2149
AbcSigMap assign_map;
2150
2150
assign_map.set (mod);
2151
+ // Create an FfInitVals and use it for all ABC runs. FfInitVals only cares about
2152
+ // wires with the ID::init attribute and we don't add or remove any such wires
2153
+ // in this pass.
2154
+ FfInitVals initvals;
2155
+ initvals.set (&assign_map, mod);
2151
2156
2152
2157
for (auto wire : mod->wires ())
2153
2158
if (wire->port_id > 0 || wire->get_bool_attribute (ID::keep))
@@ -2157,7 +2162,7 @@ struct AbcPass : public Pass {
2157
2162
std::vector<RTLIL::Cell*> cells = mod->selected_cells ();
2158
2163
assign_cell_connection_ports (mod, {&cells}, assign_map);
2159
2164
2160
- AbcModuleState state (config);
2165
+ AbcModuleState state (config, initvals );
2161
2166
state.abc_module (design, mod, assign_map, cells, dff_mode, clk_str);
2162
2167
state.extract (assign_map, design, mod);
2163
2168
state.finish ();
@@ -2180,8 +2185,6 @@ struct AbcPass : public Pass {
2180
2185
dict<RTLIL::Cell*, pool<RTLIL::SigBit>> cell_to_bit, cell_to_bit_up, cell_to_bit_down;
2181
2186
dict<RTLIL::SigBit, pool<RTLIL::Cell*>> bit_to_cell, bit_to_cell_up, bit_to_cell_down;
2182
2187
2183
- FfInitVals initvals;
2184
- initvals.set (&assign_map, mod);
2185
2188
for (auto cell : all_cells)
2186
2189
{
2187
2190
clkdomain_t key;
@@ -2321,7 +2324,7 @@ struct AbcPass : public Pass {
2321
2324
assign_cell_connection_ports (mod, cell_sets, assign_map);
2322
2325
}
2323
2326
for (auto &it : assigned_cells) {
2324
- AbcModuleState state (config);
2327
+ AbcModuleState state (config, initvals );
2325
2328
state.clk_polarity = std::get<0 >(it.first );
2326
2329
state.clk_sig = assign_map (std::get<1 >(it.first ));
2327
2330
state.en_polarity = std::get<2 >(it.first );
0 commit comments