orion64
Newbie level 2
- Joined
- Jun 13, 2013
- Messages
- 2
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 16
I am trying to make register to increase or decrease in value when push buttons are pressed. It works in simulation but in the FPGA board it doesn't. Does any body know why? any suggestion?
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 module key_speed #(parameter speedDefault = 2, speedMax=4, speedMin=0) (reset, keyUp, keyDown, speed, reset_reg_eight); input reset, keyUp, keyDown; output reset_reg_eight; output reg [2:0] speed; always @(negedge keyUp or negedge keyDown or negedge reset) begin if (~reset) speed = speedDefault; else begin if (keyDown==0) begin if (speed!=speedMin) speed--; else speed = speed; end else if (keyUp==0) begin if (speed!=speedMax) speed++; else speed = speed; end end end assign reset_reg_eight = (keyUp&keyDown); endmodule