forked from tanchou/Verilog
- Created tangnano20k.cst to define I/O locations for clock, button, and LEDs. - Implemented top.v module to instantiate the counter with clock and button inputs, and 4-bit count output.
15 lines
243 B
Verilog
15 lines
243 B
Verilog
module counter (
|
|
input wire clk,
|
|
input wire btn1,
|
|
output reg [3:0] count
|
|
);
|
|
|
|
always @(posedge clk)
|
|
begin
|
|
if(btn1)
|
|
count <= 4'b0000;
|
|
else
|
|
count <= count + 1;
|
|
end
|
|
|
|
endmodule |