1 -------------------------------------------------------------------------------     2 -- File       : AxiI2cRegMaster.vhd     3 -- Company    : SLAC National Accelerator Laboratory     4 -- Created    : 2015-07-08     5 -- Last update: 2017-05-09     6 -------------------------------------------------------------------------------     7 -- Description: AXI-Lite I2C Register Master     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;
    26 use unisim.vcomponents.
all;
    29  --! @ingroup protocols_i2c    42       -- AXI-Lite Register Interface    54    -- Note: PRESCALE_G = (clk_freq / (5 * i2c_freq)) - 1    55    --       FILTER_G = (min_pulse_time / clk_period) + 1    74          -- I2C Register Interface    77          -- AXI-Lite Register Interface    96          -- I2C Register Interface   105          O  => i2ci.scl,
                -- Buffer output   106          IO => 
scl,
                     -- Buffer inout port (connect directly to top-level port)   107          I  => i2co.scl,
                -- Buffer input   108          T  => i2co.scloen
);
            -- 3-state enable input, high=input, low=output     112          O  => i2ci.sda,
                -- Buffer output   113          IO => 
sda,
                     -- Buffer inout port (connect directly to top-level port)   114          I  => i2co.sda,
                -- Buffer input   115          T  => i2co.sdaoen
);
            -- 3-state enable input, high=input, low=output   in regInI2cRegMasterInType  
 
natural  :=(   getTimeRatio(   AXI_CLK_FREQ_G,   I2C_SCL_5xFREQ_C))- 1 PRESCALE_C
 
AXI_CLK_FREQ_Greal  := 156.25E+6
 
AXI_ERROR_RESP_Gslv( 1 downto  0)  :=   AXI_RESP_SLVERR_C
 
out axiWriteSlaveAxiLiteWriteSlaveType  
 
AXI_ERROR_RESP_Gslv( 1 downto  0)  :=   AXI_RESP_SLVERR_C
 
natural  :=   natural(   AXI_CLK_FREQ_G*   I2C_MIN_PULSE_G)+ 1 FILTER_C
 
I2cRegMasterOutType   i2cRegMasterOut
 
out axiReadSlaveAxiLiteReadSlaveType  
 
I2cRegMasterInType   i2cRegMasterIn
 
array(natural range <> ) of I2cAxiLiteDevType   I2cAxiLiteDevArray
 
I2C_SCL_FREQ_Greal  := 100.0E+3
 
OUTPUT_EN_POLARITY_Ginteger   range  0 to  1:= 0
 
DEVICE_MAP_GI2cAxiLiteDevArray  :=   I2C_AXIL_DEV_ARRAY_DEFAULT_C
 
in axiWriteMasterAxiLiteWriteMasterType  
 
out axiReadSlaveAxiLiteReadSlaveType  
 
slv( 1 downto  0)  :=   "10" AXI_RESP_SLVERR_C
 
in axiReadMasterAxiLiteReadMasterType  
 
I2C_MIN_PULSE_Greal  := 100.0E-9
 
DEVICE_MAP_GI2cAxiLiteDevArray  :=   I2C_AXIL_DEV_ARRAY_DEFAULT_C
 
in i2cRegMasterOutI2cRegMasterOutType  
 
in axiWriteMasterAxiLiteWriteMasterType  
 
real  := 5.0*   I2C_SCL_FREQ_G I2C_SCL_5xFREQ_C
 
in axiReadMasterAxiLiteReadMasterType  
 
out axiWriteSlaveAxiLiteWriteSlaveType  
 
I2cAxiLiteDevArray( 0 to  3)  :=( 0=>(   MakeI2cAxiLiteDevType(   "0000000", 8, 8, '0')), 1=>(   MakeI2cAxiLiteDevType(   "0000010", 16, 16, '0')), 2=>(   MakeI2cAxiLiteDevType(   "0000100", 32, 8, '0')), 3=>(   MakeI2cAxiLiteDevType(   "0001000", 32, 32, '0'))) I2C_AXIL_DEV_ARRAY_DEFAULT_C
 
out i2cRegMasterInI2cRegMasterInType  
 
FILTER_Ginteger   range  2 to  512:= 8
 
out regOutI2cRegMasterOutType  
 
PRESCALE_Ginteger   range  0 to  655535:= 62