aboutsummaryrefslogtreecommitdiffstats
path: root/techlibs/common/simlib.v
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-03-31 14:14:40 +0200
committerClifford Wolf <clifford@clifford.at>2014-03-31 14:14:40 +0200
commitd4a1b0af5b41d1360c74a73fb2ae92ee5f6c3bd0 (patch)
tree5a97ed0aa1a75d06f727e00bf37651eb6ee79d5c /techlibs/common/simlib.v
parenta3b9692a68e88bbe3e32e0dbbd30c5e20f3800b7 (diff)
downloadyosys-d4a1b0af5b41d1360c74a73fb2ae92ee5f6c3bd0.tar.gz
yosys-d4a1b0af5b41d1360c74a73fb2ae92ee5f6c3bd0.tar.bz2
yosys-d4a1b0af5b41d1360c74a73fb2ae92ee5f6c3bd0.zip
Added support for dlatchsr cells
Diffstat (limited to 'techlibs/common/simlib.v')
-rw-r--r--techlibs/common/simlib.v32
1 files changed, 32 insertions, 0 deletions
diff --git a/techlibs/common/simlib.v b/techlibs/common/simlib.v
index 4436abfe7..908314f84 100644
--- a/techlibs/common/simlib.v
+++ b/techlibs/common/simlib.v
@@ -1097,6 +1097,38 @@ endmodule
// --------------------------------------------------------
+module \$dlatchsr (EN, SET, CLR, D, Q);
+
+parameter WIDTH = 0;
+parameter EN_POLARITY = 1'b1;
+parameter SET_POLARITY = 1'b1;
+parameter CLR_POLARITY = 1'b1;
+
+input EN;
+input [WIDTH-1:0] SET, CLR, D;
+output reg [WIDTH-1:0] Q;
+
+wire pos_en = EN == EN_POLARITY;
+wire [WIDTH-1:0] pos_set = SET_POLARITY ? SET : ~SET;
+wire [WIDTH-1:0] pos_clr = CLR_POLARITY ? CLR : ~CLR;
+
+genvar i;
+generate
+ for (i = 0; i < WIDTH; i = i+1) begin:bit
+ always @*
+ if (pos_clr[i])
+ Q[i] <= 0;
+ else if (pos_set[i])
+ Q[i] <= 1;
+ else if (pos_en)
+ Q[i] <= D[i];
+ end
+endgenerate
+
+endmodule
+
+// --------------------------------------------------------
+
module \$fsm (CLK, ARST, CTRL_IN, CTRL_OUT);
parameter NAME = "";