1 ------------------------------------------------------------------------------- 2 -- File : AxiAd9467Spi.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2013-05-23 5 -- Last update: 2014-09-24 6 ------------------------------------------------------------------------------- 7 -- Description: AD9467 SPI Interface Module 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 use unisim.vcomponents.
all;
30 --! @ingroup devices_AnalogDevices_ad9467 57 signal state : StateType := IDLE_S;
64 signal pntr : slv(7 downto 0) := (others => '0');
65 signal cnt : range 0 to MAX_CNT_C := 0;
75 O => sdo,
-- Buffer output 76 IO =>
adcSdio,
-- Buffer inout port (connect directly to top-level port) 77 I => sdi,
-- Buffer input 78 T => inEn
);
-- 3-state enable input, high=input, low=output 82 if rising_edge(axiClk) then 86 sdi <= '0' after TPD_G;
87 inEn <= '0' after TPD_G;
89 pntr <= (others => '0') after TPD_G;
94 ---------------------------------------------------------------------- 96 if AdcSpiIn.req = '1' then 99 state <= SCK_LOW_S after TPD_G;
101 ---------------------------------------------------------------------- 106 sdi <= AdcSpiIn.din(conv_integer(23-pntr)) after TPD_G;
108 sdi <= AdcSpiIn.addr(conv_integer(15-pntr)) after TPD_G;
112 sdi <= '0' after TPD_G;
114 cnt <= cnt + 1 after TPD_G;
116 if cnt = MAX_CNT_C then 117 cnt <= 0 after TPD_G;
119 r.dout(conv_integer(23-pntr)) <= sdo after TPD_G;
121 state <= SCK_HIGH_S after TPD_G;
123 ---------------------------------------------------------------------- 126 cnt <= cnt + 1 after TPD_G;
128 if cnt = MAX_CNT_C then 129 cnt <= 0 after TPD_G;
130 pntr <= pntr + 1 after TPD_G;
133 pntr <= (others => '0') after TPD_G;
134 inEn <= '0' after TPD_G;
136 state <= HANDSHAKE_S after TPD_G;
138 state <= SCK_LOW_S after TPD_G;
141 ---------------------------------------------------------------------- 144 if AdcSpiIn.req = '0' then 147 state <= IDLE_S after TPD_G;
149 ----------------------------------------------------------------------
AXI_CLK_FREQ_Greal := 125.0E+6
out adcSpiOutAxiAd9467SpiOutType
in adcSpiInAxiAd9467SpiInType