3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-09-05 09:37:45 +00:00

synth_gatemate: add -noconstmult option

This commit is contained in:
Lofty 2025-08-07 07:19:48 +01:00
parent 9c447ad9d4
commit 1c73870f4d
2 changed files with 27 additions and 7 deletions

View file

@ -26,6 +26,9 @@ module \$__MULMXN (A, B, Y);
parameter B_WIDTH = 1;
parameter Y_WIDTH = 1;
parameter [A_WIDTH-1:0] _TECHMAP_CONSTMSK_A_ = {A_WIDTH{1'b0}};
parameter [A_WIDTH-1:0] _TECHMAP_CONSTMSK_B_ = {B_WIDTH{1'b0}};
(* force_downto *)
input [A_WIDTH-1:0] A;
(* force_downto *)
@ -37,6 +40,11 @@ module \$__MULMXN (A, B, Y);
localparam B_ADJWIDTH = B_WIDTH + (B_SIGNED ? 0 : 1);
generate
`ifdef NO_CONST_MULT
if (|_TECHMAP_CONSTMSK_A_ != 0 || |_TECHMAP_CONSTMSK_B_ != 0) begin
wire _TECHMAP_FAIL_ = 1'b1;
end
`endif
if (A_SIGNED) begin: blkA
wire signed [A_ADJWIDTH-1:0] Aext = $signed(A);
end

View file

@ -41,12 +41,12 @@ struct SynthGateMatePass : public ScriptPass
log(" use the specified module as top module.\n");
log("\n");
log(" -vlog <file>\n");
log(" write the design to the specified verilog file. Writing of an output\n");
log(" file is omitted if this parameter is not specified.\n");
log(" write the design to the specified verilog file. Writing of an\n");
log(" output file is omitted if this parameter is not specified.\n");
log("\n");
log(" -json <file>\n");
log(" write the design to the specified JSON file. Writing of an output file\n");
log(" is omitted if this parameter is not specified.\n");
log(" write the design to the specified JSON file. Writing of an output\n");
log(" file is omitted if this parameter is not specified.\n");
log("\n");
log(" -run <from_label>:<to_label>\n");
log(" only run the commands between the labels (see below). An empty\n");
@ -65,11 +65,15 @@ struct SynthGateMatePass : public ScriptPass
log(" -nomult\n");
log(" do not use CC_MULT multiplier cells in output netlist.\n");
log("\n");
log(" -noconstmult\n");
log(" do not use CC_MULT multiplier cells to multiply with a constants\n");
log(" in output netlist.\n");
log("\n");
log(" -nomx8, -nomx4\n");
log(" do not use CC_MX{8,4} multiplexer cells in output netlist.\n");
log("\n");
log(" -luttree\n");
log(" use new LUT tree mapping approach (EXPERIMENTAL).\n");
log(" use new LUT tree mapping approach (for nextpnr output).\n");
log("\n");
log(" -dff\n");
log(" run 'abc' with -dff option\n");
@ -90,7 +94,7 @@ struct SynthGateMatePass : public ScriptPass
}
string top_opt, vlog_file, json_file;
bool noflatten, nobram, noaddf, nomult, nomx4, nomx8, luttree, dff, retime, noiopad, noclkbuf;
bool noflatten, nobram, noaddf, nomult, noconstmult, nomx4, nomx8, luttree, dff, retime, noiopad, noclkbuf;
void clear_flags() override
{
@ -101,6 +105,7 @@ struct SynthGateMatePass : public ScriptPass
nobram = false;
noaddf = false;
nomult = false;
noconstmult = false;
nomx4 = false;
nomx8 = false;
luttree = false;
@ -154,6 +159,10 @@ struct SynthGateMatePass : public ScriptPass
nomult = true;
continue;
}
if (args[argidx] == "-noconstmult") {
noconstmult = true;
continue;
}
if (args[argidx] == "-nomx4") {
nomx4 = true;
continue;
@ -232,7 +241,10 @@ struct SynthGateMatePass : public ScriptPass
if (check_label("map_mult", "(skip if '-nomult')") && !nomult)
{
run("techmap -map +/gatemate/mul_map.v");
if (help_mode)
run("techmap -map +/gatemate/mul_map.v [-D NO_CONST_MULT]", "(-D NO_CONST_MULT if -noconstmult)");
else
run(stringf("techmap -map +/gatemate/mul_map.v %s", noconstmult ? "-D NO_CONST_MULT" : ""));
}
if (check_label("coarse"))