Merge branch 'latfix'
This commit is contained in:
@ -327,8 +327,8 @@ begin
|
||||
end if;
|
||||
end case;
|
||||
end if;
|
||||
|
||||
evr_latency_measure_stat.counter_val <= std_logic_vector(counter);
|
||||
evr_latency_measure_stat.event_detected <= event_detected_sync(event_detected_sync'left);
|
||||
end process;
|
||||
|
||||
end block;
|
||||
|
@ -60,6 +60,7 @@ package evr320_pkg is
|
||||
|
||||
type typ_rec_latency_measure_stat is record
|
||||
counter_val : std_logic_vector(31 downto 0);
|
||||
event_detected : std_logic;
|
||||
end record;
|
||||
|
||||
--*** Type record and constant for new feature pulse width & delay ***
|
||||
@ -82,7 +83,8 @@ package evr320_pkg is
|
||||
|
||||
constant c_INIT_REC_LATENCY_MEASURE_CTRL : typ_rec_latency_measure_ctrl := (event_nr => (others =>'0'),
|
||||
counter_arm => '1');
|
||||
constant c_INIT_REC_LATENCY_MEASURE_STAT : typ_rec_latency_measure_stat := (counter_val => (others =>'0'));
|
||||
constant c_INIT_REC_LATENCY_MEASURE_STAT : typ_rec_latency_measure_stat := (counter_val => (others =>'0'),
|
||||
event_detected => '0');
|
||||
-- --------------------------------------------------------------------------
|
||||
-- Function Prototypes
|
||||
-- --------------------------------------------------------------------------
|
||||
|
@ -39,7 +39,7 @@ entity evr320_tmem is
|
||||
evr_evt_rec_control_o : out typ_evt_rec_ctrl;
|
||||
evr_latency_measure_stat_i : in typ_rec_latency_measure_stat;
|
||||
evr_latency_measure_ctrl_o : out typ_rec_latency_measure_ctrl;
|
||||
mgt_status_i : in std_logic_vector(31 downto 0);
|
||||
mgt_status_i : in std_logic_vector(31 downto 0) := (others=>'0');
|
||||
mgt_reset_o : out std_logic;
|
||||
mem_clk_o : out std_logic;
|
||||
mem_addr_o : out std_logic_vector(10 downto 0);
|
||||
@ -105,6 +105,9 @@ architecture rtl of evr320_tmem is
|
||||
signal lat_counter_arm : std_logic := '0';
|
||||
signal lat_event_nr : std_logic_vector(7 downto 0) := x"26"; -- default SOS event
|
||||
signal lat_counter_val : std_logic_vector(31 downto 0) := (others=>'0');
|
||||
signal lat_event_detected : std_logic_vector(7 downto 0);
|
||||
signal lat_arm : std_logic := '0';
|
||||
signal lat_arm_edge : std_logic_vector(1 downto 0) := (others=>'0');
|
||||
|
||||
-- signal evr_force : std_logic_vector(3 downto 0) := (others => '0');
|
||||
-- signal evr_force_rd : std_logic_vector(3 downto 0) := (others => '0'); -- readback
|
||||
@ -129,6 +132,23 @@ begin
|
||||
er_handshake_status <= X"0000" & bit2byte(er_status.data_error) & bit2byte(er_status.data_valid);
|
||||
er_control_concat <= X"0000" & er_event_number & bit2byte(er_event_enable);
|
||||
lat_counter_val <= evr_latency_measure_stat_i.counter_val;
|
||||
|
||||
process (xuser_CLK)
|
||||
begin
|
||||
if rising_edge(xuser_CLK) then
|
||||
-- edge detection of latency arm:
|
||||
lat_arm_edge <= lat_arm_edge(0) & lat_arm;
|
||||
lat_counter_arm <= lat_arm_edge(0) and not lat_arm_edge(1);
|
||||
|
||||
|
||||
if (evr_latency_measure_stat_i.event_detected = '1') then
|
||||
lat_event_detected <= (others=>'1');
|
||||
end if;
|
||||
if (lat_counter_arm = '1') then
|
||||
lat_event_detected <= (others=>'0');
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- --------------------------------------------------------------------------
|
||||
-- Synchronisation to xuser_CLK
|
||||
@ -157,10 +177,12 @@ begin
|
||||
-- --------------------------------------------------------------------------
|
||||
-- Read operation
|
||||
-- --------------------------------------------------------------------------
|
||||
blk_tmemrd : block
|
||||
|
||||
begin
|
||||
read_tmem_evr: process(xuser_CLK)
|
||||
begin
|
||||
if (rising_edge(xuser_CLK)) then
|
||||
lat_counter_arm <= '0';
|
||||
if (xuser_TMEM_ENA_reg = '1') then
|
||||
if (xuser_TMEM_ADD_reg(13 downto REG_ADDR_WIDTH) = c_LOW(13 downto REG_ADDR_WIDTH)) then
|
||||
case xuser_TMEM_ADD_reg(REG_ADDR_MSB downto TMEM_ADDR_LSB) is
|
||||
@ -170,8 +192,8 @@ begin
|
||||
when X"3" => xuser_TMEM_DATR <= evr_frequency & reserved(31 downto 0); -- 64bit / ByteAddr 018 --> 0x018 = Implementation Options + c_EVR_Location_vec
|
||||
when X"4" => xuser_TMEM_DATR <= cs_min_time & cs_min_cnt; -- 64bit / ByteAddr 020
|
||||
when X"5" => xuser_TMEM_DATR <= reserved(63 downto 0); -- 64bit / ByteAddr 028
|
||||
when X"6" => xuser_TMEM_DATR <= lat_counter_val & X"000000" & lat_event_nr; -- 64bit / ByteAddr 030
|
||||
when X"7" => xuser_TMEM_DATR <= reserved(63 downto 32) & lat_counter_val; lat_counter_arm <= '1'; -- 64bit / ByteAddr 038
|
||||
when X"6" => xuser_TMEM_DATR <= lat_counter_val & x"00" & lat_event_detected & X"00" & lat_event_nr; -- 64bit / ByteAddr 030
|
||||
when X"7" => xuser_TMEM_DATR <= reserved(63 downto 32) & reserved(31 downto 0); -- 64bit / ByteAddr 038
|
||||
when X"8" => xuser_TMEM_DATR <= er_handshake_status & er_control_concat; -- 64bit / ByteAddr 040
|
||||
when X"9" => xuser_TMEM_DATR <= reserved(63 downto 32) & er_status.usr_events_counter; -- 64bit / ByteAddr 048
|
||||
when X"A" => xuser_TMEM_DATR <= evr_puls_delay_cfg_s(4) & evr_puls_delay_cfg_s(3) & evr_puls_delay_cfg_s(2) & evr_puls_delay_cfg_s(1) ; -- 64bit / ByteAddr 050
|
||||
@ -186,6 +208,7 @@ begin
|
||||
end if;
|
||||
end process;
|
||||
|
||||
end block;
|
||||
|
||||
-- --------------------------------------------------------------------------
|
||||
-- Write operation - Byte control
|
||||
@ -197,6 +220,7 @@ begin
|
||||
-- default assignments
|
||||
er_data_ack <= er_data_ack(2 downto 0) & '0';
|
||||
er_error_ack <= er_error_ack(2 downto 0) & '0';
|
||||
lat_arm <= '0';
|
||||
|
||||
|
||||
if (xuser_TMEM_ENA_reg = '1' and xuser_TMEM_ADD_reg(13 downto REG_ADDR_WIDTH) = c_LOW(13 downto REG_ADDR_WIDTH)) then
|
||||
@ -247,7 +271,18 @@ begin
|
||||
-----------------------------------------------------------------------------------------------------------------
|
||||
if xuser_TMEM_ADD_reg(6 downto 3) = X"6" then --ByteAddr 030 Latency Measurement
|
||||
if xuser_TMEM_WE_reg(0) = '1' then lat_event_nr ( 7 downto 0) <= xuser_TMEM_DATW_reg( 7 downto 0); end if;
|
||||
-- if xuser_TMEM_WE_reg(1) = '1' then -reserved- (15 downto 8) <= xuser_TMEM_DATW_reg(15 downto 8); end if;
|
||||
-- if xuser_TMEM_WE_reg(1) = '1' then -reserved- (15 downto 8) <= xuser_TMEM_DATW_reg(15 downto 8); end if;
|
||||
-- if xuser_TMEM_WE_reg(2) = '1' then -reserved- (23 downto 16) <= xuser_TMEM_DATW_reg(23 downto 16); end if;
|
||||
-- if xuser_TMEM_WE_reg(3) = '1' then -reserved- (31 downto 24) <= xuser_TMEM_DATW_reg(31 downto 24); end if;
|
||||
-- if xuser_TMEM_WE_reg(4) = '1' then -reserved- ( 7 downto 0) <= xuser_TMEM_DATW_reg(39 downto 32); end if;
|
||||
-- if xuser_TMEM_WE_reg(5) = '1' then -reserved- (15 downto 8) <= xuser_TMEM_DATW_reg(47 downto 40); end if;
|
||||
-- if xuser_TMEM_WE_reg(6) = '1' then -reserved- (23 downto 16) <= xuser_TMEM_DATW_reg(55 downto 48); end if;
|
||||
-- if xuser_TMEM_WE_reg(7) = '1' then -reserved- (31 downto 24) <= xuser_TMEM_DATW_reg(63 downto 56); end if;
|
||||
end if;
|
||||
-----------------------------------------------------------------------------------------------------------------
|
||||
if xuser_TMEM_ADD_reg(6 downto 3) = X"7" then --ByteAddr 038 Latency Measurement
|
||||
if xuser_TMEM_WE_reg(0) = '1' then lat_arm <= xuser_TMEM_DATW_reg(0); end if;
|
||||
-- if xuser_TMEM_WE_reg(1) = '1' then -reserved- (15 downto 8) <= xuser_TMEM_DATW_reg(15 downto 8); end if;
|
||||
-- if xuser_TMEM_WE_reg(2) = '1' then -reserved- (23 downto 16) <= xuser_TMEM_DATW_reg(23 downto 16); end if;
|
||||
-- if xuser_TMEM_WE_reg(3) = '1' then -reserved- (31 downto 24) <= xuser_TMEM_DATW_reg(31 downto 24); end if;
|
||||
-- if xuser_TMEM_WE_reg(4) = '1' then -reserved- ( 7 downto 0) <= xuser_TMEM_DATW_reg(39 downto 32); end if;
|
||||
@ -349,6 +384,4 @@ begin
|
||||
end block;
|
||||
|
||||
end rtl;
|
||||
-- ----------------------------------------------------------------------------
|
||||
-- ////////////////////////////////////////////////////////////////////////////
|
||||
-- ----------------------------------------------------------------------------
|
||||
|
||||
|
Reference in New Issue
Block a user