Skip to content

Commit 748631d

Browse files
authored
Merge pull request #4 from georgerennie/patch-1
Add dffsr cell
2 parents d3c72fa + 754c4a0 commit 748631d

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/cells.v

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,26 @@ module dff_cell (
7171
assign notq = !q;
7272
always @(posedge clk)
7373
q <= d;
74-
74+
75+
endmodule
76+
77+
module dffsr_cell (
78+
input wire clk,
79+
input wire d,
80+
input wire s,
81+
input wire r,
82+
output reg q,
83+
output wire notq
84+
);
85+
86+
assign notq = !q;
87+
88+
always @(posedge clk or posedge s or posedge r) begin
89+
if (r)
90+
q <= '0;
91+
else if (s)
92+
q <= '1;
93+
else
94+
q <= d;
95+
end
7596
endmodule

0 commit comments

Comments
 (0)