// blinky.sv: divide the board clock with a free-running counter and // drive one LED from the counter's top bit. // Basys 3, 100 MHz clock, WIDTH = 27: the LED toggles every 2^26 cycles, // about every 0.67 s. // iCEBreaker, 12 MHz clock, WIDTH = 24: the LED toggles every 2^23 cycles, // about every 0.70 s. `timescale 1ns/1ps module blinky #( parameter int unsigned WIDTH = 27 ) ( input logic clk, output logic led ); // FPGA tools turn the declaration value into the power-up state of the // flip-flops, loaded with the bitstream, so this free-running counter // needs no reset. Verilator -Wall flags this because ASIC flows expect // a reset instead; its documentation lists declaration initializers as a // valid FPGA idiom, so the warning is switched off for this line only. /* verilator lint_off PROCASSINIT */ logic [WIDTH-1:0] count = '0; /* verilator lint_on PROCASSINIT */ always_ff @(posedge clk) begin count <= count + 1'b1; end assign led = count[WIDTH-1]; endmodule