I have a top module that implements a 14-bit counter.
I added an input button in the top module and to the 14-bit counter
In the counter I check to see if the button is pressed and if so reset the counter to 0.
I have also added the line
NET "button" LOC = K18;
to the .ucf file.
But the design will not implement. It complains that button is defined but not used and something about button_ibuf and button has no load...
does anyone have an idea what is wrong with my code?
here is the counter module
module counter_14bit(
input wire counter_clk_signal,
input wire switch, // enable / disable the counter
input wire button, // reset the counter to 0
output reg [13:0] counter=0 // 14 bit counter value (0-16383)
);
always@(posedge counter_clk_signal)
begin
if (switch == 0) begin
counter <= counter;
end
// max 14-bit unsigned value is 16383 but my board has only 4 sseg displays so
// limit counter to 9999 max
if (switch == 1) begin
if (button == 1) begin
counter <= 0; // reset counter to 0 if button 1 is pressed
end
if (counter == 9999) begin // reset counter to 0 if counter is 9999
counter <= 0;
end else begin
counter <= counter+1;
end
end
end
endmodule
counter_14bitthe top-level module, or where is it instantiated?