Added DFFSR cell to techlibs/cmos/cmos_cells.lib
authorClifford Wolf <clifford@clifford.at>
Thu, 31 Oct 2013 11:27:35 +0000 (12:27 +0100)
committerClifford Wolf <clifford@clifford.at>
Thu, 31 Oct 2013 11:27:35 +0000 (12:27 +0100)
techlibs/cmos/cmos_cells.lib
techlibs/cmos/cmos_cells.v

index 1d7b8279cacd3997c048e6688e86f72748bd92ea..164256c0184bc271436f89aef8b6ab45f1650f1c 100644 (file)
@@ -29,4 +29,18 @@ library(demo) {
     pin(Q) { direction: output;
               function: "IQ"; }
   }
+  cell(DFFSR) {
+    area: 18;
+    ff(IQ, IQN) { clocked_on: C;
+                  next_state: D;
+                      preset: S;
+                       clear: R; }
+    pin(C) { direction: input;
+                 clock: true; }
+    pin(D) { direction: input; }
+    pin(Q) { direction: output;
+              function: "IQ"; }
+    pin(S) { direction: input; }
+    pin(R) { direction: input; }
+  }
 }
index 802f58718bd57f3e56ee57319a91a9be3e89b920..da75270cb4e54936cf657b9284161422213072fd 100644 (file)
@@ -21,3 +21,15 @@ always @(posedge C)
        Q <= D;
 endmodule
 
+module DFFSR(C, D, Q, S, R);
+input C, D, S, R;
+output reg Q;
+always @(posedge C, posedge S, posedge R)
+       if (S)
+               Q <= 1'b1;
+       else if (R)
+               Q <= 1'b0;
+       else
+               Q <= D;
+endmodule
+