Skip to content

Instantly share code, notes, and snippets.

@mit41301
Last active September 10, 2026 13:21
Show Gist options
  • Select an option

  • Save mit41301/5b3864f9991fb1162d7151cc1ce23d78 to your computer and use it in GitHub Desktop.

Select an option

Save mit41301/5b3864f9991fb1162d7151cc1ce23d78 to your computer and use it in GitHub Desktop.
Verilog Example
module countpro(sys_clk,led);
input sys_clk;
output [3:0] led;
reg [25:0] count;
reg [2:0] led;
always @(posedge sys_clk)
begin
count <= count + 1;
if( count == 26'b11_1111_1111_1111_1111_1111_1110 )
begin
led <= ~led;
end
else
led <= led;
end
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment