aboutsummaryrefslogtreecommitdiffstats
path: root/techlibs
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2016-10-14 12:33:56 +0200
committerClifford Wolf <clifford@clifford.at>2016-10-14 12:33:56 +0200
commit53655d173b2928328061c8440cc993508e951e1f (patch)
tree87c12bdeb1a7cde96569efd1da18bee909b2f115 /techlibs
parentffbb4e992e5312d8feafcc1c6c850ea06c3e09b2 (diff)
downloadyosys-53655d173b2928328061c8440cc993508e951e1f.tar.gz
yosys-53655d173b2928328061c8440cc993508e951e1f.tar.bz2
yosys-53655d173b2928328061c8440cc993508e951e1f.zip
Added $global_clock verilog syntax support for creating $ff cells
Diffstat (limited to 'techlibs')
-rw-r--r--techlibs/common/simcells.v17
-rw-r--r--techlibs/common/simlib.v8
2 files changed, 23 insertions, 2 deletions
diff --git a/techlibs/common/simcells.v b/techlibs/common/simcells.v
index c4f170a3c..e770c5453 100644
--- a/techlibs/common/simcells.v
+++ b/techlibs/common/simcells.v
@@ -495,6 +495,23 @@ always @(posedge S, posedge R) begin
end
endmodule
+`ifdef SIMCELLS_FF
+// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
+//-
+//- $_FF_ (D, Q)
+//-
+//- A D-type flip-flop that is clocked from the implicit global clock. (This cell
+//- type is usually only used in netlists for formal verification.)
+//-
+module \$_FF_ (D, Q);
+input D;
+output reg Q;
+always @($global_clock) begin
+ Q <= D;
+end
+endmodule
+`endif
+
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
//-
//- $_DFF_N_ (D, C, Q)
diff --git a/techlibs/common/simlib.v b/techlibs/common/simlib.v
index db818269b..b10c858f2 100644
--- a/techlibs/common/simlib.v
+++ b/techlibs/common/simlib.v
@@ -1382,18 +1382,22 @@ endmodule
`endif
// --------------------------------------------------------
+`ifdef SIMLIB_FF
module \$ff (D, Q);
parameter WIDTH = 0;
input [WIDTH-1:0] D;
-output [WIDTH-1:0] Q;
+output reg [WIDTH-1:0] Q;
-assign D = Q;
+always @($global_clk) begin
+ Q <= D;
+end
endmodule
+`endif
// --------------------------------------------------------
module \$dff (CLK, D, Q);