aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/pack_tests/ffmodes.v
blob: c09ced748835bc4d3213ec53e39b32dca90d1b31 (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
38
39
40
41
42
43
module top(input clk, cen, rst, ina, inb, output reg outa, outb, outc, outd);

reg temp0 = 1'b0, temp1 = 1'b0;
initial outa = 1'b0;
initial outb = 1'b0;
initial outc = 1'b0;
initial outd = 1'b0;

always @(posedge clk)
    if (cen)
        if(rst)
            temp0 <= 1'b0;
        else
            temp0 <= ina;

always @(negedge clk)
    if (ina)
        if(rst)
            temp1 <= 1'b1;
        else
            temp1 <= inb;


always @(posedge clk or posedge rst)
    if(rst)
        outa <= 1'b0;
    else
        outa <= temp0;

always @(posedge clk)
    outb <= temp1;

always @(negedge clk)
    outc <= temp0;

always @(negedge clk or posedge rst)
    if (rst)
        outd <= 1'b1;
    else
        outd <= temp1;


endmodule