1 ------------------------------------------------------------------------------- 2 -- File : AdiConfigSlave.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2014-01-14 5 -- Last update: 2016-11-14 6 ------------------------------------------------------------------------------- 7 -- Description: An implementation of the common SPI configuration interface 8 -- use by many AnalogDevices chips. 9 ------------------------------------------------------------------------------- 10 -- This file is part of 'SLAC Firmware Standard Library'. 11 -- It is subject to the license terms in the LICENSE.txt file found in the 12 -- top-level directory of this distribution and at: 13 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. 14 -- No part of 'SLAC Firmware Standard Library', including this file, 15 -- may be copied, modified, propagated, or distributed except according to 16 -- the terms contained in the LICENSE.txt file. 17 ------------------------------------------------------------------------------- 20 use ieee.std_logic_1164.
all;
21 use ieee.std_logic_unsigned.
all;
22 use ieee.std_logic_arith.
all;
26 --! @ingroup devices_AnalogDevices_general 46 end entity AdiConfigSlave;
75 state => WAIT_CSB_FALL_S, 76 count => (others => '0'), 77 shift => (others => '0'), 78 bytes => (others => '0'), 81 addr => (others => '0'), 150 when WAIT_CSB_FALL_S => 152 v.shift := (others => '0');
153 v.count := (others => '0');
155 v.state := SHIFT_HEADER_S;
158 when SHIFT_HEADER_S => 163 v.state := LATCH_HEADER_S;
167 when LATCH_HEADER_S => 169 case (r.shift(14 downto 13)) is 177 v.byteValid := "1111";
-- No support yet for streaming 183 if (r.shift(15) = '0') then 186 v.state := READ_WAIT_S;
195 v.state := LATCH_WRITE_BYTE_S;
199 when LATCH_WRITE_BYTE_S => 202 v.count := (others => '0');
205 v.state := WAIT_CSB_FALL_S;
213 v.state := LATCH_READ_BYTE_S;
215 when LATCH_READ_BYTE_S => 218 v.count := (others => '0');
230 v.state := WAIT_SCLK_RISE_S;
232 v.state := LATCH_READ_BYTE_S;
237 when WAIT_SCLK_RISE_S => 238 -- Hold last rd data until it has been sampled and txn is over 241 v.state := WAIT_CSB_FALL_S;
259 if (rising_edge(clk)) then 267 end architecture behavioral;
out byteValidslv( 3 downto 0)
out addrslv( 12 downto 0)
slv( 3 downto 0) byteValid
out wrDataslv( 31 downto 0)
in rstsl :=not RST_POLARITY_G
RegType :=(state => WAIT_CSB_FALL_S,count =>( others => '0'),shift =>( others => '0'),bytes =>( others => '0'),wrEn => '0',rdEn => '0',addr =>( others => '0'),wrData =>( others => '0'),byteValid =>( others => '0'),dataOut => '1') REG_INIT_C
(WAIT_CSB_FALL_S,SHIFT_HEADER_S,LATCH_HEADER_S,WRITE_S,LATCH_WRITE_BYTE_S,READ_WAIT_S,LATCH_READ_BYTE_S,READ_S,WAIT_SCLK_RISE_S) StateType
in rdDataslv( 31 downto 0)