diff --git a/Makefile b/Makefile index a181a9fc2..4e4d41c6e 100644 --- a/Makefile +++ b/Makefile @@ -953,7 +953,7 @@ MK_TEST_DIRS += tests/verilog # Tests that don't generate .mk SH_TEST_DIRS = -SH_TEST_DIRS += tests/csa_tree +SH_TEST_DIRS += tests/arith_tree SH_TEST_DIRS += tests/simple SH_TEST_DIRS += tests/simple_abc9 SH_TEST_DIRS += tests/hana diff --git a/passes/techmap/Makefile.inc b/passes/techmap/Makefile.inc index 190b93570..eccad8998 100644 --- a/passes/techmap/Makefile.inc +++ b/passes/techmap/Makefile.inc @@ -55,7 +55,7 @@ OBJS += passes/techmap/extractinv.o OBJS += passes/techmap/cellmatch.o OBJS += passes/techmap/clockgate.o OBJS += passes/techmap/constmap.o -OBJS += passes/techmap/csa_tree.o +OBJS += passes/techmap/arith_tree.o endif ifeq ($(DISABLE_SPAWN),0) diff --git a/passes/techmap/csa_tree.cc b/passes/techmap/arith_tree.cc similarity index 94% rename from passes/techmap/csa_tree.cc rename to passes/techmap/arith_tree.cc index 132b4bcc7..92e9239f6 100644 --- a/passes/techmap/csa_tree.cc +++ b/passes/techmap/arith_tree.cc @@ -297,7 +297,7 @@ struct Rewriter { return sig; } - void replace_with_csa_tree(std::vector &operands, SigSpec result_y, int neg_compensation, const char *desc) + void replace_with_carry_save_tree(std::vector &operands, SigSpec result_y, int neg_compensation, const char *desc) { int width = GetSize(result_y); std::vector extended; @@ -354,7 +354,7 @@ struct Rewriter { if (operands.size() < 3) continue; - replace_with_csa_tree(operands, root->getPort(ID::Y), neg_compensation, "Replaced add/sub chain"); + replace_with_carry_save_tree(operands, root->getPort(ID::Y), neg_compensation, "Replaced add/sub chain"); for (auto cell : chain) module->remove(cell); } @@ -370,7 +370,7 @@ struct Rewriter { if (operands.size() < 3) continue; - replace_with_csa_tree(operands, cell->getPort(ID::Y), neg_compensation, "Replaced $macc"); + replace_with_carry_save_tree(operands, cell->getPort(ID::Y), neg_compensation, "Replaced $macc"); module->remove(cell); } } @@ -388,14 +388,14 @@ void run(Module *module) rewriter.process_maccs(); } -struct CsaTreePass : public Pass { - CsaTreePass() : Pass("csa_tree", "convert add/sub/macc chains to carry-save adder trees") {} +struct ArithTreePass : public Pass { + ArithTreePass() : Pass("arith_tree", "convert add/sub/macc chains to carry-save adder trees") {} void help() override { // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| log("\n"); - log(" csa_tree [selection]\n"); + log(" arith_tree [selection]\n"); log("\n"); log("This pass replaces chains of $add/$sub cells, $alu cells (with constant\n"); log("BI/CI), and $macc/$macc_v2 cells (without multiplications) with carry-save\n"); @@ -409,7 +409,7 @@ struct CsaTreePass : public Pass { void execute(std::vector args, RTLIL::Design *design) override { - log_header(design, "Executing CSA_TREE pass.\n"); + log_header(design, "Executing ARITH_TREE pass.\n"); size_t argidx; for (argidx = 1; argidx < args.size(); argidx++) @@ -420,6 +420,6 @@ struct CsaTreePass : public Pass { run(module); } } -} CsaTreePass; +} ArithTreePass; PRIVATE_NAMESPACE_END diff --git a/techlibs/common/synth.cc b/techlibs/common/synth.cc index 1490c6adc..daebd789a 100644 --- a/techlibs/common/synth.cc +++ b/techlibs/common/synth.cc @@ -67,8 +67,8 @@ struct SynthPass : public ScriptPass { log(" -booth\n"); log(" run the booth pass to map $mul to Booth encoded multipliers\n"); log("\n"); - log(" -csa\n"); - log(" run the csa_tree pass to convert $add/$sub chains and $macc cells to\n"); + log(" -arith_tree\n"); + log(" run the arith_tree pass to convert $add/$sub chains and $macc cells to\n"); log(" carry-save adder trees.\n"); log("\n"); log(" -noalumacc\n"); @@ -112,7 +112,7 @@ struct SynthPass : public ScriptPass { } string top_module, fsm_opts, memory_opts, abc; - bool autotop, flatten, noalumacc, nofsm, noabc, noshare, flowmap, booth, csa, hieropt, relative_share; + bool autotop, flatten, noalumacc, nofsm, noabc, noshare, flowmap, booth, arith_tree, hieropt, relative_share; int lut; std::vector techmap_maps; @@ -131,7 +131,7 @@ struct SynthPass : public ScriptPass { noshare = false; flowmap = false; booth = false; - csa = false; + arith_tree = false; hieropt = false; relative_share = false; abc = "abc"; @@ -192,8 +192,8 @@ struct SynthPass : public ScriptPass { booth = true; continue; } - if (args[argidx] == "-csa") { - csa = true; + if (args[argidx] == "-arith_tree") { + arith_tree = true; continue; } if (args[argidx] == "-nordff") { @@ -297,8 +297,8 @@ struct SynthPass : public ScriptPass { run("booth", " (if -booth)"); if (!noalumacc) run("alumacc", " (unless -noalumacc)"); - if (csa || help_mode) - run("csa_tree", " (if -csa)"); + if (arith_tree || help_mode) + run("arith_tree", " (if -arith_tree)"); if (!noshare) run("share", " (unless -noshare)"); run("opt" + hieropt_flag); diff --git a/tests/csa_tree/csa_tree_add_chains.ys b/tests/arith_tree/arith_tree_add_chains.ys similarity index 97% rename from tests/csa_tree/csa_tree_add_chains.ys rename to tests/arith_tree/arith_tree_add_chains.ys index ad9a1ddfa..f293ed9da 100644 --- a/tests/csa_tree/csa_tree_add_chains.ys +++ b/tests/arith_tree/arith_tree_add_chains.ys @@ -8,7 +8,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 1 t:$fa select -assert-count 1 t:$add design -reset @@ -23,7 +23,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 3 t:$fa select -assert-count 1 t:$add design -reset @@ -38,7 +38,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 6 t:$fa select -assert-count 1 t:$add design -reset @@ -55,7 +55,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 14 t:$fa select -assert-count 1 t:$add design -reset @@ -76,7 +76,7 @@ endmodule EOT hierarchy -auto-top select -assert-count 2 t:$alu -csa_tree +arith_tree opt_clean select -assert-count 1 t:$fa select -assert-count 1 t:$add @@ -102,7 +102,7 @@ endmodule EOT hierarchy -auto-top select -assert-count 3 t:$alu -csa_tree +arith_tree opt_clean select -assert-count 2 t:$fa select -assert-count 1 t:$add @@ -131,7 +131,7 @@ endmodule EOT hierarchy -auto-top select -assert-count 4 t:$alu -csa_tree +arith_tree opt_clean select -assert-count 3 t:$fa select -assert-count 1 t:$add @@ -151,7 +151,7 @@ hierarchy -auto-top proc alumacc opt -csa_tree +arith_tree opt_clean select -assert-count 1 t:$fa select -assert-count 1 t:$add @@ -170,7 +170,7 @@ hierarchy -auto-top proc alumacc opt -csa_tree +arith_tree opt_clean select -assert-count 3 t:$fa select -assert-count 1 t:$add @@ -189,7 +189,7 @@ hierarchy -auto-top proc alumacc opt -csa_tree +arith_tree opt_clean select -assert-count 6 t:$fa select -assert-count 1 t:$add diff --git a/tests/csa_tree/csa_tree_alu_macc_equiv.ys b/tests/arith_tree/arith_tree_alu_macc_equiv.ys similarity index 91% rename from tests/csa_tree/csa_tree_alu_macc_equiv.ys rename to tests/arith_tree/arith_tree_alu_macc_equiv.ys index 7e9e39ae2..95839d04f 100644 --- a/tests/csa_tree/csa_tree_alu_macc_equiv.ys +++ b/tests/arith_tree/arith_tree_alu_macc_equiv.ys @@ -10,7 +10,7 @@ hierarchy -auto-top proc alumacc opt -equiv_opt csa_tree +equiv_opt arith_tree design -load postopt select -assert-count 1 t:$fa select -assert-count 1 t:$add @@ -28,7 +28,7 @@ hierarchy -auto-top proc alumacc opt -equiv_opt csa_tree +equiv_opt arith_tree design -load postopt select -assert-count 2 t:$fa select -assert-count 1 t:$add @@ -46,7 +46,7 @@ hierarchy -auto-top proc alumacc opt -equiv_opt csa_tree +equiv_opt arith_tree design -load postopt select -assert-count 6 t:$fa select -assert-count 1 t:$add @@ -64,7 +64,7 @@ hierarchy -auto-top proc alumacc opt -equiv_opt csa_tree +equiv_opt arith_tree design -load postopt select -assert-count 2 t:$fa select -assert-count 1 t:$add @@ -82,7 +82,7 @@ hierarchy -auto-top proc alumacc opt -equiv_opt csa_tree +equiv_opt arith_tree design -load postopt select -assert-min 1 t:$fa select -assert-count 1 t:$add @@ -100,8 +100,8 @@ hierarchy -auto-top proc alumacc opt -equiv_opt csa_tree +equiv_opt arith_tree design -load postopt select -assert-min 1 t:$fa select -assert-count 1 t:$add -design -reset +design -reset \ No newline at end of file diff --git a/tests/csa_tree/csa_tree_edge_cases.ys b/tests/arith_tree/arith_tree_edge_cases.ys similarity index 96% rename from tests/csa_tree/csa_tree_edge_cases.ys rename to tests/arith_tree/arith_tree_edge_cases.ys index 97feb3f5c..fd40f2aa7 100644 --- a/tests/csa_tree/csa_tree_edge_cases.ys +++ b/tests/arith_tree/arith_tree_edge_cases.ys @@ -8,7 +8,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 1 t:$fa select -assert-count 1 t:$add design -reset @@ -23,7 +23,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 2 t:$fa select -assert-count 1 t:$add design -reset @@ -38,7 +38,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 2 t:$fa select -assert-count 1 t:$add design -reset @@ -56,7 +56,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 2 t:$fa select -assert-count 1 t:$add design -reset @@ -71,7 +71,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 2 t:$fa select -assert-count 1 t:$add design -reset @@ -86,7 +86,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 2 t:$fa select -assert-count 1 t:$add design -reset @@ -101,7 +101,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 2 t:$fa select -assert-count 1 t:$add design -reset @@ -117,7 +117,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 4 t:$fa select -assert-count 2 t:$add design -reset @@ -141,7 +141,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 2 t:$fa select -assert-count 1 t:$add design -reset @@ -158,7 +158,7 @@ hierarchy -auto-top proc alumacc opt_clean -csa_tree +arith_tree select -assert-none t:$fa select -assert-none t:$add select -assert-none t:$sub @@ -177,7 +177,7 @@ hierarchy -auto-top proc alumacc opt_clean -csa_tree +arith_tree select -assert-none t:$fa select -assert-none t:$add select -assert-none t:$sub @@ -196,7 +196,7 @@ hierarchy -auto-top proc alumacc opt_clean -csa_tree +arith_tree select -assert-none t:$fa select -assert-none t:$add select -assert-none t:$sub @@ -215,7 +215,7 @@ hierarchy -auto-top proc alumacc opt -csa_tree +arith_tree opt_clean select -assert-none t:$fa select -assert-min 1 t:$macc t:$macc_v2 %u @@ -235,7 +235,7 @@ hierarchy -auto-top proc alumacc opt_clean -csa_tree +arith_tree opt_clean select -assert-none t:$fa select -assert-count 2 t:$alu @@ -253,7 +253,7 @@ hierarchy -auto-top proc alumacc opt -csa_tree +arith_tree opt_clean select -assert-none t:$fa design -reset @@ -273,7 +273,7 @@ hierarchy -auto-top proc alumacc opt_clean -csa_tree +arith_tree opt_clean select -assert-count 2 t:$fa select -assert-count 1 t:$add @@ -293,7 +293,7 @@ hierarchy -auto-top proc alumacc opt_clean -csa_tree +arith_tree opt_clean select -assert-count 2 t:$fa select -assert-count 1 t:$add @@ -322,7 +322,7 @@ hierarchy -auto-top proc alumacc opt_clean -csa_tree +arith_tree opt_clean select -assert-min 1 t:$dff design -reset @@ -341,7 +341,7 @@ hierarchy -auto-top proc alumacc opt_clean -csa_tree +arith_tree opt_clean select -assert-count 1 t:$fa select -assert-count 1 t:$add @@ -361,7 +361,7 @@ hierarchy -auto-top proc alumacc opt_clean -csa_tree +arith_tree opt_clean select -assert-count 2 t:$fa select -assert-count 1 t:$add @@ -381,7 +381,7 @@ hierarchy -auto-top proc alumacc opt_clean -csa_tree +arith_tree select -assert-none t:$fa select -assert-none t:$add select -assert-none t:$sub @@ -400,7 +400,7 @@ hierarchy -auto-top proc alumacc opt -csa_tree +arith_tree opt_clean select -assert-none t:$fa select -assert-min 1 t:$macc t:$macc_v2 %u diff --git a/tests/csa_tree/csa_tree_equiv.ys b/tests/arith_tree/arith_tree_equiv.ys similarity index 92% rename from tests/csa_tree/csa_tree_equiv.ys rename to tests/arith_tree/arith_tree_equiv.ys index 966f8ccff..9595d3070 100644 --- a/tests/csa_tree/csa_tree_equiv.ys +++ b/tests/arith_tree/arith_tree_equiv.ys @@ -8,7 +8,7 @@ endmodule EOT hierarchy -auto-top proc -equiv_opt csa_tree +equiv_opt arith_tree design -load postopt select -assert-count 1 t:$fa select -assert-count 1 t:$add @@ -24,7 +24,7 @@ endmodule EOT hierarchy -auto-top proc -equiv_opt csa_tree +equiv_opt arith_tree design -load postopt select -assert-count 2 t:$fa select -assert-count 1 t:$add @@ -40,7 +40,7 @@ endmodule EOT hierarchy -auto-top proc -equiv_opt csa_tree +equiv_opt arith_tree design -load postopt select -assert-count 3 t:$fa select -assert-count 1 t:$add @@ -56,7 +56,7 @@ endmodule EOT hierarchy -auto-top proc -equiv_opt csa_tree +equiv_opt arith_tree design -load postopt select -assert-count 6 t:$fa select -assert-count 1 t:$add @@ -72,7 +72,7 @@ endmodule EOT hierarchy -auto-top proc -equiv_opt csa_tree +equiv_opt arith_tree design -load postopt select -assert-count 2 t:$fa select -assert-count 1 t:$add @@ -90,7 +90,7 @@ endmodule EOT hierarchy -auto-top proc -equiv_opt csa_tree +equiv_opt arith_tree design -load postopt select -assert-count 1 t:$fa select -assert-count 1 t:$add @@ -106,7 +106,7 @@ endmodule EOT hierarchy -auto-top proc -equiv_opt csa_tree +equiv_opt arith_tree design -load postopt select -assert-count 2 t:$fa select -assert-count 1 t:$add @@ -122,7 +122,7 @@ endmodule EOT hierarchy -auto-top proc -equiv_opt csa_tree +equiv_opt arith_tree design -load postopt select -assert-min 1 t:$fa select -assert-count 1 t:$add @@ -138,7 +138,7 @@ endmodule EOT hierarchy -auto-top proc -equiv_opt csa_tree +equiv_opt arith_tree design -load postopt select -assert-min 1 t:$fa select -assert-count 1 t:$add @@ -154,7 +154,7 @@ endmodule EOT hierarchy -auto-top proc -equiv_opt csa_tree +equiv_opt arith_tree design -load postopt select -assert-count 3 t:$fa select -assert-count 1 t:$add @@ -171,7 +171,7 @@ endmodule EOT hierarchy -auto-top proc -equiv_opt csa_tree +equiv_opt arith_tree design -load postopt select -assert-count 2 t:$fa select -assert-count 1 t:$add diff --git a/tests/csa_tree/csa_tree_idempotent.ys b/tests/arith_tree/arith_tree_idempotent.ys similarity index 94% rename from tests/csa_tree/csa_tree_idempotent.ys rename to tests/arith_tree/arith_tree_idempotent.ys index f4d9f7836..3ca0fcc90 100644 --- a/tests/csa_tree/csa_tree_idempotent.ys +++ b/tests/arith_tree/arith_tree_idempotent.ys @@ -9,11 +9,11 @@ EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 6 t:$fa select -assert-count 1 t:$add -csa_tree +arith_tree select -assert-count 6 t:$fa select -assert-count 1 t:$add select -assert-none t:$sub @@ -32,13 +32,13 @@ proc alumacc opt_clean -csa_tree +arith_tree select -assert-count 6 t:$fa select -assert-count 1 t:$add select -assert-none t:$sub select -assert-none t:$alu -csa_tree +arith_tree select -assert-count 6 t:$fa select -assert-count 1 t:$add select -assert-none t:$sub diff --git a/tests/csa_tree/csa_tree_negative.ys b/tests/arith_tree/arith_tree_negative.ys similarity index 95% rename from tests/csa_tree/csa_tree_negative.ys rename to tests/arith_tree/arith_tree_negative.ys index 1cdcf3deb..beb540dd9 100644 --- a/tests/csa_tree/csa_tree_negative.ys +++ b/tests/arith_tree/arith_tree_negative.ys @@ -8,7 +8,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-none t:$fa select -assert-count 1 t:$add design -reset @@ -25,7 +25,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-none t:$fa design -reset @@ -39,7 +39,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-none t:$fa select -assert-count 1 t:$sub design -reset @@ -54,7 +54,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-none t:$fa select -assert-max 1 t:$add design -reset @@ -71,7 +71,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 2 t:$fa select -assert-count 2 t:$add design -reset diff --git a/tests/csa_tree/csa_tree_sub_chains.ys b/tests/arith_tree/arith_tree_sub_chains.ys similarity index 96% rename from tests/csa_tree/csa_tree_sub_chains.ys rename to tests/arith_tree/arith_tree_sub_chains.ys index 3652e5c90..a34cb3868 100644 --- a/tests/csa_tree/csa_tree_sub_chains.ys +++ b/tests/arith_tree/arith_tree_sub_chains.ys @@ -8,7 +8,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 2 t:$fa select -assert-count 1 t:$add select -assert-count 1 t:$not @@ -25,7 +25,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 3 t:$fa select -assert-count 1 t:$add select -assert-count 1 t:$not @@ -42,7 +42,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 3 t:$fa select -assert-count 1 t:$add select -assert-count 3 t:$not @@ -59,7 +59,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 4 t:$fa select -assert-count 1 t:$add select -assert-count 2 t:$not @@ -76,7 +76,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 3 t:$fa select -assert-count 1 t:$add select -assert-count 2 t:$not @@ -94,7 +94,7 @@ endmodule EOT hierarchy -auto-top proc -csa_tree +arith_tree select -assert-count 2 t:$fa select -assert-count 1 t:$add select -assert-count 1 t:$not @@ -113,7 +113,7 @@ hierarchy -auto-top proc alumacc opt_clean -csa_tree +arith_tree opt_clean select -assert-count 2 t:$fa select -assert-count 1 t:$add @@ -133,7 +133,7 @@ hierarchy -auto-top proc alumacc opt_clean -csa_tree +arith_tree opt_clean select -assert-count 3 t:$fa select -assert-count 1 t:$add @@ -153,7 +153,7 @@ hierarchy -auto-top proc alumacc opt_clean -csa_tree +arith_tree opt_clean select -assert-count 3 t:$fa select -assert-count 1 t:$add @@ -173,7 +173,7 @@ hierarchy -auto-top proc alumacc opt_clean -csa_tree +arith_tree opt_clean select -assert-count 3 t:$fa select -assert-count 1 t:$add @@ -193,7 +193,7 @@ hierarchy -auto-top proc alumacc opt -csa_tree +arith_tree opt_clean select -assert-none t:$macc t:$macc_v2 %u select -assert-min 1 t:$fa @@ -212,7 +212,7 @@ hierarchy -auto-top proc alumacc opt -csa_tree +arith_tree opt_clean select -assert-none t:$macc t:$macc_v2 %u select -assert-min 1 t:$fa @@ -232,7 +232,7 @@ hierarchy -auto-top proc alumacc opt -csa_tree +arith_tree opt_clean select -assert-none t:$macc t:$macc_v2 %u select -assert-count 4 t:$fa diff --git a/tests/csa_tree/run-test.sh b/tests/arith_tree/run-test.sh similarity index 100% rename from tests/csa_tree/run-test.sh rename to tests/arith_tree/run-test.sh