// ALU Infrastructure
// --------------------------------------------------------
-module \$__alu_ripple (A, B, CI, Y, CO, CS);
+module \$__alu_ripple (A, B, CI, X, Y, CO, CS);
parameter WIDTH = 1;
input [WIDTH-1:0] A, B;
- output [WIDTH-1:0] Y;
+ output [WIDTH-1:0] X, Y;
input CI;
output CO, CS;
\$_OR_ gate5 ( .A(t1), .B(t3), .Y(x) );
assign a = A[i], b = B[i], c = carry[i];
- assign carry[i+1] = x, Y[i] = y;
+ assign carry[i+1] = x, X[i] = t2, Y[i] = y;
end
endgenerate
endmodule
endgenerate
endmodule
-module \$__alu_lookahead (A, B, CI, Y, CO, CS);
+module \$__alu_lookahead (A, B, CI, X, Y, CO, CS);
parameter WIDTH = 1;
input [WIDTH-1:0] A, B;
- output [WIDTH-1:0] Y;
+ output [WIDTH-1:0] X, Y;
input CI;
output CO, CS;
\$_XOR_ gate3 ( .A(p), .B(c), .Y(y) );
assign a = A[i], b = B[i], c = C[i];
- assign P[i] = p, G[i] = g, Y[i] = y;
+ assign P[i] = p, G[i] = g, X[i] = p, Y[i] = y;
end
endgenerate
\$__lcu #(.WIDTH(WIDTH)) lcu (.P(P), .G(G), .CI(CI), .CO(C));
endmodule
-module \$__alu (A, B, CI, S, Y, CO, CS);
+module \$__alu (A, B, CI, BI, X, Y, CO, CS);
parameter A_SIGNED = 0;
parameter B_SIGNED = 0;
parameter A_WIDTH = 1;
input [A_WIDTH-1:0] A;
input [B_WIDTH-1:0] B;
- output [Y_WIDTH-1:0] Y;
+ output [Y_WIDTH-1:0] X, Y;
// carry in, sub, carry out, carry sign
- input CI, S;
+ input CI, BI;
output CO, CS;
wire [Y_WIDTH-1:0] A_buf, B_buf;
\$pos #(.A_SIGNED(B_SIGNED), .A_WIDTH(B_WIDTH), .Y_WIDTH(Y_WIDTH)) B_conv (.A(B), .Y(B_buf));
`ifdef ALU_RIPPLE
- \$__alu_ripple #(.WIDTH(Y_WIDTH)) _TECHMAP_REPLACE_ (.A(A_buf), .B(S ? ~B_buf : B_buf), .CI(CI), .Y(Y), .CO(CO), .CS(CS));
+ \$__alu_ripple #(.WIDTH(Y_WIDTH)) _TECHMAP_REPLACE_ (.A(A_buf), .B(BI ? ~B_buf : B_buf), .CI(CI), .X(X), .Y(Y), .CO(CO), .CS(CS));
`else
if (Y_WIDTH <= 4) begin
- \$__alu_ripple #(.WIDTH(Y_WIDTH)) _TECHMAP_REPLACE_ (.A(A_buf), .B(S ? ~B_buf : B_buf), .CI(CI), .Y(Y), .CO(CO), .CS(CS));
+ \$__alu_ripple #(.WIDTH(Y_WIDTH)) _TECHMAP_REPLACE_ (.A(A_buf), .B(BI ? ~B_buf : B_buf), .CI(CI), .X(X), .Y(Y), .CO(CO), .CS(CS));
end else begin
- \$__alu_lookahead #(.WIDTH(Y_WIDTH)) _TECHMAP_REPLACE_ (.A(A_buf), .B(S ? ~B_buf : B_buf), .CI(CI), .Y(Y), .CO(CO), .CS(CS));
+ \$__alu_lookahead #(.WIDTH(Y_WIDTH)) _TECHMAP_REPLACE_ (.A(A_buf), .B(BI ? ~B_buf : B_buf), .CI(CI), .X(X), .Y(Y), .CO(CO), .CS(CS));
end
`endif
endmodule
// ALU Cell Types: Compare, Add, Subtract
// --------------------------------------------------------
-`define ALU_COMMONS(_width, _ci, _s) """
+`define ALU_COMMONS(_width, _ci, _bi) """
parameter A_SIGNED = 0;
parameter B_SIGNED = 0;
parameter A_WIDTH = 1;
output [Y_WIDTH-1:0] Y;
wire alu_co, alu_cs;
- wire [WIDTH-1:0] alu_y;
+ wire [WIDTH-1:0] alu_x, alu_y;
\$__alu #(
.A_SIGNED(A_SIGNED),
.A(A),
.B(B),
.CI(_ci),
- .S(_s),
+ .BI(_bi),
+ .X(alu_x),
.Y(alu_y),
.CO(alu_co),
.CS(alu_cs)
wire cf, of, zf, sf;
assign cf = !alu_co;
assign of = alu_co ^ alu_cs;
- assign zf = ~|alu_y;
assign sf = alu_y[WIDTH-1];
"""
module \$le (A, B, Y);
wire [1023:0] _TECHMAP_DO_ = "RECURSION; opt_const -mux_undef -mux_bool -fine;;;";
`ALU_COMMONS(`MAX(A_WIDTH, B_WIDTH), 1, 1)
- assign Y = zf || (A_SIGNED && B_SIGNED ? of != sf : cf);
+ assign Y = &alu_x || (A_SIGNED && B_SIGNED ? of != sf : cf);
endmodule
module \$add (A, B, Y);