mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-14 04:48:46 +00:00
Reorganized stdcells.v (no actual code change, just moved and indented stuff)
This commit is contained in:
parent
6166c76831
commit
41555cde10
|
@ -33,28 +33,47 @@
|
||||||
`define MIN(_a, _b) ((_a) < (_b) ? (_a) : (_b))
|
`define MIN(_a, _b) ((_a) < (_b) ? (_a) : (_b))
|
||||||
`define MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b))
|
`define MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b))
|
||||||
|
|
||||||
|
|
||||||
|
// --------------------------------------------------------
|
||||||
|
// Use simplemap for trivial cell types
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
(* techmap_simplemap *)
|
||||||
module \$not ;
|
(* techmap_celltype = "$pos $bu0" *)
|
||||||
|
module simplemap_buffers;
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
(* techmap_simplemap *)
|
||||||
module \$pos ;
|
(* techmap_celltype = "$not $and $or $xor $xnor" *)
|
||||||
|
module simplemap_bool_ops;
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
(* techmap_simplemap *)
|
||||||
module \$bu0 ;
|
(* techmap_celltype = "$reduce_and $reduce_or $reduce_xor $reduce_xnor $reduce_bool" *)
|
||||||
|
module simplemap_reduce_ops;
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
(* techmap_simplemap *)
|
||||||
|
(* techmap_celltype = "$logic_not $logic_and $logic_or" *)
|
||||||
|
module simplemap_logic_ops;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
(* techmap_simplemap *)
|
||||||
|
(* techmap_celltype = "$slice $concat $mux" *)
|
||||||
|
module simplemap_various;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
(* techmap_simplemap *)
|
||||||
|
(* techmap_celltype = "$sr $dff $adff $dffsr $dlatch" *)
|
||||||
|
module simplemap_registers;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
|
||||||
|
// --------------------------------------------------------
|
||||||
|
// Trivial substitutions
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
|
||||||
module \$neg (A, Y);
|
module \$neg (A, Y);
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
parameter A_SIGNED = 0;
|
||||||
parameter A_WIDTH = 1;
|
parameter A_WIDTH = 1;
|
||||||
parameter Y_WIDTH = 1;
|
parameter Y_WIDTH = 1;
|
||||||
|
@ -73,68 +92,63 @@ output [Y_WIDTH-1:0] Y;
|
||||||
.B(A),
|
.B(A),
|
||||||
.Y(Y)
|
.Y(Y)
|
||||||
);
|
);
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
module \$ge (A, B, Y);
|
||||||
|
parameter A_SIGNED = 0;
|
||||||
|
parameter B_SIGNED = 0;
|
||||||
|
parameter A_WIDTH = 1;
|
||||||
|
parameter B_WIDTH = 1;
|
||||||
|
parameter Y_WIDTH = 1;
|
||||||
|
|
||||||
|
input [A_WIDTH-1:0] A;
|
||||||
|
input [B_WIDTH-1:0] B;
|
||||||
|
output [Y_WIDTH-1:0] Y;
|
||||||
|
|
||||||
|
\$le #(
|
||||||
|
.A_SIGNED(B_SIGNED),
|
||||||
|
.B_SIGNED(A_SIGNED),
|
||||||
|
.A_WIDTH(B_WIDTH),
|
||||||
|
.B_WIDTH(A_WIDTH),
|
||||||
|
.Y_WIDTH(Y_WIDTH)
|
||||||
|
) _TECHMAP_REPLACE_ (
|
||||||
|
.A(B),
|
||||||
|
.B(A),
|
||||||
|
.Y(Y)
|
||||||
|
);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module \$gt (A, B, Y);
|
||||||
|
parameter A_SIGNED = 0;
|
||||||
|
parameter B_SIGNED = 0;
|
||||||
|
parameter A_WIDTH = 1;
|
||||||
|
parameter B_WIDTH = 1;
|
||||||
|
parameter Y_WIDTH = 1;
|
||||||
|
|
||||||
|
input [A_WIDTH-1:0] A;
|
||||||
|
input [B_WIDTH-1:0] B;
|
||||||
|
output [Y_WIDTH-1:0] Y;
|
||||||
|
|
||||||
|
\$lt #(
|
||||||
|
.A_SIGNED(B_SIGNED),
|
||||||
|
.B_SIGNED(A_SIGNED),
|
||||||
|
.A_WIDTH(B_WIDTH),
|
||||||
|
.B_WIDTH(A_WIDTH),
|
||||||
|
.Y_WIDTH(Y_WIDTH)
|
||||||
|
) _TECHMAP_REPLACE_ (
|
||||||
|
.A(B),
|
||||||
|
.B(A),
|
||||||
|
.Y(Y)
|
||||||
|
);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
// Shift operators
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$and ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$or ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$xor ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$xnor ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$reduce_and ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$reduce_or ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$reduce_xor ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$reduce_xnor ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$reduce_bool ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
|
||||||
(* techmap_celltype = "$shr $shl $sshl $sshr" *)
|
(* techmap_celltype = "$shr $shl $sshl $sshr" *)
|
||||||
module shift_ops_shr_shl_sshl_sshr (A, B, Y);
|
module shift_ops_shr_shl_sshl_sshr (A, B, Y);
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
parameter A_SIGNED = 0;
|
||||||
parameter B_SIGNED = 0;
|
parameter B_SIGNED = 0;
|
||||||
parameter A_WIDTH = 1;
|
parameter A_WIDTH = 1;
|
||||||
|
@ -175,14 +189,10 @@ always @* begin
|
||||||
end
|
end
|
||||||
|
|
||||||
assign Y = buffer;
|
assign Y = buffer;
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_celltype = "$shift $shiftx" *)
|
(* techmap_celltype = "$shift $shiftx" *)
|
||||||
module shift_shiftx (A, B, Y);
|
module shift_shiftx (A, B, Y);
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
parameter A_SIGNED = 0;
|
||||||
parameter B_SIGNED = 0;
|
parameter B_SIGNED = 0;
|
||||||
parameter A_WIDTH = 1;
|
parameter A_WIDTH = 1;
|
||||||
|
@ -234,13 +244,14 @@ always @* begin
|
||||||
end
|
end
|
||||||
|
|
||||||
assign Y = buffer;
|
assign Y = buffer;
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
|
||||||
|
// --------------------------------------------------------
|
||||||
|
// ALU Infrastructure
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
|
||||||
module \$__fulladd (A, B, C, X, Y);
|
module \$__fulladd (A, B, C, X, Y);
|
||||||
|
|
||||||
// {X, Y} = A + B + C
|
// {X, Y} = A + B + C
|
||||||
input A, B, C;
|
input A, B, C;
|
||||||
output X, Y;
|
output X, Y;
|
||||||
|
@ -253,14 +264,9 @@ wire t1, t2, t3;
|
||||||
\$_AND_ gate3 ( .A(t2), .B(C), .Y(t3) );
|
\$_AND_ gate3 ( .A(t2), .B(C), .Y(t3) );
|
||||||
\$_XOR_ gate4 ( .A(t2), .B(C), .Y(Y) );
|
\$_XOR_ gate4 ( .A(t2), .B(C), .Y(Y) );
|
||||||
\$_OR_ gate5 ( .A(t1), .B(t3), .Y(X) );
|
\$_OR_ gate5 ( .A(t1), .B(t3), .Y(X) );
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
module \$__alu (A, B, Cin, Y, Cout, Csign);
|
module \$__alu (A, B, Cin, Y, Cout, Csign);
|
||||||
|
|
||||||
parameter WIDTH = 1;
|
parameter WIDTH = 1;
|
||||||
|
|
||||||
input [WIDTH-1:0] A, B;
|
input [WIDTH-1:0] A, B;
|
||||||
|
@ -286,13 +292,14 @@ generate
|
||||||
);
|
);
|
||||||
end
|
end
|
||||||
endgenerate
|
endgenerate
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
|
||||||
|
// --------------------------------------------------------
|
||||||
|
// Compare cells
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
|
||||||
module \$lt (A, B, Y);
|
module \$lt (A, B, Y);
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
parameter A_SIGNED = 0;
|
||||||
parameter B_SIGNED = 0;
|
parameter B_SIGNED = 0;
|
||||||
parameter A_WIDTH = 1;
|
parameter A_WIDTH = 1;
|
||||||
|
@ -335,13 +342,9 @@ generate
|
||||||
assign Y = cf;
|
assign Y = cf;
|
||||||
end
|
end
|
||||||
endgenerate
|
endgenerate
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
module \$le (A, B, Y);
|
module \$le (A, B, Y);
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
parameter A_SIGNED = 0;
|
||||||
parameter B_SIGNED = 0;
|
parameter B_SIGNED = 0;
|
||||||
parameter A_WIDTH = 1;
|
parameter A_WIDTH = 1;
|
||||||
|
@ -384,169 +387,14 @@ generate
|
||||||
assign Y = zf || cf;
|
assign Y = zf || cf;
|
||||||
end
|
end
|
||||||
endgenerate
|
endgenerate
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
// Add and Subtract
|
||||||
module \$eq (A, B, Y);
|
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
|
||||||
parameter B_SIGNED = 0;
|
|
||||||
parameter A_WIDTH = 1;
|
|
||||||
parameter B_WIDTH = 1;
|
|
||||||
parameter Y_WIDTH = 1;
|
|
||||||
|
|
||||||
localparam WIDTH = A_WIDTH > B_WIDTH ? A_WIDTH : B_WIDTH;
|
|
||||||
|
|
||||||
input [A_WIDTH-1:0] A;
|
|
||||||
input [B_WIDTH-1:0] B;
|
|
||||||
output [Y_WIDTH-1:0] Y;
|
|
||||||
|
|
||||||
wire carry, carry_sign;
|
|
||||||
wire [WIDTH-1:0] A_buf, B_buf;
|
|
||||||
\$bu0 #(.A_SIGNED(A_SIGNED), .A_WIDTH(A_WIDTH), .Y_WIDTH(WIDTH)) A_conv (.A(A), .Y(A_buf));
|
|
||||||
\$bu0 #(.A_SIGNED(B_SIGNED), .A_WIDTH(B_WIDTH), .Y_WIDTH(WIDTH)) B_conv (.A(B), .Y(B_buf));
|
|
||||||
|
|
||||||
assign Y = ~|(A_buf ^ B_buf);
|
|
||||||
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
module \$ne (A, B, Y);
|
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
|
||||||
parameter B_SIGNED = 0;
|
|
||||||
parameter A_WIDTH = 1;
|
|
||||||
parameter B_WIDTH = 1;
|
|
||||||
parameter Y_WIDTH = 1;
|
|
||||||
|
|
||||||
localparam WIDTH = A_WIDTH > B_WIDTH ? A_WIDTH : B_WIDTH;
|
|
||||||
|
|
||||||
input [A_WIDTH-1:0] A;
|
|
||||||
input [B_WIDTH-1:0] B;
|
|
||||||
output [Y_WIDTH-1:0] Y;
|
|
||||||
|
|
||||||
wire carry, carry_sign;
|
|
||||||
wire [WIDTH-1:0] A_buf, B_buf;
|
|
||||||
\$bu0 #(.A_SIGNED(A_SIGNED), .A_WIDTH(A_WIDTH), .Y_WIDTH(WIDTH)) A_conv (.A(A), .Y(A_buf));
|
|
||||||
\$bu0 #(.A_SIGNED(B_SIGNED), .A_WIDTH(B_WIDTH), .Y_WIDTH(WIDTH)) B_conv (.A(B), .Y(B_buf));
|
|
||||||
|
|
||||||
assign Y = |(A_buf ^ B_buf);
|
|
||||||
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
module \$eqx (A, B, Y);
|
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
|
||||||
parameter B_SIGNED = 0;
|
|
||||||
parameter A_WIDTH = 1;
|
|
||||||
parameter B_WIDTH = 1;
|
|
||||||
parameter Y_WIDTH = 1;
|
|
||||||
|
|
||||||
localparam WIDTH = A_WIDTH > B_WIDTH ? A_WIDTH : B_WIDTH;
|
|
||||||
|
|
||||||
input [A_WIDTH-1:0] A;
|
|
||||||
input [B_WIDTH-1:0] B;
|
|
||||||
output [Y_WIDTH-1:0] Y;
|
|
||||||
|
|
||||||
wire carry, carry_sign;
|
|
||||||
wire [WIDTH-1:0] A_buf, B_buf;
|
|
||||||
\$pos #(.A_SIGNED(A_SIGNED), .A_WIDTH(A_WIDTH), .Y_WIDTH(WIDTH)) A_conv (.A(A), .Y(A_buf));
|
|
||||||
\$pos #(.A_SIGNED(B_SIGNED), .A_WIDTH(B_WIDTH), .Y_WIDTH(WIDTH)) B_conv (.A(B), .Y(B_buf));
|
|
||||||
|
|
||||||
assign Y = ~|(A_buf ^ B_buf);
|
|
||||||
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
module \$nex (A, B, Y);
|
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
|
||||||
parameter B_SIGNED = 0;
|
|
||||||
parameter A_WIDTH = 1;
|
|
||||||
parameter B_WIDTH = 1;
|
|
||||||
parameter Y_WIDTH = 1;
|
|
||||||
|
|
||||||
localparam WIDTH = A_WIDTH > B_WIDTH ? A_WIDTH : B_WIDTH;
|
|
||||||
|
|
||||||
input [A_WIDTH-1:0] A;
|
|
||||||
input [B_WIDTH-1:0] B;
|
|
||||||
output [Y_WIDTH-1:0] Y;
|
|
||||||
|
|
||||||
wire carry, carry_sign;
|
|
||||||
wire [WIDTH-1:0] A_buf, B_buf;
|
|
||||||
\$pos #(.A_SIGNED(A_SIGNED), .A_WIDTH(A_WIDTH), .Y_WIDTH(WIDTH)) A_conv (.A(A), .Y(A_buf));
|
|
||||||
\$pos #(.A_SIGNED(B_SIGNED), .A_WIDTH(B_WIDTH), .Y_WIDTH(WIDTH)) B_conv (.A(B), .Y(B_buf));
|
|
||||||
|
|
||||||
assign Y = |(A_buf ^ B_buf);
|
|
||||||
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
module \$ge (A, B, Y);
|
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
|
||||||
parameter B_SIGNED = 0;
|
|
||||||
parameter A_WIDTH = 1;
|
|
||||||
parameter B_WIDTH = 1;
|
|
||||||
parameter Y_WIDTH = 1;
|
|
||||||
|
|
||||||
input [A_WIDTH-1:0] A;
|
|
||||||
input [B_WIDTH-1:0] B;
|
|
||||||
output [Y_WIDTH-1:0] Y;
|
|
||||||
|
|
||||||
\$le #(
|
|
||||||
.A_SIGNED(B_SIGNED),
|
|
||||||
.B_SIGNED(A_SIGNED),
|
|
||||||
.A_WIDTH(B_WIDTH),
|
|
||||||
.B_WIDTH(A_WIDTH),
|
|
||||||
.Y_WIDTH(Y_WIDTH)
|
|
||||||
) ge_via_le (
|
|
||||||
.A(B),
|
|
||||||
.B(A),
|
|
||||||
.Y(Y)
|
|
||||||
);
|
|
||||||
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
module \$gt (A, B, Y);
|
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
|
||||||
parameter B_SIGNED = 0;
|
|
||||||
parameter A_WIDTH = 1;
|
|
||||||
parameter B_WIDTH = 1;
|
|
||||||
parameter Y_WIDTH = 1;
|
|
||||||
|
|
||||||
input [A_WIDTH-1:0] A;
|
|
||||||
input [B_WIDTH-1:0] B;
|
|
||||||
output [Y_WIDTH-1:0] Y;
|
|
||||||
|
|
||||||
\$lt #(
|
|
||||||
.A_SIGNED(B_SIGNED),
|
|
||||||
.B_SIGNED(A_SIGNED),
|
|
||||||
.A_WIDTH(B_WIDTH),
|
|
||||||
.B_WIDTH(A_WIDTH),
|
|
||||||
.Y_WIDTH(Y_WIDTH)
|
|
||||||
) gt_via_lt (
|
|
||||||
.A(B),
|
|
||||||
.B(A),
|
|
||||||
.Y(Y)
|
|
||||||
);
|
|
||||||
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
|
||||||
module \$add (A, B, Y);
|
module \$add (A, B, Y);
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
parameter A_SIGNED = 0;
|
||||||
parameter B_SIGNED = 0;
|
parameter B_SIGNED = 0;
|
||||||
parameter A_WIDTH = 1;
|
parameter A_WIDTH = 1;
|
||||||
|
@ -569,13 +417,9 @@ wire [Y_WIDTH-1:0] A_buf, B_buf;
|
||||||
.Cin(1'b0),
|
.Cin(1'b0),
|
||||||
.Y(Y)
|
.Y(Y)
|
||||||
);
|
);
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
module \$sub (A, B, Y);
|
module \$sub (A, B, Y);
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
parameter A_SIGNED = 0;
|
||||||
parameter B_SIGNED = 0;
|
parameter B_SIGNED = 0;
|
||||||
parameter A_WIDTH = 1;
|
parameter A_WIDTH = 1;
|
||||||
|
@ -598,13 +442,14 @@ wire [Y_WIDTH-1:0] A_buf, B_buf;
|
||||||
.Cin(1'b1),
|
.Cin(1'b1),
|
||||||
.Y(Y)
|
.Y(Y)
|
||||||
);
|
);
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
|
||||||
|
// --------------------------------------------------------
|
||||||
|
// Multiply
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
|
||||||
module \$__arraymul (A, B, Y);
|
module \$__arraymul (A, B, Y);
|
||||||
|
|
||||||
parameter WIDTH = 8;
|
parameter WIDTH = 8;
|
||||||
input [WIDTH-1:0] A, B;
|
input [WIDTH-1:0] A, B;
|
||||||
output [WIDTH-1:0] Y;
|
output [WIDTH-1:0] Y;
|
||||||
|
@ -618,13 +463,9 @@ generate for (i = 1; i < WIDTH; i = i+1) begin:gen
|
||||||
end endgenerate
|
end endgenerate
|
||||||
|
|
||||||
assign Y = partials[WIDTH*WIDTH-1 : WIDTH*(WIDTH-1)];
|
assign Y = partials[WIDTH*WIDTH-1 : WIDTH*(WIDTH-1)];
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
module \$mul (A, B, Y);
|
module \$mul (A, B, Y);
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
parameter A_SIGNED = 0;
|
||||||
parameter B_SIGNED = 0;
|
parameter B_SIGNED = 0;
|
||||||
parameter A_WIDTH = 1;
|
parameter A_WIDTH = 1;
|
||||||
|
@ -646,13 +487,14 @@ wire [Y_WIDTH-1:0] A_buf, B_buf;
|
||||||
.B(B_buf),
|
.B(B_buf),
|
||||||
.Y(Y)
|
.Y(Y)
|
||||||
);
|
);
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
|
||||||
|
// --------------------------------------------------------
|
||||||
|
// Divide and Modulo
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
|
||||||
module \$__div_mod_u (A, B, Y, R);
|
module \$__div_mod_u (A, B, Y, R);
|
||||||
|
|
||||||
parameter WIDTH = 1;
|
parameter WIDTH = 1;
|
||||||
|
|
||||||
input [WIDTH-1:0] A, B;
|
input [WIDTH-1:0] A, B;
|
||||||
|
@ -676,13 +518,9 @@ generate begin
|
||||||
assign chaindata[(i+1)*WIDTH-1:i*WIDTH] = Y[WIDTH-(i+1)] ? stage_in - {B, {WIDTH-(i+1){1'b0}}} : stage_in;
|
assign chaindata[(i+1)*WIDTH-1:i*WIDTH] = Y[WIDTH-(i+1)] ? stage_in - {B, {WIDTH-(i+1){1'b0}}} : stage_in;
|
||||||
end
|
end
|
||||||
end endgenerate
|
end endgenerate
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
module \$__div_mod (A, B, Y, R);
|
module \$__div_mod (A, B, Y, R);
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
parameter A_SIGNED = 0;
|
||||||
parameter B_SIGNED = 0;
|
parameter B_SIGNED = 0;
|
||||||
parameter A_WIDTH = 1;
|
parameter A_WIDTH = 1;
|
||||||
|
@ -716,13 +554,9 @@ assign B_buf_u = B_SIGNED && B_buf[WIDTH-1] ? -B_buf : B_buf;
|
||||||
|
|
||||||
assign Y = A_SIGNED && B_SIGNED && (A_buf[WIDTH-1] != B_buf[WIDTH-1]) ? -Y_u : Y_u;
|
assign Y = A_SIGNED && B_SIGNED && (A_buf[WIDTH-1] != B_buf[WIDTH-1]) ? -Y_u : Y_u;
|
||||||
assign R = A_SIGNED && B_SIGNED && A_buf[WIDTH-1] ? -R_u : R_u;
|
assign R = A_SIGNED && B_SIGNED && A_buf[WIDTH-1] ? -R_u : R_u;
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
module \$div (A, B, Y);
|
module \$div (A, B, Y);
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
parameter A_SIGNED = 0;
|
||||||
parameter B_SIGNED = 0;
|
parameter B_SIGNED = 0;
|
||||||
parameter A_WIDTH = 1;
|
parameter A_WIDTH = 1;
|
||||||
|
@ -744,13 +578,9 @@ output [Y_WIDTH-1:0] Y;
|
||||||
.B(B),
|
.B(B),
|
||||||
.Y(Y)
|
.Y(Y)
|
||||||
);
|
);
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
module \$mod (A, B, Y);
|
module \$mod (A, B, Y);
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
parameter A_SIGNED = 0;
|
||||||
parameter B_SIGNED = 0;
|
parameter B_SIGNED = 0;
|
||||||
parameter A_WIDTH = 1;
|
parameter A_WIDTH = 1;
|
||||||
|
@ -772,14 +602,14 @@ output [Y_WIDTH-1:0] Y;
|
||||||
.B(B),
|
.B(B),
|
||||||
.R(Y)
|
.R(Y)
|
||||||
);
|
);
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
/****
|
|
||||||
|
// --------------------------------------------------------
|
||||||
|
// Power
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
|
||||||
module \$pow (A, B, Y);
|
module \$pow (A, B, Y);
|
||||||
|
|
||||||
parameter A_SIGNED = 0;
|
parameter A_SIGNED = 0;
|
||||||
parameter B_SIGNED = 0;
|
parameter B_SIGNED = 0;
|
||||||
parameter A_WIDTH = 1;
|
parameter A_WIDTH = 1;
|
||||||
|
@ -790,54 +620,104 @@ input [A_WIDTH-1:0] A;
|
||||||
input [B_WIDTH-1:0] B;
|
input [B_WIDTH-1:0] B;
|
||||||
output [Y_WIDTH-1:0] Y;
|
output [Y_WIDTH-1:0] Y;
|
||||||
|
|
||||||
wire signed [A_WIDTH:0] buffer_a = A_SIGNED ? $signed(A) : A;
|
wire _TECHMAP_FAIL_ = 1;
|
||||||
wire signed [B_WIDTH:0] buffer_b = B_SIGNED ? $signed(B) : B;
|
|
||||||
|
|
||||||
assign Y = buffer_a ** buffer_b;
|
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
****/
|
// Equal and Not-Equal
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$logic_not ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
module \$eq (A, B, Y);
|
||||||
module \$logic_and ;
|
parameter A_SIGNED = 0;
|
||||||
|
parameter B_SIGNED = 0;
|
||||||
|
parameter A_WIDTH = 1;
|
||||||
|
parameter B_WIDTH = 1;
|
||||||
|
parameter Y_WIDTH = 1;
|
||||||
|
|
||||||
|
localparam WIDTH = A_WIDTH > B_WIDTH ? A_WIDTH : B_WIDTH;
|
||||||
|
|
||||||
|
input [A_WIDTH-1:0] A;
|
||||||
|
input [B_WIDTH-1:0] B;
|
||||||
|
output [Y_WIDTH-1:0] Y;
|
||||||
|
|
||||||
|
wire carry, carry_sign;
|
||||||
|
wire [WIDTH-1:0] A_buf, B_buf;
|
||||||
|
\$bu0 #(.A_SIGNED(A_SIGNED), .A_WIDTH(A_WIDTH), .Y_WIDTH(WIDTH)) A_conv (.A(A), .Y(A_buf));
|
||||||
|
\$bu0 #(.A_SIGNED(B_SIGNED), .A_WIDTH(B_WIDTH), .Y_WIDTH(WIDTH)) B_conv (.A(B), .Y(B_buf));
|
||||||
|
|
||||||
|
assign Y = ~|(A_buf ^ B_buf);
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
module \$ne (A, B, Y);
|
||||||
|
parameter A_SIGNED = 0;
|
||||||
|
parameter B_SIGNED = 0;
|
||||||
|
parameter A_WIDTH = 1;
|
||||||
|
parameter B_WIDTH = 1;
|
||||||
|
parameter Y_WIDTH = 1;
|
||||||
|
|
||||||
|
localparam WIDTH = A_WIDTH > B_WIDTH ? A_WIDTH : B_WIDTH;
|
||||||
|
|
||||||
|
input [A_WIDTH-1:0] A;
|
||||||
|
input [B_WIDTH-1:0] B;
|
||||||
|
output [Y_WIDTH-1:0] Y;
|
||||||
|
|
||||||
|
wire carry, carry_sign;
|
||||||
|
wire [WIDTH-1:0] A_buf, B_buf;
|
||||||
|
\$bu0 #(.A_SIGNED(A_SIGNED), .A_WIDTH(A_WIDTH), .Y_WIDTH(WIDTH)) A_conv (.A(A), .Y(A_buf));
|
||||||
|
\$bu0 #(.A_SIGNED(B_SIGNED), .A_WIDTH(B_WIDTH), .Y_WIDTH(WIDTH)) B_conv (.A(B), .Y(B_buf));
|
||||||
|
|
||||||
|
assign Y = |(A_buf ^ B_buf);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module \$eqx (A, B, Y);
|
||||||
|
parameter A_SIGNED = 0;
|
||||||
|
parameter B_SIGNED = 0;
|
||||||
|
parameter A_WIDTH = 1;
|
||||||
|
parameter B_WIDTH = 1;
|
||||||
|
parameter Y_WIDTH = 1;
|
||||||
|
|
||||||
|
localparam WIDTH = A_WIDTH > B_WIDTH ? A_WIDTH : B_WIDTH;
|
||||||
|
|
||||||
|
input [A_WIDTH-1:0] A;
|
||||||
|
input [B_WIDTH-1:0] B;
|
||||||
|
output [Y_WIDTH-1:0] Y;
|
||||||
|
|
||||||
|
wire carry, carry_sign;
|
||||||
|
wire [WIDTH-1:0] A_buf, B_buf;
|
||||||
|
\$pos #(.A_SIGNED(A_SIGNED), .A_WIDTH(A_WIDTH), .Y_WIDTH(WIDTH)) A_conv (.A(A), .Y(A_buf));
|
||||||
|
\$pos #(.A_SIGNED(B_SIGNED), .A_WIDTH(B_WIDTH), .Y_WIDTH(WIDTH)) B_conv (.A(B), .Y(B_buf));
|
||||||
|
|
||||||
|
assign Y = ~|(A_buf ^ B_buf);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module \$nex (A, B, Y);
|
||||||
|
parameter A_SIGNED = 0;
|
||||||
|
parameter B_SIGNED = 0;
|
||||||
|
parameter A_WIDTH = 1;
|
||||||
|
parameter B_WIDTH = 1;
|
||||||
|
parameter Y_WIDTH = 1;
|
||||||
|
|
||||||
|
localparam WIDTH = A_WIDTH > B_WIDTH ? A_WIDTH : B_WIDTH;
|
||||||
|
|
||||||
|
input [A_WIDTH-1:0] A;
|
||||||
|
input [B_WIDTH-1:0] B;
|
||||||
|
output [Y_WIDTH-1:0] Y;
|
||||||
|
|
||||||
|
wire carry, carry_sign;
|
||||||
|
wire [WIDTH-1:0] A_buf, B_buf;
|
||||||
|
\$pos #(.A_SIGNED(A_SIGNED), .A_WIDTH(A_WIDTH), .Y_WIDTH(WIDTH)) A_conv (.A(A), .Y(A_buf));
|
||||||
|
\$pos #(.A_SIGNED(B_SIGNED), .A_WIDTH(B_WIDTH), .Y_WIDTH(WIDTH)) B_conv (.A(B), .Y(B_buf));
|
||||||
|
|
||||||
|
assign Y = |(A_buf ^ B_buf);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
// Parallel Multiplexers
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$logic_or ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$slice ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$concat ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$mux ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
|
||||||
module \$pmux (A, B, S, Y);
|
module \$pmux (A, B, S, Y);
|
||||||
|
|
||||||
parameter WIDTH = 1;
|
parameter WIDTH = 1;
|
||||||
parameter S_WIDTH = 1;
|
parameter S_WIDTH = 1;
|
||||||
|
|
||||||
|
@ -864,13 +744,9 @@ generate
|
||||||
endgenerate
|
endgenerate
|
||||||
|
|
||||||
assign Y = |S ? Y_B : A;
|
assign Y = |S ? Y_B : A;
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
module \$safe_pmux (A, B, S, Y);
|
module \$safe_pmux (A, B, S, Y);
|
||||||
|
|
||||||
parameter WIDTH = 1;
|
parameter WIDTH = 1;
|
||||||
parameter S_WIDTH = 1;
|
parameter S_WIDTH = 1;
|
||||||
|
|
||||||
|
@ -905,38 +781,5 @@ endgenerate
|
||||||
.S(S & {S_WIDTH{~|status_found_second}}),
|
.S(S & {S_WIDTH{~|status_found_second}}),
|
||||||
.Y(Y)
|
.Y(Y)
|
||||||
);
|
);
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$sr ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$dff ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$adff ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$dffsr ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
(* techmap_simplemap *)
|
|
||||||
module \$dlatch ;
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue