abc9_ops: tidy up, suppress error if no boxes/holes

This commit is contained in:
Eddie Hung 2020-04-21 12:42:09 -07:00
parent e2044fd9c7
commit d5a8aaba8c
1 changed files with 18 additions and 18 deletions

View File

@ -296,25 +296,25 @@ struct Abc9Pass : public ScriptPass
run("wbflip"); run("wbflip");
run("techmap"); run("techmap");
run("opt"); run("opt");
if (dff_mode) { if (dff_mode || help_mode) {
if (!help_mode) if (!help_mode)
active_design->scratchpad_unset("abc9_ops.prep_dff_submod.did_something"); active_design->scratchpad_unset("abc9_ops.prep_dff_submod.did_something");
run("abc9_ops -prep_dff_submod", "(only if -dff)"); // rewrite specify run("abc9_ops -prep_dff_submod", " (only if -dff)"); // rewrite specify
bool did_something = help_mode || active_design->scratchpad_get_bool("abc9_ops.prep_dff_submod.did_something"); bool did_something = help_mode || active_design->scratchpad_get_bool("abc9_ops.prep_dff_submod.did_something");
if (did_something) { if (did_something) {
// select all $_DFF_[NP]_ // select all $_DFF_[NP]_
// then select all its fanins // then select all its fanins
// then select all fanouts of all that // then select all fanouts of all that
// lastly remove $_DFF_[NP]_ cells // lastly remove $_DFF_[NP]_ cells
run("setattr -set submod \"$abc9_flop\" t:$_DFF_?_ %ci* %co* t:$_DFF_?_ %d"); run("setattr -set submod \"$abc9_flop\" t:$_DFF_?_ %ci* %co* t:$_DFF_?_ %d", " (only if -dff)");
run("submod"); run("submod", " (only if -dff)");
run("setattr -mod -set whitebox 1 -set abc9_flop 1 -set abc9_box 1 *_$abc9_flop"); run("setattr -mod -set whitebox 1 -set abc9_flop 1 -set abc9_box 1 *_$abc9_flop", "(only if -dff)");
run("abc9_ops -prep_dff_unmap"); run("abc9_ops -prep_dff_unmap", " (only if -dff)");
run("design -copy-to $abc9 *_$abc9_flop"); // copy submod out run("design -copy-to $abc9 *_$abc9_flop", " (only if -dff)"); // copy submod out
run("delete *_$abc9_flop"); run("delete *_$abc9_flop", " (only if -dff)");
if (help_mode) { if (help_mode) {
run("foreach module in design"); run("foreach module in design");
run(" rename <module-name>_$abc9_flop _TECHMAP_REPLACE_"); run(" rename <module-name>_$abc9_flop _TECHMAP_REPLACE_", " (only if -dff)");
} }
else { else {
// Rename all submod-s to _TECHMAP_REPLACE_ to inherit name + attrs // Rename all submod-s to _TECHMAP_REPLACE_ to inherit name + attrs
@ -346,18 +346,18 @@ struct Abc9Pass : public ScriptPass
run(stringf("abc9_ops -prep_lut %d", maxlut)); run(stringf("abc9_ops -prep_lut %d", maxlut));
if (help_mode) if (help_mode)
run("abc9_ops -prep_box", "(skip if -box)"); run("abc9_ops -prep_box", "(skip if -box)");
else if (box_file.empty()) { else if (box_file.empty())
run("abc9_ops -prep_box"); run("abc9_ops -prep_box");
} if (saved_designs.count("$abc9_holes") || help_mode) {
run("design -stash $abc9"); run("design -stash $abc9");
run("design -load $abc9_holes"); run("design -load $abc9_holes");
run("techmap -wb -map %$abc9 -map +/techmap.v"); run("techmap -wb -map %$abc9 -map +/techmap.v");
run("opt -purge"); run("opt -purge");
run("aigmap");
run("design -stash $abc9_holes"); run("design -stash $abc9_holes");
run("design -load $abc9"); run("design -load $abc9");
run("design -delete $abc9"); run("design -delete $abc9");
} }
}
if (check_label("exe")) { if (check_label("exe")) {
run("aigmap"); run("aigmap");