Debian Codegraph @

examples/blinky-tbuf.v

raw
1 module top (
2 input clk,
3 input key_i,
4 output [`LEDS_NR-1:0] led
5 );
6
7 wire key = key_i ^ `INV_BTN;
8
9 reg [25:0] ctr_q;
10 wire [25:0] ctr_d;
11
12 // Sequential code (flip-flop)
13 always @(posedge clk) begin
14 ctr_q <= ctr_d;
15 end
16
17 // Combinational code (boolean logic)
18 assign ctr_d = ctr_q + 1'b1;
19 assign led[`LEDS_NR - 1:1] = ctr_q[25:25-(`LEDS_NR - 2)];
20
21 TBUF tbuf(
22 .I(ctr_q[25 - (`LEDS_NR - 1)]),
23 .O(led[0]),
24 .OEN(~key)
25 );
26
27 endmodule