-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdff.v
More file actions
45 lines (40 loc) · 959 Bytes
/
dff.v
File metadata and controls
45 lines (40 loc) · 959 Bytes
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
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:41:34 09/19/2018
// Design Name:
// Module Name: dff
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module dff (
input i_clk,
input i_rst, // active LOW
input i_load,
input i_enable,
input i_zeroize, // makes the DFF output a 0, instead of i_D
input i_D,
output o_Q,
output o_direct
);
reg out = 0;
always @ (posedge i_clk or negedge i_rst) begin
if (~i_rst)
out <= 0;
else
if (i_load)
out <= i_D;
end
assign o_Q = (i_enable ? (i_zeroize ? 1'b0 : out) : (1'bZ));
assign o_direct = out;
endmodule