1 ------------------------------------------------------------------------------- 2 -- File : PgpParallelSimModel.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 07/21/2016 5 -- Last update: 07/21/2016 6 ------------------------------------------------------------------------------- 7 -- This file is part of 'SLAC Firmware Standard Library'. 8 -- It is subject to the license terms in the LICENSE.txt file found in the 9 -- top-level directory of this distribution and at: 10 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. 11 -- No part of 'SLAC Firmware Standard Library', including this file, 12 -- may be copied, modified, propagated, or distributed except according to 13 -- the terms contained in the LICENSE.txt file. 14 ------------------------------------------------------------------------------- 17 use ieee.std_logic_1164.
all;
18 use ieee.std_logic_arith.
all;
19 use ieee.std_logic_unsigned.
all;
26 --! @ingroup protocols_saci 39 -- AXI lite slave port 45 -- AXI lite master port 56 type StateType is (S_IDLE_C, S_IS_ASIC_C, S_WRITE_C, S_WRITE_AXI_C, 57 S_READ_C, S_READ_AXI_C, S_DONE_OK_C, S_DONE_FAIL_C);
59 type RegType is record 61 localMultiPix : MultiPixelWriteType;
62 asicMask : slv(3 downto 0);
63 writeCnt : slv(3 downto 0);
65 timer : slv(23 downto 0);
74 constant REG_INIT_C : RegType := ( 76 localMultiPix => MULTI_PIXEL_WRITE_INIT_C,
77 asicMask => (others=>'0'), 78 writeCnt => (others=>'0'), 80 timer => (others => '1'), 88 signal r : RegType := REG_INIT_C;
93 assert (SACI_NUM_CHIPS_G = 4) report "Multi-pixel write supports only 4 ASIC configuration!" severity failure;
105 -- Pseudo SACI Commands (multi-pixel write) 125 v.globalMultiPix.req := '1';
-- start the AxiL master 162 -- State machine for SACI mediation 163 -- SACI is accessed via the AXI lite master bus 168 v.asicMask := (others => '0');
169 v.writeCnt := (others => '0');
171 -- If we see a multi-pixel write request, handle it 172 if (r.globalMultiPix.req = '1') then 174 r.globalMultiPix.row, 175 r.globalMultiPix.col, 178 r.globalMultiPix.data, 179 v.localMultiPix.asic, 182 v.localMultiPix.data);
189 -- Read the ASIC mask 193 v.timer := (others => '1');
195 -- Start AXI transaction 198 v.state := S_READ_AXI_C;
202 v.timer := r.timer - 1;
204 -- Clear control signals on ack 217 -- End transaction on timeout 224 -- Transaction is done 226 if v.fail = '1' or v.timeout = '1' then 227 v.state := S_DONE_FAIL_C;
229 v.state := S_IS_ASIC_C;
233 -- Check if ASIC is enabled 235 -- If the ASIC is not active, immediately drop the req and return 236 if (r.asicMask(conv_integer(r.localMultiPix.asic)) = '0') then 237 v.state := S_DONE_OK_C;
239 v.state := S_WRITE_C;
242 -- Prepare Write Transactions 244 if r.writeCnt = 0 then 245 -- ASIC offset + CMD = 6, ADDR = 17 249 elsif r.writeCnt = 1 then 250 -- ASIC offset + CMD = 6, ADDR = 19 254 elsif r.writeCnt = 2 then 255 -- ASIC offset + CMD = 5, ADDR = 0 263 v.timer := (others => '1');
268 v.state := S_WRITE_AXI_C;
270 -- Write Transaction, AXI 271 when S_WRITE_AXI_C => 272 v.timer := r.timer - 1;
274 -- Clear control signals on ack 289 -- End transaction on timeout 297 -- Transaction is done 302 if v.fail = '1' or v.timeout = '1' then 303 v.state := S_DONE_FAIL_C;
304 elsif r.writeCnt >= 2 then 305 -- Done if this was the last bank 306 if r.localMultiPix.bankFlag = "0111" then 307 v.state := S_DONE_OK_C;
308 -- Otherwise, rotate the bank counter and pixel data 310 v.writeCnt := (others=>'0');
311 v.localMultiPix.bankFlag(3 downto 1) := r.localMultiPix.bankFlag(2 downto 0);
313 v.localMultiPix.data(2 downto 0) := r.localMultiPix.data(3 downto 1);
314 v.state := S_WRITE_C;
317 v.writeCnt := r.writeCnt + 1;
318 v.state := S_WRITE_C;
324 v.globalMultiPix.req := '0';
328 when S_DONE_FAIL_C => 329 v.globalMultiPix.req := '0';
352 r <= rin after TPD_G;
out sAxilWriteSlaveAxiLiteWriteSlaveType
in sAxilWriteMasterAxiLiteWriteMasterType
SACI_BASE_ADDR_Gslv( 31 downto 0) := x"02000000"
AXIL_ERR_RESP_Gslv( 1 downto 0) := AXI_RESP_DECERR_C
out mAxilReadMasterAxiLiteReadMasterType
MASK_REG_ADDR_Gslv( 31 downto 0) := x"00000034"
AxiLiteStatusType axiStatus
slv( 1 downto 0) := "11" AXI_RESP_DECERR_C
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
out sAxilReadSlaveAxiLiteReadSlaveType
SACI_NUM_CHIPS_Gnatural range 1 to 4:= 4
Slv16Array( 3 downto 0) data
out mAxilWriteMasterAxiLiteWriteMasterType
AxiLiteReadSlaveType :=(arready => '0',rdata =>( others => '0'),rresp =>( others => '0'),rvalid => '0') AXI_LITE_READ_SLAVE_INIT_C
AxiLiteReadMasterType :=(araddr =>( others => '0'),arprot =>( others => '0'),arvalid => '0',rready => '1') AXI_LITE_READ_MASTER_INIT_C
in mAxilWriteSlaveAxiLiteWriteSlaveType
AxiLiteWriteMasterType :=(awaddr =>( others => '0'),awprot =>( others => '0'),awvalid => '0',wdata =>( others => '0'),wstrb =>( others => '1'),wvalid => '0',bready => '1') AXI_LITE_WRITE_MASTER_INIT_C
slv( 1 downto 0) := "00" AXI_RESP_OK_C
in mAxilReadSlaveAxiLiteReadSlaveType
in sAxilReadMasterAxiLiteReadMasterType
slv( 3 downto 0) bankFlag
AxiLiteWriteSlaveType :=(awready => '0',wready => '0',bresp =>( others => '0'),bvalid => '0') AXI_LITE_WRITE_SLAVE_INIT_C