|
| 1 | +------------------------------------------------------------------------------- |
| 2 | +-- Company : SLAC National Accelerator Laboratory |
| 3 | +------------------------------------------------------------------------------- |
| 4 | +-- Description: Wrapper for LeapXcvrCore |
| 5 | +------------------------------------------------------------------------------- |
| 6 | +-- This file is part of 'SLAC Firmware Standard Library'. |
| 7 | +-- It is subject to the license terms in the LICENSE.txt file found in the |
| 8 | +-- top-level directory of this distribution and at: |
| 9 | +-- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. |
| 10 | +-- No part of 'SLAC Firmware Standard Library', including this file, |
| 11 | +-- may be copied, modified, propagated, or distributed except according to |
| 12 | +-- the terms contained in the LICENSE.txt file. |
| 13 | +------------------------------------------------------------------------------- |
| 14 | + |
| 15 | +library ieee; |
| 16 | +use ieee.std_logic_1164.all; |
| 17 | + |
| 18 | +library surf; |
| 19 | +use surf.StdRtlPkg.all; |
| 20 | +use surf.AxiLitePkg.all; |
| 21 | +use surf.I2cPkg.all; |
| 22 | + |
| 23 | +library unisim; |
| 24 | +use unisim.vcomponents.all; |
| 25 | + |
| 26 | +entity LeapXcvr is |
| 27 | + generic ( |
| 28 | + TPD_G : time := 1 ns; |
| 29 | + I2C_BASE_ADDR_G : slv(3 downto 0) := "0000"; -- A[3:0] pin config |
| 30 | + I2C_SCL_FREQ_G : real := 100.0E+3; -- units of Hz |
| 31 | + I2C_MIN_PULSE_G : real := 100.0E-9; -- units of seconds |
| 32 | + AXIL_CLK_FREQ_G : real := 156.25E+6); -- units of Hz |
| 33 | + port ( |
| 34 | + -- I2C Ports |
| 35 | + scl : inout sl; |
| 36 | + sda : inout sl; |
| 37 | + -- Optional I/O Ports |
| 38 | + intL : in sl := '1'; |
| 39 | + rstL : out sl; |
| 40 | + -- AXI-Lite Register Interface |
| 41 | + axilReadMaster : in AxiLiteReadMasterType; |
| 42 | + axilReadSlave : out AxiLiteReadSlaveType; |
| 43 | + axilWriteMaster : in AxiLiteWriteMasterType; |
| 44 | + axilWriteSlave : out AxiLiteWriteSlaveType; |
| 45 | + -- Clocks and Resets |
| 46 | + axilClk : in sl; |
| 47 | + axilRst : in sl); |
| 48 | +end LeapXcvr; |
| 49 | + |
| 50 | +architecture mapping of LeapXcvr is |
| 51 | + |
| 52 | + signal i2ci : i2c_in_type; |
| 53 | + signal i2co : i2c_out_type; |
| 54 | + |
| 55 | +begin |
| 56 | + |
| 57 | + U_Core : entity surf.LeapXcvrCore |
| 58 | + generic map ( |
| 59 | + TPD_G => TPD_G, |
| 60 | + I2C_BASE_ADDR_G => I2C_BASE_ADDR_G, |
| 61 | + I2C_SCL_FREQ_G => I2C_SCL_FREQ_G, |
| 62 | + I2C_MIN_PULSE_G => I2C_MIN_PULSE_G, |
| 63 | + AXIL_CLK_FREQ_G => AXIL_CLK_FREQ_G) |
| 64 | + port map ( |
| 65 | + -- I2C Interface |
| 66 | + i2ci => i2ci, |
| 67 | + i2co => i2co, |
| 68 | + -- Optional I/O Ports |
| 69 | + intL => intL, |
| 70 | + rstL => rstL, |
| 71 | + -- AXI-Lite Register Interface |
| 72 | + axilReadMaster => axilReadMaster, |
| 73 | + axilReadSlave => axilReadSlave, |
| 74 | + axilWriteMaster => axilWriteMaster, |
| 75 | + axilWriteSlave => axilWriteSlave, |
| 76 | + -- Clocks and Resets |
| 77 | + axilClk => axilClk, |
| 78 | + axilRst => axilRst); |
| 79 | + |
| 80 | + IOBUF_SCL : entity surf.IoBufWrapper |
| 81 | + port map ( |
| 82 | + O => i2ci.scl, -- Buffer output |
| 83 | + IO => scl, -- Buffer inout port (connect directly to top-level port) |
| 84 | + I => i2co.scl, -- Buffer input |
| 85 | + T => i2co.scloen); -- 3-state enable input, high=input, low=output |
| 86 | + |
| 87 | + IOBUF_SDA : entity surf.IoBufWrapper |
| 88 | + port map ( |
| 89 | + O => i2ci.sda, -- Buffer output |
| 90 | + IO => sda, -- Buffer inout port (connect directly to top-level port) |
| 91 | + I => i2co.sda, -- Buffer input |
| 92 | + T => i2co.sdaoen); -- 3-state enable input, high=input, low=output |
| 93 | + |
| 94 | +end mapping; |
0 commit comments