Skip to content

Commit 285f24d

Browse files
committed
abc_new: Support per-module script override
1 parent 495a780 commit 285f24d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

passes/techmap/abc_new.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,26 @@ struct AbcNewPass : public ScriptPass {
131131
active_design->selection().select(mod);
132132
}
133133

134+
std::string script_save;
135+
if (mod->has_attribute(ID(abc9_script))) {
136+
script_save = active_design->scratchpad_get_string("abc9.script");
137+
active_design->scratchpad_set_string("abc9.script",
138+
mod->get_string_attribute(ID(abc9_script)));
139+
}
140+
134141
run(stringf(" abc9_ops -write_box %s/input.box", tmpdir.c_str()));
135142
run(stringf(" write_xaiger2 -mapping_prep -map2 %s/input.map2 %s/input.xaig", tmpdir.c_str(), tmpdir.c_str()));
136143
run(stringf(" abc9_exe %s -cwd %s -box %s/input.box", exe_options.c_str(), tmpdir.c_str(), tmpdir.c_str()));
137144
run(stringf(" read_xaiger2 -sc_mapping -module_name %s -map2 %s/input.map2 %s/output.aig",
138145
modname.c_str(), tmpdir.c_str(), tmpdir.c_str()));
139146

147+
if (mod->has_attribute(ID(abc9_script))) {
148+
if (script_save.empty())
149+
active_design->scratchpad_unset("abc9.script");
150+
else
151+
active_design->scratchpad_set_string("abc9.script", script_save);
152+
}
153+
140154
if (!help_mode) {
141155
active_design->selection().selected_modules.clear();
142156
log_pop();

0 commit comments

Comments
 (0)