11 use IEEE.STD_LOGIC_1164.
ALL;
18 -- Uncomment the following library declaration if using
19 -- arithmetic functions with Signed or Unsigned values
22 -- Uncomment the following library declaration if instantiating
23 -- any Xilinx primitives in this code.
25 --use UNISIM.VComponents.all;
33 -- this instructs the modules downstream to plug in the alignment word.
36 Data_out : out (TX_indata_length - 1 downto 0));
38 end CMX_CP_Topo_Encoder;
42 --these consts describe the trigger object arrangement
43 constant num_cols : :=5;
-- 4 CP TO's per fiber
44 -- indexing starts on the left i.e. TO 0
46 -- occupies the most sig 28 bits
49 --these consts describe the word (16 or 18 bit) object arrangement
51 --16bit+2bit K flag per fiber)
52 --note that these start at the low end
53 --i.e. word 0 is 15 downto 0 in
55 --or 17 down to 0 in final_array
59 --first the input data is interpreted as an array of CP TOs (no logic here
60 --just renaming signals)
61 --signal TO_CPs : arr_TO_CP;
63 --then the TO_CPs array is packed onto a flat array
64 --it is just a long vector but we can think of this as having 8 rows 128 bits
65 --each (i.e. each row corresponds to data sent on a single fiber)
66 --each 'row' holds 4 jet TO's and is padded with zeros (least sig 15 bits
67 --bit 16 is the overflow)
68 --the position of TO in the row is the column. Columns are filled first
69 -- e.g. CP TO 0 occupying bits 127 downto 100 is row 0 column 0
70 -- CP TO 8 is occupying bits 355 downto 327 is row 2 column 1
75 --component chipscope_ila_jet_encoder is
77 -- CONTROL : inout std_logic_vector(35 downto 0);
78 -- CLK : in std_logic;
79 -- DATA : in std_logic_vector(585 downto 0);
80 -- TRIG0 : in std_logic_vector(0 to 0));
81 --end component chipscope_ila_jet_encoder;
83 --signal CONTROL : std_logic_vector(35 downto 0);
84 --signal DATA_ila_jet_encoder : std_logic_vector(585 downto 0);
85 --signal TRIG0_ila_jet_encoder : std_logic_vector(0 to 0);
87 --component chipscope_icon_u1_c1 is
89 -- CONTROL0 : inout std_logic_vector(35 downto 0));
90 --end component chipscope_icon_u1_c1;
95 ----form the array of jet TO's
96 --jet_arr_gen: for i_jet in 0 to Num_TO_CP-1 generate
97 -- TO_CPs(i_jet)(TO_CP_Et2_size-1 downto 0)<=DATA_Et2((i_jet+1)*TO_CP_Et2_size - 1 downto i_jet * TO_CP_Et2_size);
98 -- TO_CPs(i_jet)(TO_CP_Et2_size+TO_CP_Et1_size-1 downto TO_CP_Et2_size)<=DATA_Et1((i_jet+1)*TO_CP_Et1_size - 1 downto i_jet * TO_CP_Et1_size);
99 -- TO_CPs(i_jet)(TO_CP_Et2_size+TO_CP_Et1_size+TO_CP_pos_size-1 downto TO_CP_Et2_size+TO_CP_Et1_size)<=DATA_pos((i_jet+1)*TO_CP_pos_size - 1 downto i_jet * TO_CP_pos_size);
100 --end generate jet_arr_gen;
104 flat_arr_payload_copy_gen: for i_copy in 0 to num_copies-1 generate
105 flat_arr_payload_gen: for i_TO in 0 to max_tobs_topo-1 generate
111 --constant msb : integer := 128*i_row + 127 - ( i_col * TO_CP_size );
112 --constant lsb : integer := 128*i_row + 128 - ( ( i_col +1 ) * TO_CP_size );
114 --constant i_row_cpy : integer := i_row+i_copy*num_rows;
120 --flat_array(msb downto lsb)<=TO_CPs(i_TO);
121 --flat_array(128*i_row + 127 - ( i_col * TO_CP_size ) downto 128*i_row + 128 - ( ( i_col +1 ) * TO_CP_size ))<=TO_CPs(i_TO);
125 assert i_TO<=29 report "TOO MANY TOBS in THE DECODER INSTATIATION!!!" severity FAILURE;
126 assert lsb>=0 report "LSB less than 0 in the decoder instantiation!!!; i_copy: "&'IMAGE(i_copy)&", i_TO: "&'IMAGE(i_TO)&", i_col: "&'IMAGE(i_col)&", i_row: "&'IMAGE(i_row)&", msb: "&'IMAGE(msb)&", lsb: "&'IMAGE(lsb) severity FAILURE;
132 end generate flat_arr_payload_gen;
133 end generate flat_arr_payload_copy_gen;
136 flat_arr_overflow_copy_gen: for i_copy in 0 to num_copies-1 generate
140 end generate flat_arr_overflow_gen;
141 end generate flat_arr_overflow_copy_gen;
145 send_align_copy_gen: for i_copy in 0 to num_copies-1 generate
151 end generate send_align_gen;
152 end generate send_align_copy_gen;
159 --chipscope_icon_u1_c1_inst: entity work.chipscope_icon_u1_c1
161 -- CONTROL0 => CONTROL);
163 --chipscope_ila_jet_encoder_inst: entity work.chipscope_ila_jet_encoder
165 -- CONTROL => CONTROL,
167 -- DATA => DATA_ila_jet_encoder,
168 -- TRIG0 => TRIG0_ila_jet_encoder);
170 --TRIG0_ila_jet_encoder(0)<='0';
172 --DATA_ila_jet_encoder(0)<='0';
173 --DATA_ila_jet_encoder(8 downto 1)<=send_align;
174 --DATA_ila_jet_encoder(328 downto 9)<=DATA_Et2;
175 --DATA_ila_jet_encoder(584 downto 329)<=flat_array(255 downto 0);
176 --DATA_ila_jet_encoder(585)<='0';
integer :=(i_TO / num_rows) i_col
integer :=fiber_to_gtx (i_row) i_row_fiber
out Data_outstd_logic_vector (TX_indata_length - 1 downto 0)
integer :=6 num_rows_words
in Tobs_to_TOPOcopy_arr_TOB
std_logic_vector (num_copies * num_cols_words * num_rows_words * 16 - 1 downto 0) flat_array)
integer :=8 num_cols_words
integer :=(i_TO rem num_rows) + num_rows * i_copy i_row
out send_align_outstd_logic_vector (num_GTX_groups * num_GTX_per_group - 1 downto 0)
integer :=128 * i_row_fiber + 128 - ((i_col + 1) * TO_EmTau_size) lsb
integer :=i_row + i_copy * num_rows i_row_cpy
integer :=128 * i_row_fiber + 127 - (i_col * TO_EmTau_size msb)
in overflowstd_logic_vector (num_copies - 1 downto 0)