Clean up after bufnorm.

This commit is contained in:
nella
2026-09-21 16:57:53 +02:00
parent 5726f981fa
commit c3c5388ed9
3 changed files with 27 additions and 13 deletions
+19
View File
@@ -1745,6 +1745,23 @@ struct XAigerWriter : AigerWriter {
}
};
// $input_port cells only encode buffer-normalized form, but bufNormalize(false)
// leaves the cells in the design
void remove_input_port_cells(Design *design)
{
std::vector<Cell *> to_remove;
for (auto module : design->modules()) {
to_remove.clear();
for (auto cell : module->cells())
if (cell->type == ID($input_port))
to_remove.push_back(cell);
for (auto cell : to_remove)
module->remove(cell);
}
}
struct Aiger2Backend : Backend {
Aiger2Backend() : Backend("aiger2", "(experimental) write design to AIGER file")
{
@@ -1842,6 +1859,7 @@ struct Aiger2Backend : Backend {
// flag must not be kept on past the code that can work
// with it)
design->bufNormalize(false);
remove_input_port_cells(design);
}
} Aiger2Backend;
@@ -1923,6 +1941,7 @@ struct XAiger2Backend : Backend {
// flag must not be kept on past the code that can work
// with it)
design->bufNormalize(false);
remove_input_port_cells(design);
}
} XAiger2Backend;
+1 -13
View File
@@ -3,18 +3,6 @@
import sys
sys.path.append("..")
import glob
import gen_tests_makefile
skip = [
"hier_check.ys",
]
def create_tests():
for ys in sorted(glob.glob("*.ys")):
if ys in skip:
continue
gen_tests_makefile.generate_ys_test(ys)
gen_tests_makefile.generate_custom(create_tests)
gen_tests_makefile.generate(["--yosys-scripts"])
+7
View File
@@ -11,6 +11,13 @@ EOT
hierarchy -top top
techmap
design -save pre
abc9 -lut 4
select -assert-none t:$input_port
check -assert
design -load pre
abc_new -liberty openroad/cm_test_cells.lib
select -assert-none t:$input_port
check -assert