1 -------------------------------------------------------------------------------     2 -- File       : AxiLiteSaciMaster2.vhd     3 -- Company    : SLAC National Accelerator Laboratory     4 -- Created    : 2016-06-01     5 -- Last update: 2016-11-15     6 -------------------------------------------------------------------------------     7 -- Description: New and improved version of the AxiLiteSaciMaster.     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 protocols_saci    45       -- AXI-Lite Register Interface    52 end AxiLiteSaciMaster;
    64    type RegType is record    73       timer          :  range 0 to TIMEOUT_C;
    79    constant REG_INIT_C : RegType := (    83       chip           => (others => '0'),    85       cmd            => (others => '0'),    86       addr           => (others => '0'),    92    signal r   : RegType := REG_INIT_C;
    99    -- attribute dont_touch      : string;   100    -- attribute dont_touch of r : signal is "true";      105       report "AXIL_CLK_PERIOD_G must be < 1.0 seconds" severity failure;
   107       report "AXIL_TIMEOUT_G must be < 1.0 seconds" severity failure;
   109       report "SACI_CLK_PERIOD_G must be < 1.0 seconds" severity failure;
   111       report "AXIL_CLK_PERIOD_G must be < AXIL_TIMEOUT_G" severity failure;
   113       report "AXIL_CLK_PERIOD_G must be < SACI_CLK_PERIOD_G" severity failure;
   115       report "SACI_CLK_PERIOD_G must be < AXIL_TIMEOUT_G" severity failure;
   127          sysRst   => r.saciRst,
         -- [in]   128          req      => r.req,
             -- [in]   131          chip     => r.chip,
            -- [in]   133          cmd      => r.cmd,
             -- [in]   134          addr     => r.addr,
            -- [in]   135          wrData   => r.wrData,
          -- [in]   143       variable v          : RegType;
   145       variable resp       : slv(1 downto 0);
   147       -- Latch the current value   150       -- Reset the strobing signals   154       if r.timer /= TIMEOUT_C then   155          -- Increment the counter   156          v.timer := r.timer + 1;
   159       -- Determine the transaction type   164          ----------------------------------------------------------------------   169             -- Check for a write request   182                v.state  := SACI_REQ_S;
   183             -- Check for a read request               194                v.wrData := (others => '0');
   196                v.state  := SACI_REQ_S;
   198          ----------------------------------------------------------------------   200             if (ack = '1' and fail = '1') or (r.timer = TIMEOUT_C) then   201                -- Set the error flags   205             elsif (ack = '1') then   211             if (v.req = '0') then   212                -- Check for Write operation   214                   --- Send AXI-Lite response   217                   -- Return the read data bus   219                   -- Send AXI-Lite Response   223                v.state := SACI_ACK_S;
   225          ----------------------------------------------------------------------   227             -- Check status of ACK flag   232       ----------------------------------------------------------------------   240       -- Register the variable for next clock cycle   252          r <= rin after TPD_G;
 
SYS_CLK_PERIOD_Greal  := 8.0e-9
 
out axilWriteSlaveAxiLiteWriteSlaveType  
 
in axilWriteMasterAxiLiteWriteMasterType  
 
in saciRspslv(   ite(   SACI_RSP_BUSSED_G, 0,   SACI_NUM_CHIPS_G- 1) downto  0)  
 
AXIL_CLK_PERIOD_Greal  := 8.0e-9
 
SACI_CLK_FREERUN_Gboolean  :=   false
 
SACI_RSP_BUSSED_Gboolean  :=   false
 
out saciSelLslv(   SACI_NUM_CHIPS_G- 1 downto  0)  
 
in axilReadMasterAxiLiteReadMasterType  
 
slv( 1 downto  0)  :=   "11" AXI_RESP_DECERR_C
 
out rdDataslv( 31 downto  0)  
 
SACI_RSP_BUSSED_Gboolean  :=   false
 
SACI_NUM_CHIPS_Gpositive   range  1 to  4:= 1
 
in chipslv(   log2(SACI_NUM_CHIPS_G  )- 1 downto  0)  
 
in wrDataslv( 31 downto  0)  
 
AxiLiteReadSlaveType  :=(arready  => '0',rdata  =>( others => '0'),rresp  =>( others => '0'),rvalid  => '0') AXI_LITE_READ_SLAVE_INIT_C
 
AXIL_TIMEOUT_Greal  := 1.0E-3
 
SACI_CLK_FREERUN_Gboolean  :=   false
 
slv( 1 downto  0)  :=   "00" AXI_RESP_OK_C
 
AXIL_ERROR_RESP_Gslv( 1 downto  0)  :=   AXI_RESP_DECERR_C
 
in saciRspslv(   ite(   SACI_RSP_BUSSED_G, 0,   SACI_NUM_CHIPS_G- 1) downto  0)  
 
SACI_NUM_CHIPS_Gpositive  := 1
 
out saciSelLslv(   SACI_NUM_CHIPS_G- 1 downto  0)  
 
AxiLiteWriteSlaveType  :=(awready  => '0',wready  => '0',bresp  =>( others => '0'),bvalid  => '0') AXI_LITE_WRITE_SLAVE_INIT_C
 
out axilReadSlaveAxiLiteReadSlaveType  
 
SACI_CLK_PERIOD_Greal  := 1.0e-6
 
slv(   SACI_CHIP_WIDTH_C- 1 downto  0)   chip
 
SACI_CLK_PERIOD_Greal  := 1.0e-6