1 ------------------------------------------------------------------------------- 2 -- File : AxiAd9467Reg.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2014-09-23 5 -- Last update: 2014-09-24 6 ------------------------------------------------------------------------------- 7 -- Description: AD9467 AXI-Lite Register Access 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;
28 --! @ingroup devices_AnalogDevices_ad9467 37 -- AXI-Lite Register Interface (axiClk domain) 44 -- Register Inputs/Outputs (axiClk domain) 46 config :
out AxiAd9467ConfigType;
55 function CompressAddressSpace (vec :
slv(
7 downto 0))
return slv is 56 variable retVar : slv(11 downto 0) := x"0FF";
59 -- chip_port_config register 65 -- chip_grade register 68 -- device_update register 83 -- output_mode register 86 -- output_adjust register 89 -- output_phase register 95 -- analog_input register 98 -- Buffer Current Select 1 register 101 -- Buffer Current Select 2 register 116 type RegType is record 117 config : AxiAd9467ConfigType;
123 constant REG_INIT_C : RegType := ( 129 signal r : RegType := REG_INIT_C;
130 signal rin : RegType;
136 ------------------------------- 137 -- Configuration Register 138 ------------------------------- 141 variable v : RegType;
143 variable axiWriteResp : slv(1 downto 0);
144 variable axiReadResp : slv(1 downto 0);
146 -- Latch the current value 149 -- Determine the transaction type 152 -- Reset strobe signals 157 -- Check for an out of 32 bit aligned address 166 -- Decode address and perform write 209 -- Check for an out of 32 bit aligned address 211 -- Reset the register 220 -- Decode address and assign read data 286 ---------------------------------------------------------------------- 289 ---------------------------------------------------------------------- 295 ---------------------------------------------------------------------- 297 -- De-assert the flag 299 -- Check for ack strobe 300 if syncIn.spi.ack = '1' then 301 -- Check if we need to perform a read or write response 311 ---------------------------------------------------------------------- 323 -- Register the variable for next clock cycle 334 if rising_edge(axiClk) then 335 r <= rin after TPD_G;
339 ------------------------------- 340 -- Synchronization: Outputs 341 ------------------------------- 342 config.spi <= r.config.spi;
349 dataIn => r.config.delay.dmux,
352 SyncOut_delayIn_load :
entity work.
RstSync 361 SyncOut_delayIn_rst :
entity work.
RstSync 371 for i in 0 to 7 generate 378 din => r.config.delay.data
(i
),
380 dout => config.delay.data
(i
));
381 end generate GEN_DAT_CONFIG;
383 ------------------------------- 384 -- Synchronization: Inputs 385 ------------------------------- 393 dataIn => status.pllLocked,
397 for i in 0 to 15 generate 404 din => status.adcDataMon
(i
),
406 dout => syncIn.adcDataMon
(i
));
407 end generate GEN_ADC_MON;
414 dataIn => status.delay.rdy,
418 for i in 0 to 7 generate 425 din => status.delay.data
(i
),
427 dout => syncIn.delay.data
(i
));
428 end generate GEN_DAT_STATUS;
in statusAxiAd9467StatusType
AxiAd9467ConfigType :=(spi => AXI_AD9467_SPI_IN_INIT_C,delay => AXI_AD9467_DELAY_IN_INIT_C) AXI_AD9467_CONFIG_INIT_C
AxiAd9467DelayOutType delay
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_SLVERR_C
in dinslv( DATA_WIDTH_G- 1 downto 0)
Slv16Array( 0 to 15) adcDataMon
out doutslv( DATA_WIDTH_G- 1 downto 0)
AxiLiteStatusType axiStatus
DELAY_INIT_GSlv5Array( 0 to 7) :=( others => "00000")
out axiReadSlaveAxiLiteReadSlaveType
slv( 1 downto 0) := "10" AXI_RESP_SLVERR_C
RELEASE_DELAY_Ginteger range 3 to positive'high:= 3
STATUS_CNT_WIDTH_Gnatural range 1 to 32:= 32
in axiReadMasterAxiLiteReadMasterType
in axiWriteMasterAxiLiteWriteMasterType
AxiLiteReadSlaveType :=(arready => '0',rdata =>( others => '0'),rresp =>( others => '0'),rvalid => '0') AXI_LITE_READ_SLAVE_INIT_C
AxiAd9467StatusType :=(pllLocked => '0',adcData => x"0000",adcDataMon =>( others => x"0000"),spi => AXI_AD9467_SPI_OUT_INIT_C,delay => AXI_AD9467_DELAY_OUT_INIT_C) AXI_AD9467_STATUS_INIT_C
array(natural range <> ) of slv( 4 downto 0) Slv5Array
slv( 1 downto 0) := "00" AXI_RESP_OK_C
out configAxiAd9467ConfigType
AxiLiteWriteSlaveType :=(awready => '0',wready => '0',bresp =>( others => '0'),bvalid => '0') AXI_LITE_WRITE_SLAVE_INIT_C
out axiWriteSlaveAxiLiteWriteSlaveType
DATA_WIDTH_Ginteger range 1 to ( 2** 24):= 16