SURF  1.0
AxiI2cQsfpCore.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : AxiI2cQsfpCore.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2014-04-24
5 -- Last update: 2016-09-20
6 -------------------------------------------------------------------------------
7 -- Description: AXI-Lite interface to QSFP
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 -------------------------------------------------------------------------------
17 
18 library ieee;
19 use ieee.std_logic_1164.all;
20 use ieee.numeric_std.all;
21 
22 use work.StdRtlPkg.all;
23 use work.AxiLitePkg.all;
24 use work.I2cPkg.all;
25 use work.AxiI2cQsfpPkg.all;
26 
27 library unisim;
28 use unisim.vcomponents.all;
29 
30 --! @see entity
31  --! @ingroup devices_transceivers_qsfp
32 entity AxiI2cQsfpCore is
33  generic (
34  TPD_G : time := 1 ns;
35  AXI_CLK_FREQ_G : real := 200.0E+6; -- units of Hz
36  I2C_SCL_FREQ_G : real := 100.0E+3; -- units of Hz
37  I2C_MIN_PULSE_G : real := 100.0E-9; -- units of seconds
38  STATUS_CNT_WIDTH_G : natural range 1 to 32 := 32;
40  port (
41  -- QSFP Ports
45  -- AXI-Lite Register Interface
50  -- Clocks and Resets
51  axiClk : in sl;
52  axiRst : in sl);
53 end AxiI2cQsfpCore;
54 
55 architecture mapping of AxiI2cQsfpCore is
56 
57  -- Note: PRESCALE_G = (clk_freq / (5 * i2c_freq)) - 1
58  -- FILTER_G = (min_pulse_time / clk_period) + 1
59  constant I2C_SCL_5xFREQ_C : real := 5.0 * I2C_SCL_FREQ_G;
60  constant PRESCALE_C : natural := (getTimeRatio(AXI_CLK_FREQ_G, I2C_SCL_5xFREQ_C)) - 1;
61  constant FILTER_C : natural := natural(AXI_CLK_FREQ_G * I2C_MIN_PULSE_G) + 1;
62 
65 
66  signal i2ci : i2c_in_type;
67  signal i2co : i2c_out_type;
68 
71 
72 begin
73 
74  IOBUF_SCL : IOBUF
75  port map (
76  O => i2ci.scl, -- Buffer output
77  IO => qsfpInOut.scl, -- Buffer inout port (connect directly to top-level port)
78  I => i2co.scl, -- Buffer input
79  T => i2co.scloen); -- 3-state enable input, high=input, low=output
80 
81  IOBUF_SDA : IOBUF
82  port map (
83  O => i2ci.sda, -- Buffer output
84  IO => qsfpInOut.sda, -- Buffer inout port (connect directly to top-level port)
85  I => i2co.sda, -- Buffer input
86  T => i2co.sdaoen); -- 3-state enable input, high=input, low=output
87 
88  qsfpOut.modSelL <= not(config.modSel);
89  qsfpOut.rstL <= not(config.rst);
91 
92  status.modPrst <= not(qsfpIn.modPrstL);
93  status.interrupt <= not(qsfpIn.intL);
94 
95  AxiI2cQsfpReg_Inst : entity work.AxiI2cQsfpReg
96  generic map(
97  TPD_G => TPD_G,
100  port map(
101  -- I2C Register Interface
104  -- AXI-Lite Register Interface
109  -- Register Inputs/Outputs
110  status => status,
111  config => config,
112  -- Clock and Reset
113  axiClk => axiClk,
114  axiRst => axiRst);
115 
116  I2cRegMaster_Inst : entity work.I2cRegMaster
117  generic map(
118  TPD_G => TPD_G,
120  FILTER_G => FILTER_C,
122  port map (
123  -- I2C Port Interface
124  i2ci => i2ci,
125  i2co => i2co,
126  -- I2C Register Interface
129  -- Clock and Reset
130  clk => axiClk,
131  srst => axiRst);
132 
133 end mapping;
in regInI2cRegMasterInType
out i2cRegMasterInI2cRegMasterInType
out qsfpOutAxiI2cQsfpOutType
in qsfpInAxiI2cQsfpInType
out axiWriteSlaveAxiLiteWriteSlaveType
out axiReadSlaveAxiLiteReadSlaveType
in i2cii2c_in_type
I2C_MIN_PULSE_Greal := 100.0E-9
i2c_in_type
Definition: I2cPkg.vhd:34
I2cRegMasterInType i2cRegMasterIn
AxiLiteWriteMasterType
Definition: AxiLitePkg.vhd:111
std_logic sl
Definition: StdRtlPkg.vhd:28
STATUS_CNT_WIDTH_Gnatural range 1 to 32:= 32
in axiReadMasterAxiLiteReadMasterType
natural := natural( AXI_CLK_FREQ_G* I2C_MIN_PULSE_G)+ 1 FILTER_C
in i2cRegMasterOutI2cRegMasterOutType
in srstsl := '0'
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_SLVERR_C
in axiWriteMasterAxiLiteWriteMasterType
OUTPUT_EN_POLARITY_Ginteger range 0 to 1:= 0
in statusAxiI2cQsfpStatusType
out axiReadSlaveAxiLiteReadSlaveType
AxiI2cQsfpStatusType status
real := 5.0* I2C_SCL_FREQ_G I2C_SCL_5xFREQ_C
TPD_Gtime := 1 ns
TPD_Gtime := 1 ns
in axiWriteMasterAxiLiteWriteMasterType
I2C_SCL_FREQ_Greal := 100.0E+3
slv( 1 downto 0) := "10" AXI_RESP_SLVERR_C
Definition: AxiLitePkg.vhd:36
I2cRegMasterOutType
Definition: I2cPkg.vhd:110
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_SLVERR_C
natural :=( getTimeRatio( AXI_CLK_FREQ_G, I2C_SCL_5xFREQ_C))- 1 PRESCALE_C
_library_ ieeeieee
i2c_out_type
Definition: I2cPkg.vhd:41
AxiLiteReadMasterType
Definition: AxiLitePkg.vhd:59
in axiReadMasterAxiLiteReadMasterType
I2cRegMasterOutType i2cRegMasterOut
I2cRegMasterInType
Definition: I2cPkg.vhd:79
AxiLiteReadSlaveType
Definition: AxiLitePkg.vhd:85
STATUS_CNT_WIDTH_Gnatural range 1 to 32:= 32
inout qsfpInOutAxiI2cQsfpInOutType
out i2coi2c_out_type
TPD_Gtime := 1 ns
out axiWriteSlaveAxiLiteWriteSlaveType
FILTER_Ginteger range 2 to 512:= 8
out regOutI2cRegMasterOutType
AXI_CLK_FREQ_Greal := 200.0E+6
out configAxiI2cQsfpConfigType
PRESCALE_Ginteger range 0 to 655535:= 62
std_logic_vector slv
Definition: StdRtlPkg.vhd:29
AxiI2cQsfpConfigType config