mirror of
https://github.com/YosysHQ/yosys
synced 2025-11-09 23:52:03 +00:00
Split abc_module() into prepare_module() and run_abc()
`prepare_module()` will have to run on the main thread.
This commit is contained in:
parent
7d82d80a95
commit
13b3418a7f
1 changed files with 12 additions and 10 deletions
|
|
@ -180,8 +180,9 @@ struct AbcModuleState {
|
||||||
std::string remap_name(RTLIL::IdString abc_name, RTLIL::Wire **orig_wire = nullptr);
|
std::string remap_name(RTLIL::IdString abc_name, RTLIL::Wire **orig_wire = nullptr);
|
||||||
void dump_loop_graph(FILE *f, int &nr, dict<int, pool<int>> &edges, pool<int> &workpool, std::vector<int> &in_counts);
|
void dump_loop_graph(FILE *f, int &nr, dict<int, pool<int>> &edges, pool<int> &workpool, std::vector<int> &in_counts);
|
||||||
void handle_loops(AbcSigMap &assign_map, RTLIL::Module *module);
|
void handle_loops(AbcSigMap &assign_map, RTLIL::Module *module);
|
||||||
void abc_module(RTLIL::Design *design, RTLIL::Module *module, AbcSigMap &assign_map, const std::vector<RTLIL::Cell*> &cells,
|
void prepare_module(RTLIL::Design *design, RTLIL::Module *module, AbcSigMap &assign_map, const std::vector<RTLIL::Cell*> &cells,
|
||||||
bool dff_mode, std::string clk_str);
|
bool dff_mode, std::string clk_str);
|
||||||
|
void run_abc();
|
||||||
void extract(AbcSigMap &assign_map, RTLIL::Design *design, RTLIL::Module *module);
|
void extract(AbcSigMap &assign_map, RTLIL::Design *design, RTLIL::Module *module);
|
||||||
void finish();
|
void finish();
|
||||||
};
|
};
|
||||||
|
|
@ -775,7 +776,7 @@ struct abc_output_filter
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void AbcModuleState::abc_module(RTLIL::Design *design, RTLIL::Module *module, AbcSigMap &assign_map, const std::vector<RTLIL::Cell*> &cells,
|
void AbcModuleState::prepare_module(RTLIL::Design *design, RTLIL::Module *module, AbcSigMap &assign_map, const std::vector<RTLIL::Cell*> &cells,
|
||||||
bool dff_mode, std::string clk_str)
|
bool dff_mode, std::string clk_str)
|
||||||
{
|
{
|
||||||
map_autoidx = autoidx++;
|
map_autoidx = autoidx++;
|
||||||
|
|
@ -987,9 +988,12 @@ void AbcModuleState::abc_module(RTLIL::Design *design, RTLIL::Module *module, Ab
|
||||||
mark_port(assign_map, srst_sig);
|
mark_port(assign_map, srst_sig);
|
||||||
|
|
||||||
handle_loops(assign_map, module);
|
handle_loops(assign_map, module);
|
||||||
|
}
|
||||||
|
|
||||||
buffer = stringf("%s/input.blif", tempdir_name);
|
void AbcModuleState::run_abc()
|
||||||
f = fopen(buffer.c_str(), "wt");
|
{
|
||||||
|
std::string buffer = stringf("%s/input.blif", tempdir_name);
|
||||||
|
FILE *f = fopen(buffer.c_str(), "wt");
|
||||||
if (f == nullptr)
|
if (f == nullptr)
|
||||||
log_error("Opening %s for writing failed: %s\n", buffer, strerror(errno));
|
log_error("Opening %s for writing failed: %s\n", buffer, strerror(errno));
|
||||||
|
|
||||||
|
|
@ -1111,8 +1115,6 @@ void AbcModuleState::abc_module(RTLIL::Design *design, RTLIL::Module *module, Ab
|
||||||
log_push();
|
log_push();
|
||||||
if (count_output > 0)
|
if (count_output > 0)
|
||||||
{
|
{
|
||||||
log_header(design, "Executing ABC.\n");
|
|
||||||
|
|
||||||
auto &cell_cost = cmos_cost ? CellCosts::cmos_gate_cost() : CellCosts::default_gate_cost();
|
auto &cell_cost = cmos_cost ? CellCosts::cmos_gate_cost() : CellCosts::default_gate_cost();
|
||||||
|
|
||||||
buffer = stringf("%s/stdcells.genlib", tempdir_name);
|
buffer = stringf("%s/stdcells.genlib", tempdir_name);
|
||||||
|
|
@ -1522,8 +1524,6 @@ void AbcModuleState::finish()
|
||||||
log("Removing temp directory.\n");
|
log("Removing temp directory.\n");
|
||||||
remove_directory(tempdir_name);
|
remove_directory(tempdir_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_pop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// For every signal that connects cells from different sets, or a cell in a set to a cell not in any set,
|
// For every signal that connects cells from different sets, or a cell in a set to a cell not in any set,
|
||||||
|
|
@ -2163,7 +2163,8 @@ struct AbcPass : public Pass {
|
||||||
assign_cell_connection_ports(mod, {&cells}, assign_map);
|
assign_cell_connection_ports(mod, {&cells}, assign_map);
|
||||||
|
|
||||||
AbcModuleState state(config, initvals);
|
AbcModuleState state(config, initvals);
|
||||||
state.abc_module(design, mod, assign_map, cells, dff_mode, clk_str);
|
state.prepare_module(design, mod, assign_map, cells, dff_mode, clk_str);
|
||||||
|
state.run_abc();
|
||||||
state.extract(assign_map, design, mod);
|
state.extract(assign_map, design, mod);
|
||||||
state.finish();
|
state.finish();
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2333,7 +2334,8 @@ struct AbcPass : public Pass {
|
||||||
state.arst_sig = assign_map(std::get<5>(it.first));
|
state.arst_sig = assign_map(std::get<5>(it.first));
|
||||||
state.srst_polarity = std::get<6>(it.first);
|
state.srst_polarity = std::get<6>(it.first);
|
||||||
state.srst_sig = assign_map(std::get<7>(it.first));
|
state.srst_sig = assign_map(std::get<7>(it.first));
|
||||||
state.abc_module(design, mod, assign_map, it.second, !state.clk_sig.empty(), "$");
|
state.prepare_module(design, mod, assign_map, it.second, !state.clk_sig.empty(), "$");
|
||||||
|
state.run_abc();
|
||||||
state.extract(assign_map, design, mod);
|
state.extract(assign_map, design, mod);
|
||||||
state.finish();
|
state.finish();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue