Now that we have the blinking LED in Verilog up and running, we can do an advanced version of the same project; a binary counter using the LED's. Also this time I will be using the push button to increment the counter. So every time the push button is pressed the counter will be incremented by 1, the LED's will present the binary counter. The code for the program is shown below: module button_binary( input clock, input reset, input button, output led, output led2, output led3, output led4, output led5, output led6, output led7, output led8 ); reg [7:0]count; always @ (posedge button or posedge reset) begin if (reset) count <= 0; else if (button) count <= count + 1; end assign led = count[0]; assign led2 = count[1]; assign led3 = count[2]; assign led4 = count[3]; assign led5 = count[4]; assign led6 = count[5]; assign led7 = count[6]; assign led8 = count[7]; endmodule The above program is so simple it ne
Easy FPGA Code Using Verilog