-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathFDRE.v
69 lines (61 loc) · 1.42 KB
/
FDRE.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
`ifdef verilator3
`else
`timescale 1 ps / 1 ps
`endif
//
// FDRE primitive for Xilinx FPGAs
// Compatible with Verilator tool (www.veripool.org)
// Copyright (c) 2019-2022 Frédéric REQUIN
// License : BSD
//
/* verilator coverage_off */
module FDRE
#(
parameter [0:0] IS_C_INVERTED = 1'b0,
parameter [0:0] IS_D_INVERTED = 1'b0,
parameter [0:0] IS_R_INVERTED = 1'b0,
parameter [0:0] INIT = 1'b0
)
(
// Clock
input wire C,
// Clock enable
input wire CE,
// Synchronous reset
input wire R,
// Data in
input wire D,
// Data out
output wire Q
);
reg _r_Q;
wire _w_D = D ^ IS_D_INVERTED;
wire _w_R = R ^ IS_R_INVERTED;
initial begin : INIT_STATE
_r_Q = INIT[0];
end
generate
if (IS_C_INVERTED) begin : GEN_CLK_NEG
always @(negedge C) begin
if (_w_R) begin
_r_Q <= 1'b0;
end
else if (CE) begin
_r_Q <= _w_D;
end
end
end
else begin : GEN_CLK_POS
always @(posedge C) begin
if (_w_R) begin
_r_Q <= 1'b0;
end
else if (CE) begin
_r_Q <= _w_D;
end
end
end
endgenerate
assign Q = _r_Q;
endmodule
/* verilator coverage_on */