-------------------------------------------------------------------------------
attribute syn_keep : boolean;
--- attribute syn_keep of trg_win_end_tdc : signal is true;
attribute syn_keep of trg_win_end_rdo : signal is true;
attribute syn_preserve : boolean;
--- attribute syn_preserve of trg_win_end_tdc : signal is true;
attribute nomerge : string;
--- attribute nomerge of trg_win_end_tdc : signal is "true";
attribute nomerge of trg_win_end_rdo : signal is "true";
-------------------------------------------------------------------------------
FIFO_DATA_VALID_OUT <= buf_data_valid;
-- FIFO_EMPTY_OUT <= buf_empty;
FIFO_EMPTY_OUT <= buf_empty when rising_edge(CLK_100);
- trg_win_end_tdc <= TRG_WIN_END_TDC_IN; -- when rising_edge(CLK_200);
+ trg_win_end_tdc <= TRG_WIN_END_TDC_IN;
trg_win_end_rdo <= TRG_WIN_END_RDO_IN;
rd_en_reg <= READ_EN_IN when rising_edge(CLK_100);
buf_empty_reg <= buf_empty when rising_edge(CLK_100);
-- File : Readout_record.vhd
-- Author : cugur@gsi.de
-- Created : 2012-10-25
--- Last update: 2015-10-16
+-- Last update: 2015-12-07
-------------------------------------------------------------------------------
-- Description:
-------------------------------------------------------------------------------
signal hit_in_i : std_logic_vector(CHANNEL_NUMBER-1 downto 1);
-- debug
signal header_error_bits : std_logic_vector(15 downto 0);
+ signal header_trg_type : std_logic_vector(3 downto 0);
+ signal header_trg_code : std_logic_vector(7 downto 0);
signal trailer_error_bits : std_logic_vector(15 downto 0);
signal rd_fsm_debug : std_logic_vector(3 downto 0);
signal rd_fsm_debug_r : std_logic_vector(3 downto 0);
RD_NEXT <= WAIT_FOR_BUFFER_TRANSFER;
if MISSING_REF_TIME_IN = '1' or isNoHit_r = '0' then
wr_header_fsm <= '1';
- if MISSING_REF_TIME_IN = '1' then
+ end if;
+ if MISSING_REF_TIME_IN = '1' then
missing_ref_time_fsm <= '1';
- end if;
end if;
end if;
wait_fsm <= '1';
header_error_bits(1) <= missing_ref_time;
header_error_bits(15 downto 2) <= (others => '0');
+ HeaderTriggerInfo: process (CLK_100) is
+ begin
+ if rising_edge(CLK_100) then -- rising clock edge
+ if READOUT_RX.data_valid = '1' then
+ header_trg_type <= READOUT_RX.trg_type when ;
+ header_trg_code <= READOUT_RX.trg_code when ;
+ end if;
+ end if;
+ end process HeaderTriggerInfo;
+
+
-- Error, warning bits set in the trailer
trailer_error_bits <= (others => '0');
-- trailer_error_bits (0) <= wrong_readout; -- if there is a wrong readout because of a spurious timing trigger
-- Coarse counters
signal coarse_cntr : std_logic_vector_array_11(0 to CHANNEL_NUMBER);
signal coarse_cntr_reset : std_logic;
- --signal coarse_cntr_reset_r : std_logic_vector(CHANNEL_NUMBER downto 0);
- --signal coarse_cntr_reset_2r : std_logic_vector(CHANNEL_NUMBER downto 0);
-- Slow control
signal ctrl_reg : std_logic_vector_array_32(0 to 8);
signal logic_anal_control : std_logic_vector(3 downto 0);
signal trg_win_en : std_logic;
signal trg_win_end_rdo : std_logic;
signal trg_win_end_tdc : std_logic;
- signal trg_win_end_tdc_r : std_logic_vector(CHANNEL_NUMBER downto 0);
signal missing_ref_time : std_logic;
signal valid_trg_rdo : std_logic;
signal valid_trg_tdc : std_logic;
attribute syn_keep : boolean;
attribute syn_keep of reset_tdc : signal is true;
attribute syn_keep of coarse_cntr : signal is true;
- --attribute syn_keep of coarse_cntr_reset_r : signal is true;
- --attribute syn_keep of coarse_cntr_reset_2r : signal is true;
- --attribute syn_keep of trg_win_end_tdc_r : signal is true;
attribute syn_keep of hit_in_i : signal is true;
attribute syn_preserve : boolean;
attribute syn_preserve of coarse_cntr : signal is true;
- --attribute syn_preserve of coarse_cntr_reset_r : signal is true;
- --attribute syn_preserve of coarse_cntr_reset_2r : signal is true;
- --attribute syn_preserve of trg_win_end_tdc_r : signal is true;
attribute syn_preserve of hit_in_i : signal is true;
attribute nomerge : string;
attribute nomerge of hit_in_i : signal is "true";
CLK_100 => CLK_READOUT,
HIT_IN => hit_in_i(0),
HIT_EDGE_IN => '1',
- TRG_WIN_END_TDC_IN => trg_win_end_tdc, --trg_win_end_tdc_r(0),
+ TRG_WIN_END_TDC_IN => trg_win_end_tdc,
TRG_WIN_END_RDO_IN => trg_win_end_rdo,
EPOCH_COUNTER_IN => epoch_cntr,
COARSE_COUNTER_IN => coarse_cntr(0),
CLK_100 => CLK_READOUT,
HIT_IN => hit_in_i(i),
HIT_EDGE_IN => hit_edge_2r(i),
- TRG_WIN_END_TDC_IN => trg_win_end_tdc, --trg_win_end_tdc_r(i),
+ TRG_WIN_END_TDC_IN => trg_win_end_tdc,
TRG_WIN_END_RDO_IN => trg_win_end_rdo,
EPOCH_COUNTER_IN => epoch_cntr,
COARSE_COUNTER_IN => coarse_cntr(i), -- coarse_cntr(integer(ceil(real(i)/real(8)))),
DEBUG_OUT => trg_handler_status_registers
);
trg_in <= REFERENCE_TIME;
- --GenTriggerWindowEnd : for i in 0 to CHANNEL_NUMBER generate
- -- trg_win_end_tdc_r(i) <= trg_win_end_tdc when rising_edge(CLK_TDC);
- --end generate GenTriggerWindowEnd;
-------------------------------------------------------------------------------
-- Readout
TRG_WIN_POST_IN => trg_win_post,
TRG_WIN_EN_IN => trg_win_en,
-- from the trigger handler
- TRG_WIN_END_TDC_IN => trg_win_end_tdc, --trg_win_end_tdc_r(CHANNEL_NUMBER),
+ TRG_WIN_END_TDC_IN => trg_win_end_tdc,
TRG_WIN_END_RDO_IN => trg_win_end_rdo,
TRG_TDC_IN => trg_tdc,
TRG_TIME_IN => trg_time,
NUMBER_OF_BITS => 11)
port map (
CLK => CLK_TDC,
- RESET => coarse_cntr_reset, --coarse_cntr_reset_2r(i),
+ RESET => coarse_cntr_reset,
COUNT_OUT => coarse_cntr(i),
UP_IN => '1');
end generate GenCoarseCounter;
if reset_tdc = '1' then
coarse_cntr_reset <= '1';
--elsif run_mode_200 = '0' then
- -- coarse_cntr_reset <= trg_win_end_tdc_r(1);
+ -- coarse_cntr_reset <= trg_win_end_tdc;
--elsif run_mode_edge_200 = '1' then
-- coarse_cntr_reset <= '1';
elsif reset_coarse_cntr_flag = '1' and valid_trg_tdc = '1' then
SIGNAL_IN => reset_coarse_cntr_200,
PULSE_OUT => reset_coarse_cntr_edge_200);
- --GenCoarseCounterReset : for i in 0 to CHANNEL_NUMBER generate
- -- coarse_cntr_reset_r(i) <= coarse_cntr_reset when rising_edge(CLK_TDC);
- -- coarse_cntr_reset_2r(i) <= coarse_cntr_reset_r(i) when rising_edge(CLK_TDC);
- --end generate GenCoarseCounterReset;
-
-- EPOCH counter
TheEpochCounter : up_counter
generic map (
COUNT_OUT => epoch_cntr,
UP_IN => epoch_cntr_up);
epoch_cntr_up <= and_all(coarse_cntr(CHANNEL_NUMBER));
- epoch_cntr_reset <= coarse_cntr_reset; --coarse_cntr_reset_2r(CHANNEL_NUMBER);
+ epoch_cntr_reset <= coarse_cntr_reset;
-------------------------------------------------------------------------------
-- Statistics