Skip to content

Instantly share code, notes, and snippets.

@stylesuxx
Created February 4, 2016 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stylesuxx/dba7a64ba853aff43aa6 to your computer and use it in GitHub Desktop.
Save stylesuxx/dba7a64ba853aff43aa6 to your computer and use it in GitHub Desktop.
module top (input btn1, output led1, output led2, output led3);
reg [2:0] cnt;
initial begin
cnt = 3'b000;
end
always @(posedge btn1) begin
if(cnt == 0)cnt = 3'b001;
else cnt = cnt << 1;
{led3, led2, led1} = cnt;
end
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment