8 use ieee.std_logic_1164.
all;
9 --use IEEE.std_logic_unsigned.all;
13 use unisim.vcomponents.
all;
25 -- data_in : in std_logic_vector((data_width-1) downto 0);
26 -- orbit_counter : in std_logic_vector(11 downto 0);
45 -- signal and constans declarations
52 -- extended to maintain properly the parity bit attached to each single package
53 constant slice_1 : (8 downto 0):= "001100000";
54 constant slice_3 : (8 downto 0):= "100100010";
55 constant slice_5 : (8 downto 0):= "111100100";
64 --this walks in sync with cur_wr_arddress
65 -- cur_wr_address minus programmable offset minus nslices
67 --upon reception of l1a this gets
69 --cur_wr_address minus programmable offset plus nslices
74 --WTF: BUG: --signal bc_counter_readout_uncorrected: unsigned(11 downto 0); --current
75 --WTF: BUG: --bc_counter
76 --WTF: BUG: --minus offset
78 --WTF: BUG: --corrected for
79 --WTF: BUG: --mod 3564 logic)
82 --this is the bcid that
83 --will be appended to the
101 component Readout_BUFFER_RAM
is
105 wea :
IN (
0 DOWNTO 0);
106 addra :
IN (
7 DOWNTO 0);
107 dina :
IN (
95 DOWNTO 0);
109 addrb :
IN (
7 DOWNTO 0);
110 doutb :
OUT (
95 DOWNTO 0));
119 din :
IN (
1919 DOWNTO 0);
122 dout :
OUT (
1919 DOWNTO 0);
132 -- signal read_next, read_next_d : std_logic;
151 --register input data and bcid to ease timing closure by local replication of
161 --buffer memories -store all event data in 256 event cycle
162 mem_gen: for i_mem in 19 downto 0 generate
164 gen_cur_wr_address_mem0: if i_mem=0 generate
166 end generate gen_cur_wr_address_mem0;
168 gen_cur_wr_address_mem_1_to_19: if i_mem/=0 generate
170 end generate gen_cur_wr_address_mem_1_to_19;
174 Readout_BUFFER_RAM_inst:
entity work.Readout_BUFFER_RAM
184 lower_rows: if i_mem /= 19 generate
186 end generate lower_rows;
187 upper_row: if i_mem=19 generate
188 --leave space for the BCID and FIFO overflow
192 end generate upper_row;
193 end generate mem_gen;
195 -- this process drives the advancing address and detects the l1a
196 -- if l1a arrives the data is started to be loaded onto fifo
197 -- the fifo_wr_en is asserted and then de-asserted when addresses high and
207 elsif rising_edge(clk4008) then
218 --WTF: BUG: bc_counter_readout_uncorrected<=bc_counter_reg-RAM_global_offset-1;
219 --need to add here replacing part of the data with fixed BCID
228 --WTF: BUG: bc_counter_readout<=bc_counter_readout_uncorrected - to_unsigned(3564,11) when bc_counter_readout_uncorrected>=3564 else bc_counter_readout_uncorrected;
244 begin -- process ADDR
245 if reset = '1' then -- asynchronous reset (active high)
292 -- dav_space <= slice_1 when nslices = "00" else -- 1 slices
293 -- slice_3 when nslices = "01" else -- 3 slices
294 -- slice_5 when nslices = "10"; -- 5 slices
299 begin -- process SH_REG
300 if reset = '1' then -- asynchronous reset (active high)
301 shift_reg <= (others => (others => '0'));
302 parity <= (others => '1');
304 for i in 0 to 19 loop
307 for i in 0 to 19 loop
311 for i in 0 to 19 loop
314 parity <= (others => '1');
320 begin -- process DOUT
321 if reset = '1' then -- asynchronous reset (active low)
326 for i in 0 to 19 loop
std_logic_vector (19 downto 0) parity
in data_inarr_96 (19 downto 0)
std_logic_vector (20 * 96 - 1 downto 0) data_fifo_out)
in RAM_rel_offsetsarr_ctr_8bit (18 downto 0)
arr_ctr_8bit (19 downto 0) cur_wr_address_i
std_logic_vector (2 downto 0) :=( others =>'0' ) ctrl_fsm
array (19 downto 0 ) of std_logic_vector (95 downto 0) shift_reg_type
std_logic_vector (8 downto 0) :="001100000" slice_1
arr_96 (19 downto 0) data_in_reg
in nslicesunsigned (7 downto 0)
in bc_counterunsigned (11 downto 0)
unsigned (7 downto 0) addr_rd_low
unsigned (11 downto 0) bc_counter_readout
unsigned (7 downto 0) cur_wr_address
in RAM_global_offsetunsigned (7 downto 0)
std_logic_vector (8 downto 0) :="111100100" slice_5
std_logic_vector (8 downto 0) dav_space
out doutSTD_LOGIC_VECTOR (1919 downto 0)
arr_96 (19 downto 0) data_buffered_out_short
unsigned (7 downto 0) addr_rd_high
std_logic_vector (20 * 96 - 1 downto 0) data_buffered_out)
in dinSTD_LOGIC_VECTOR (1919 downto 0)
unsigned (11 downto 0) bc_counter_reg
std_logic_vector (8 downto 0) :="100100010" slice_3
std_logic_vector (dav_space' high downto 0) :=( others =>'0' ) frame_counter
out data_outstd_logic_vector (19 downto 0)