Rename csa_tree to arith_tree.

This commit is contained in:
nella 2026-04-08 12:14:02 +02:00
parent f6971bfccd
commit 6e273cb2bd
12 changed files with 90 additions and 90 deletions

View File

@ -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

View File

@ -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)

View File

@ -297,7 +297,7 @@ struct Rewriter {
return sig;
}
void replace_with_csa_tree(std::vector<Operand> &operands, SigSpec result_y, int neg_compensation, const char *desc)
void replace_with_carry_save_tree(std::vector<Operand> &operands, SigSpec result_y, int neg_compensation, const char *desc)
{
int width = GetSize(result_y);
std::vector<SigSpec> 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<std::string> 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

View File

@ -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<std::string> 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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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