aboutsummaryrefslogtreecommitdiffstats
path: root/manual/APPNOTE_011_Design_Investigation/example.v
blob: 8c71989b3653b58ff1772811c000428489a96578 (plain)
1
2
3
4
5
6
module example(input clk, a, b, c,
               output reg [1:0] y);
    always @(posedge clk)
        if (c)
            y <= c ? a + b : 2'd0;
endmodule
"k">if (rst) count <= 0; else count <= count + 1; end assign ping = &count; endmodule module counter2(clk, rst, ping); input clk, rst; output ping; reg [31:0] count; integer i; reg carry; always @(posedge clk) begin carry = 1; for (i = 0; i < 32; i = i+1) begin count[i] <= !rst & (count[i] ^ carry); carry = count[i] & carry; end end assign ping = &count; endmodule