I am looking to map the four basic operations (multiplication, addition, subtraction, and division) to one of four keys which are located on my FPGA board. I have an if-statement which would check to see which key is pressed and execute the appropriate statements. However, when writing the always block sensitivity list no matter what I place in the block it will not recognize all four keys. If I leave the sensitivity block empty then it will recognize all of the keys but will perform the operation of the first key and wait for the other keys to be pressed to perform those operations.
always @(negedge KEY) begin
if (KEY[0] == 0) begin
...
end else if(KEY[1] == 0) begin
//Check for value for A and B
if(SW[15:8] < SW[7:0]) begin
...
end
end else if(KEY[2] == 0) begin
...
end
end
Implementing the code like this will calculate only the operation which is connected to KEY1. The rest of the keys act as if they have not been programmed. Is there any way around this small annoyance?
Thanks!