Commit 3848a6c9 authored by Denia Bouhired-Ferrag's avatar Denia Bouhired-Ferrag

Fixed bug, where state machine cannot recover from REJECT state if no new pulses arrive

parent c2306023
...@@ -93,6 +93,8 @@ entity conv_dyn_burst_ctrl is ...@@ -93,6 +93,8 @@ entity conv_dyn_burst_ctrl is
pulse_r_edge_p_i : in std_logic; pulse_r_edge_p_i : in std_logic;
pulse_f_edge_p_i : in std_logic; pulse_f_edge_p_i : in std_logic;
-- Temp_rise is output for external probing
temp_rise_o : out unsigned (39 downto 0) ;
-- Dynamic temperature-controlled ouput pulse train. -- Dynamic temperature-controlled ouput pulse train.
pulse_burst_o : out std_logic; pulse_burst_o : out std_logic;
...@@ -133,7 +135,7 @@ entity conv_dyn_burst_ctrl is ...@@ -133,7 +135,7 @@ entity conv_dyn_burst_ctrl is
-- Output from module depends on burst_ctrl_rst and en_i -- Output from module depends on burst_ctrl_rst and en_i
--------------------------------------------------------- ---------------------------------------------------------
pulse_burst_o <= '0' when burst_ctrl_rst = '1' else pulse_burst_i and en_i; pulse_burst_o <= '0' when burst_ctrl_rst = '1' else pulse_burst_i and en_i;
temp_rise_o <= temp_rise;
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- Finite State Machine FSM -- Finite State Machine FSM
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
...@@ -168,7 +170,7 @@ entity conv_dyn_burst_ctrl is ...@@ -168,7 +170,7 @@ entity conv_dyn_burst_ctrl is
when IDLE => when IDLE =>
if en_i = '1' and pulse_r_edge_p_i = '1' then if en_i = '1' and pulse_r_edge_p_i = '1' then
nxt_state <= PULSE_REPEAT; nxt_state <= PULSE_REPEAT;
else else
nxt_state <= IDLE; nxt_state <= IDLE;
end if; end if;
...@@ -191,7 +193,8 @@ entity conv_dyn_burst_ctrl is ...@@ -191,7 +193,8 @@ entity conv_dyn_burst_ctrl is
-- i.e. temp_rise >= g_max_temp. -- i.e. temp_rise >= g_max_temp.
------------------------------------------------------------------------ ------------------------------------------------------------------------
when PULSE_REJECT => when PULSE_REJECT =>
if pulse_f_edge_p_i = '1' and temp_rise <= g_max_temp then if (pulse_f_edge_p_i = '1' and temp_rise <= g_max_temp) OR
temp_rise = 0 then
nxt_state <= PULSE_REPEAT; nxt_state <= PULSE_REPEAT;
else else
nxt_state <= PULSE_REJECT; nxt_state <= PULSE_REJECT;
...@@ -265,10 +268,10 @@ entity conv_dyn_burst_ctrl is ...@@ -265,10 +268,10 @@ entity conv_dyn_burst_ctrl is
else else
-- Reset counters in the event of a new pulse only -- Reset counters in the event of a new pulse only
-- when pulse rejection is not active -- when pulse rejection is not active
if (pulse_r_edge_p_i = '1') and burst_ctrl_rst = '0' then if (pulse_r_edge_p_i = '1' and burst_ctrl_rst = '0') then --OR
--(pulse_f_edge_p_i = '1' and n_cycle_cnt /= 1) then
single_cycle_cnt <= 1; single_cycle_cnt <= 1;
n_cycle_cnt <= 1; n_cycle_cnt <= 1;
else else
--count clk cycles --count clk cycles
single_cycle_cnt <= single_cycle_cnt + 1; single_cycle_cnt <= single_cycle_cnt + 1;
...@@ -305,7 +308,11 @@ entity conv_dyn_burst_ctrl is ...@@ -305,7 +308,11 @@ entity conv_dyn_burst_ctrl is
end if; end if;
end if; end if;
elsif s_pulse_reject = '1' and temp_rise > 0 then elsif s_pulse_reject = '1' and temp_rise > 0 then
temp_rise <= temp_rise - to_unsigned(g_temp_decre_step(n_cycle_cnt-1), 40); if temp_rise >= g_temp_decre_step(n_cycle_cnt-1) then
temp_rise <= temp_rise - to_unsigned(g_temp_decre_step(n_cycle_cnt-1), 40);
else
temp_rise <= (others => '0');
end if;
end if; end if;
end if; end if;
end if; end if;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment