1 ------------------------------------------------------------------------------- 2 -- File : AxiI2cMasterCore.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2014-04-22 5 -- Last update: 2017-05-09 6 ------------------------------------------------------------------------------- 7 -- Description: AXI-Lite interface to generic I2C master controller 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;
30 --! @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 70 O => i2ci.scl,
-- Buffer output 71 IO => i2cInOut.scl,
-- Buffer inout port (connect directly to top-level port) 72 I => i2co.scl,
-- Buffer input 73 T => i2co.scloen
);
-- 3-state enable input, high=input, low=output 77 O => i2ci.sda,
-- Buffer output 78 IO => i2cInOut.sda,
-- Buffer inout port (connect directly to top-level port) 79 I => i2co.sda,
-- Buffer input 80 T => i2co.sdaoen
);
-- 3-state enable input, high=input, low=output 92 -- AXI-Lite Register Interface 108 -- I2C Port Interface 111 -- I2C Register Interface in regInI2cRegMasterInType
in axiWriteMasterAxiLiteWriteMasterType
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_SLVERR_C
I2C_SCL_FREQ_Greal := 100.0E+3
out axiWriteSlaveAxiLiteWriteSlaveType
natural := natural( AXI_CLK_FREQ_G* I2C_MIN_PULSE_G)+ 1 FILTER_C
real := 5.0* I2C_SCL_FREQ_G I2C_SCL_5xFREQ_C
in axiReadMasterAxiLiteReadMasterType
out axiWriteSlaveAxiLiteWriteSlaveType
array(natural range <> ) of I2cAxiLiteDevType I2cAxiLiteDevArray
OUTPUT_EN_POLARITY_Ginteger range 0 to 1:= 0
DEVICE_MAP_GI2cAxiLiteDevArray := I2C_AXIL_DEV_ARRAY_DEFAULT_C
in axiWriteMasterAxiLiteWriteMasterType
I2cRegMasterInType i2cRegMasterIn
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_SLVERR_C
out axiReadSlaveAxiLiteReadSlaveType
AXI_CLK_FREQ_Greal := 200.0E+6
slv( 1 downto 0) := "10" AXI_RESP_SLVERR_C
in axiReadMasterAxiLiteReadMasterType
DEVICE_MAP_GI2cAxiLiteDevArray := I2C_AXIL_DEV_ARRAY_DEFAULT_C
in i2cRegMasterOutI2cRegMasterOutType
EN_USER_REG_Gboolean := false
out axiReadSlaveAxiLiteReadSlaveType
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
natural :=( getTimeRatio( AXI_CLK_FREQ_G, I2C_SCL_5xFREQ_C))- 1 PRESCALE_C
I2C_MIN_PULSE_Greal := 100.0E-9
FILTER_Ginteger range 2 to 512:= 8
out regOutI2cRegMasterOutType
inout i2cInOutAxiI2cMasterInOutType
PRESCALE_Ginteger range 0 to 655535:= 62
I2cRegMasterOutType i2cRegMasterOut