Im very new to fpgas, and overall this type of thing, and i seem to have run into a problem.
The idea is simple-just to connect a pushbutton, but i can't seem to work with it. This is how i connected it
and this is the code that i use
- Code: Select all
module button(clk,PB, LED1,LED2);
input clk;
input PB;
output LED1;
output LED2;
reg r1, r2;
always @(posedge clk) begin
r1 <= PB;
r2 <= r1;
end
assign LED1 = r2;
assign LED2 = ~r2;
endmodule
(found part or it somewhere in the forum)
One LED is always on, and nothing else happens whether i push the button or not.
What am i doing wrong?