Altera_Forum
Honored Contributor
14 years agoUndefined behavior in my key detection
I am designing a shift key detector.I wrote a test bench. The test showed that my implementation was incorrect. See attachment for the screenshot of ModelSim simulation.
Beside the undefined behavior, why is there such a big gap between 3rd and 4th values? If you look at the test bench, the 3rd and 4th procedures are using the format used for the 1st and 2rd. As you can see. I have two states in my design. PS2 receiver will filter and generate clean 8-bit make code when a key is pressed (or released). The break code is simply F0 follow by the make code of the key just released. My state machine uses two extra bits to keep track of which shift key has been pressed. left_pressed and right_pressed are signals, not variables. So they should have the a value at any instance. If one of them changes, the connection to shift signal will be updated automatically. Can someone please help me? Thanks. Thanks.