output [Y_WIDTH-1:0] Y;\r
\r
generate\r
- if (A_SIGNED != B_SIGNED)\r
- wire _TECHMAP_FAIL_ = 1;\r
- else if (A_WIDTH <= `DSP_A_MAXWIDTH && B_WIDTH <= `DSP_B_MAXWIDTH)\r
+ if (A_SIGNED != B_SIGNED || A_WIDTH <= 1 || B_WIDTH <= 1)\r
wire _TECHMAP_FAIL_ = 1;\r
// NB: A_SIGNED == B_SIGNED == 0 from here\r
else if (A_WIDTH >= B_WIDTH)\r
endmodule\r
\r
(* techmap_celltype = "$__mul" *)\r
-module _90_internal_mul_to_external (A, B, Y); \r
+module $__soft_mul (A, B, Y); \r
parameter A_SIGNED = 0;\r
parameter B_SIGNED = 0;\r
parameter A_WIDTH = 1;\r
input [B_WIDTH-1:0] B;\r
output [Y_WIDTH-1:0] Y;\r
\r
+ // Indirection necessary since mapping\r
+ // back to $mul will cause recursion\r
generate\r
if (A_SIGNED && !B_SIGNED)\r
- \$mul #(\r
+ \$__soft__mul #(\r
.A_SIGNED(A_SIGNED),\r
.B_SIGNED(1),\r
.A_WIDTH(A_WIDTH),\r
.Y_WIDTH(Y_WIDTH)\r
) _TECHMAP_REPLACE_ (\r
.A(A),\r
- .B({1'b0, B}),\r
+ .B({1'b0,B}),\r
.Y(Y)\r
);\r
else if (!A_SIGNED && B_SIGNED)\r
- \$mul #(\r
+ \$__soft_mul #(\r
.A_SIGNED(1),\r
.B_SIGNED(B_SIGNED),\r
.A_WIDTH(A_WIDTH+1),\r
.B_WIDTH(B_WIDTH),\r
.Y_WIDTH(Y_WIDTH)\r
) _TECHMAP_REPLACE_ (\r
- .A({1'b0, A}),\r
+ .A({1'b0,A}),\r
.B(B),\r
.Y(Y)\r
);\r
else\r
- \$mul #(\r
+ \$__soft_mul #(\r
.A_SIGNED(A_SIGNED),\r
.B_SIGNED(B_SIGNED),\r
.A_WIDTH(A_WIDTH),\r
if (help_mode || dsp) {
run("techmap -map +/mul2dsp.v -D DSP_A_MAXWIDTH=16 -D DSP_B_MAXWIDTH=16 -D DSP_MINWIDTH=11 -D DSP_NAME=$__MUL16X16", "(if -dsp)");
run("ice40_dsp", "(if -dsp)");
+ run("chtype -set $mul t:$__soft_mul");
}
run("alumacc");
run("opt");