1 ------------------------------------------------------------------------------- 2 -- File : AxiSy56040Reg.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2015-06-12 5 -- Last update: 2016-09-20 6 ------------------------------------------------------------------------------- 7 -- Description: This controller is designed around the Micrel SY56040AR. 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_unsigned.
all;
21 use ieee.std_logic_arith.
all;
27 --! @ingroup devices_Microchip_sy56040 40 -- AXI-Lite Register Interface 52 constant PULSE_WIDTH_C : := 10.0E-9;
-- units of seconds 53 constant PULSE_FREQ_C : := 1.
0 / PULSE_WIDTH_C;
-- units of Hz 54 constant MAX_CNT_C : := getTimeRatio(AXI_CLK_FREQ_G, PULSE_FREQ_C);
62 type RegType is record 63 sin : slv(1 downto 0);
64 sout : slv(1 downto 0);
66 config : Slv2Array(
3 downto 0);
67 cnt : range 0 to MAX_CNT_C;
76 constant REG_INIT_C : RegType := ( 77 sin => (others => '0'), 78 sout => (others => '0'), 80 config => XBAR_DEFAULT_G,
89 signal r : RegType := REG_INIT_C;
92 -- attribute dont_touch : string; 93 -- attribute dont_touch of r : signal is "true"; 100 variable axiWriteResp : slv(1 downto 0);
101 variable axiReadResp : slv(1 downto 0);
103 -- Latch the current value 106 -- Determine the transaction type 111 ---------------------------------------------------------------------- 113 -- Check for a read request 115 -- Reset the register 118 -- Decode address and assign read data 120 when x"0" => -- OUT[0] Mapping 122 when x"4" => -- OUT[1] Mapping 124 when x"8" => -- OUT[2] Mapping 126 when x"C" => -- OUT[3] Mapping 131 -- Send AXI-Lite Response 133 -- Check for a write request 136 -- Decode address and perform write 138 when x"0" => -- OUT[0] Mapping 141 when x"4" => -- OUT[1] Mapping 144 when x"8" => -- OUT[2] Mapping 147 when x"C" => -- OUT[3] Mapping 153 -- Send AXI-Lite response 156 ---------------------------------------------------------------------- 158 v.sin := r.config(r.index);
159 v.sout := toSLv(r.index, 2);
161 -- Increment the counter 164 if r.cnt = MAX_CNT_C then 170 ---------------------------------------------------------------------- 173 -- Increment the counter 176 if r.cnt = MAX_CNT_C then 182 ---------------------------------------------------------------------- 185 -- Increment the counter 188 if r.cnt = MAX_CNT_C then 191 -- Increment the counter 192 v.index := r.index + 1;
204 ---------------------------------------------------------------------- 212 -- Register the variable for next clock cycle 227 if rising_edge(axiClk) then 228 r <= rin after TPD_G;
out xBarSoutslv( 1 downto 0)
out axiReadSlaveAxiLiteReadSlaveType
AxiLiteStatusType axiStatus
slv( 1 downto 0) := "10" AXI_RESP_SLVERR_C
in axiWriteMasterAxiLiteWriteMasterType
AxiLiteReadSlaveType :=(arready => '0',rdata =>( others => '0'),rresp =>( others => '0'),rvalid => '0') AXI_LITE_READ_SLAVE_INIT_C
AXI_CLK_FREQ_Greal := 200.0E+6
out xBarSinslv( 1 downto 0)
XBAR_DEFAULT_GSlv2Array( 3 downto 0) :=( "11", "10", "01", "00")
slv( 1 downto 0) := "00" AXI_RESP_OK_C
in axiReadMasterAxiLiteReadMasterType
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_SLVERR_C
AxiLiteWriteSlaveType :=(awready => '0',wready => '0',bresp =>( others => '0'),bvalid => '0') AXI_LITE_WRITE_SLAVE_INIT_C
out axiWriteSlaveAxiLiteWriteSlaveType
array(natural range <> ) of slv( 1 downto 0) Slv2Array