1 ------------------------------------------------------------------------------- 2 -- File : SaciMultiPixelPkg.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 07/21/2016 5 -- Last update: 07/21/2016 6 ------------------------------------------------------------------------------- 7 -- Description: SaciMultiPixel Package File 8 ------------------------------------------------------------------------------- 9 -- This file is part of 'SLAC Firmware Standard Library'. 10 -- It is subject to the license terms in the LICENSE.txt file found in the 11 -- top-level directory of this distribution and at: 12 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. 13 -- No part of 'SLAC Firmware Standard Library', including this file, 14 -- may be copied, modified, propagated, or distributed except according to 15 -- the terms contained in the LICENSE.txt file. 16 ------------------------------------------------------------------------------ 19 use ieee.std_logic_1164.
all;
20 use ieee.std_logic_arith.
all;
21 use ieee.std_logic_unsigned.
all;
27 --! @ingroup protocols_saci 42 asic => (others => '0'), 43 row => (others => '0'), 44 col => (others => '0'), 45 data => (others => (others => '0')), 54 --Functions to allow use of EPIX100 or 10k 59 --Number of columns in ePix "super row" 60 -- (columns / ch) * (channels / asic) * (asics / row) / (adc values / word) 61 -- constant WORDS_PER_SUPER_ROW_C : integer := NCOL_C * 4 * 2 / 2; 69 signal globalCol :
in slv;
73 variable localAsic :
inout slv;
74 variable localRow :
inout slv;
75 variable localCol :
inout slv;
78 signal globalCol :
in slv;
82 variable localAsic :
inout slv;
83 variable localRow :
inout slv;
84 variable localCol :
inout slv;
87 end SaciMultiPixelPkg;
93 return toSlv
(asic*
(2**
22),
32);
98 assert (version
(31 downto 24) = x"E0"
or 99 version
(31 downto 24) = x"EA"
or 100 version
(31 downto 24) = x"E2"
or 101 version
(31 downto 24) = x"E3"
) report "Unable to determine ASIC type from version string!" severity failure;
102 --Epix 100p and Epix100a 103 if (version
(31 downto 24) = x"E0"
or version
(31 downto 24) = x"EA"
) then 106 elsif (version
(31 downto 24) = x"E2"
) then 109 elsif (version
(31 downto 24) = x"E3"
) then 111 --Other (default to Epix 100) 119 --EpixS reads only the active ASICs 120 if (version
(31 downto 24) = x"E3"
) then 124 return NCOL_C *
4 *
2 /
2;
129 signal globalRow :
in slv;
130 signal globalCol :
in slv;
134 variable localAsic :
inout slv;
135 variable localRow :
inout slv;
136 variable localCol :
inout slv;
140 assert (FPGA_VERSION_C(31 downto 24) = x"EA"
) report "Multi-pixel writes not supported for this ASIC!" severity warning;
142 globalToLocalPixelEpix100A
(globalRow,globalCol,
calRowFlag,
calBotFlag,inputData,localAsic,localRow,localCol,localData
);
144 end procedure globalToLocalPixel;
146 procedure globalToLocalPixelEpix100A
( 147 signal globalRow :
in slv;
148 signal globalCol :
in slv;
152 variable localAsic :
inout slv;
153 variable localRow :
inout slv;
154 variable localCol :
inout slv;
157 variable asicCol :
slv(9 downto 0);
161 -- ASIC 2 (upper left) 162 if globalCol <
NCOL_C *
4 then 164 asicCol :=
NCOL_C *
4 - globalCol -
1;
165 -- ASIC 1 (upper right) 168 asicCol :=
NCOL_C *
4 *
2 -
1 - globalCol;
170 -- For both top ASICs, translate row to local space 176 -- Readout order for top ASICs is 3->0 178 localData
(3-i
) := inputData
(i
);
182 -- ASIC 3 (lower left) 183 if (globalCol <
NCOL_C *
4) then 185 asicCol := globalCol;
186 -- ASIC 0 (lower right) 189 asicCol := globalCol -
NCOL_C *
4;
191 -- For both bottom ASICs, translate row to local space 197 -- Readout order for bottom ASICs is 0->3 199 localData
(i
) := inputData
(i
);
202 -- Decode column to column within a bank 205 elsif asicCol <
NCOL_C *
2 then 206 localCol := asicCol -
NCOL_C;
207 elsif asicCol <
NCOL_C *
3 then 208 localCol := asicCol -
NCOL_C *
2;
210 localCol := asicCol -
NCOL_C *
3;
212 end procedure globalToLocalPixelEpix100A;
214 end package body SaciMultiPixelPkg;
integer := 48 EPIX10K_COLS_PER_ROW
integer getNumColumnsversion,
globalToLocalPixelEpix100AglobalRow,globalCol,calRowFlag,calBotFlag,inputData,localAsic,localRow,localCol,localData,
slv( 31 downto 0) := x"00000000" FPGA_VERSION_C
globalToLocalPixelglobalRow,globalCol,calRowFlag,calBotFlag,inputData,localAsic,localRow,localCol,localData,
integer := 10 EPIXS_COLS_PER_ROW
MultiPixelWriteType :=(asic =>( others => '0'),row =>( others => '0'),col =>( others => '0'),data =>( others =>( others => '0')),bankFlag =>( others => '0'),calRowFlag => '0',calBotFlag => '0',req => '0') MULTI_PIXEL_WRITE_INIT_C
Slv16Array( 3 downto 0) data
array(natural range <> ) of slv( 15 downto 0) Slv16Array
integer := getWordsPerSuperRow(FPGA_VERSION_C ) WORDS_PER_SUPER_ROW_C
integer := 352 EPIX100A_ROWS_PER_ASIC
integer getWordsPerSuperRowversion,
integer := 96 EPIX100_COLS_PER_ROW
slv( 3 downto 0) bankFlag
integer := getNumColumns(FPGA_VERSION_C ) NCOL_C