1 ------------------------------------------------------------------------------- 2 -- File : SlvArraytoAxiLite.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2016-07-21 5 -- Last update: 2016-07-21 6 ------------------------------------------------------------------------------- 7 -- Description: SLV array to AXI-Lite Master Bridge 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;
36 -- SLV Array Interface 40 -- AXI-Lite Master Interface 47 end entity SlvArraytoAxiLite;
55 type RegType is record 63 constant REG_INIT_C : RegType := ( 65 valid => (others => '0'), 66 inSlv => (others => (others => '0')), 70 signal r : RegType := REG_INIT_C;
76 -- attribute dont_touch : string; 77 -- attribute dont_touch of r : signal is "true"; 82 for i in (SIZE_G-1) downto 0 generate 89 -- Write Ports (wr_clk domain) 92 -- Read Ports (rd_clk domain) 110 comb :
process (ack,
axilRst, inSlv, r)
is 111 variable v : RegType;
114 -- Latch the current value 117 -- Loop through the SLV array 118 for i in (SIZE_G-1) downto 0 loop 119 -- Check for changes in the bus 120 if inSlv(i) /= r.inSlv(i) then 126 -- Update the registered value 131 ---------------------------------------------------------------------- 133 -- Increment the counter 134 if r.cnt = (SIZE_G-1) then 139 -- Check the valid flag and transaction completed 140 if (r.valid(r.cnt) = '1') and (ack.done = '0') then 142 v.valid(r.cnt) := '0';
143 -- Setup the AXI-Lite Master request 145 v.req.rnw := '0';
-- Write operation 147 v.req.wrData := r.inSlv(r.cnt);
151 ---------------------------------------------------------------------- 153 -- Wait for DONE to set 154 if ack.done = '1' then 160 ---------------------------------------------------------------------- 168 -- Register the variable for next clock cycle 176 r <= rin after TPD_G;
180 end architecture rtl;
out axilReadMasterAxiLiteReadMasterType
in axilReadSlaveAxiLiteReadSlaveType
AxiLiteMasterReqType :=(request => '0',rnw => '1',address =>( others => '0'),wrData =>( others => '0')) AXI_LITE_MASTER_REQ_INIT_C
array(natural range <> ) of slv( 31 downto 0) Slv32Array
out axilWriteMasterAxiLiteWriteMasterType
out axilReadMasterAxiLiteReadMasterType
in dinslv( DATA_WIDTH_G- 1 downto 0)
in axilWriteSlaveAxiLiteWriteSlaveType
in reqAxiLiteMasterReqType
out ackAxiLiteMasterAckType
COMMON_CLK_Gboolean := false
out doutslv( DATA_WIDTH_G- 1 downto 0)
COMMON_CLK_Gboolean := false
in inputSlv32Array( SIZE_G- 1 downto 0)
out axilWriteMasterAxiLiteWriteMasterType
in axilReadSlaveAxiLiteReadSlaveType
in axilWriteSlaveAxiLiteWriteSlaveType
ADDR_GSlv32Array :=( 0=> x"00000000")
slv( 31 downto 0) address
DATA_WIDTH_Ginteger range 1 to ( 2** 24):= 16