Altera_Forum
Honored Contributor
13 years agoState Machine - CASE\WHEN and glitches
Hi everyone, I'm a bit lost and I need your help.
In my design I'm using a state machine I coded in VHDL to control a small ALU for floating point operations. The state machine is divided in 2 parts. The register section, with a process(low_clk), that increments the current_instruction and some other registered values... and the combinatorial section, with a process(current_instruction), containing a long CASE\WHEN structure that drives, for every instruction counter, various output signals to control the rest of the logic, plus some IF\THEN constructs that allows me to loop some sections. Now... the code works like a charm at RTL level. When I simulate it at GATE level however things get extremely glitchy (not to mention when I program it with the rest of the design on my FPGA) For example... by moving up or down a "late" istruction (for example changing a WHEN 44 into a WHEN 45) alters the behavior of the whole code, adding glitches around istruction 0-10. I believe this may be related to the synthesis of the WHEN\CASE structure... for some reasons, the comparators triggers even when they shouldn't. I'm not asking to anyone patient enough to read my thread to debug my code... however, could he point out if I did I any major mistake in the machine design? Or maybe if I have to make some particular timequest costraints to make it work properly? (by now I didn't have the chance to learn that part of QII yet...) Thanks!!!