1 -------------------------------------------------------------------------------     2 -- File       : AxiAds42lb69Reg.vhd     3 -- Company    : SLAC National Accelerator Laboratory     4 -- Created    : 2015-03-20     5 -- Last update: 2015-05-19     6 -------------------------------------------------------------------------------     7 -- Description: AXI-Lite Register Access     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_Ti_ads42lb69    37       -- AXI-Lite Register Interface (axiClk domain)    42       -- Register Inputs/Outputs (Mixed domain)    44       config         : 
out AxiAds42lb69ConfigType;
    57    type RegType is record    59       regOut        : AxiAds42lb69ConfigType;
    64    constant REG_INIT_C : RegType := (    65       adcSmpl       => (others => (others => (others => '0'))),    66       regOut        => AXI_ADS42LB69_CONFIG_INIT_C,
    70    type AdcType is record    71       timer         :  range 0 to TIMEOUT_1S_C;
    72       smplCnt       :  range 0 to 7;
    76    constant ADC_INIT_C : AdcType := (    81    signal r    : RegType := REG_INIT_C;
    83    signal ra   : AdcType := ADC_INIT_C;
    84    signal rain : AdcType;
    92    -------------------------------    93    -- Configuration Register    94    -------------------------------      97       variable va           : AdcType;
    99       variable axiWriteResp : slv(1 downto 0);
   100       variable axiReadResp  : slv(1 downto 0);
   102       -- Latch the current value   106       -- Determine the transaction type   109       -- Reset strobe signals   113       -- Increment the counter (ADC clock domain)   114       va.timer := ra.timer + 1;
   115       -- Check the timer for 1 second timeout   116       if ra.timer = TIMEOUT_1S_C then   117          -- Reset the counters   123       -- Count ADC samples (ADC clock domain)   124       if ra.armed = '1' then   125          va.smplCnt := ra.smplCnt + 1;
   126          if ra.smplCnt = 7 then   131       -- Store last 8 samples read from ADCs   132       for ch in 1 downto 0 loop   134             v.adcSmpl(ch, 0) := regIn.adcData(ch);
   135             v.adcSmpl(ch, 1) := r.adcSmpl(ch, 0);
   136             v.adcSmpl(ch, 2) := r.adcSmpl(ch, 1);
   137             v.adcSmpl(ch, 3) := r.adcSmpl(ch, 2);
   138             v.adcSmpl(ch, 4) := r.adcSmpl(ch, 3);
   139             v.adcSmpl(ch, 5) := r.adcSmpl(ch, 4);
   140             v.adcSmpl(ch, 6) := r.adcSmpl(ch, 5);
   141             v.adcSmpl(ch, 7) := r.adcSmpl(ch, 6);
   146          -- Check for an out of 32 bit aligned address   148          -- Decode address and perform write   222          -- Check for an out of 32 bit aligned address   224          -- Reset the register   226          -- Decode address and assign read data   313       -- Register the variable for next clock cycle   326       if rising_edge(axiClk) then   327          r <= rin after TPD_G;
   331    seqa : 
process (
adcClk) 
is   333       if rising_edge(adcClk) then   334          ra <= rain after TPD_G;
   338    -------------------------------               340    -------------------------------   343    for ch in 0 to 1 generate   351             din      => status.adcData
(ch
),
   353             rd_en    => regIn.adcValid
(ch
),
   354             valid    => regIn.adcValid
(ch
),
   355             dout     => regIn.adcData
(ch
)   359    regIn.delayOut <= status.delayOut;
 
AxiAds42lb69DelayOutType   delayOut
 
AXI_ERROR_RESP_Gslv( 1 downto  0)  :=   AXI_RESP_SLVERR_C
 
Slv8Array( 1 downto  0)   load
 
out axiReadSlaveAxiLiteReadSlaveType  
 
slv( 1 downto  0)   adcValid
 
in dinslv(   DATA_WIDTH_G- 1 downto  0)  
 
out axiWriteSlaveAxiLiteWriteSlaveType  
 
in axiWriteMasterAxiLiteWriteMasterType  
 
out doutslv(   DATA_WIDTH_G- 1 downto  0)  
 
AxiLiteStatusType   axiStatus
 
slv( 1 downto  0)  :=   "10" AXI_RESP_SLVERR_C
 
DMODE_INIT_Gslv( 1 downto  0)  :=   "00"
 
SIM_SPEEDUP_Gboolean  :=   false
 
in statusAxiAds42lb69StatusType  
 
ADC_CLK_FREQ_Greal  := 250.00E+6
 
AxiLiteReadSlaveType  :=(arready  => '0',rdata  =>( others => '0'),rresp  =>( others => '0'),rvalid  => '0') AXI_LITE_READ_SLAVE_INIT_C
 
slv( 1 downto  0)  :=   "00" AXI_RESP_OK_C
 
AxiAds42lb69StatusType  :=(adcValid  =>( others => '0'),adcData  =>( others => x"0000"),delayOut  =>   AXI_ADS42LB69_DELAY_OUT_INIT_C) AXI_ADS42LB69_STATUS_INIT_C
 
AxiAds42lb69DelayInType   delayIn
 
Slv16Array( 1 downto  0)   adcData
 
in axiReadMasterAxiLiteReadMasterType  
 
AxiLiteWriteSlaveType  :=(awready  => '0',wready  => '0',bresp  =>( others => '0'),bvalid  => '0') AXI_LITE_WRITE_SLAVE_INIT_C
 
array(natural range <> ,natural range <> ) of slv( 15 downto  0)   Slv16VectorArray
 
DATA_WIDTH_Ginteger   range  1 to ( 2** 24):= 16