EVR STABLE: add generic to discard for hipa this statement EVR STABLE

This commit is contained in:
2020-09-14 16:30:33 +02:00
parent 3049e28ea7
commit a68b5e6bba
2 changed files with 27 additions and 20 deletions

View File

@ -24,8 +24,10 @@ use work.evr320_pkg.all;
entity evr320_decoder is
generic
(
FACILITY : string := "SFEL"; -- "HIPA" | "SFEL"
EVENT_RECORDER : boolean := false;
MEM_DATA_WIDTH : integer := 32
MEM_DATA_WIDTH : integer := 32;
EXP_REC_CLK_FREQ : natural := 142_800_000 -- in Hz
);
port
(
@ -73,6 +75,7 @@ architecture behavioral of evr320_decoder is
-----------------------------------------------------------------------------
-- Constant
-----------------------------------------------------------------------------
--
constant HIGH : std_logic := '1';
constant LOW : std_logic := '0';
constant LOW_slv : std_logic_vector(15 downto 0) := (others => '0');
@ -221,7 +224,9 @@ architecture behavioral of evr320_decoder is
-- attribute fsm_safe_state : string;
-- attribute fsm_safe_state of frame_fsm : signal is "default_state";
-- attribute fsm_safe_state of mem_fsm : signal is "default_state";
constant evr_stable_time_int_c : natural := EXP_REC_CLK_FREQ/100;
constant evr_stable_time_slv_c : std_logic_vector(cs_timeout_cnt'range):= std_logic_vector(to_unsigned(evr_stable_time_int_c, cs_timeout_cnt'length));
begin
-----------------------------------------------------------------------------
@ -290,6 +295,7 @@ begin
-----------------------------------------------------------------------------
-- evr stable state
-- TODO: Perform the sync according to k28.5
-----------------------------------------------------------------------------
prc_evr_stable : process(i_mgt_rx_clk)
begin
@ -297,10 +303,9 @@ begin
if (i_mgt_rst = '1') then
evr_stable <= '0';
else
if ((std_logic_vector(cs_min_cnt) > i_evr_params.cs_min_cnt) and
(std_logic_vector(cs_min_time) > i_evr_params.cs_min_time) and
--(std_logic_vector(cs_timeout_cnt) < X"15CA20")) then
(std_logic_vector(cs_timeout_cnt) < std_logic_vector(to_unsigned(506329,cs_timeout_cnt'length)))) then
if ((std_logic_vector(cs_min_cnt) > i_evr_params.cs_min_cnt) and
(std_logic_vector(cs_min_time) > i_evr_params.cs_min_time) and
(std_logic_vector(cs_timeout_cnt) < evr_stable_time_slv_c)) then -- make generics depending on recovery_clock
evr_stable <= '1';
else
evr_stable <= '0';
@ -319,13 +324,21 @@ begin
if (i_mgt_rst = '1') then
usr_events <= (others => (others => '0'));
else
for i in 0 to 3 loop
if ((i_evr_params.event_enable(i) = '1') and (i_mgt_rx_charisk( 0) = '0') and (i_mgt_rx_data( 7 downto 0) = i_evr_params.event_numbers(i)) and (evr_stable = '1')) then
for i in 0 to 3 loop
if FACILITY = "HIPA" then
if ((i_evr_params.event_enable(i) = '1') and (i_mgt_rx_charisk( 0) = '0') and (i_mgt_rx_data( 7 downto 0) = i_evr_params.event_numbers(i))) then
usr_events(i) <= "1111";
else
usr_events(i) <= usr_events(i)( 2 downto 0) & '0';
end if;
end loop;
else
if ((i_evr_params.event_enable(i) = '1') and (i_mgt_rx_charisk( 0) = '0') and (i_mgt_rx_data( 7 downto 0) = i_evr_params.event_numbers(i))and (evr_stable = '1')) then
usr_events(i) <= "1111";
else
usr_events(i) <= usr_events(i)( 2 downto 0) & '0';
end if;
end if;
end loop;
end if;
end if;
end process;

View File

@ -166,8 +166,10 @@ begin
-- --------------------------------------------------------------------------
evr320_decoder_inst : entity work.evr320_decoder
generic map(
EVENT_RECORDER => g_EVENT_RECORDER,
MEM_DATA_WIDTH => c_TOSCA2_DATA_WIDTH)
FACILITY => g_FACILITY,
EVENT_RECORDER => g_EVENT_RECORDER,
MEM_DATA_WIDTH => c_TOSCA2_DATA_WIDTH,
EXP_REC_CLK_FREQ => 50_632_820)
port map(
-- Debug interface
debug_clk => debug_clk,
@ -347,15 +349,7 @@ begin
signal usr_events_concat_s : std_logic_vector(4 downto 0);
begin
--*** double stage sync for reset ***--
--proc_rst : process(clk_evr)
--begin
-- if rising_edge(clk_evr) then
-- rst0_s <= xuser_RESET;
-- rst1_s <= rst0_s;
-- end if;
--end process;
evr_rst_s <= mgt_status(15); -- RXLOSSOFSYNC
usr_events_concat_s <= usr_events_s & sos_event_s;