Altera_Forum
Honored Contributor
10 years agoSecurely start a State-Machine with pulses or edges
Hi there,
this problem occures in my work from time to time: I want to start a State-Machine (Transition from Idle-State S000 to State S010) either with a single one-clock-pulse or on the edge (rising or falling) of a signal. But just when I think "Hey, this seems secure!", the state-machine misses the pulse or the edge. Is there some kind of attribute or something to mark an input or a signal of the component as really really really very important to the compiler? I currently work on a project which uses mainly a 125MHz-Clock. some tries here:(The following codes are inside the idle-state of a state-machine.) edge detection (with filter) on input start_in:
sig_Start_IN(0) <= Start_IN;
sig_Start_IN(1) <= sig_Start_IN(0);
sig_Start_IN(2) <= sig_Start_IN(1);
sig_Start_IN(3) <= sig_Start_IN(2);
if (sig_Start_IN = "0011") then
current_state <= S010;
elsif (sig_Start_IN = "1111") then
current_state <= current_state;
elsif (sig_Start_IN = "1100") then
current_state <= S000;
else
current_state <= current_state;
end if;
edge detection (without filter) on input start_in:
sig_Start_IN <= Start_IN;
if ((sig_Start_IN = '0') AND (Start_IN = '1')) then
current_state <= S010;
else
current_state <= S000;
end if;
start by a one-clock-pulse on start_in:
if (Start_IN = '1') then
current_state <= S010;
else
current_state <= S000;
end if;
Is there somewhere a better way defined to securely "see" the pulse ore edge? Why does the process sometimes skip a pulse or an edge?