aboutsummaryrefslogtreecommitdiffstats
path: root/tests/arch/ice40/dffs.v
blob: d97840c439411c0c63b3df766a1798b5fc9caad8 (plain)
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
module dff
    ( input d, clk, output reg q );
	always @( posedge clk )
            q <= d;
endmodule

module dffe
    ( input d, clk, en, output reg q );
    initial begin
      q = 0;
    end
	always @( posedge clk )
		if ( en )
			q <= d;
endmodule

module top (
input clk,
input en,
input a,
output b,b1,
);

dff u_dff (
        .clk (clk ),
        .d (a ),
        .q (b )
    );

dffe u_ndffe (
        .clk (clk ),
        .en (en),
        .d (a ),
        .q (b1 )
    );

endmodule