shaiko
Advanced Member level 5
Code:
asynchronous_fsm : process
begin
if reset = '0' then
dsp_on <= '0' ;
general_register <= ( others => "00000001" ) ;
mask_register <= ( others => '0' ) ;
event_register <= ( others => '0' ) ;
fsm_state <= fsm_idle_state_0 ;
else
case state is
when idle_state =>
if event_detected = '1' then
event_register <= events ;
if unmasked_event_detected = '1' then
state <= on_state ;
dsp_on <= '1' ;
end if ;
end if ;
when on_state =>
if general_register_1 ( 0 ) = '0' then -- has been changed later
dsp_on <= '0' ;
state <= idle_state ;
end if ;
if address = mask_register then
mask_register <= data ;
elsif address = general_register_1_address then
general_register_1 <= data ;
elsif address = general_register_2_address then
general_register_2 <= data ;
end if ;
end case ;
end if ;
end process asynchronous_fsm ;
I synthesized the code above for an asynchronous FSM and encountered a problem.
When the "event" signal turned to '1' , the fsm would change from "idle_state" to "on_state" but immideatly switch back to "idle_state".
I changed this section of the code that handles the return to idle state condition from on_state:
Code:
if general_register_1 ( 0 ) = '0' then
dsp_on <= '0' ;
state <= idle_state ;
end if ;
to this :
Code:
if general_register_1 ( 0 ) = '0' then
dsp_on <= '0' ;
state <= idle_state ;
else
dsp_on <= '1' ;
end if ;
After this change everything worked fine.
Please help me understand why...
Last edited: