summaryrefslogtreecommitdiff
path: root/techlibs/common/stdcells.v
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2013-12-27 14:20:15 +0100
committerClifford Wolf <clifford@clifford.at>2013-12-27 14:20:15 +0100
commit369bf81a7049c96f62af084bb5007fbf45e36ab4 (patch)
tree92071580c9bd60888ee5861d59457947a8adfde7 /techlibs/common/stdcells.v
parentecc30255ba70910777a4586f5bd6abc818073293 (diff)
Added support for non-const === and !== (for miter circuits)
Diffstat (limited to 'techlibs/common/stdcells.v')
-rw-r--r--techlibs/common/stdcells.v50
1 files changed, 50 insertions, 0 deletions
diff --git a/techlibs/common/stdcells.v b/techlibs/common/stdcells.v
index ef4b96f7..c7efa240 100644
--- a/techlibs/common/stdcells.v
+++ b/techlibs/common/stdcells.v
@@ -572,6 +572,56 @@ 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;
+
+parameter 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 && B_SIGNED), .A_WIDTH(A_WIDTH), .Y_WIDTH(WIDTH)) A_conv (.A(A), .Y(A_buf));
+\$pos #(.A_SIGNED(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;
+
+parameter 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 && B_SIGNED), .A_WIDTH(A_WIDTH), .Y_WIDTH(WIDTH)) A_conv (.A(A), .Y(A_buf));
+\$pos #(.A_SIGNED(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;