TrickyDicky
Advanced Member level 7
- Joined
- Jun 7, 2010
- Messages
- 7,110
- Helped
- 2,081
- Reputation
- 4,181
- Reaction score
- 2,048
- Trophy points
- 1,393
- Activity points
- 39,769
I made it another go. It compiles, but complains about some signals not being in the sensitivity list. If I don't need the process to be re-evaluated, there is no real need to put every signal that is read inside the sensitivity list, right? I tried uploading it to my DE-2-nano, but it doesn't work. LED(1 DOWNTO 0) are supposed to show me which state it's in, but both leds seem to glow quite dimly so I guess it's switching states with the same frequency as CLOCK_50 (which I don't understand).
.
Yes you do. Synthesis ignores sensitivity lists, so missing some out will only lead to a difference in behaviour between your simulation and real hardware.
You are also using the 'last_value attribute. I have no idea how this got through synthesis, as 'last_valud has no meaning in hardware. You need to explicitly build a register to check the "last value". It appears to have assumed you intended that signal to be a clock, and it's somehow put some clocking logic in your unclocked process.
The difference between a clock and a 'event is that a clock should toggle from '0' to '1' back to '0' in a periodicy frequency. Hence it should create 'events with a fixed period. Using the sensitivity list may mean the process remains inactive for a long period of time. 'events are also created on ANY change in signal, and std_logic has 9 states in simulation ('U', 'X', '0', '1', 'Z'. 'W', 'L', 'H' and '-'). So changing from any of these to any other of these causes a 'event, which is not a clock edge.
'events were implemented for simulation purposes. It means a process can sit and do nothing for a period of time giving CPU resources to another process. Remember VHDL was first standardised in 1987 (and used from inception in the early 80s) when computer power was rather poor, and any free CPU cycles would be a blessing.