quicklogic: Avoid carry chains in division mapping

The default mapping rules for division-like operations (div/divfloor/
mod/modfloor) invoke subtractions which can get mapped to carry chains
in FPGA flows. Optimizations across carry chains are weak, so in
practice this ends up too costly compared to implementing the division
purely in soft logic.

For this reason arrange for `techmap.v` ignoring division operations
under `-D NODIV`, and use this mode in `synth_quicklogic` to avoid carry
chains for divisions.
This commit is contained in:
Martin Povišer 2024-09-19 11:21:09 +02:00
parent 4d581a97d6
commit 9018d06a33
2 changed files with 4 additions and 2 deletions

View File

@ -304,6 +304,7 @@ endmodule
// Divide and Modulo // Divide and Modulo
// -------------------------------------------------------- // --------------------------------------------------------
`ifndef NODIV
module \$__div_mod_u (A, B, Y, R); module \$__div_mod_u (A, B, Y, R);
parameter WIDTH = 1; parameter WIDTH = 1;
@ -531,7 +532,7 @@ module _90_modfloor (A, B, Y);
.R(Y) .R(Y)
); );
endmodule endmodule
`endif
// -------------------------------------------------------- // --------------------------------------------------------
// Power // Power

View File

@ -266,7 +266,8 @@ struct SynthQuickLogicPass : public ScriptPass {
if (check_label("map_gates")) { if (check_label("map_gates")) {
if (inferAdder && family == "qlf_k6n10f") { if (inferAdder && family == "qlf_k6n10f") {
run("techmap -map +/techmap.v -map " + lib_path + family + "/arith_map.v", "(unless -no_adder)"); run("techmap -map +/techmap.v -map " + lib_path + family + "/arith_map.v -D NODIV", "(unless -no_adder)");
run("techmap", "(unless -no_adder)");
} else { } else {
run("techmap"); run("techmap");
} }