Checking in separated 10GB ethernet offload engine (xgbe_oe) and ComBlock MAC/TCP server components, as well as Altera XAUI part. These latter are checked in under a third_party folder to distinguish them, even though they may be modified.
This commit is contained in:
parent
5020183bdc
commit
c128393352
140 changed files with 49170 additions and 0 deletions
233
generic_ip/third_party_ip/mac/src/MII_MI.vhd
Normal file
233
generic_ip/third_party_ip/mac/src/MII_MI.vhd
Normal file
|
|
@ -0,0 +1,233 @@
|
|||
-------------------------------------------------------------
|
||||
-- MSS copyright 2003-2018
|
||||
-- Filename: MII_MI.VHD
|
||||
-- Author: Alain Zarembowitch / MSS
|
||||
-- Version: 0
|
||||
-- Date last modified: 12/2/17
|
||||
-- Inheritance: MII_MI.VHD rev3 2/1/14 (COM-5401)
|
||||
-- MII_MI.vhd rev1 11-8-03 (COM-5003/5004)
|
||||
--
|
||||
-- description: MII management interface.
|
||||
-- Three transactions are supported: set register address, write and read register
|
||||
-- to/from the PHY IC through the MDC & MDIO serial interface.
|
||||
-- The MCLK clock speed is set as a constant within (integer division of the reference clock CLK).
|
||||
-- USAGE: adjust the constant MCLK_COUNTER_DIV within to meet the MDC/MDIO timing requirements (see PHY specs).
|
||||
-- Note: uses a ST="00" start of frame, unlike previous versions using a "01"
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use ieee. numeric_std.all;
|
||||
|
||||
entity MII_MI is
|
||||
Port (
|
||||
--// CLK, RESET
|
||||
SYNC_RESET: in std_logic;
|
||||
CLK: in std_logic;
|
||||
|
||||
PHY_ADDR: std_logic_vector(4 downto 0);
|
||||
-- destination device address
|
||||
MI_REGAD: in std_logic_vector(4 downto 0);
|
||||
-- 32 register address space for the PHY (ieee 802.3)
|
||||
-- 0 - 15 are standard PHY registers as per IEEE specification.
|
||||
-- 16 - 31 are vendor-specific registers
|
||||
MI_TX_DATA: in std_logic_vector(15 downto 0);
|
||||
-- address/data
|
||||
MI_RX_DATA: out std_logic_vector(15 downto 0);
|
||||
MI_ADDR_START: in std_logic;
|
||||
-- 1 CLK wide pulse to start a set address transaction
|
||||
-- The 16-bit address is in MI_TX_DATA
|
||||
-- will be ignored if the previous transaction is yet to be completed.
|
||||
-- For reliable operation, the user must check MI_TRANSACTION_COMPLETE first.
|
||||
MI_READ_START: in std_logic;
|
||||
-- 1 CLK wide pulse to start read transaction
|
||||
-- will be ignored if the previous transaction is yet to be completed.
|
||||
-- For reliable operation, the user must check MI_TRANSACTION_COMPLETE first.
|
||||
MI_WRITE_START: in std_logic;
|
||||
-- 1 CLK wide pulse to start write transaction
|
||||
-- will be ignored if the previous transaction is yet to be completed.
|
||||
-- For reliable operation, the user must check MI_TRANSACTION_COMPLETE first.
|
||||
|
||||
MI_TRANSACTION_COMPLETE: out std_logic;
|
||||
-- '1' when transaction is complete
|
||||
|
||||
--// serial interface to/from MDIO managed devices:
|
||||
-- Connect to external PHY and XAUI adapter (shared MDIO bus)
|
||||
MDC: out std_logic;
|
||||
MDIO_OUT: out std_logic;
|
||||
MDIO_IN: in std_logic;
|
||||
MDIO_DIR: out std_logic
|
||||
-- '0' when output, '1' when input
|
||||
-- MDIO serial interface to control and monitor two MMDs: external 10G PHY and
|
||||
-- internal XAUI adapter.
|
||||
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of MII_MI is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
signal TRANSACTION: std_logic_vector(1 downto 0) := "00";
|
||||
signal STATE: unsigned(7 downto 0) := (others => '0'); -- 0 is idle
|
||||
signal TXRX_FRAME: std_logic_vector(63 downto 0); --32-bit idle sequence + 32-bit MI serial port frame + 2 end bit
|
||||
signal MCLK_LOCAL: std_logic := '0';
|
||||
signal MDOE: std_logic := '1';
|
||||
signal MDI_SAMPLE_CLK: std_logic := '0';
|
||||
constant MCLK_COUNTER_DIV: unsigned(7 downto 0) := x"4D"; -- 1 MHz (156.25 MHz/156)
|
||||
--constant MCLK_COUNTER_DIV: std_logic_vector(7 downto 0) := x"17";
|
||||
-- divide CLK by this 2*(value + 1) to generate a slower MCLK
|
||||
-- MCLK period (typ): 600 ns [Microsemi VSC8486-11]
|
||||
-- Example: 156.25 MHz clock, 1us MCLK period => MCLK_COUNTER_DIV = 77
|
||||
signal MCLK_COUNTER: unsigned(7 downto 0) := x"00";
|
||||
signal MI_SAMPLE_REQ: std_logic := '0';
|
||||
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
------------------------------------------------------
|
||||
-- MCLK GENERATION
|
||||
------------------------------------------------------
|
||||
-- Divide CLK by MCLK_COUNTER_DIV
|
||||
MCLK_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
MCLK_COUNTER <= (others => '0');
|
||||
MI_SAMPLE_REQ <= '0';
|
||||
elsif(STATE = 0) then
|
||||
-- idle. awaiting a start of transaction.
|
||||
MI_SAMPLE_REQ <= '0';
|
||||
if(MI_WRITE_START = '1') or (MI_READ_START = '1') or (MI_ADDR_START = '1') then
|
||||
-- get started. reset MCLK phase.
|
||||
MCLK_COUNTER <= (others => '0');
|
||||
end if;
|
||||
else
|
||||
-- read/write transaction in progress
|
||||
if(MCLK_COUNTER = MCLK_COUNTER_DIV) then
|
||||
-- next sample
|
||||
MI_SAMPLE_REQ <= '1';
|
||||
MCLK_COUNTER <= (others => '0');
|
||||
else
|
||||
MI_SAMPLE_REQ <= '0';
|
||||
MCLK_COUNTER <= MCLK_COUNTER + 1;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
------------------------------------------------------
|
||||
-- OUTPUT TO PHY
|
||||
------------------------------------------------------
|
||||
|
||||
STATE_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
STATE <= (others => '0');
|
||||
MCLK_LOCAL <= '0';
|
||||
MDOE <= '0';
|
||||
TRANSACTION <= "00";
|
||||
elsif(STATE = 0) then
|
||||
if(MI_ADDR_START = '1') then
|
||||
-- was idle. start of set address transaction. start counting
|
||||
TRANSACTION <= "00";
|
||||
STATE <= x"01";
|
||||
MCLK_LOCAL <= '0';
|
||||
MDOE <= '1';
|
||||
elsif (MI_WRITE_START = '1') then
|
||||
-- was idle. start of write transaction. start counting
|
||||
TRANSACTION <= "01";
|
||||
STATE <= x"01";
|
||||
MCLK_LOCAL <= '0';
|
||||
MDOE <= '1';
|
||||
elsif (MI_READ_START = '1') then
|
||||
-- was idle. start of read transaction. start counting
|
||||
TRANSACTION <= "11";
|
||||
STATE <= x"01";
|
||||
MCLK_LOCAL <= '0';
|
||||
MDOE <= '1';
|
||||
end if;
|
||||
elsif (MI_SAMPLE_REQ = '1') then
|
||||
if (STATE = 128) then
|
||||
-- address/write transaction complete. set output enable to high impedance
|
||||
TRANSACTION <= "00";
|
||||
STATE <= x"00";
|
||||
MCLK_LOCAL <= '0';
|
||||
MDOE <= '0';
|
||||
if(TRANSACTION(1) = '1') then
|
||||
-- read transaction near complete
|
||||
MI_RX_DATA <= TXRX_FRAME(15 downto 0); -- complete word read from PHY
|
||||
end if;
|
||||
elsif (TRANSACTION(1) = '1') and (STATE = 92) then
|
||||
-- read transaction: finished writing addresses. switch to read mode
|
||||
STATE <= STATE + 1;
|
||||
MCLK_LOCAL <= not MCLK_LOCAL;
|
||||
MDOE <= '0';
|
||||
else
|
||||
STATE <= STATE + 1;
|
||||
MCLK_LOCAL <= not MCLK_LOCAL;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- immediate turn off the 'available' message as soon as a new transaction is triggered.
|
||||
MI_TRANSACTION_COMPLETE <= '0' when (STATE > 0) else
|
||||
'0' when (MI_ADDR_START = '1') else
|
||||
'0' when (MI_WRITE_START = '1') else
|
||||
'0' when (MI_READ_START = '1') else
|
||||
'1';
|
||||
|
||||
-- send MCLK to output
|
||||
MDC <= MCLK_LOCAL;
|
||||
|
||||
TXRX_FRAME_GEN: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
TXRX_FRAME <= (others => '0');
|
||||
elsif(MI_ADDR_START = '1') then
|
||||
-- start of set address transaction.
|
||||
-- Note: transmission sequence starts at bit 63
|
||||
TXRX_FRAME(63 downto 32) <= x"FFFFFFFF"; -- preamble: idle sequence 32 '1's
|
||||
TXRX_FRAME(31 downto 23) <= "0000" & PHY_ADDR;
|
||||
TXRX_FRAME(22 downto 18) <= MI_REGAD;
|
||||
TXRX_FRAME(17 downto 16) <= "10";
|
||||
TXRX_FRAME(15 downto 0) <= MI_TX_DATA;
|
||||
elsif(MI_WRITE_START = '1') then
|
||||
-- start of write transaction.
|
||||
-- Note: transmission sequence starts at bit 63
|
||||
TXRX_FRAME(63 downto 32) <= x"FFFFFFFF"; -- preamble: idle sequence 32 '1's
|
||||
TXRX_FRAME(31 downto 23) <= "0001" & PHY_ADDR;
|
||||
TXRX_FRAME(22 downto 18) <= MI_REGAD;
|
||||
TXRX_FRAME(17 downto 16) <= "10";
|
||||
TXRX_FRAME(15 downto 0) <= MI_TX_DATA;
|
||||
elsif(MI_READ_START = '1') then
|
||||
-- start of read transaction.
|
||||
-- Note: transmission sequence starts at bit 63
|
||||
TXRX_FRAME(63 downto 32) <= x"FFFFFFFF"; -- preamble: idle sequence 32 '1's
|
||||
TXRX_FRAME(31 downto 23) <= "0011" & PHY_ADDR;
|
||||
TXRX_FRAME(22 downto 18) <= MI_REGAD;
|
||||
elsif(MI_SAMPLE_REQ = '1') and (STATE /= 0) and (STATE(0) = '0') and (MDOE = '1') then
|
||||
-- shift TXRX_FRAME 1 bit left every two clocks
|
||||
TXRX_FRAME(63 downto 1) <= TXRX_FRAME(62 downto 0);
|
||||
elsif(MI_SAMPLE_REQ = '1') and (STATE /= 0) and (STATE(0) = '1') and (MDOE = '0') then
|
||||
-- shift MDIO into TXRX_FRAME 1 bit left every two clocks (read at the rising edge of MCLK)
|
||||
-- do this 16 times to collect the 16-bit response from the PHY.
|
||||
TXRX_FRAME(63 downto 1) <= TXRX_FRAME(62 downto 0);
|
||||
TXRX_FRAME(0) <= MDIO_IN;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- select output bit.
|
||||
MDIO_OUT <= TXRX_FRAME(63);
|
||||
MDIO_DIR <= not MDOE;
|
||||
|
||||
|
||||
end Behavioral;
|
||||
150
generic_ip/third_party_ip/mac/src/bram_dp2.vhd
Normal file
150
generic_ip/third_party_ip/mac/src/bram_dp2.vhd
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
-------------------------------------------------------------
|
||||
-- Filename: BRAM_DP2.VHD
|
||||
-- Authors:
|
||||
-- from http://www.xilinx.com/support/documentation/sw_manuals/xilinx14_4/xst_v6s6.pdf
|
||||
-- Alain Zarembowitch / MSS
|
||||
-- Version: Rev 2
|
||||
-- Last modified: 6/29/16
|
||||
|
||||
-- Inheritance: BRAM_DP.VHD 5/7/15
|
||||
--
|
||||
-- description: synthesizable generic dual port RAM
|
||||
--
|
||||
-- Rev 1b 6/21/16 AZ
|
||||
-- Switched to numeric_std library
|
||||
-- Initialize to zero during simulation
|
||||
--
|
||||
-- Rev 2 6/29/16 AZ
|
||||
-- Added asymmetrical case (different data widths on A and B ports)
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity BRAM_DP2 is
|
||||
Generic (
|
||||
DATA_WIDTHA: integer := 9; -- MUST BE <= DATA_WIDTHB
|
||||
ADDR_WIDTHA: integer := 11;
|
||||
DATA_WIDTHB: integer := 9;
|
||||
ADDR_WIDTHB: integer := 11
|
||||
-- total size on A size MUST match total size on B side
|
||||
-- (DATA_WIDTHA * 2**ADDR_WIDTHA) == (DATA_WIDTHB * 2**ADDR_WIDTHB)
|
||||
);
|
||||
Port (
|
||||
-- chip select, active high
|
||||
|
||||
-- Port A
|
||||
CLKA : in std_logic;
|
||||
CSA: in std_logic; -- chip select, active high
|
||||
WEA : in std_logic; -- write enable, active high
|
||||
OEA : in std_logic; -- output enable, active high
|
||||
ADDRA : in std_logic_vector(ADDR_WIDTHA-1 downto 0);
|
||||
DIA : in std_logic_vector(DATA_WIDTHA-1 downto 0);
|
||||
DOA : out std_logic_vector(DATA_WIDTHA-1 downto 0);
|
||||
|
||||
-- Port B
|
||||
CLKB : in std_logic;
|
||||
CSB: in std_logic; -- chip select, active high
|
||||
WEB : in std_logic; -- write enable, active high
|
||||
OEB : in std_logic; -- output enable, active high
|
||||
ADDRB : in std_logic_vector(ADDR_WIDTHB-1 downto 0);
|
||||
DIB : in std_logic_vector(DATA_WIDTHB-1 downto 0);
|
||||
DOB : out std_logic_vector(DATA_WIDTHB-1 downto 0)
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of BRAM_DP2 is
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------function
|
||||
--function max(L,R:INTEGER) return INTEGER is
|
||||
--begin
|
||||
-- if (L > R) then
|
||||
-- return L;
|
||||
-- else
|
||||
-- return R;
|
||||
-- end if;
|
||||
--end;
|
||||
--function min(L,R:INTEGER) return INTEGER is
|
||||
--begin
|
||||
-- if(L < R) then
|
||||
-- return L;
|
||||
-- else
|
||||
-- return R;
|
||||
-- end if;
|
||||
--end;
|
||||
|
||||
-- see users constraints in generic section
|
||||
constant MIN_DATA_WIDTH: integer := DATA_WIDTHA;
|
||||
constant MAX_DATA_WIDTH: integer := DATA_WIDTHB;
|
||||
constant MIN_ADDR_WIDTH: integer := ADDR_WIDTHB;
|
||||
constant MAX_ADDR_WIDTH: integer := ADDR_WIDTHA;
|
||||
constant RATIO: integer := MAX_DATA_WIDTH / MIN_DATA_WIDTH;
|
||||
constant log2RATIO: integer := ADDR_WIDTHA - ADDR_WIDTHB;
|
||||
|
||||
-- infered
|
||||
type mem_type is array ( (2**MAX_ADDR_WIDTH)-1 downto 0 ) of std_logic_vector(MIN_DATA_WIDTH-1 downto 0);
|
||||
shared variable MEM : mem_type := (others => (others => '0'));
|
||||
signal DOA_local: std_logic_vector(DATA_WIDTHA-1 downto 0) := (others => '0');
|
||||
signal DOB_local: std_logic_vector(DATA_WIDTHB-1 downto 0) := (others => '0');
|
||||
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
-- Port A write
|
||||
process(CLKA)
|
||||
begin
|
||||
if rising_edge(CLKA) then
|
||||
if(CSA = '1') and (WEA = '1') then
|
||||
mem(to_integer(unsigned(ADDRA))) := DIA;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Port A read
|
||||
process(CLKA)
|
||||
begin
|
||||
if rising_edge(CLKA) then
|
||||
if(CSA = '1') then
|
||||
DOA_local <= mem(to_integer(unsigned(ADDRA)));
|
||||
else
|
||||
DOA_local <= (others => '0');
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- tri-state output
|
||||
DOA <= DOA_local when (CSA = '1') and (OEA = '1') else (others => 'Z');
|
||||
|
||||
-- Port B write
|
||||
process(CLKB)
|
||||
begin
|
||||
if rising_edge(CLKB) then
|
||||
if(CSB = '1') and (WEB = '1') then
|
||||
for I in 0 to RATIO-1 loop
|
||||
mem(to_integer(unsigned(ADDRB) & to_unsigned(I,log2RATIO))) := DIB((I+1)*MIN_DATA_WIDTH - 1 downto I*MIN_DATA_WIDTH);
|
||||
end loop;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Port B read
|
||||
process(CLKB)
|
||||
begin
|
||||
if rising_edge(CLKB) then
|
||||
if(CSB = '1') then
|
||||
for I in 0 to RATIO-1 loop
|
||||
DOB_local((I+1)*MIN_DATA_WIDTH - 1 downto I*MIN_DATA_WIDTH) <= mem(to_integer(unsigned(ADDRB) & to_unsigned(I,log2RATIO)));
|
||||
end loop;
|
||||
else
|
||||
DOB_local <= (others => '0');
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- tri-state output
|
||||
DOB <= DOB_local when (CSB = '1') and (OEB = '1') else (others => 'Z');
|
||||
|
||||
end Behavioral;
|
||||
2491
generic_ip/third_party_ip/mac/src/com5501.vhd
Normal file
2491
generic_ip/third_party_ip/mac/src/com5501.vhd
Normal file
File diff suppressed because it is too large
Load diff
2280
generic_ip/third_party_ip/mac/src/com5501test.vhd
Normal file
2280
generic_ip/third_party_ip/mac/src/com5501test.vhd
Normal file
File diff suppressed because it is too large
Load diff
236
generic_ip/third_party_ip/mac/src/crc32.vhd
Normal file
236
generic_ip/third_party_ip/mac/src/crc32.vhd
Normal file
|
|
@ -0,0 +1,236 @@
|
|||
-------------------------------------------------------------
|
||||
-- Filename: CRC32.VHD
|
||||
-- Authors:
|
||||
-- Alain Zarembowitch / MSS
|
||||
-- Version: Rev 1
|
||||
-- Last modified: 8/6/18
|
||||
-- Inheritance: n/a
|
||||
--
|
||||
-- description: high-speed generation of 32-bit CRC32 (optimized for 10G Ethernet 64-bit words)
|
||||
-- Data bit order: MSb of MSB is first sent/received
|
||||
-- Algorithm based on seminal paper "High Performance Table-Based Algorithm for Pipelined CRC Calculation",
|
||||
-- by Yan Sun and Min Sik Kim
|
||||
-- Verified by comparing with the crc calculator at http://www.sunshine2k.de/coding/javascript/crc/crc_js.html
|
||||
--
|
||||
-- Rev 1 8/6/18 AZ
|
||||
-- Added one extra stage of pipelining for better timing
|
||||
--
|
||||
-------------------------------------------
|
||||
-- Device utilization
|
||||
-------------------------------------------
|
||||
-- FF: 188
|
||||
-- LUT: 682
|
||||
-- 18Kb block RAMs: 0
|
||||
-- DSP: 0
|
||||
-- GCLK: 1
|
||||
-- Minimum period: 4.836ns (Maximum Frequency: 206.782MHz) Artix7-100T -1 speed grade
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity CRC32 is
|
||||
Port (
|
||||
CLK : IN std_logic;
|
||||
DATA_IN: in std_logic_vector(63 downto 0);
|
||||
-- Natural order (as if input to a standard LFSR), i.e. not inverted, not reversed.
|
||||
-- order: MSb of MSB is first serialized bit
|
||||
-- Special case: when last word is less than 8 bytes, bytes are left-aligned (MSB first) and lower byte(s) are ignored.
|
||||
SAMPLE_CLK_IN: in std_logic;
|
||||
-- read DATA_IN at the rising_edge of CLK when SAMPLE_CLK_IN = '1'
|
||||
SOF_IN: in std_logic;
|
||||
-- 1-CLK wide pulse marks the first word in a message. Initializes the CRC to all zero
|
||||
-- aligned with SAMPLE_CLK_IN
|
||||
DATA_VALID_IN : IN std_logic_vector(7 downto 0);
|
||||
-- Valid bytes in DATA_IN.
|
||||
-- Valid inputs: 0x00,80 (one MSB byte),C0,E0,F0,F8,FC,FE,FF (8 bytes)
|
||||
CRC_INITIALIZATION: in std_logic_vector(31 downto 0);
|
||||
-- typically 0xFFFFFFFF. Read at SOF_IN = '1'
|
||||
CRC_OUT: out std_logic_vector(31 downto 0);
|
||||
-- Natural order (as in the flip-flop values of a standard LFSR), i.e. not inverted, not reversed.
|
||||
SAMPLE_CLK_OUT: out std_logic
|
||||
-- latency 2 CLKs after SAMPLE_CLK_IN
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of CRC32 is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
COMPONENT CRC32_LUT1
|
||||
PORT(
|
||||
CLK : IN std_logic;
|
||||
DATA_IN : IN std_logic_vector(31 downto 0);
|
||||
SAMPLE_CLK_IN : IN std_logic;
|
||||
CRC_OUT : OUT std_logic_vector(31 downto 0);
|
||||
SAMPLE_CLK_OUT : OUT std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
COMPONENT CRC32_LUT2
|
||||
PORT(
|
||||
CLK : IN std_logic;
|
||||
DATA_IN : IN std_logic_vector(31 downto 0);
|
||||
SAMPLE_CLK_IN : IN std_logic;
|
||||
CRC_OUT : OUT std_logic_vector(31 downto 0);
|
||||
SAMPLE_CLK_OUT : OUT std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
signal DATA1: std_logic_vector(63 downto 0) := (others => '0');
|
||||
signal DATA1_VALID: std_logic_vector(7 downto 0) := (others => '0');
|
||||
signal DATA2: std_logic_vector(63 downto 0) := (others => '0');
|
||||
signal DATA12: std_logic_vector(63 downto 0) := (others => '0');
|
||||
signal SAMPLE1_CLK: std_logic := '0';
|
||||
signal SAMPLE1_CLK_D: std_logic := '0';
|
||||
signal SAMPLE1_CLK_D2: std_logic := '0';
|
||||
signal SOF1: std_logic := '0';
|
||||
signal SOF1_D: std_logic := '0';
|
||||
signal CRC1: std_logic_vector(31 downto 0) := (others => '0');
|
||||
signal CRC2: std_logic_vector(31 downto 0) := (others => '0');
|
||||
signal CRC12: std_logic_vector(31 downto 0) := (others => '0');
|
||||
signal CRC12_D: std_logic_vector(31 downto 0) := (others => '0');
|
||||
signal CRC12_FROZEN: std_logic_vector(31 downto 0) := (others => '0');
|
||||
|
||||
|
||||
|
||||
signal CRC3: std_logic_vector(31 downto 0) := (others => '0');
|
||||
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
-- Special case: when last word is less than 8 bytes, input bytes are left-aligned (MSB first) and lower byte(s) are ignored.
|
||||
-- partial last word case: reorder last word so that bytes are right aligned
|
||||
REORDER_01: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
SAMPLE1_CLK <= SAMPLE_CLK_IN;
|
||||
DATA1_VALID <= DATA_VALID_IN;
|
||||
SOF1 <= SOF_IN;
|
||||
|
||||
if(SAMPLE_CLK_IN = '1') then
|
||||
-- if(DATA_VALID_IN(7) = '0') then
|
||||
-- DATA1 <= (others => '0');
|
||||
-- elsif(DATA_VALID_IN(6) = '0') then
|
||||
-- DATA1 <= x"00000000000000" & DATA_IN(63 downto 56); -- last word contains 1 byte
|
||||
-- elsif(DATA_VALID_IN(5) = '0') then
|
||||
-- DATA1 <= x"000000000000" & DATA_IN(63 downto 48); -- last word
|
||||
-- elsif(DATA_VALID_IN(4) = '0') then
|
||||
-- DATA1 <= x"0000000000" & DATA_IN(63 downto 40); -- last word
|
||||
-- elsif(DATA_VALID_IN(3) = '0') then
|
||||
-- DATA1 <= x"00000000" & DATA_IN(63 downto 32); -- last word
|
||||
-- elsif(DATA_VALID_IN(2) = '0') then
|
||||
-- DATA1 <= x"000000" & DATA_IN(63 downto 24); -- last word
|
||||
-- elsif(DATA_VALID_IN(1) = '0') then
|
||||
-- DATA1 <= x"0000" & DATA_IN(63 downto 16); -- last word
|
||||
-- elsif(DATA_VALID_IN(0) = '0') then
|
||||
-- DATA1 <= x"00" & DATA_IN(63 downto 8); -- last word
|
||||
-- else
|
||||
-- DATA1 <= DATA_IN(63 downto 0); -- full 8-byte input word
|
||||
-- end if;
|
||||
-- slightly better rephrasing below
|
||||
case DATA_VALID_IN is
|
||||
when "11111111" => DATA1 <= DATA_IN(63 downto 0); -- full 8-byte input word
|
||||
when "11111110" => DATA1 <= x"00" & DATA_IN(63 downto 8); -- last word
|
||||
when "11111100" => DATA1 <= x"0000" & DATA_IN(63 downto 16); -- last word
|
||||
when "11111000" => DATA1 <= x"000000" & DATA_IN(63 downto 24); -- last word
|
||||
when "11110000" => DATA1 <= x"00000000" & DATA_IN(63 downto 32); -- last word
|
||||
when "11100000" => DATA1 <= x"0000000000" & DATA_IN(63 downto 40); -- last word
|
||||
when "11000000" => DATA1 <= x"000000000000" & DATA_IN(63 downto 48); -- last word
|
||||
when "10000000" => DATA1 <= x"00000000000000" & DATA_IN(63 downto 56); -- last word contains 1 byte
|
||||
when others => DATA1 <= (others => '0');
|
||||
end case;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- CRC32 look-up table
|
||||
-- Latency: 1 CLK (from table address DATA_IN to table output CRC_OUT)
|
||||
-- lower 32-bits
|
||||
LUT1_001: CRC32_LUT1 PORT MAP (
|
||||
CLK => CLK,
|
||||
DATA_IN => DATA12(31 downto 0),
|
||||
SAMPLE_CLK_IN => SAMPLE1_CLK,
|
||||
CRC_OUT => CRC1,
|
||||
SAMPLE_CLK_OUT => SAMPLE1_CLK_D
|
||||
);
|
||||
-- upper 32-bits. LUT2 shifts the input by x^32
|
||||
-- Latency: 1 CLK (from table address DATA_IN to table output CRC_OUT)
|
||||
LUT2_001: CRC32_LUT2 PORT MAP (
|
||||
CLK => CLK,
|
||||
DATA_IN => DATA12(63 downto 32),
|
||||
SAMPLE_CLK_IN => SAMPLE1_CLK,
|
||||
CRC_OUT => CRC2,
|
||||
SAMPLE_CLK_OUT => open
|
||||
);
|
||||
CRC12 <= CRC1 xor CRC2; -- this is the CRC[DATA_IN(63:0)]
|
||||
|
||||
-- freeze CRC12 (otherwise algorithm runs amok) immediately at the LUT output (without waiting for next rising edge)
|
||||
FREEZE_CRC12_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SAMPLE1_CLK_D = '1') then
|
||||
CRC12_D <= CRC12;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
CRC12_FROZEN <= CRC_INITIALIZATION when (SOF1 = '1') else -- initialize CRC to zero at the first input word
|
||||
CRC12 when (SAMPLE1_CLK_D = '1') else
|
||||
CRC12_D;
|
||||
|
||||
-- last word special case. Add left-over bytes from last word CRC
|
||||
DATA2_GEN_001: process(CRC12_FROZEN, DATA1_VALID)
|
||||
begin
|
||||
if(DATA1_VALID(7) = '0') then
|
||||
DATA2 <= (others => '0');
|
||||
elsif(DATA1_VALID(6) = '0') then
|
||||
DATA2 <= x"00000000000000" & CRC12_FROZEN(31 downto 24); -- last input word contains 1 byte
|
||||
elsif(DATA1_VALID(5) = '0') then
|
||||
DATA2 <= x"000000000000" & CRC12_FROZEN(31 downto 16); -- last input word contains 2 bytes
|
||||
elsif(DATA1_VALID(4) = '0') then
|
||||
DATA2 <= x"0000000000" & CRC12_FROZEN(31 downto 8); -- last input word contains 3 bytes
|
||||
elsif(DATA1_VALID(3) = '0') then
|
||||
DATA2 <= x"00000000" & CRC12_FROZEN(31 downto 0);
|
||||
elsif(DATA1_VALID(2) = '0') then
|
||||
DATA2 <= x"000000" & CRC12_FROZEN(31 downto 0) & x"00";
|
||||
elsif(DATA1_VALID(1) = '0') then
|
||||
DATA2 <= x"0000" & CRC12_FROZEN(31 downto 0) & x"0000";
|
||||
elsif(DATA1_VALID(0) = '0') then
|
||||
DATA2 <= x"00" & CRC12_FROZEN(31 downto 0) & x"000000";
|
||||
else
|
||||
DATA2 <= CRC12_FROZEN(31 downto 0) & x"00000000";
|
||||
end if;
|
||||
end process;
|
||||
|
||||
DATA12 <= DATA1 xor DATA2;
|
||||
|
||||
|
||||
CRC3_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SAMPLE1_CLK = '1') then
|
||||
if(DATA1_VALID(7) = '0') then
|
||||
CRC3 <= (others => '0');
|
||||
elsif(DATA1_VALID(6) = '0') then
|
||||
CRC3 <= CRC12_FROZEN(23 downto 0) & x"00"; -- last input word contains 1 byte
|
||||
elsif(DATA1_VALID(5) = '0') then
|
||||
CRC3 <= CRC12_FROZEN(15 downto 0) & x"0000"; -- last input word contains 2 bytes
|
||||
elsif(DATA1_VALID(4) = '0') then
|
||||
CRC3 <= CRC12_FROZEN(7 downto 0) & x"000000"; -- last input word contains 3 bytes
|
||||
else
|
||||
CRC3 <= (others => '0');
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- outputs
|
||||
CRC_OUT <= CRC12_FROZEN xor CRC3;
|
||||
SAMPLE_CLK_OUT <= SAMPLE1_CLK_D;
|
||||
|
||||
end Behavioral;
|
||||
118
generic_ip/third_party_ip/mac/src/crc32_lut1.vhd
Normal file
118
generic_ip/third_party_ip/mac/src/crc32_lut1.vhd
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
-------------------------------------------------------------
|
||||
-- Filename: CRC32_LUT1.VHD
|
||||
-- Authors:
|
||||
-- Alain Zarembowitch / MSS
|
||||
-- Version: Rev 0
|
||||
-- Last modified: 2/25/18
|
||||
-- Inheritance: n/a
|
||||
--
|
||||
-- description: 32-bit CRC lookup table
|
||||
-- Actually comprised of 4 small (256 entries) tables, one for each input byte
|
||||
-- Data bit order: MSb of MSB is first sent/received
|
||||
-- Algorithm based on seminal paper "High Performance Table-Based Algorithm for Pipelined CRC Calculation",
|
||||
-- by Yan Sun and Min Sik Kim
|
||||
-- CRC_OUT only depends on DATA_IN. The algorithm is thus memoryless.
|
||||
-- Verified by comparing with the crc calculator at http://www.sunshine2k.de/coding/javascript/crc/crc_js.html
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity CRC32_LUT1 is
|
||||
Port (
|
||||
CLK : IN std_logic;
|
||||
DATA_IN: in std_logic_vector(31 downto 0);
|
||||
-- Natural order (as if input to a standard LFSR), i.e. not inverted, not reversed.
|
||||
-- order: MSb of MSB is first serialized bit
|
||||
SAMPLE_CLK_IN: in std_logic;
|
||||
-- read DATA_IN at the rising_edge of CLK when SAMPLE_CLK_IN = '1'
|
||||
CRC_OUT: out std_logic_vector(31 downto 0);
|
||||
-- Natural order (as if the flip-flop values of a standard LFSR), i.e. not inverted, not reversed.
|
||||
SAMPLE_CLK_OUT: out std_logic
|
||||
-- latency 1 CLK after SAMPLE_CLK_IN
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of CRC32_LUT1 is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
COMPONENT CRC32_LUT1ab
|
||||
GENERIC (
|
||||
DATA_WIDTH: integer;
|
||||
ADDR_WIDTH: integer
|
||||
);
|
||||
PORT(
|
||||
ADDRA : IN std_logic_vector(8 downto 0);
|
||||
ADDRB : IN std_logic_vector(8 downto 0);
|
||||
DOA : OUT std_logic_vector(31 downto 0);
|
||||
DOB : OUT std_logic_vector(31 downto 0)
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
COMPONENT CRC32_LUT1cd
|
||||
GENERIC (
|
||||
DATA_WIDTH: integer;
|
||||
ADDR_WIDTH: integer
|
||||
);
|
||||
PORT(
|
||||
ADDRA : IN std_logic_vector(8 downto 0);
|
||||
ADDRB : IN std_logic_vector(8 downto 0);
|
||||
DOA : OUT std_logic_vector(31 downto 0);
|
||||
DOB : OUT std_logic_vector(31 downto 0)
|
||||
);
|
||||
END COMPONENT;
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
signal ADDR0: std_logic_vector(8 downto 0) := (others => '0');
|
||||
signal ADDR1: std_logic_vector(8 downto 0) := (others => '0');
|
||||
signal ADDR2: std_logic_vector(8 downto 0) := (others => '0');
|
||||
signal ADDR3: std_logic_vector(8 downto 0) := (others => '0');
|
||||
signal CRC0: std_logic_vector(31 downto 0) := (others => '0');
|
||||
signal CRC1: std_logic_vector(31 downto 0) := (others => '0');
|
||||
signal CRC2: std_logic_vector(31 downto 0) := (others => '0');
|
||||
signal CRC3: std_logic_vector(31 downto 0) := (others => '0');
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
-- input bytes 0(A-side) and 1 (B-side)
|
||||
-- Latency: 0 CLK after
|
||||
ADDR0 <= '0' & DATA_IN(7 downto 0); -- order: LSB (last received)
|
||||
ADDR1 <= '1' & DATA_IN(15 downto 8);
|
||||
CRC32_LUT1ab_001: CRC32_LUT1ab
|
||||
GENERIC MAP(
|
||||
DATA_WIDTH => 32,
|
||||
ADDR_WIDTH => 9)
|
||||
PORT MAP(
|
||||
ADDRA => ADDR0,
|
||||
DOA => CRC0,
|
||||
ADDRB => ADDR1,
|
||||
DOB => CRC1
|
||||
);
|
||||
|
||||
ADDR2 <= '0' & DATA_IN(23 downto 16);
|
||||
ADDR3 <= '1' & DATA_IN(31 downto 24); -- order: MSb of MSB received first
|
||||
CRC32_LUT1cd_001: CRC32_LUT1cd
|
||||
GENERIC MAP(
|
||||
DATA_WIDTH => 32,
|
||||
ADDR_WIDTH => 9)
|
||||
PORT MAP(
|
||||
ADDRA => ADDR2,
|
||||
DOA => CRC2,
|
||||
ADDRB => ADDR3,
|
||||
DOB => CRC3
|
||||
);
|
||||
|
||||
|
||||
RECLOCK_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
CRC_OUT <= CRC0 xor CRC1 xor CRC2 xor CRC3;
|
||||
SAMPLE_CLK_OUT <= SAMPLE_CLK_IN;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
end Behavioral;
|
||||
134
generic_ip/third_party_ip/mac/src/crc32_lut1ab.vhd
Normal file
134
generic_ip/third_party_ip/mac/src/crc32_lut1ab.vhd
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
-------------------------------------------------------------
|
||||
-- Filename: CRC32_LUT1ab.VHD
|
||||
-- Authors:
|
||||
-- from http://www.xilinx.com/support/documentation/sw_manuals/xilinx14_4/xst_v6s6.pdf p262
|
||||
-- Alain Zarembowitch / MSS
|
||||
-- Version: Rev 0
|
||||
-- Last modified: 12/13/17
|
||||
-- Inheritance: ROM1.vhd 8/24/16
|
||||
--
|
||||
-- description: synthesizable generic dual port ROM containing two tables of 256 CRC32s values each
|
||||
-- (called LUT1a and LUT1b)
|
||||
-- The tables are generated by the Java application crc32tables in the /java folder
|
||||
-- LUT1a computes the CRC32s for inputs in the form 00 00 00 x, where x is the LSB (last received byte)
|
||||
-- LUT1b computes the CRC32s for inputs in the form 00 00 x 00
|
||||
-- Data bit order: MSb of MSB is first sent/received
|
||||
-- Note: the returned crc values are NOT inverted and NOT reflected left-right. They are as they would appear
|
||||
-- when generated by a standard LFSR
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity CRC32_LUT1ab is
|
||||
Generic (
|
||||
DATA_WIDTH: integer := 32;
|
||||
ADDR_WIDTH: integer := 9
|
||||
);
|
||||
Port (
|
||||
-- Port A
|
||||
ADDRA : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
-- LUT1a at addresses 0 - 255
|
||||
-- LUT1b at addresses 256 - 511
|
||||
DOA : out std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
|
||||
-- Port B
|
||||
ADDRB : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
-- LUT1a at addresses 0 - 255
|
||||
-- LUT1b at addresses 256 - 511
|
||||
DOB : out std_logic_vector(DATA_WIDTH-1 downto 0)
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of CRC32_LUT1ab is
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
-- inferred rom
|
||||
signal DOA_local: std_logic_vector(DATA_WIDTH-1 downto 0) := (others => '0');
|
||||
signal DOB_local: std_logic_vector(DATA_WIDTH-1 downto 0) := (others => '0');
|
||||
type ROM_TYPE is array ( (2**ADDR_WIDTH)-1 downto 0 ) of std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
-- IMPORTANT ORDER INFORMATION: the table below is read from bottom to top and right to left. Thus
|
||||
-- to restore a common-sense order, address bits are inverted.
|
||||
constant ROM : ROM_TYPE := (
|
||||
-- LUT1a
|
||||
x"00000000", x"04C11DB7", x"09823B6E", x"0D4326D9", x"130476DC", x"17C56B6B", x"1A864DB2", x"1E475005",
|
||||
x"2608EDB8", x"22C9F00F", x"2F8AD6D6", x"2B4BCB61", x"350C9B64", x"31CD86D3", x"3C8EA00A", x"384FBDBD",
|
||||
x"4C11DB70", x"48D0C6C7", x"4593E01E", x"4152FDA9", x"5F15ADAC", x"5BD4B01B", x"569796C2", x"52568B75",
|
||||
x"6A1936C8", x"6ED82B7F", x"639B0DA6", x"675A1011", x"791D4014", x"7DDC5DA3", x"709F7B7A", x"745E66CD",
|
||||
x"9823B6E0", x"9CE2AB57", x"91A18D8E", x"95609039", x"8B27C03C", x"8FE6DD8B", x"82A5FB52", x"8664E6E5",
|
||||
x"BE2B5B58", x"BAEA46EF", x"B7A96036", x"B3687D81", x"AD2F2D84", x"A9EE3033", x"A4AD16EA", x"A06C0B5D",
|
||||
x"D4326D90", x"D0F37027", x"DDB056FE", x"D9714B49", x"C7361B4C", x"C3F706FB", x"CEB42022", x"CA753D95",
|
||||
x"F23A8028", x"F6FB9D9F", x"FBB8BB46", x"FF79A6F1", x"E13EF6F4", x"E5FFEB43", x"E8BCCD9A", x"EC7DD02D",
|
||||
x"34867077", x"30476DC0", x"3D044B19", x"39C556AE", x"278206AB", x"23431B1C", x"2E003DC5", x"2AC12072",
|
||||
x"128E9DCF", x"164F8078", x"1B0CA6A1", x"1FCDBB16", x"018AEB13", x"054BF6A4", x"0808D07D", x"0CC9CDCA",
|
||||
x"7897AB07", x"7C56B6B0", x"71159069", x"75D48DDE", x"6B93DDDB", x"6F52C06C", x"6211E6B5", x"66D0FB02",
|
||||
x"5E9F46BF", x"5A5E5B08", x"571D7DD1", x"53DC6066", x"4D9B3063", x"495A2DD4", x"44190B0D", x"40D816BA",
|
||||
x"ACA5C697", x"A864DB20", x"A527FDF9", x"A1E6E04E", x"BFA1B04B", x"BB60ADFC", x"B6238B25", x"B2E29692",
|
||||
x"8AAD2B2F", x"8E6C3698", x"832F1041", x"87EE0DF6", x"99A95DF3", x"9D684044", x"902B669D", x"94EA7B2A",
|
||||
x"E0B41DE7", x"E4750050", x"E9362689", x"EDF73B3E", x"F3B06B3B", x"F771768C", x"FA325055", x"FEF34DE2",
|
||||
x"C6BCF05F", x"C27DEDE8", x"CF3ECB31", x"CBFFD686", x"D5B88683", x"D1799B34", x"DC3ABDED", x"D8FBA05A",
|
||||
x"690CE0EE", x"6DCDFD59", x"608EDB80", x"644FC637", x"7A089632", x"7EC98B85", x"738AAD5C", x"774BB0EB",
|
||||
x"4F040D56", x"4BC510E1", x"46863638", x"42472B8F", x"5C007B8A", x"58C1663D", x"558240E4", x"51435D53",
|
||||
x"251D3B9E", x"21DC2629", x"2C9F00F0", x"285E1D47", x"36194D42", x"32D850F5", x"3F9B762C", x"3B5A6B9B",
|
||||
x"0315D626", x"07D4CB91", x"0A97ED48", x"0E56F0FF", x"1011A0FA", x"14D0BD4D", x"19939B94", x"1D528623",
|
||||
x"F12F560E", x"F5EE4BB9", x"F8AD6D60", x"FC6C70D7", x"E22B20D2", x"E6EA3D65", x"EBA91BBC", x"EF68060B",
|
||||
x"D727BBB6", x"D3E6A601", x"DEA580D8", x"DA649D6F", x"C423CD6A", x"C0E2D0DD", x"CDA1F604", x"C960EBB3",
|
||||
x"BD3E8D7E", x"B9FF90C9", x"B4BCB610", x"B07DABA7", x"AE3AFBA2", x"AAFBE615", x"A7B8C0CC", x"A379DD7B",
|
||||
x"9B3660C6", x"9FF77D71", x"92B45BA8", x"9675461F", x"8832161A", x"8CF30BAD", x"81B02D74", x"857130C3",
|
||||
x"5D8A9099", x"594B8D2E", x"5408ABF7", x"50C9B640", x"4E8EE645", x"4A4FFBF2", x"470CDD2B", x"43CDC09C",
|
||||
x"7B827D21", x"7F436096", x"7200464F", x"76C15BF8", x"68860BFD", x"6C47164A", x"61043093", x"65C52D24",
|
||||
x"119B4BE9", x"155A565E", x"18197087", x"1CD86D30", x"029F3D35", x"065E2082", x"0B1D065B", x"0FDC1BEC",
|
||||
x"3793A651", x"3352BBE6", x"3E119D3F", x"3AD08088", x"2497D08D", x"2056CD3A", x"2D15EBE3", x"29D4F654",
|
||||
x"C5A92679", x"C1683BCE", x"CC2B1D17", x"C8EA00A0", x"D6AD50A5", x"D26C4D12", x"DF2F6BCB", x"DBEE767C",
|
||||
x"E3A1CBC1", x"E760D676", x"EA23F0AF", x"EEE2ED18", x"F0A5BD1D", x"F464A0AA", x"F9278673", x"FDE69BC4",
|
||||
x"89B8FD09", x"8D79E0BE", x"803AC667", x"84FBDBD0", x"9ABC8BD5", x"9E7D9662", x"933EB0BB", x"97FFAD0C",
|
||||
x"AFB010B1", x"AB710D06", x"A6322BDF", x"A2F33668", x"BCB4666D", x"B8757BDA", x"B5365D03", x"B1F740B4",
|
||||
-- LUT1b
|
||||
x"00000000", x"D219C1DC", x"A0F29E0F", x"72EB5FD3", x"452421A9", x"973DE075", x"E5D6BFA6", x"37CF7E7A",
|
||||
x"8A484352", x"5851828E", x"2ABADD5D", x"F8A31C81", x"CF6C62FB", x"1D75A327", x"6F9EFCF4", x"BD873D28",
|
||||
x"10519B13", x"C2485ACF", x"B0A3051C", x"62BAC4C0", x"5575BABA", x"876C7B66", x"F58724B5", x"279EE569",
|
||||
x"9A19D841", x"4800199D", x"3AEB464E", x"E8F28792", x"DF3DF9E8", x"0D243834", x"7FCF67E7", x"ADD6A63B",
|
||||
x"20A33626", x"F2BAF7FA", x"8051A829", x"524869F5", x"6587178F", x"B79ED653", x"C5758980", x"176C485C",
|
||||
x"AAEB7574", x"78F2B4A8", x"0A19EB7B", x"D8002AA7", x"EFCF54DD", x"3DD69501", x"4F3DCAD2", x"9D240B0E",
|
||||
x"30F2AD35", x"E2EB6CE9", x"9000333A", x"4219F2E6", x"75D68C9C", x"A7CF4D40", x"D5241293", x"073DD34F",
|
||||
x"BABAEE67", x"68A32FBB", x"1A487068", x"C851B1B4", x"FF9ECFCE", x"2D870E12", x"5F6C51C1", x"8D75901D",
|
||||
x"41466C4C", x"935FAD90", x"E1B4F243", x"33AD339F", x"04624DE5", x"D67B8C39", x"A490D3EA", x"76891236",
|
||||
x"CB0E2F1E", x"1917EEC2", x"6BFCB111", x"B9E570CD", x"8E2A0EB7", x"5C33CF6B", x"2ED890B8", x"FCC15164",
|
||||
x"5117F75F", x"830E3683", x"F1E56950", x"23FCA88C", x"1433D6F6", x"C62A172A", x"B4C148F9", x"66D88925",
|
||||
x"DB5FB40D", x"094675D1", x"7BAD2A02", x"A9B4EBDE", x"9E7B95A4", x"4C625478", x"3E890BAB", x"EC90CA77",
|
||||
x"61E55A6A", x"B3FC9BB6", x"C117C465", x"130E05B9", x"24C17BC3", x"F6D8BA1F", x"8433E5CC", x"562A2410",
|
||||
x"EBAD1938", x"39B4D8E4", x"4B5F8737", x"994646EB", x"AE893891", x"7C90F94D", x"0E7BA69E", x"DC626742",
|
||||
x"71B4C179", x"A3AD00A5", x"D1465F76", x"035F9EAA", x"3490E0D0", x"E689210C", x"94627EDF", x"467BBF03",
|
||||
x"FBFC822B", x"29E543F7", x"5B0E1C24", x"8917DDF8", x"BED8A382", x"6CC1625E", x"1E2A3D8D", x"CC33FC51",
|
||||
x"828CD898", x"50951944", x"227E4697", x"F067874B", x"C7A8F931", x"15B138ED", x"675A673E", x"B543A6E2",
|
||||
x"08C49BCA", x"DADD5A16", x"A83605C5", x"7A2FC419", x"4DE0BA63", x"9FF97BBF", x"ED12246C", x"3F0BE5B0",
|
||||
x"92DD438B", x"40C48257", x"322FDD84", x"E0361C58", x"D7F96222", x"05E0A3FE", x"770BFC2D", x"A5123DF1",
|
||||
x"189500D9", x"CA8CC105", x"B8679ED6", x"6A7E5F0A", x"5DB12170", x"8FA8E0AC", x"FD43BF7F", x"2F5A7EA3",
|
||||
x"A22FEEBE", x"70362F62", x"02DD70B1", x"D0C4B16D", x"E70BCF17", x"35120ECB", x"47F95118", x"95E090C4",
|
||||
x"2867ADEC", x"FA7E6C30", x"889533E3", x"5A8CF23F", x"6D438C45", x"BF5A4D99", x"CDB1124A", x"1FA8D396",
|
||||
x"B27E75AD", x"6067B471", x"128CEBA2", x"C0952A7E", x"F75A5404", x"254395D8", x"57A8CA0B", x"85B10BD7",
|
||||
x"383636FF", x"EA2FF723", x"98C4A8F0", x"4ADD692C", x"7D121756", x"AF0BD68A", x"DDE08959", x"0FF94885",
|
||||
x"C3CAB4D4", x"11D37508", x"63382ADB", x"B121EB07", x"86EE957D", x"54F754A1", x"261C0B72", x"F405CAAE",
|
||||
x"4982F786", x"9B9B365A", x"E9706989", x"3B69A855", x"0CA6D62F", x"DEBF17F3", x"AC544820", x"7E4D89FC",
|
||||
x"D39B2FC7", x"0182EE1B", x"7369B1C8", x"A1707014", x"96BF0E6E", x"44A6CFB2", x"364D9061", x"E45451BD",
|
||||
x"59D36C95", x"8BCAAD49", x"F921F29A", x"2B383346", x"1CF74D3C", x"CEEE8CE0", x"BC05D333", x"6E1C12EF",
|
||||
x"E36982F2", x"3170432E", x"439B1CFD", x"9182DD21", x"A64DA35B", x"74546287", x"06BF3D54", x"D4A6FC88",
|
||||
x"6921C1A0", x"BB38007C", x"C9D35FAF", x"1BCA9E73", x"2C05E009", x"FE1C21D5", x"8CF77E06", x"5EEEBFDA",
|
||||
x"F33819E1", x"2121D83D", x"53CA87EE", x"81D34632", x"B61C3848", x"6405F994", x"16EEA647", x"C4F7679B",
|
||||
x"79705AB3", x"AB699B6F", x"D982C4BC", x"0B9B0560", x"3C547B1A", x"EE4DBAC6", x"9CA6E515", x"4EBF24C9"
|
||||
);
|
||||
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
-- Port A read
|
||||
DOA <= ROM(to_integer(unsigned(not ADDRA))); -- see IMPORTANT ORDER INFORMATION above
|
||||
|
||||
|
||||
-- Port B read
|
||||
DOB <= ROM(to_integer(unsigned(not ADDRB))); -- see IMPORTANT ORDER INFORMATION above
|
||||
|
||||
end Behavioral;
|
||||
134
generic_ip/third_party_ip/mac/src/crc32_lut1cd.vhd
Normal file
134
generic_ip/third_party_ip/mac/src/crc32_lut1cd.vhd
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
-------------------------------------------------------------
|
||||
-- Filename: CRC32_LUT1cd.VHD
|
||||
-- Authors:
|
||||
-- from http://www.xilinx.com/support/documentation/sw_manuals/xilinx14_4/xst_v6s6.pdf p262
|
||||
-- Alain Zarembowitch / MSS
|
||||
-- Version: Rev 0
|
||||
-- Last modified: 12/13/17
|
||||
-- Inheritance: ROM1.vhd 8/24/16
|
||||
--
|
||||
-- description: synthesizable generic dual port ROM containing two tables of 256 CRC32s values each
|
||||
-- (called LUT1c and LUT1d)
|
||||
-- The tables are generated by the Java application crc32tables in the /java folder
|
||||
-- LUT1c computes the CRC32s for inputs in the form 00 x 00 00
|
||||
-- LUT1d computes the CRC32s for inputs in the form y 00 00 00, where y is the MSB
|
||||
-- Data bit order: MSb of MSB is first sent/received
|
||||
-- Note: the returned crc values are NOT inverted and NOT reflected left-right. They are as they would appear
|
||||
-- when generated by a standard LFSR
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity CRC32_LUT1cd is
|
||||
Generic (
|
||||
DATA_WIDTH: integer := 32;
|
||||
ADDR_WIDTH: integer := 9
|
||||
);
|
||||
Port (
|
||||
-- Port A
|
||||
ADDRA : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
-- LUT1c at addresses 0 - 255
|
||||
-- LUT1d at addresses 256 - 511
|
||||
DOA : out std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
|
||||
-- Port B
|
||||
ADDRB : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
-- LUT1c at addresses 0 - 255
|
||||
-- LUT1d at addresses 256 - 511
|
||||
DOB : out std_logic_vector(DATA_WIDTH-1 downto 0)
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of CRC32_LUT1cd is
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
-- inferred rom
|
||||
signal DOA_local: std_logic_vector(DATA_WIDTH-1 downto 0) := (others => '0');
|
||||
signal DOB_local: std_logic_vector(DATA_WIDTH-1 downto 0) := (others => '0');
|
||||
type ROM_TYPE is array ( (2**ADDR_WIDTH)-1 downto 0 ) of std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
-- IMPORTANT ORDER INFORMATION: the table below is read from bottom to top and right to left. Thus
|
||||
-- to restore a common-sense order, address bits are inverted.
|
||||
constant ROM : ROM_TYPE := (
|
||||
-- LUT1c
|
||||
x"00000000", x"01D8AC87", x"03B1590E", x"0269F589", x"0762B21C", x"06BA1E9B", x"04D3EB12", x"050B4795",
|
||||
x"0EC56438", x"0F1DC8BF", x"0D743D36", x"0CAC91B1", x"09A7D624", x"087F7AA3", x"0A168F2A", x"0BCE23AD",
|
||||
x"1D8AC870", x"1C5264F7", x"1E3B917E", x"1FE33DF9", x"1AE87A6C", x"1B30D6EB", x"19592362", x"18818FE5",
|
||||
x"134FAC48", x"129700CF", x"10FEF546", x"112659C1", x"142D1E54", x"15F5B2D3", x"179C475A", x"1644EBDD",
|
||||
x"3B1590E0", x"3ACD3C67", x"38A4C9EE", x"397C6569", x"3C7722FC", x"3DAF8E7B", x"3FC67BF2", x"3E1ED775",
|
||||
x"35D0F4D8", x"3408585F", x"3661ADD6", x"37B90151", x"32B246C4", x"336AEA43", x"31031FCA", x"30DBB34D",
|
||||
x"269F5890", x"2747F417", x"252E019E", x"24F6AD19", x"21FDEA8C", x"2025460B", x"224CB382", x"23941F05",
|
||||
x"285A3CA8", x"2982902F", x"2BEB65A6", x"2A33C921", x"2F388EB4", x"2EE02233", x"2C89D7BA", x"2D517B3D",
|
||||
x"762B21C0", x"77F38D47", x"759A78CE", x"7442D449", x"714993DC", x"70913F5B", x"72F8CAD2", x"73206655",
|
||||
x"78EE45F8", x"7936E97F", x"7B5F1CF6", x"7A87B071", x"7F8CF7E4", x"7E545B63", x"7C3DAEEA", x"7DE5026D",
|
||||
x"6BA1E9B0", x"6A794537", x"6810B0BE", x"69C81C39", x"6CC35BAC", x"6D1BF72B", x"6F7202A2", x"6EAAAE25",
|
||||
x"65648D88", x"64BC210F", x"66D5D486", x"670D7801", x"62063F94", x"63DE9313", x"61B7669A", x"606FCA1D",
|
||||
x"4D3EB120", x"4CE61DA7", x"4E8FE82E", x"4F5744A9", x"4A5C033C", x"4B84AFBB", x"49ED5A32", x"4835F6B5",
|
||||
x"43FBD518", x"4223799F", x"404A8C16", x"41922091", x"44996704", x"4541CB83", x"47283E0A", x"46F0928D",
|
||||
x"50B47950", x"516CD5D7", x"5305205E", x"52DD8CD9", x"57D6CB4C", x"560E67CB", x"54679242", x"55BF3EC5",
|
||||
x"5E711D68", x"5FA9B1EF", x"5DC04466", x"5C18E8E1", x"5913AF74", x"58CB03F3", x"5AA2F67A", x"5B7A5AFD",
|
||||
x"EC564380", x"ED8EEF07", x"EFE71A8E", x"EE3FB609", x"EB34F19C", x"EAEC5D1B", x"E885A892", x"E95D0415",
|
||||
x"E29327B8", x"E34B8B3F", x"E1227EB6", x"E0FAD231", x"E5F195A4", x"E4293923", x"E640CCAA", x"E798602D",
|
||||
x"F1DC8BF0", x"F0042777", x"F26DD2FE", x"F3B57E79", x"F6BE39EC", x"F766956B", x"F50F60E2", x"F4D7CC65",
|
||||
x"FF19EFC8", x"FEC1434F", x"FCA8B6C6", x"FD701A41", x"F87B5DD4", x"F9A3F153", x"FBCA04DA", x"FA12A85D",
|
||||
x"D743D360", x"D69B7FE7", x"D4F28A6E", x"D52A26E9", x"D021617C", x"D1F9CDFB", x"D3903872", x"D24894F5",
|
||||
x"D986B758", x"D85E1BDF", x"DA37EE56", x"DBEF42D1", x"DEE40544", x"DF3CA9C3", x"DD555C4A", x"DC8DF0CD",
|
||||
x"CAC91B10", x"CB11B797", x"C978421E", x"C8A0EE99", x"CDABA90C", x"CC73058B", x"CE1AF002", x"CFC25C85",
|
||||
x"C40C7F28", x"C5D4D3AF", x"C7BD2626", x"C6658AA1", x"C36ECD34", x"C2B661B3", x"C0DF943A", x"C10738BD",
|
||||
x"9A7D6240", x"9BA5CEC7", x"99CC3B4E", x"981497C9", x"9D1FD05C", x"9CC77CDB", x"9EAE8952", x"9F7625D5",
|
||||
x"94B80678", x"9560AAFF", x"97095F76", x"96D1F3F1", x"93DAB464", x"920218E3", x"906BED6A", x"91B341ED",
|
||||
x"87F7AA30", x"862F06B7", x"8446F33E", x"859E5FB9", x"8095182C", x"814DB4AB", x"83244122", x"82FCEDA5",
|
||||
x"8932CE08", x"88EA628F", x"8A839706", x"8B5B3B81", x"8E507C14", x"8F88D093", x"8DE1251A", x"8C39899D",
|
||||
x"A168F2A0", x"A0B05E27", x"A2D9ABAE", x"A3010729", x"A60A40BC", x"A7D2EC3B", x"A5BB19B2", x"A463B535",
|
||||
x"AFAD9698", x"AE753A1F", x"AC1CCF96", x"ADC46311", x"A8CF2484", x"A9178803", x"AB7E7D8A", x"AAA6D10D",
|
||||
x"BCE23AD0", x"BD3A9657", x"BF5363DE", x"BE8BCF59", x"BB8088CC", x"BA58244B", x"B831D1C2", x"B9E97D45",
|
||||
x"B2275EE8", x"B3FFF26F", x"B19607E6", x"B04EAB61", x"B545ECF4", x"B49D4073", x"B6F4B5FA", x"B72C197D",
|
||||
-- LUT1d
|
||||
x"00000000", x"DC6D9AB7", x"BC1A28D9", x"6077B26E", x"7CF54C05", x"A098D6B2", x"C0EF64DC", x"1C82FE6B",
|
||||
x"F9EA980A", x"258702BD", x"45F0B0D3", x"999D2A64", x"851FD40F", x"59724EB8", x"3905FCD6", x"E5686661",
|
||||
x"F7142DA3", x"2B79B714", x"4B0E057A", x"97639FCD", x"8BE161A6", x"578CFB11", x"37FB497F", x"EB96D3C8",
|
||||
x"0EFEB5A9", x"D2932F1E", x"B2E49D70", x"6E8907C7", x"720BF9AC", x"AE66631B", x"CE11D175", x"127C4BC2",
|
||||
x"EAE946F1", x"3684DC46", x"56F36E28", x"8A9EF49F", x"961C0AF4", x"4A719043", x"2A06222D", x"F66BB89A",
|
||||
x"1303DEFB", x"CF6E444C", x"AF19F622", x"73746C95", x"6FF692FE", x"B39B0849", x"D3ECBA27", x"0F812090",
|
||||
x"1DFD6B52", x"C190F1E5", x"A1E7438B", x"7D8AD93C", x"61082757", x"BD65BDE0", x"DD120F8E", x"017F9539",
|
||||
x"E417F358", x"387A69EF", x"580DDB81", x"84604136", x"98E2BF5D", x"448F25EA", x"24F89784", x"F8950D33",
|
||||
x"D1139055", x"0D7E0AE2", x"6D09B88C", x"B164223B", x"ADE6DC50", x"718B46E7", x"11FCF489", x"CD916E3E",
|
||||
x"28F9085F", x"F49492E8", x"94E32086", x"488EBA31", x"540C445A", x"8861DEED", x"E8166C83", x"347BF634",
|
||||
x"2607BDF6", x"FA6A2741", x"9A1D952F", x"46700F98", x"5AF2F1F3", x"869F6B44", x"E6E8D92A", x"3A85439D",
|
||||
x"DFED25FC", x"0380BF4B", x"63F70D25", x"BF9A9792", x"A31869F9", x"7F75F34E", x"1F024120", x"C36FDB97",
|
||||
x"3BFAD6A4", x"E7974C13", x"87E0FE7D", x"5B8D64CA", x"470F9AA1", x"9B620016", x"FB15B278", x"277828CF",
|
||||
x"C2104EAE", x"1E7DD419", x"7E0A6677", x"A267FCC0", x"BEE502AB", x"6288981C", x"02FF2A72", x"DE92B0C5",
|
||||
x"CCEEFB07", x"108361B0", x"70F4D3DE", x"AC994969", x"B01BB702", x"6C762DB5", x"0C019FDB", x"D06C056C",
|
||||
x"3504630D", x"E969F9BA", x"891E4BD4", x"5573D163", x"49F12F08", x"959CB5BF", x"F5EB07D1", x"29869D66",
|
||||
x"A6E63D1D", x"7A8BA7AA", x"1AFC15C4", x"C6918F73", x"DA137118", x"067EEBAF", x"660959C1", x"BA64C376",
|
||||
x"5F0CA517", x"83613FA0", x"E3168DCE", x"3F7B1779", x"23F9E912", x"FF9473A5", x"9FE3C1CB", x"438E5B7C",
|
||||
x"51F210BE", x"8D9F8A09", x"EDE83867", x"3185A2D0", x"2D075CBB", x"F16AC60C", x"911D7462", x"4D70EED5",
|
||||
x"A81888B4", x"74751203", x"1402A06D", x"C86F3ADA", x"D4EDC4B1", x"08805E06", x"68F7EC68", x"B49A76DF",
|
||||
x"4C0F7BEC", x"9062E15B", x"F0155335", x"2C78C982", x"30FA37E9", x"EC97AD5E", x"8CE01F30", x"508D8587",
|
||||
x"B5E5E3E6", x"69887951", x"09FFCB3F", x"D5925188", x"C910AFE3", x"157D3554", x"750A873A", x"A9671D8D",
|
||||
x"BB1B564F", x"6776CCF8", x"07017E96", x"DB6CE421", x"C7EE1A4A", x"1B8380FD", x"7BF43293", x"A799A824",
|
||||
x"42F1CE45", x"9E9C54F2", x"FEEBE69C", x"22867C2B", x"3E048240", x"E26918F7", x"821EAA99", x"5E73302E",
|
||||
x"77F5AD48", x"AB9837FF", x"CBEF8591", x"17821F26", x"0B00E14D", x"D76D7BFA", x"B71AC994", x"6B775323",
|
||||
x"8E1F3542", x"5272AFF5", x"32051D9B", x"EE68872C", x"F2EA7947", x"2E87E3F0", x"4EF0519E", x"929DCB29",
|
||||
x"80E180EB", x"5C8C1A5C", x"3CFBA832", x"E0963285", x"FC14CCEE", x"20795659", x"400EE437", x"9C637E80",
|
||||
x"790B18E1", x"A5668256", x"C5113038", x"197CAA8F", x"05FE54E4", x"D993CE53", x"B9E47C3D", x"6589E68A",
|
||||
x"9D1CEBB9", x"4171710E", x"2106C360", x"FD6B59D7", x"E1E9A7BC", x"3D843D0B", x"5DF38F65", x"819E15D2",
|
||||
x"64F673B3", x"B89BE904", x"D8EC5B6A", x"0481C1DD", x"18033FB6", x"C46EA501", x"A419176F", x"78748DD8",
|
||||
x"6A08C61A", x"B6655CAD", x"D612EEC3", x"0A7F7474", x"16FD8A1F", x"CA9010A8", x"AAE7A2C6", x"768A3871",
|
||||
x"93E25E10", x"4F8FC4A7", x"2FF876C9", x"F395EC7E", x"EF171215", x"337A88A2", x"530D3ACC", x"8F60A07B"
|
||||
);
|
||||
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
-- Port A read
|
||||
DOA <= ROM(to_integer(unsigned(not ADDRA))); -- see IMPORTANT ORDER INFORMATION above
|
||||
|
||||
|
||||
-- Port B read
|
||||
DOB <= ROM(to_integer(unsigned(not ADDRB))); -- see IMPORTANT ORDER INFORMATION above
|
||||
|
||||
end Behavioral;
|
||||
118
generic_ip/third_party_ip/mac/src/crc32_lut2.vhd
Normal file
118
generic_ip/third_party_ip/mac/src/crc32_lut2.vhd
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
-------------------------------------------------------------
|
||||
-- Filename: CRC32_LUT2.VHD
|
||||
-- Authors:
|
||||
-- Alain Zarembowitch / MSS
|
||||
-- Version: Rev 0
|
||||
-- Last modified: 2/25/17
|
||||
-- Inheritance: n/a
|
||||
--
|
||||
-- description: 32-bit CRC lookup table for x^32.DATA_IN (in other words, the upper 32-bits of a 64-bit word)
|
||||
-- Actually comprised of 4 small (256 entries) tables, one for each input byte
|
||||
-- Data bit order: MSb of MSB is first sent/received
|
||||
-- Algorithm based on seminal paper "High Performance Table-Based Algorithm for Pipelined CRC Calculation",
|
||||
-- by Yan Sun and Min Sik Kim
|
||||
-- CRC_OUT only depends on DATA_IN. The algorithm is thus memoryless.
|
||||
-- Verified by comparing with the crc calculator at http://www.sunshine2k.de/coding/javascript/crc/crc_js.html
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity CRC32_LUT2 is
|
||||
Port (
|
||||
CLK : IN std_logic;
|
||||
DATA_IN: in std_logic_vector(31 downto 0);
|
||||
-- Natural order (as if input to a standard LFSR), i.e. not inverted, not reversed.
|
||||
-- order: MSb of MSB is first serialized bit
|
||||
SAMPLE_CLK_IN: in std_logic;
|
||||
-- read DATA_IN at the rising_edge of CLK when SAMPLE_CLK_IN = '1'
|
||||
CRC_OUT: out std_logic_vector(31 downto 0);
|
||||
-- Natural order (as if the flip-flop values of a standard LFSR), i.e. not inverted, not reversed.
|
||||
SAMPLE_CLK_OUT: out std_logic
|
||||
-- latency 1 CLK after SAMPLE_CLK_IN
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of CRC32_LUT2 is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
COMPONENT CRC32_LUT2ab
|
||||
GENERIC (
|
||||
DATA_WIDTH: integer;
|
||||
ADDR_WIDTH: integer
|
||||
);
|
||||
PORT(
|
||||
ADDRA : IN std_logic_vector(8 downto 0);
|
||||
ADDRB : IN std_logic_vector(8 downto 0);
|
||||
DOA : OUT std_logic_vector(31 downto 0);
|
||||
DOB : OUT std_logic_vector(31 downto 0)
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
COMPONENT CRC32_LUT2cd
|
||||
GENERIC (
|
||||
DATA_WIDTH: integer;
|
||||
ADDR_WIDTH: integer
|
||||
);
|
||||
PORT(
|
||||
ADDRA : IN std_logic_vector(8 downto 0);
|
||||
ADDRB : IN std_logic_vector(8 downto 0);
|
||||
DOA : OUT std_logic_vector(31 downto 0);
|
||||
DOB : OUT std_logic_vector(31 downto 0)
|
||||
);
|
||||
END COMPONENT;
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
signal ADDR0: std_logic_vector(8 downto 0) := (others => '0');
|
||||
signal ADDR1: std_logic_vector(8 downto 0) := (others => '0');
|
||||
signal ADDR2: std_logic_vector(8 downto 0) := (others => '0');
|
||||
signal ADDR3: std_logic_vector(8 downto 0) := (others => '0');
|
||||
signal CRC0: std_logic_vector(31 downto 0) := (others => '0');
|
||||
signal CRC1: std_logic_vector(31 downto 0) := (others => '0');
|
||||
signal CRC2: std_logic_vector(31 downto 0) := (others => '0');
|
||||
signal CRC3: std_logic_vector(31 downto 0) := (others => '0');
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
-- input bytes 0(A-side) and 1 (B-side)
|
||||
-- Latency: 0 CLK after
|
||||
ADDR0 <= '0' & DATA_IN(7 downto 0); -- order: LSB (last received)
|
||||
ADDR1 <= '1' & DATA_IN(15 downto 8);
|
||||
CRC32_LUT2ab_001: CRC32_LUT2ab
|
||||
GENERIC MAP(
|
||||
DATA_WIDTH => 32,
|
||||
ADDR_WIDTH => 9)
|
||||
PORT MAP(
|
||||
ADDRA => ADDR0,
|
||||
DOA => CRC0,
|
||||
ADDRB => ADDR1,
|
||||
DOB => CRC1
|
||||
);
|
||||
|
||||
ADDR2 <= '0' & DATA_IN(23 downto 16);
|
||||
ADDR3 <= '1' & DATA_IN(31 downto 24); -- order: MSb of MSB received first
|
||||
CRC32_LUT2cd_001: CRC32_LUT2cd
|
||||
GENERIC MAP(
|
||||
DATA_WIDTH => 32,
|
||||
ADDR_WIDTH => 9)
|
||||
PORT MAP(
|
||||
ADDRA => ADDR2,
|
||||
DOA => CRC2,
|
||||
ADDRB => ADDR3,
|
||||
DOB => CRC3
|
||||
);
|
||||
|
||||
|
||||
RECLOCK_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
CRC_OUT <= CRC0 xor CRC1 xor CRC2 xor CRC3;
|
||||
SAMPLE_CLK_OUT <= SAMPLE_CLK_IN;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
end Behavioral;
|
||||
134
generic_ip/third_party_ip/mac/src/crc32_lut2ab.vhd
Normal file
134
generic_ip/third_party_ip/mac/src/crc32_lut2ab.vhd
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
-------------------------------------------------------------
|
||||
-- Filename: CRC32_LUT2ab.VHD
|
||||
-- Authors:
|
||||
-- from http://www.xilinx.com/support/documentation/sw_manuals/xilinx14_4/xst_v6s6.pdf p262
|
||||
-- Alain Zarembowitch / MSS
|
||||
-- Version: Rev 0
|
||||
-- Last modified: 12/13/17
|
||||
-- Inheritance: ROM1.vhd 8/24/16
|
||||
--
|
||||
-- description: synthesizable generic dual port ROM containing two tables of 256 CRC32s values each
|
||||
-- (called LUT2a and LUT2b)
|
||||
-- The tables are generated by the Java application crc32tables in the /java folder
|
||||
-- LUT2a computes the CRC32s for 64-BIT INPUT WORDS in the form 00 00 00 x 00 00 00 00, where x is the LSB (last received byte)
|
||||
-- LUT2b computes the CRC32s for 64-BIT INPUT WORDS in the form 00 00 x 00 00 00 00 00
|
||||
-- Data bit order: MSb of MSB is first sent/received
|
||||
-- Note: the returned crc values are NOT inverted and NOT reflected left-right. They are as they would appear
|
||||
-- when generated by a standard LFSR
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity CRC32_LUT2ab is
|
||||
Generic (
|
||||
DATA_WIDTH: integer := 32;
|
||||
ADDR_WIDTH: integer := 9
|
||||
);
|
||||
Port (
|
||||
-- Port A
|
||||
ADDRA : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
-- LUT1a at addresses 0 - 255
|
||||
-- LUT1b at addresses 256 - 511
|
||||
DOA : out std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
|
||||
-- Port B
|
||||
ADDRB : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
-- LUT1a at addresses 0 - 255
|
||||
-- LUT1b at addresses 256 - 511
|
||||
DOB : out std_logic_vector(DATA_WIDTH-1 downto 0)
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of CRC32_LUT2ab is
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
-- inferred rom
|
||||
signal DOA_local: std_logic_vector(DATA_WIDTH-1 downto 0) := (others => '0');
|
||||
signal DOB_local: std_logic_vector(DATA_WIDTH-1 downto 0) := (others => '0');
|
||||
type ROM_TYPE is array ( (2**ADDR_WIDTH)-1 downto 0 ) of std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
-- IMPORTANT ORDER INFORMATION: the table below is read from bottom to top and right to left. Thus
|
||||
-- to restore a common-sense order, address bits are inverted.
|
||||
constant ROM : ROM_TYPE := (
|
||||
-- LUT2a
|
||||
x"00000000", x"490D678D", x"921ACF1A", x"DB17A897", x"20F48383", x"69F9E40E", x"B2EE4C99", x"FBE32B14",
|
||||
x"41E90706", x"08E4608B", x"D3F3C81C", x"9AFEAF91", x"611D8485", x"2810E308", x"F3074B9F", x"BA0A2C12",
|
||||
x"83D20E0C", x"CADF6981", x"11C8C116", x"58C5A69B", x"A3268D8F", x"EA2BEA02", x"313C4295", x"78312518",
|
||||
x"C23B090A", x"8B366E87", x"5021C610", x"192CA19D", x"E2CF8A89", x"ABC2ED04", x"70D54593", x"39D8221E",
|
||||
x"036501AF", x"4A686622", x"917FCEB5", x"D872A938", x"2391822C", x"6A9CE5A1", x"B18B4D36", x"F8862ABB",
|
||||
x"428C06A9", x"0B816124", x"D096C9B3", x"999BAE3E", x"6278852A", x"2B75E2A7", x"F0624A30", x"B96F2DBD",
|
||||
x"80B70FA3", x"C9BA682E", x"12ADC0B9", x"5BA0A734", x"A0438C20", x"E94EEBAD", x"3259433A", x"7B5424B7",
|
||||
x"C15E08A5", x"88536F28", x"5344C7BF", x"1A49A032", x"E1AA8B26", x"A8A7ECAB", x"73B0443C", x"3ABD23B1",
|
||||
x"06CA035E", x"4FC764D3", x"94D0CC44", x"DDDDABC9", x"263E80DD", x"6F33E750", x"B4244FC7", x"FD29284A",
|
||||
x"47230458", x"0E2E63D5", x"D539CB42", x"9C34ACCF", x"67D787DB", x"2EDAE056", x"F5CD48C1", x"BCC02F4C",
|
||||
x"85180D52", x"CC156ADF", x"1702C248", x"5E0FA5C5", x"A5EC8ED1", x"ECE1E95C", x"37F641CB", x"7EFB2646",
|
||||
x"C4F10A54", x"8DFC6DD9", x"56EBC54E", x"1FE6A2C3", x"E40589D7", x"AD08EE5A", x"761F46CD", x"3F122140",
|
||||
x"05AF02F1", x"4CA2657C", x"97B5CDEB", x"DEB8AA66", x"255B8172", x"6C56E6FF", x"B7414E68", x"FE4C29E5",
|
||||
x"444605F7", x"0D4B627A", x"D65CCAED", x"9F51AD60", x"64B28674", x"2DBFE1F9", x"F6A8496E", x"BFA52EE3",
|
||||
x"867D0CFD", x"CF706B70", x"1467C3E7", x"5D6AA46A", x"A6898F7E", x"EF84E8F3", x"34934064", x"7D9E27E9",
|
||||
x"C7940BFB", x"8E996C76", x"558EC4E1", x"1C83A36C", x"E7608878", x"AE6DEFF5", x"757A4762", x"3C7720EF",
|
||||
x"0D9406BC", x"44996131", x"9F8EC9A6", x"D683AE2B", x"2D60853F", x"646DE2B2", x"BF7A4A25", x"F6772DA8",
|
||||
x"4C7D01BA", x"05706637", x"DE67CEA0", x"976AA92D", x"6C898239", x"2584E5B4", x"FE934D23", x"B79E2AAE",
|
||||
x"8E4608B0", x"C74B6F3D", x"1C5CC7AA", x"5551A027", x"AEB28B33", x"E7BFECBE", x"3CA84429", x"75A523A4",
|
||||
x"CFAF0FB6", x"86A2683B", x"5DB5C0AC", x"14B8A721", x"EF5B8C35", x"A656EBB8", x"7D41432F", x"344C24A2",
|
||||
x"0EF10713", x"47FC609E", x"9CEBC809", x"D5E6AF84", x"2E058490", x"6708E31D", x"BC1F4B8A", x"F5122C07",
|
||||
x"4F180015", x"06156798", x"DD02CF0F", x"940FA882", x"6FEC8396", x"26E1E41B", x"FDF64C8C", x"B4FB2B01",
|
||||
x"8D23091F", x"C42E6E92", x"1F39C605", x"5634A188", x"ADD78A9C", x"E4DAED11", x"3FCD4586", x"76C0220B",
|
||||
x"CCCA0E19", x"85C76994", x"5ED0C103", x"17DDA68E", x"EC3E8D9A", x"A533EA17", x"7E244280", x"3729250D",
|
||||
x"0B5E05E2", x"4253626F", x"9944CAF8", x"D049AD75", x"2BAA8661", x"62A7E1EC", x"B9B0497B", x"F0BD2EF6",
|
||||
x"4AB702E4", x"03BA6569", x"D8ADCDFE", x"91A0AA73", x"6A438167", x"234EE6EA", x"F8594E7D", x"B15429F0",
|
||||
x"888C0BEE", x"C1816C63", x"1A96C4F4", x"539BA379", x"A878886D", x"E175EFE0", x"3A624777", x"736F20FA",
|
||||
x"C9650CE8", x"80686B65", x"5B7FC3F2", x"1272A47F", x"E9918F6B", x"A09CE8E6", x"7B8B4071", x"328627FC",
|
||||
x"083B044D", x"413663C0", x"9A21CB57", x"D32CACDA", x"28CF87CE", x"61C2E043", x"BAD548D4", x"F3D82F59",
|
||||
x"49D2034B", x"00DF64C6", x"DBC8CC51", x"92C5ABDC", x"692680C8", x"202BE745", x"FB3C4FD2", x"B231285F",
|
||||
x"8BE90A41", x"C2E46DCC", x"19F3C55B", x"50FEA2D6", x"AB1D89C2", x"E210EE4F", x"390746D8", x"700A2155",
|
||||
x"CA000D47", x"830D6ACA", x"581AC25D", x"1117A5D0", x"EAF48EC4", x"A3F9E949", x"78EE41DE", x"31E32653",
|
||||
-- LUT2b
|
||||
x"00000000", x"1B280D78", x"36501AF0", x"2D781788", x"6CA035E0", x"77883898", x"5AF02F10", x"41D82268",
|
||||
x"D9406BC0", x"C26866B8", x"EF107130", x"F4387C48", x"B5E05E20", x"AEC85358", x"83B044D0", x"989849A8",
|
||||
x"B641CA37", x"AD69C74F", x"8011D0C7", x"9B39DDBF", x"DAE1FFD7", x"C1C9F2AF", x"ECB1E527", x"F799E85F",
|
||||
x"6F01A1F7", x"7429AC8F", x"5951BB07", x"4279B67F", x"03A19417", x"1889996F", x"35F18EE7", x"2ED9839F",
|
||||
x"684289D9", x"736A84A1", x"5E129329", x"453A9E51", x"04E2BC39", x"1FCAB141", x"32B2A6C9", x"299AABB1",
|
||||
x"B102E219", x"AA2AEF61", x"8752F8E9", x"9C7AF591", x"DDA2D7F9", x"C68ADA81", x"EBF2CD09", x"F0DAC071",
|
||||
x"DE0343EE", x"C52B4E96", x"E853591E", x"F37B5466", x"B2A3760E", x"A98B7B76", x"84F36CFE", x"9FDB6186",
|
||||
x"0743282E", x"1C6B2556", x"311332DE", x"2A3B3FA6", x"6BE31DCE", x"70CB10B6", x"5DB3073E", x"469B0A46",
|
||||
x"D08513B2", x"CBAD1ECA", x"E6D50942", x"FDFD043A", x"BC252652", x"A70D2B2A", x"8A753CA2", x"915D31DA",
|
||||
x"09C57872", x"12ED750A", x"3F956282", x"24BD6FFA", x"65654D92", x"7E4D40EA", x"53355762", x"481D5A1A",
|
||||
x"66C4D985", x"7DECD4FD", x"5094C375", x"4BBCCE0D", x"0A64EC65", x"114CE11D", x"3C34F695", x"271CFBED",
|
||||
x"BF84B245", x"A4ACBF3D", x"89D4A8B5", x"92FCA5CD", x"D32487A5", x"C80C8ADD", x"E5749D55", x"FE5C902D",
|
||||
x"B8C79A6B", x"A3EF9713", x"8E97809B", x"95BF8DE3", x"D467AF8B", x"CF4FA2F3", x"E237B57B", x"F91FB803",
|
||||
x"6187F1AB", x"7AAFFCD3", x"57D7EB5B", x"4CFFE623", x"0D27C44B", x"160FC933", x"3B77DEBB", x"205FD3C3",
|
||||
x"0E86505C", x"15AE5D24", x"38D64AAC", x"23FE47D4", x"622665BC", x"790E68C4", x"54767F4C", x"4F5E7234",
|
||||
x"D7C63B9C", x"CCEE36E4", x"E196216C", x"FABE2C14", x"BB660E7C", x"A04E0304", x"8D36148C", x"961E19F4",
|
||||
x"A5CB3AD3", x"BEE337AB", x"939B2023", x"88B32D5B", x"C96B0F33", x"D243024B", x"FF3B15C3", x"E41318BB",
|
||||
x"7C8B5113", x"67A35C6B", x"4ADB4BE3", x"51F3469B", x"102B64F3", x"0B03698B", x"267B7E03", x"3D53737B",
|
||||
x"138AF0E4", x"08A2FD9C", x"25DAEA14", x"3EF2E76C", x"7F2AC504", x"6402C87C", x"497ADFF4", x"5252D28C",
|
||||
x"CACA9B24", x"D1E2965C", x"FC9A81D4", x"E7B28CAC", x"A66AAEC4", x"BD42A3BC", x"903AB434", x"8B12B94C",
|
||||
x"CD89B30A", x"D6A1BE72", x"FBD9A9FA", x"E0F1A482", x"A12986EA", x"BA018B92", x"97799C1A", x"8C519162",
|
||||
x"14C9D8CA", x"0FE1D5B2", x"2299C23A", x"39B1CF42", x"7869ED2A", x"6341E052", x"4E39F7DA", x"5511FAA2",
|
||||
x"7BC8793D", x"60E07445", x"4D9863CD", x"56B06EB5", x"17684CDD", x"0C4041A5", x"2138562D", x"3A105B55",
|
||||
x"A28812FD", x"B9A01F85", x"94D8080D", x"8FF00575", x"CE28271D", x"D5002A65", x"F8783DED", x"E3503095",
|
||||
x"754E2961", x"6E662419", x"431E3391", x"58363EE9", x"19EE1C81", x"02C611F9", x"2FBE0671", x"34960B09",
|
||||
x"AC0E42A1", x"B7264FD9", x"9A5E5851", x"81765529", x"C0AE7741", x"DB867A39", x"F6FE6DB1", x"EDD660C9",
|
||||
x"C30FE356", x"D827EE2E", x"F55FF9A6", x"EE77F4DE", x"AFAFD6B6", x"B487DBCE", x"99FFCC46", x"82D7C13E",
|
||||
x"1A4F8896", x"016785EE", x"2C1F9266", x"37379F1E", x"76EFBD76", x"6DC7B00E", x"40BFA786", x"5B97AAFE",
|
||||
x"1D0CA0B8", x"0624ADC0", x"2B5CBA48", x"3074B730", x"71AC9558", x"6A849820", x"47FC8FA8", x"5CD482D0",
|
||||
x"C44CCB78", x"DF64C600", x"F21CD188", x"E934DCF0", x"A8ECFE98", x"B3C4F3E0", x"9EBCE468", x"8594E910",
|
||||
x"AB4D6A8F", x"B06567F7", x"9D1D707F", x"86357D07", x"C7ED5F6F", x"DCC55217", x"F1BD459F", x"EA9548E7",
|
||||
x"720D014F", x"69250C37", x"445D1BBF", x"5F7516C7", x"1EAD34AF", x"058539D7", x"28FD2E5F", x"33D52327"
|
||||
);
|
||||
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
-- Port A read
|
||||
DOA <= ROM(to_integer(unsigned(not ADDRA))); -- see IMPORTANT ORDER INFORMATION above
|
||||
|
||||
|
||||
-- Port B read
|
||||
DOB <= ROM(to_integer(unsigned(not ADDRB))); -- see IMPORTANT ORDER INFORMATION above
|
||||
|
||||
end Behavioral;
|
||||
134
generic_ip/third_party_ip/mac/src/crc32_lut2cd.vhd
Normal file
134
generic_ip/third_party_ip/mac/src/crc32_lut2cd.vhd
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
-------------------------------------------------------------
|
||||
-- Filename: CRC32_LUT2cd.VHD
|
||||
-- Authors:
|
||||
-- from http://www.xilinx.com/support/documentation/sw_manuals/xilinx14_4/xst_v6s6.pdf p262
|
||||
-- Alain Zarembowitch / MSS
|
||||
-- Version: Rev 0
|
||||
-- Last modified: 12/13/17
|
||||
-- Inheritance: ROM1.vhd 8/24/16
|
||||
--
|
||||
-- description: synthesizable generic dual port ROM containing two tables of 256 CRC32s values each
|
||||
-- (called LUT2c and LUT2d)
|
||||
-- The tables are generated by the Java application crc32tables in the /java folder
|
||||
-- LUT1c computes the CRC32s for 64-BIT INPUT WORDS in the form 00 x 00 00 00 00 00 00
|
||||
-- LUT1d computes the CRC32s for 64-BIT INPUT WORDS in the form y 00 00 00 00 00 00 00, where y is the MSB
|
||||
-- Data bit order: MSb of MSB is first sent/received
|
||||
-- Note: the returned crc values are NOT inverted and NOT reflected left-right. They are as they would appear
|
||||
-- when generated by a standard LFSR
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity CRC32_LUT2cd is
|
||||
Generic (
|
||||
DATA_WIDTH: integer := 32;
|
||||
ADDR_WIDTH: integer := 9
|
||||
);
|
||||
Port (
|
||||
-- Port A
|
||||
ADDRA : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
-- LUT1c at addresses 0 - 255
|
||||
-- LUT1d at addresses 256 - 511
|
||||
DOA : out std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
|
||||
-- Port B
|
||||
ADDRB : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
-- LUT1c at addresses 0 - 255
|
||||
-- LUT1d at addresses 256 - 511
|
||||
DOB : out std_logic_vector(DATA_WIDTH-1 downto 0)
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of CRC32_LUT2cd is
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
-- inferred rom
|
||||
signal DOA_local: std_logic_vector(DATA_WIDTH-1 downto 0) := (others => '0');
|
||||
signal DOB_local: std_logic_vector(DATA_WIDTH-1 downto 0) := (others => '0');
|
||||
type ROM_TYPE is array ( (2**ADDR_WIDTH)-1 downto 0 ) of std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
-- IMPORTANT ORDER INFORMATION: the table below is read from bottom to top and right to left. Thus
|
||||
-- to restore a common-sense order, address bits are inverted.
|
||||
constant ROM : ROM_TYPE := (
|
||||
-- LUT2c
|
||||
x"00000000", x"4F576811", x"9EAED022", x"D1F9B833", x"399CBDF3", x"76CBD5E2", x"A7326DD1", x"E86505C0",
|
||||
x"73397BE6", x"3C6E13F7", x"ED97ABC4", x"A2C0C3D5", x"4AA5C615", x"05F2AE04", x"D40B1637", x"9B5C7E26",
|
||||
x"E672F7CC", x"A9259FDD", x"78DC27EE", x"378B4FFF", x"DFEE4A3F", x"90B9222E", x"41409A1D", x"0E17F20C",
|
||||
x"954B8C2A", x"DA1CE43B", x"0BE55C08", x"44B23419", x"ACD731D9", x"E38059C8", x"3279E1FB", x"7D2E89EA",
|
||||
x"C824F22F", x"87739A3E", x"568A220D", x"19DD4A1C", x"F1B84FDC", x"BEEF27CD", x"6F169FFE", x"2041F7EF",
|
||||
x"BB1D89C9", x"F44AE1D8", x"25B359EB", x"6AE431FA", x"8281343A", x"CDD65C2B", x"1C2FE418", x"53788C09",
|
||||
x"2E5605E3", x"61016DF2", x"B0F8D5C1", x"FFAFBDD0", x"17CAB810", x"589DD001", x"89646832", x"C6330023",
|
||||
x"5D6F7E05", x"12381614", x"C3C1AE27", x"8C96C636", x"64F3C3F6", x"2BA4ABE7", x"FA5D13D4", x"B50A7BC5",
|
||||
x"9488F9E9", x"DBDF91F8", x"0A2629CB", x"457141DA", x"AD14441A", x"E2432C0B", x"33BA9438", x"7CEDFC29",
|
||||
x"E7B1820F", x"A8E6EA1E", x"791F522D", x"36483A3C", x"DE2D3FFC", x"917A57ED", x"4083EFDE", x"0FD487CF",
|
||||
x"72FA0E25", x"3DAD6634", x"EC54DE07", x"A303B616", x"4B66B3D6", x"0431DBC7", x"D5C863F4", x"9A9F0BE5",
|
||||
x"01C375C3", x"4E941DD2", x"9F6DA5E1", x"D03ACDF0", x"385FC830", x"7708A021", x"A6F11812", x"E9A67003",
|
||||
x"5CAC0BC6", x"13FB63D7", x"C202DBE4", x"8D55B3F5", x"6530B635", x"2A67DE24", x"FB9E6617", x"B4C90E06",
|
||||
x"2F957020", x"60C21831", x"B13BA002", x"FE6CC813", x"1609CDD3", x"595EA5C2", x"88A71DF1", x"C7F075E0",
|
||||
x"BADEFC0A", x"F589941B", x"24702C28", x"6B274439", x"834241F9", x"CC1529E8", x"1DEC91DB", x"52BBF9CA",
|
||||
x"C9E787EC", x"86B0EFFD", x"574957CE", x"181E3FDF", x"F07B3A1F", x"BF2C520E", x"6ED5EA3D", x"2182822C",
|
||||
x"2DD0EE65", x"62878674", x"B37E3E47", x"FC295656", x"144C5396", x"5B1B3B87", x"8AE283B4", x"C5B5EBA5",
|
||||
x"5EE99583", x"11BEFD92", x"C04745A1", x"8F102DB0", x"67752870", x"28224061", x"F9DBF852", x"B68C9043",
|
||||
x"CBA219A9", x"84F571B8", x"550CC98B", x"1A5BA19A", x"F23EA45A", x"BD69CC4B", x"6C907478", x"23C71C69",
|
||||
x"B89B624F", x"F7CC0A5E", x"2635B26D", x"6962DA7C", x"8107DFBC", x"CE50B7AD", x"1FA90F9E", x"50FE678F",
|
||||
x"E5F41C4A", x"AAA3745B", x"7B5ACC68", x"340DA479", x"DC68A1B9", x"933FC9A8", x"42C6719B", x"0D91198A",
|
||||
x"96CD67AC", x"D99A0FBD", x"0863B78E", x"4734DF9F", x"AF51DA5F", x"E006B24E", x"31FF0A7D", x"7EA8626C",
|
||||
x"0386EB86", x"4CD18397", x"9D283BA4", x"D27F53B5", x"3A1A5675", x"754D3E64", x"A4B48657", x"EBE3EE46",
|
||||
x"70BF9060", x"3FE8F871", x"EE114042", x"A1462853", x"49232D93", x"06744582", x"D78DFDB1", x"98DA95A0",
|
||||
x"B958178C", x"F60F7F9D", x"27F6C7AE", x"68A1AFBF", x"80C4AA7F", x"CF93C26E", x"1E6A7A5D", x"513D124C",
|
||||
x"CA616C6A", x"8536047B", x"54CFBC48", x"1B98D459", x"F3FDD199", x"BCAAB988", x"6D5301BB", x"220469AA",
|
||||
x"5F2AE040", x"107D8851", x"C1843062", x"8ED35873", x"66B65DB3", x"29E135A2", x"F8188D91", x"B74FE580",
|
||||
x"2C139BA6", x"6344F3B7", x"B2BD4B84", x"FDEA2395", x"158F2655", x"5AD84E44", x"8B21F677", x"C4769E66",
|
||||
x"717CE5A3", x"3E2B8DB2", x"EFD23581", x"A0855D90", x"48E05850", x"07B73041", x"D64E8872", x"9919E063",
|
||||
x"02459E45", x"4D12F654", x"9CEB4E67", x"D3BC2676", x"3BD923B6", x"748E4BA7", x"A577F394", x"EA209B85",
|
||||
x"970E126F", x"D8597A7E", x"09A0C24D", x"46F7AA5C", x"AE92AF9C", x"E1C5C78D", x"303C7FBE", x"7F6B17AF",
|
||||
x"E4376989", x"AB600198", x"7A99B9AB", x"35CED1BA", x"DDABD47A", x"92FCBC6B", x"43050458", x"0C526C49",
|
||||
-- LUT2d
|
||||
x"00000000", x"5BA1DCCA", x"B743B994", x"ECE2655E", x"6A466E9F", x"31E7B255", x"DD05D70B", x"86A40BC1",
|
||||
x"D48CDD3E", x"8F2D01F4", x"63CF64AA", x"386EB860", x"BECAB3A1", x"E56B6F6B", x"09890A35", x"5228D6FF",
|
||||
x"ADD8A7CB", x"F6797B01", x"1A9B1E5F", x"413AC295", x"C79EC954", x"9C3F159E", x"70DD70C0", x"2B7CAC0A",
|
||||
x"79547AF5", x"22F5A63F", x"CE17C361", x"95B61FAB", x"1312146A", x"48B3C8A0", x"A451ADFE", x"FFF07134",
|
||||
x"5F705221", x"04D18EEB", x"E833EBB5", x"B392377F", x"35363CBE", x"6E97E074", x"8275852A", x"D9D459E0",
|
||||
x"8BFC8F1F", x"D05D53D5", x"3CBF368B", x"671EEA41", x"E1BAE180", x"BA1B3D4A", x"56F95814", x"0D5884DE",
|
||||
x"F2A8F5EA", x"A9092920", x"45EB4C7E", x"1E4A90B4", x"98EE9B75", x"C34F47BF", x"2FAD22E1", x"740CFE2B",
|
||||
x"262428D4", x"7D85F41E", x"91679140", x"CAC64D8A", x"4C62464B", x"17C39A81", x"FB21FFDF", x"A0802315",
|
||||
x"BEE0A442", x"E5417888", x"09A31DD6", x"5202C11C", x"D4A6CADD", x"8F071617", x"63E57349", x"3844AF83",
|
||||
x"6A6C797C", x"31CDA5B6", x"DD2FC0E8", x"868E1C22", x"002A17E3", x"5B8BCB29", x"B769AE77", x"ECC872BD",
|
||||
x"13380389", x"4899DF43", x"A47BBA1D", x"FFDA66D7", x"797E6D16", x"22DFB1DC", x"CE3DD482", x"959C0848",
|
||||
x"C7B4DEB7", x"9C15027D", x"70F76723", x"2B56BBE9", x"ADF2B028", x"F6536CE2", x"1AB109BC", x"4110D576",
|
||||
x"E190F663", x"BA312AA9", x"56D34FF7", x"0D72933D", x"8BD698FC", x"D0774436", x"3C952168", x"6734FDA2",
|
||||
x"351C2B5D", x"6EBDF797", x"825F92C9", x"D9FE4E03", x"5F5A45C2", x"04FB9908", x"E819FC56", x"B3B8209C",
|
||||
x"4C4851A8", x"17E98D62", x"FB0BE83C", x"A0AA34F6", x"260E3F37", x"7DAFE3FD", x"914D86A3", x"CAEC5A69",
|
||||
x"98C48C96", x"C365505C", x"2F873502", x"7426E9C8", x"F282E209", x"A9233EC3", x"45C15B9D", x"1E608757",
|
||||
x"79005533", x"22A189F9", x"CE43ECA7", x"95E2306D", x"13463BAC", x"48E7E766", x"A4058238", x"FFA45EF2",
|
||||
x"AD8C880D", x"F62D54C7", x"1ACF3199", x"416EED53", x"C7CAE692", x"9C6B3A58", x"70895F06", x"2B2883CC",
|
||||
x"D4D8F2F8", x"8F792E32", x"639B4B6C", x"383A97A6", x"BE9E9C67", x"E53F40AD", x"09DD25F3", x"527CF939",
|
||||
x"00542FC6", x"5BF5F30C", x"B7179652", x"ECB64A98", x"6A124159", x"31B39D93", x"DD51F8CD", x"86F02407",
|
||||
x"26700712", x"7DD1DBD8", x"9133BE86", x"CA92624C", x"4C36698D", x"1797B547", x"FB75D019", x"A0D40CD3",
|
||||
x"F2FCDA2C", x"A95D06E6", x"45BF63B8", x"1E1EBF72", x"98BAB4B3", x"C31B6879", x"2FF90D27", x"7458D1ED",
|
||||
x"8BA8A0D9", x"D0097C13", x"3CEB194D", x"674AC587", x"E1EECE46", x"BA4F128C", x"56AD77D2", x"0D0CAB18",
|
||||
x"5F247DE7", x"0485A12D", x"E867C473", x"B3C618B9", x"35621378", x"6EC3CFB2", x"8221AAEC", x"D9807626",
|
||||
x"C7E0F171", x"9C412DBB", x"70A348E5", x"2B02942F", x"ADA69FEE", x"F6074324", x"1AE5267A", x"4144FAB0",
|
||||
x"136C2C4F", x"48CDF085", x"A42F95DB", x"FF8E4911", x"792A42D0", x"228B9E1A", x"CE69FB44", x"95C8278E",
|
||||
x"6A3856BA", x"31998A70", x"DD7BEF2E", x"86DA33E4", x"007E3825", x"5BDFE4EF", x"B73D81B1", x"EC9C5D7B",
|
||||
x"BEB48B84", x"E515574E", x"09F73210", x"5256EEDA", x"D4F2E51B", x"8F5339D1", x"63B15C8F", x"38108045",
|
||||
x"9890A350", x"C3317F9A", x"2FD31AC4", x"7472C60E", x"F2D6CDCF", x"A9771105", x"4595745B", x"1E34A891",
|
||||
x"4C1C7E6E", x"17BDA2A4", x"FB5FC7FA", x"A0FE1B30", x"265A10F1", x"7DFBCC3B", x"9119A965", x"CAB875AF",
|
||||
x"3548049B", x"6EE9D851", x"820BBD0F", x"D9AA61C5", x"5F0E6A04", x"04AFB6CE", x"E84DD390", x"B3EC0F5A",
|
||||
x"E1C4D9A5", x"BA65056F", x"56876031", x"0D26BCFB", x"8B82B73A", x"D0236BF0", x"3CC10EAE", x"6760D264"
|
||||
);
|
||||
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
-- Port A read
|
||||
DOA <= ROM(to_integer(unsigned(not ADDRA))); -- see IMPORTANT ORDER INFORMATION above
|
||||
|
||||
|
||||
-- Port B read
|
||||
DOB <= ROM(to_integer(unsigned(not ADDRB))); -- see IMPORTANT ORDER INFORMATION above
|
||||
|
||||
end Behavioral;
|
||||
226
generic_ip/third_party_ip/mac/src/crc32minlatency.vhd
Normal file
226
generic_ip/third_party_ip/mac/src/crc32minlatency.vhd
Normal file
|
|
@ -0,0 +1,226 @@
|
|||
-------------------------------------------------------------
|
||||
-- Filename: CRC32.VHD
|
||||
-- Authors:
|
||||
-- Alain Zarembowitch / MSS
|
||||
-- Version: Rev 0
|
||||
-- Last modified: 2/26/17
|
||||
-- Inheritance: n/a
|
||||
--
|
||||
-- description: high-speed generation of 32-bit CRC32 (optimized for 10G Ethernet 64-bit words)
|
||||
-- Data bit order: MSb of MSB is first sent/received
|
||||
-- Algorithm based on seminal paper "High Performance Table-Based Algorithm for Pipelined CRC Calculation",
|
||||
-- by Yan Sun and Min Sik Kim
|
||||
-- Verified by comparing with the crc calculator at http://www.sunshine2k.de/coding/javascript/crc/crc_js.html
|
||||
--
|
||||
-- Utilization:
|
||||
-- FF: 188
|
||||
-- LUT: 728
|
||||
-- 18Kb block RAMs: 0
|
||||
-- DSP: 0
|
||||
-- GCLK: 1
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity CRC32 is
|
||||
Port (
|
||||
CLK : IN std_logic;
|
||||
DATA_IN: in std_logic_vector(63 downto 0);
|
||||
-- Natural order (as if input to a standard LFSR), i.e. not inverted, not reversed.
|
||||
-- order: MSb of MSB is first serialized bit
|
||||
-- Special case: when last word is less than 8 bytes, bytes are left-aligned (MSB first) and lower byte(s) are ignored.
|
||||
SAMPLE_CLK_IN: in std_logic;
|
||||
-- read DATA_IN at the rising_edge of CLK when SAMPLE_CLK_IN = '1'
|
||||
SOF_IN: in std_logic;
|
||||
-- 1-CLK wide pulse marks the first word in a message. Initializes the CRC to all zero
|
||||
-- aligned with SAMPLE_CLK_IN
|
||||
DATA_VALID_IN : IN std_logic_vector(7 downto 0);
|
||||
-- Valid bytes in DATA_IN.
|
||||
-- Valid inputs: 0x00,80 (one MSB byte),C0,E0,F0,F8,FC,FE,FF (8 bytes)
|
||||
CRC_INITIALIZATION: in std_logic_vector(31 downto 0);
|
||||
-- typically 0xFFFFFFFF. Read at SOF_IN = '1'
|
||||
CRC_OUT: out std_logic_vector(31 downto 0);
|
||||
-- Natural order (as in the flip-flop values of a standard LFSR), i.e. not inverted, not reversed.
|
||||
SAMPLE_CLK_OUT: out std_logic
|
||||
-- latency 1 CLKs after SAMPLE_CLK_IN
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of CRC32 is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
COMPONENT CRC32_LUT1
|
||||
PORT(
|
||||
CLK : IN std_logic;
|
||||
DATA_IN : IN std_logic_vector(31 downto 0);
|
||||
SAMPLE_CLK_IN : IN std_logic;
|
||||
CRC_OUT : OUT std_logic_vector(31 downto 0);
|
||||
SAMPLE_CLK_OUT : OUT std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
COMPONENT CRC32_LUT2
|
||||
PORT(
|
||||
CLK : IN std_logic;
|
||||
DATA_IN : IN std_logic_vector(31 downto 0);
|
||||
SAMPLE_CLK_IN : IN std_logic;
|
||||
CRC_OUT : OUT std_logic_vector(31 downto 0);
|
||||
SAMPLE_CLK_OUT : OUT std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
signal DATA1: std_logic_vector(63 downto 0) := (others => '0');
|
||||
signal DATA1_D: std_logic_vector(63 downto 0) := (others => '0');
|
||||
signal DATA2: std_logic_vector(63 downto 0) := (others => '0');
|
||||
signal DATA12: std_logic_vector(63 downto 0) := (others => '0');
|
||||
signal SAMPLE1_CLK: std_logic := '0';
|
||||
signal SAMPLE1_CLK_D: std_logic := '0';
|
||||
signal SAMPLE1_CLK_D2: std_logic := '0';
|
||||
signal SOF1: std_logic := '0';
|
||||
signal SOF1_D: std_logic := '0';
|
||||
signal CRC1: std_logic_vector(31 downto 0) := (others => '0');
|
||||
signal CRC2: std_logic_vector(31 downto 0) := (others => '0');
|
||||
signal CRC12: std_logic_vector(31 downto 0) := (others => '0');
|
||||
signal CRC12_D: std_logic_vector(31 downto 0) := (others => '0');
|
||||
signal CRC12_FROZEN: std_logic_vector(31 downto 0) := (others => '0');
|
||||
|
||||
|
||||
|
||||
signal CRC3: std_logic_vector(31 downto 0) := (others => '0');
|
||||
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
-- Special case: when last word is less than 8 bytes, input bytes are left-aligned (MSB first) and lower byte(s) are ignored.
|
||||
-- partial last word case: reorder last word so that bytes are right aligned
|
||||
REORDER_001: process(DATA_IN, SAMPLE_CLK_IN, DATA_VALID_IN)
|
||||
begin
|
||||
if(SAMPLE_CLK_IN = '1') then
|
||||
if(DATA_VALID_IN(7) = '0') then
|
||||
DATA1 <= (others => '0');
|
||||
elsif(DATA_VALID_IN(6) = '0') then
|
||||
DATA1 <= x"00000000000000" & DATA_IN(63 downto 56); -- last word contains 1 byte
|
||||
elsif(DATA_VALID_IN(5) = '0') then
|
||||
DATA1 <= x"000000000000" & DATA_IN(63 downto 48); -- last word
|
||||
elsif(DATA_VALID_IN(4) = '0') then
|
||||
DATA1 <= x"0000000000" & DATA_IN(63 downto 40); -- last word
|
||||
elsif(DATA_VALID_IN(3) = '0') then
|
||||
DATA1 <= x"00000000" & DATA_IN(63 downto 32); -- last word
|
||||
elsif(DATA_VALID_IN(2) = '0') then
|
||||
DATA1 <= x"000000" & DATA_IN(63 downto 24); -- last word
|
||||
elsif(DATA_VALID_IN(1) = '0') then
|
||||
DATA1 <= x"0000" & DATA_IN(63 downto 16); -- last word
|
||||
elsif(DATA_VALID_IN(0) = '0') then
|
||||
DATA1 <= x"00" & DATA_IN(63 downto 8); -- last word
|
||||
else
|
||||
DATA1 <= DATA_IN(63 downto 0); -- full 8-byte input word
|
||||
end if;
|
||||
else
|
||||
DATA1 <= DATA1_D;
|
||||
end if;
|
||||
end process;
|
||||
SAMPLE1_CLK <= SAMPLE_CLK_IN;
|
||||
SOF1 <= SOF_IN;
|
||||
|
||||
FREEZE_DATA1_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
SOF1_D <= SOF1;
|
||||
if(SAMPLE1_CLK = '1') then
|
||||
DATA1_D <= DATA1;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- CRC32 look-up table
|
||||
-- Latency: 1 CLK (from table address DATA_IN to table output CRC_OUT)
|
||||
-- lower 32-bits
|
||||
LUT1_001: CRC32_LUT1 PORT MAP (
|
||||
CLK => CLK,
|
||||
DATA_IN => DATA12(31 downto 0),
|
||||
SAMPLE_CLK_IN => SAMPLE1_CLK,
|
||||
CRC_OUT => CRC1,
|
||||
SAMPLE_CLK_OUT => SAMPLE1_CLK_D
|
||||
);
|
||||
-- upper 32-bits. LUT2 shifts the input by x^32
|
||||
-- Latency: 1 CLK (from table address DATA_IN to table output CRC_OUT)
|
||||
LUT2_001: CRC32_LUT2 PORT MAP (
|
||||
CLK => CLK,
|
||||
DATA_IN => DATA12(63 downto 32),
|
||||
SAMPLE_CLK_IN => SAMPLE1_CLK,
|
||||
CRC_OUT => CRC2,
|
||||
SAMPLE_CLK_OUT => open
|
||||
);
|
||||
CRC12 <= CRC1 xor CRC2; -- this is the CRC[DATA_IN(63:0)]
|
||||
|
||||
-- freeze CRC12 (otherwise algorithm runs amok) immediately at the LUT output (without waiting for next rising edge)
|
||||
FREEZE_CRC12_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SAMPLE1_CLK_D = '1') then
|
||||
CRC12_D <= CRC12;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
CRC12_FROZEN <= CRC_INITIALIZATION when (SOF1 = '1') else -- initialize CRC to zero at the first input word
|
||||
CRC12 when (SAMPLE1_CLK_D = '1') else
|
||||
CRC12_D;
|
||||
|
||||
-- last word special case. Add left-over bytes from last word CRC
|
||||
DATA2_GEN_001: process(CRC12_FROZEN, DATA_VALID_IN)
|
||||
begin
|
||||
if(DATA_VALID_IN(7) = '0') then
|
||||
DATA2 <= (others => '0');
|
||||
elsif(DATA_VALID_IN(6) = '0') then
|
||||
DATA2 <= x"00000000000000" & CRC12_FROZEN(31 downto 24); -- last input word contains 1 byte
|
||||
elsif(DATA_VALID_IN(5) = '0') then
|
||||
DATA2 <= x"000000000000" & CRC12_FROZEN(31 downto 16); -- last input word contains 2 bytes
|
||||
elsif(DATA_VALID_IN(4) = '0') then
|
||||
DATA2 <= x"0000000000" & CRC12_FROZEN(31 downto 8); -- last input word contains 3 bytes
|
||||
elsif(DATA_VALID_IN(3) = '0') then
|
||||
DATA2 <= x"00000000" & CRC12_FROZEN(31 downto 0);
|
||||
elsif(DATA_VALID_IN(2) = '0') then
|
||||
DATA2 <= x"000000" & CRC12_FROZEN(31 downto 0) & x"00";
|
||||
elsif(DATA_VALID_IN(1) = '0') then
|
||||
DATA2 <= x"0000" & CRC12_FROZEN(31 downto 0) & x"0000";
|
||||
elsif(DATA_VALID_IN(0) = '0') then
|
||||
DATA2 <= x"00" & CRC12_FROZEN(31 downto 0) & x"000000";
|
||||
else
|
||||
DATA2 <= CRC12_FROZEN(31 downto 0) & x"00000000";
|
||||
end if;
|
||||
end process;
|
||||
|
||||
DATA12 <= DATA1 xor DATA2;
|
||||
|
||||
|
||||
CRC3_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SAMPLE_CLK_IN = '1') then
|
||||
if(DATA_VALID_IN(7) = '0') then
|
||||
CRC3 <= (others => '0');
|
||||
elsif(DATA_VALID_IN(6) = '0') then
|
||||
CRC3 <= CRC12_FROZEN(23 downto 0) & x"00"; -- last input word contains 1 byte
|
||||
elsif(DATA_VALID_IN(5) = '0') then
|
||||
CRC3 <= CRC12_FROZEN(15 downto 0) & x"0000"; -- last input word contains 2 bytes
|
||||
elsif(DATA_VALID_IN(4) = '0') then
|
||||
CRC3 <= CRC12_FROZEN(7 downto 0) & x"000000"; -- last input word contains 3 bytes
|
||||
else
|
||||
CRC3 <= (others => '0');
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- outputs
|
||||
CRC_OUT <= CRC12_FROZEN xor CRC3;
|
||||
SAMPLE_CLK_OUT <= SAMPLE1_CLK_D;
|
||||
|
||||
end Behavioral;
|
||||
334
generic_ip/third_party_ip/mac/src/phy_config.vhd
Normal file
334
generic_ip/third_party_ip/mac/src/phy_config.vhd
Normal file
|
|
@ -0,0 +1,334 @@
|
|||
-------------------------------------------------------------
|
||||
-- MSS copyright 2010-2018
|
||||
-- Filename: PHY_CONFIG.VHD
|
||||
-- Author: Alain Zarembowitch / MSS
|
||||
-- Version: 0
|
||||
-- Date last modified: 8/16/18
|
||||
-- Inheritance: COM-5401 PHY_CONFIG.VHD rev6 8/23/13
|
||||
--
|
||||
-- description: Configures a 10G PHY through a MDIO interface.
|
||||
-- The control and status registers are specific to the VSC8486-11 PHY
|
||||
-- The state machine must be edited to reflect any other PHY.
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.NUMERIC_STD.ALL;
|
||||
|
||||
entity PHY_CONFIG is
|
||||
generic (
|
||||
EXT_PHY_MDIO_ADDR: std_logic_vector(4 downto 0) := "00000"
|
||||
-- external PHY MDIO address
|
||||
);
|
||||
Port (
|
||||
--// CLK, RESET
|
||||
SYNC_RESET: in std_logic;
|
||||
CLK: in std_logic;
|
||||
|
||||
--// CONTROLS
|
||||
CONFIG_CHANGE: in std_logic;
|
||||
-- 1 CLK-wide pulse to activate any configuration change below.
|
||||
-- Not needed if the default values are acceptable.
|
||||
PHY_RESET: in std_logic;
|
||||
-- 1 = PHY software reset, 0 = no reset
|
||||
TEST_MODE: in std_logic_vector(1 downto 0);
|
||||
-- 00 = normal mode (default)
|
||||
-- 01 = loopback mode
|
||||
-- 10 = remote loopback
|
||||
POWER_DOWN: in std_logic;
|
||||
-- software power down mode. 1 = enabled, 0 = disabled (default).
|
||||
|
||||
--// MONITORING
|
||||
-- read ONE status register
|
||||
SREG_READ_START: in std_logic;
|
||||
-- 1 CLK wide pulse to start read transaction
|
||||
-- will be ignored if the previous transaction is yet to be completed.
|
||||
SREG_MMD: in std_logic_vector(4 downto 0);
|
||||
-- device
|
||||
SREG_ADDR: in std_logic_vector(15 downto 0);
|
||||
-- status register address
|
||||
SREG_DATA : OUT std_logic_vector(15 downto 0);
|
||||
-- 16-bit status register. Read when SREG_SAMPLE_CLK = '1'
|
||||
SREG_SAMPLE_CLK: out std_logic;
|
||||
SREG_READ_IDLE: out std_logic;
|
||||
-- '1' when the state machine is idle and thus available to read another status register
|
||||
|
||||
|
||||
-- Connect to external PHY and XAUI adapter (shared MDIO bus)
|
||||
MDC: out std_logic;
|
||||
MDIO_OUT: out std_logic;
|
||||
MDIO_IN: in std_logic;
|
||||
MDIO_DIR: out std_logic; -- '0' when output, '1' when input
|
||||
-- MDIO serial interface to control and monitor two MMDs: external 10G PHY and
|
||||
-- internal XAUI adapter.
|
||||
|
||||
--// TEST POINTS
|
||||
TP: out std_logic_vector(10 downto 1)
|
||||
|
||||
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of PHY_CONFIG is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
COMPONENT MII_MI
|
||||
PORT(
|
||||
SYNC_RESET : IN std_logic;
|
||||
CLK : IN std_logic;
|
||||
PHY_ADDR: std_logic_vector(4 downto 0);
|
||||
MI_REGAD : IN std_logic_vector(4 downto 0);
|
||||
MI_TX_DATA : IN std_logic_vector(15 downto 0);
|
||||
MI_ADDR_START: in std_logic;
|
||||
MI_READ_START : IN std_logic;
|
||||
MI_WRITE_START : IN std_logic;
|
||||
MI_RX_DATA : OUT std_logic_vector(15 downto 0);
|
||||
MI_TRANSACTION_COMPLETE : OUT std_logic;
|
||||
MDC: out std_logic;
|
||||
MDIO_OUT: out std_logic;
|
||||
MDIO_IN: in std_logic;
|
||||
MDIO_DIR: out std_logic -- '0' when output, '1' when input
|
||||
);
|
||||
END COMPONENT;
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
signal CONFIG_CHANGE_PENDING_FLAG: std_logic:= '0';
|
||||
signal PHY_RESET0: std_logic:= '0';
|
||||
signal PHY_RESET_D: std_logic:= '0';
|
||||
signal TEST_MODE0: std_logic_vector(1 downto 0) := (others => '0');
|
||||
signal POWER_DOWN0: std_logic:= '0';
|
||||
signal POWER_DOWN_D: std_logic:= '0';
|
||||
signal LOOPBACK_MODE: std_logic:= '0';
|
||||
signal REMOTE_LOOPBACK: std_logic:= '0';
|
||||
signal STATE: unsigned(7 downto 0) := (others => '0');
|
||||
signal MI_WRITE_START: std_logic := '0';
|
||||
signal MI_REGAD: std_logic_vector(4 downto 0) := "00000";
|
||||
signal MI_TX_DATA: std_logic_vector(15 downto 0) := (others => '0');
|
||||
signal MI_READ_START: std_logic := '0';
|
||||
signal MI_ADDR_START: std_logic := '0';
|
||||
signal MI_RX_DATA: std_logic_vector(15 downto 0) := (others => '0');
|
||||
signal MI_TRANSACTION_COMPLETE: std_logic:= '0';
|
||||
signal SREG_SAMPLE_CLK_local: std_logic := '0';
|
||||
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
-- hold the configuration request until it is time to process it (state machine may be busy)
|
||||
CONFIG_SAVE_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(CONFIG_CHANGE = '1') then
|
||||
CONFIG_CHANGE_PENDING_FLAG <= '1';
|
||||
PHY_RESET0 <= PHY_RESET;
|
||||
TEST_MODE0 <= TEST_MODE;
|
||||
POWER_DOWN0 <= POWER_DOWN;
|
||||
elsif(STATE = 0) and (CONFIG_CHANGE_PENDING_FLAG = '1') then
|
||||
CONFIG_CHANGE_PENDING_FLAG <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
|
||||
-- save the configuration so that it does not change while the configuration is in progress
|
||||
RECLOCK_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(STATE = 0) and (CONFIG_CHANGE_PENDING_FLAG = '1') then
|
||||
PHY_RESET_D <= PHY_RESET0;
|
||||
POWER_DOWN_D <= POWER_DOWN0;
|
||||
|
||||
case TEST_MODE0 is
|
||||
when "00" =>
|
||||
LOOPBACK_MODE <= '0';
|
||||
REMOTE_LOOPBACK <= '0';
|
||||
when "01" =>
|
||||
LOOPBACK_MODE <= '1';
|
||||
REMOTE_LOOPBACK <= '0';
|
||||
when "10" =>
|
||||
LOOPBACK_MODE <= '0';
|
||||
REMOTE_LOOPBACK <= '1';
|
||||
when others =>
|
||||
LOOPBACK_MODE <= '0';
|
||||
REMOTE_LOOPBACK <= '0';
|
||||
end case;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- state machine
|
||||
-- The state machine structure is generic, however, the actual control and status registers
|
||||
-- depend on the PHY.
|
||||
-- Written specifically for the Microsemi VSC8486-11 PHY
|
||||
STATE_GEN: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
STATE <= (others => '0');
|
||||
MI_REGAD <= (others => '0');
|
||||
MI_TX_DATA <= (others => '0');
|
||||
MI_ADDR_START <= '0';
|
||||
MI_WRITE_START <= '0';
|
||||
MI_READ_START <= '0';
|
||||
SREG_SAMPLE_CLK_local <= '0';
|
||||
|
||||
-- WRITE CONFIGURATION REGISTERS as needed
|
||||
elsif(STATE = 0) and (CONFIG_CHANGE_PENDING_FLAG = '1') then
|
||||
-- triggers a PHY reconfiguration. await PHY MDIO availability
|
||||
STATE <= STATE + 1;
|
||||
SREG_SAMPLE_CLK_local <= '0';
|
||||
|
||||
elsif(STATE = 1) and (MI_TRANSACTION_COMPLETE = '1') then
|
||||
-- PHY is ready for next transaction.
|
||||
-- Set address register 1x0000
|
||||
STATE <= STATE + 1;
|
||||
MI_REGAD <= "00001";
|
||||
MI_TX_DATA <= x"0000";
|
||||
MI_ADDR_START <= '1';
|
||||
elsif(STATE = 2) and (MI_TRANSACTION_COMPLETE = '1') then
|
||||
-- set configuration register 1x0000 (part 1/2)
|
||||
STATE <= STATE + 1;
|
||||
MI_REGAD <= "00001";
|
||||
MI_TX_DATA <= PHY_RESET_D & "010" & POWER_DOWN_D & "0000100000" & LOOPBACK_MODE;
|
||||
-- loopback J
|
||||
-- low power
|
||||
-- soft reset
|
||||
MI_WRITE_START <= '1';
|
||||
elsif(STATE = 3) and (MI_TRANSACTION_COMPLETE = '1') then
|
||||
-- set configuration register 1x0000 (part 2/2)
|
||||
-- remove the reset condition
|
||||
STATE <= STATE + 1;
|
||||
MI_REGAD <= "00001";
|
||||
MI_TX_DATA <= "0010" & POWER_DOWN_D & "0000100000" & LOOPBACK_MODE;
|
||||
-- loopback J
|
||||
-- low power
|
||||
-- soft reset
|
||||
MI_WRITE_START <= '1';
|
||||
elsif(STATE = 4) and (MI_TRANSACTION_COMPLETE = '1') then
|
||||
-- PHY is ready for next transaction.
|
||||
-- Set address register 1x8000
|
||||
STATE <= STATE + 1;
|
||||
MI_REGAD <= "00001";
|
||||
MI_TX_DATA <= x"8000";
|
||||
MI_ADDR_START <= '1';
|
||||
elsif(STATE = 5) and (MI_TRANSACTION_COMPLETE = '1') then
|
||||
-- set configuration register 1x8000
|
||||
STATE <= STATE + 1;
|
||||
MI_REGAD <= "00001";
|
||||
MI_TX_DATA <= x"B55F";
|
||||
-- invert tx data polarity (see com5104 schematics)
|
||||
MI_WRITE_START <= '1';
|
||||
elsif(STATE = 6) and (MI_TRANSACTION_COMPLETE = '1') then
|
||||
-- PHY is ready for next transaction.
|
||||
-- Set address register 1xE901
|
||||
STATE <= STATE + 1;
|
||||
MI_REGAD <= "00001";
|
||||
MI_TX_DATA <= x"E901";
|
||||
MI_ADDR_START <= '1';
|
||||
elsif(STATE = 7) and (MI_TRANSACTION_COMPLETE = '1') then
|
||||
-- set configuration register 1xE901
|
||||
STATE <= STATE + 1;
|
||||
MI_REGAD <= "00001";
|
||||
MI_TX_DATA <= x"283A";
|
||||
-- LEDs configured for rx and tx lines activity
|
||||
MI_WRITE_START <= '1';
|
||||
elsif(STATE = 8) and (MI_TRANSACTION_COMPLETE = '1') then
|
||||
-- PHY is ready for next transaction.
|
||||
-- Set address register 4x800F
|
||||
STATE <= STATE + 1;
|
||||
MI_REGAD <= "00100";
|
||||
MI_TX_DATA <= x"800F";
|
||||
MI_ADDR_START <= '1';
|
||||
elsif(STATE = 9) and (MI_TRANSACTION_COMPLETE = '1') then
|
||||
-- set configuration register 4x800F
|
||||
STATE <= (others => '0'); -- back to idle unless there are other write transactions
|
||||
MI_REGAD <= "00100";
|
||||
MI_TX_DATA <= x"0600";
|
||||
-- invert XAUI tx/rx bits (see COM-5104 schematics p3)
|
||||
MI_WRITE_START <= '1';
|
||||
|
||||
-- add more write cycles to control registers... as needed
|
||||
-- then move to reading a status register
|
||||
|
||||
-- READ ONE STATUS REGISTER
|
||||
elsif(STATE = 0) and (SREG_READ_START = '1') then
|
||||
-- triggers a PHY status read. await PHY MDIO availability
|
||||
STATE <= "00010000";
|
||||
SREG_SAMPLE_CLK_local <= '0';
|
||||
elsif(STATE = 16) and (MI_TRANSACTION_COMPLETE = '1') then
|
||||
-- set status register address
|
||||
STATE <= STATE + 1;
|
||||
MI_REGAD <= SREG_MMD;
|
||||
MI_TX_DATA <= SREG_ADDR;
|
||||
MI_ADDR_START <= '1';
|
||||
elsif(STATE = 17) and (MI_TRANSACTION_COMPLETE = '1') then
|
||||
-- read status register
|
||||
STATE <= STATE + 1;
|
||||
MI_REGAD <= SREG_MMD;
|
||||
MI_READ_START <= '1';
|
||||
elsif(STATE = 18) and (MI_TRANSACTION_COMPLETE = '1') then
|
||||
-- we are done reading a status register! Going back to idle.
|
||||
STATE <= (others => '0');
|
||||
MI_READ_START <= '0';
|
||||
SREG_SAMPLE_CLK_local <= '1';
|
||||
else
|
||||
MI_ADDR_START <= '0';
|
||||
MI_WRITE_START <= '0';
|
||||
MI_READ_START <= '0';
|
||||
SREG_SAMPLE_CLK_local <= '0';
|
||||
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
SREG_READ_IDLE <= '1' when (STATE = 0) and (CONFIG_CHANGE_PENDING_FLAG = '0') else '0';
|
||||
-- '1' when the state machine is idle and thus available to read another status register
|
||||
|
||||
-- latch status register
|
||||
SREGOUT_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
SREG_SAMPLE_CLK <= SREG_SAMPLE_CLK_local;
|
||||
|
||||
if(SREG_SAMPLE_CLK_local = '1') then
|
||||
SREG_DATA <= MI_RX_DATA;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
|
||||
MII_MI_001: MII_MI
|
||||
PORT MAP(
|
||||
SYNC_RESET => SYNC_RESET,
|
||||
CLK => CLK,
|
||||
PHY_ADDR => EXT_PHY_MDIO_ADDR,
|
||||
MI_REGAD => MI_REGAD,
|
||||
MI_TX_DATA => MI_TX_DATA,
|
||||
MI_RX_DATA => MI_RX_DATA,
|
||||
MI_ADDR_START => MI_ADDR_START,
|
||||
MI_WRITE_START => MI_WRITE_START,
|
||||
MI_READ_START => MI_READ_START,
|
||||
MI_TRANSACTION_COMPLETE => MI_TRANSACTION_COMPLETE,
|
||||
MDC => MDC,
|
||||
MDIO_OUT => MDIO_OUT,
|
||||
MDIO_IN => MDIO_IN,
|
||||
MDIO_DIR => MDIO_DIR
|
||||
);
|
||||
|
||||
--// TEST POINTS -------------------------
|
||||
TP(1) <= CONFIG_CHANGE;
|
||||
TP(2) <= MI_TRANSACTION_COMPLETE;
|
||||
TP(3) <= SREG_SAMPLE_CLK_local;
|
||||
TP(4) <= '1' when (STATE = 1) else '0';
|
||||
TP(5) <= '1' when (STATE = 6) else '0';
|
||||
TP(6) <= '1' when (STATE = 9) else '0';
|
||||
TP(7) <= '1' when (STATE = 10) else '0';
|
||||
TP(8) <= MI_ADDR_START;
|
||||
TP(9) <= MI_WRITE_START;
|
||||
TP(10) <= MI_READ_START;
|
||||
|
||||
|
||||
end Behavioral;
|
||||
|
||||
48
generic_ip/third_party_ip/mac/src/sdp_ram.vhd
Normal file
48
generic_ip/third_party_ip/mac/src/sdp_ram.vhd
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
-- Simple Dual-Port Block RAM with Two Clocks
|
||||
-- Correct Modelization with a Shared Variable
|
||||
-- File: simple_dual_two_clocks.vhd
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_unsigned.all;
|
||||
|
||||
entity sdp_ram is
|
||||
generic(
|
||||
ADDR_WIDTH: natural := 11;
|
||||
DATA_WIDTH: integer := 9);
|
||||
port(
|
||||
clka : in std_logic;
|
||||
clkb : in std_logic;
|
||||
ena : in std_logic;
|
||||
enb : in std_logic;
|
||||
wea : in std_logic;
|
||||
addra : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
addrb : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
dia : in std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
dob : out std_logic_vector(DATA_WIDTH-1 downto 0));
|
||||
end sdp_ram;
|
||||
|
||||
architecture syn of sdp_ram is
|
||||
type ram_type is array (2**ADDR_WIDTH-1 downto 0) of std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
shared variable RAM : ram_type;
|
||||
begin
|
||||
process(clka)
|
||||
begin
|
||||
if clka'event and clka = '1' then
|
||||
if ena = '1' then
|
||||
if wea = '1' then
|
||||
RAM(conv_integer(addra)) := dia;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
process(clkb)
|
||||
begin
|
||||
if clkb'event and clkb = '1' then
|
||||
if enb = '1' then
|
||||
dob <= RAM(conv_integer(addrb));
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
end syn;
|
||||
|
|
@ -0,0 +1,494 @@
|
|||
-------------------------------------------------------------
|
||||
-- MSS copyright 2018
|
||||
-- Filename: STREAM_2_PACKETS2.VHD
|
||||
-- Author: Alain Zarembowitch / MSS
|
||||
-- Version: 0
|
||||
-- Date last modified: 3/11/18
|
||||
-- Inheritance: STREAM_2_PACKETS2.VHD rev4 7/14/17
|
||||
--
|
||||
-- description: Encapsulate input data into data packets (for example for UDP transmission).
|
||||
-- The input stream is segmented into data packets.
|
||||
-- The packet transmission is triggered by either a timeout (TIMEOUT = maximum time between successive packets)
|
||||
-- or when the number of bytes waiting for transmission is greater or equal than MAX_PACKET_SIZE bytes.
|
||||
-- A 16-byte preamble field is inserted prior to the data field, consisting of
|
||||
-- 2 bytes for payload data length, 14 bytes for PREAMBLE_IN.
|
||||
--
|
||||
-- Note: no packet is sent if there is no data available when the timer expires.
|
||||
--
|
||||
-- If the follow-on transmission component is unable to immediately send the packet
|
||||
-- (for example if UDP_TX is missing routing information) it will return a negative acknowledgement (NAK).
|
||||
-- This component is responsible for triggering a re-transmission at a later time.
|
||||
-- The wait before the next retransmission attempt is defined by the constant TX_RETRY_TIMEOUT within.
|
||||
--
|
||||
-- This component can interface seemlessly with UDP_TX.vhd at the output to encapsulate
|
||||
-- the output packets within UDP frames for network transmission.
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.NUMERIC_STD.ALL;
|
||||
|
||||
entity STREAM_2_PACKETS2 is
|
||||
generic (
|
||||
NBUFS: integer := 1;
|
||||
-- number of 16Kb dual-port RAM buffers instantiated within.
|
||||
-- Valid values: 1,2,4,8
|
||||
TIMEOUT_ENABLE: std_logic := '1';
|
||||
TIMEOUT: integer range 1 to 262144:= 125000;
|
||||
-- maximum time between successive packets, expressed in 4 us units
|
||||
MAX_PACKET_SIZE: std_logic_vector(13 downto 0) := "00" & x"400"; -- in bytes. 1024 bytes
|
||||
-- maximum data field size, in bytes. Does not include the preamble.
|
||||
SIMULATION: std_logic := '0'
|
||||
);
|
||||
Port (
|
||||
--// CLK, RESET
|
||||
SYNC_RESET: in std_logic;
|
||||
CLK: in std_logic; -- synchronous clock
|
||||
-- Must be a global clocks. No BUFG instantiation within this component.
|
||||
TICK_4us: in std_logic;
|
||||
-- 1 CLK wide pulse
|
||||
|
||||
--// INPUT STREAM
|
||||
DATA_IN: in std_logic_vector(63 downto 0); -- input data
|
||||
DATA_VALID_IN: in std_logic_vector(7 downto 0); -- 1 clk wide pulse for each input sample
|
||||
CTS_OUT: out std_logic;
|
||||
-- flow control. Typically 1 as component is fast enough to process input samples
|
||||
-- in real time.
|
||||
|
||||
--// PREAMBLE
|
||||
PACKET_TX_PULSE: out std_logic;
|
||||
-- 1 CLK pulse when the decision to send a frame is made.
|
||||
PREAMBLE_IN: in std_logic_vector(111 downto 0);
|
||||
-- user-defined preamble. for example timestamp.
|
||||
-- read upon making the decision to send a packet (PACKET_TX_PULSE = '1').
|
||||
-- Note: a 16-bit data payload length field is inserted in the first two bytes of the output frame,
|
||||
-- before this preamble.
|
||||
|
||||
--// OUTPUT PACKETS
|
||||
-- For example, interfaces with UDP_TX
|
||||
DATA_OUT: out std_logic_vector(63 downto 0);
|
||||
DATA_VALID_OUT: out std_logic_vector(7 downto 0);
|
||||
SOF_OUT: out std_logic; -- also resets internal state machine
|
||||
EOF_OUT: out std_logic;
|
||||
RTS_OUT: out std_logic; -- indicate that we are ready to send a complete frame. Stays high until acknowledged by CTS_IN
|
||||
CTS_IN: in std_logic; -- destination acknowledges that it's ok to send the complete frame.
|
||||
ACK_IN: in std_logic;
|
||||
-- previous packet is accepted for transmission.
|
||||
-- ACK/NAK can arrive anytime after SOF_OUT, even before the packet is fully transferred
|
||||
NAK_IN: in std_logic;
|
||||
-- could not send the packet (for example, no routing information available for the selected
|
||||
-- LAN destination IP). Try later.
|
||||
|
||||
--// TEST POINTS
|
||||
TP: out std_logic_vector(10 downto 1)
|
||||
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of STREAM_2_PACKETS2 is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
COMPONENT BRAM_DP2
|
||||
GENERIC(
|
||||
DATA_WIDTHA: integer;
|
||||
ADDR_WIDTHA: integer;
|
||||
DATA_WIDTHB: integer;
|
||||
ADDR_WIDTHB: integer
|
||||
);
|
||||
PORT(
|
||||
CLKA : in std_logic;
|
||||
CSA: in std_logic;
|
||||
WEA : in std_logic;
|
||||
OEA : in std_logic;
|
||||
ADDRA : in std_logic_vector(ADDR_WIDTHA-1 downto 0);
|
||||
DIA : in std_logic_vector(DATA_WIDTHA-1 downto 0);
|
||||
DOA : out std_logic_vector(DATA_WIDTHA-1 downto 0);
|
||||
CLKB : in std_logic;
|
||||
CSB: in std_logic;
|
||||
WEB : in std_logic;
|
||||
OEB : in std_logic;
|
||||
ADDRB : in std_logic_vector(ADDR_WIDTHB-1 downto 0);
|
||||
DIB : in std_logic_vector(DATA_WIDTHB-1 downto 0);
|
||||
DOB : out std_logic_vector(DATA_WIDTHB-1 downto 0)
|
||||
);
|
||||
END COMPONENT;
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
-- Suffix _D indicates a one CLK delayed version of the net with the same name
|
||||
-- Suffix _E indicates a one CLK early version of the net with the same name
|
||||
-- Suffix _X indicates an extended precision version of the net with the same name
|
||||
-- Suffix _N indicates an inverted version of the net with the same name
|
||||
|
||||
--//-- COMPONENT CONFIGURATION (FIXED AT PRE-SYNTHESIS) ---------------
|
||||
constant TX_RETRY_TIMEOUT: integer range 0 to 1023 := 500;
|
||||
constant TX_RETRY_TIMEOUT_SIM: integer range 0 to 1023 := 10; -- shorter timer during simulations
|
||||
-- wait time after a NAK before trying a retransmission, expressed in 4us units. -- 500*4us = 2ms
|
||||
-- IMPORTANT: the timeout starts at the SOF. It therefore includes the output data transfer duration (MAX_PACKET_SIZE/fCLK).
|
||||
-- Always make sure the timeout is always greater than the output data transfer duration.
|
||||
|
||||
signal DATA_VALID_IN_D: std_logic := '0';
|
||||
signal DATA_IN_D: std_logic_vector(7 downto 0) := (others => '0');
|
||||
signal PREAMBLE_IN_SHIFT: std_logic_vector(127 downto 0):= (others => '0');
|
||||
|
||||
--//-- INPUT ELASTIC BUFFER ---------------------------
|
||||
signal STREAM_DATAx: std_logic_vector(8 downto 0) := (others => '0');
|
||||
signal PTR_MASK: std_logic_vector(13 downto 0) := (others => '1');
|
||||
signal WPTR: std_logic_vector(13 downto 0) := (others => '0');
|
||||
signal RPTR: std_logic_vector(13 downto 0) := (others => '1');
|
||||
signal RPTR_INC: std_logic_vector(13 downto 0) := (others => '0');
|
||||
signal RPTR_D: std_logic_vector(13 downto 0) := (others => '1');
|
||||
signal RPTR_ACKED: std_logic_vector(13 downto 0) := (others => '1');
|
||||
signal BUF_SIZE: std_logic_vector(13 downto 0) := (others => '0');
|
||||
signal DATA_FIELD_SIZE: std_logic_vector(13 downto 0) := (others => '0');
|
||||
signal WEA: std_logic_vector((NBUFS-1) downto 0) := (others => '0');
|
||||
signal WPTR_MEMINDEX: std_logic_vector(2 downto 0) := (others => '0');
|
||||
signal RPTR_MEMINDEX: std_logic_vector(2 downto 0) := (others => '0');
|
||||
signal RPTR_MEMINDEX_D: std_logic_vector(2 downto 0) := (others => '0');
|
||||
type DOBtype is array(integer range 0 to (NBUFS-1)) of std_logic_vector(8 downto 0);
|
||||
signal DOB: DOBtype := (others => (others => '0'));
|
||||
|
||||
--//-- TIMEOUT ----------------------------
|
||||
signal TIMER: integer range 0 to 262144 := 0;
|
||||
|
||||
--//-- READ POINTER AND STATE MACHINE ----------------------------
|
||||
signal STATE: integer range 0 to 5 := 0;
|
||||
signal STATE_D: integer range 0 to 5 := 0;
|
||||
signal PREAMBLE_DATA: std_logic_vector(7 downto 0) := (others => '0');
|
||||
signal PAYLOAD_DATA: std_logic_vector(7 downto 0) := (others => '0');
|
||||
signal PREAMBLE_RPTR: integer range 0 to 16:= 16;
|
||||
signal RPTR_MAX: std_logic_vector(13 downto 0) := (others => '0');
|
||||
signal DATA_VALID_E: std_logic := '0';
|
||||
signal DATA_VALID: std_logic := '0';
|
||||
signal DATA_VALID_D: std_logic := '0';
|
||||
signal SOF_E: std_logic := '0';
|
||||
signal SOF: std_logic := '0';
|
||||
signal EOF_E: std_logic := '0';
|
||||
signal EOF: std_logic := '0';
|
||||
signal TX_RETRY_TIMER: integer range 0 to 1023 := 0;
|
||||
signal TX_RETRY_TIMEOUT_B: integer range 0 to 1023 := 0;
|
||||
|
||||
signal ACK_IN_FLAG: std_logic := '0';
|
||||
signal NAK_IN_FLAG: std_logic := '0';
|
||||
signal RTS_OUT_local: std_logic := '0';
|
||||
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
-- during simulations, reduce long timer values
|
||||
TX_RETRY_TIMEOUT_B <= TX_RETRY_TIMEOUT when (SIMULATION = '0') else TX_RETRY_TIMEOUT_SIM;
|
||||
|
||||
INPUT_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
DATA_VALID_IN_D <= DATA_VALID_IN;
|
||||
DATA_IN_D <= DATA_IN;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--//-- INPUT ELASTIC BUFFER ---------------------------
|
||||
WPTR_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
WPTR <= (others => '0');
|
||||
elsif(DATA_VALID_IN_D = '1') then
|
||||
-- data sample
|
||||
WPTR <= (WPTR + 1) and PTR_MASK;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
|
||||
-- Mask upper address bits, depending on the memory depth (1,2,4, or 8 RAMblocks)
|
||||
WPTR_MEMINDEX <= WPTR(13 downto 11) when (NBUFS = 8) else
|
||||
"0" & WPTR(12 downto 11) when (NBUFS = 4) else
|
||||
"00" & WPTR(11 downto 11) when (NBUFS = 2) else
|
||||
"000"; -- when (NBUFS = 1)
|
||||
|
||||
PTR_MASK <= "11111111111111" when (NBUFS = 8) else
|
||||
"01111111111111" when (NBUFS = 4) else
|
||||
"00111111111111" when (NBUFS = 2) else
|
||||
"00011111111111"; -- when (NBUFS = 1)
|
||||
|
||||
|
||||
-- select which RAMBlock to write to.
|
||||
WEA_GEN_001: process(WPTR_MEMINDEX, DATA_VALID_IN_D)
|
||||
begin
|
||||
for J in 0 to (NBUFS -1) loop
|
||||
if(WPTR_MEMINDEX = J) then -- range 0 through 7
|
||||
WEA(J) <= DATA_VALID_IN_D;
|
||||
else
|
||||
WEA(J) <= '0';
|
||||
end if;
|
||||
end loop;
|
||||
end process;
|
||||
|
||||
-- 1,2,4, or 8 RAM blocks.
|
||||
RAMB_16_S9_S9_Y: for J in 0 to (NBUFS-1) generate
|
||||
STREAM_DATAx <= "0" & DATA_IN_D;
|
||||
|
||||
-- 18Kbit buffer(s)
|
||||
RAMB16_S18_S9_001: BRAM_DP2
|
||||
GENERIC MAP(
|
||||
DATA_WIDTHA => 9,
|
||||
ADDR_WIDTHA => 11,
|
||||
DATA_WIDTHB => 9,
|
||||
ADDR_WIDTHB => 11
|
||||
)
|
||||
PORT MAP(
|
||||
CSA => '1',
|
||||
CLKA => CLK,
|
||||
WEA => WEA(J), -- Port A Write Enable Input
|
||||
ADDRA => WPTR(10 downto 0), -- 11-bit address
|
||||
DIA => STREAM_DATAx,
|
||||
OEA => '0',
|
||||
DOA => open,
|
||||
CSB => '1',
|
||||
CLKB => CLK,
|
||||
WEB => '0',
|
||||
ADDRB => RPTR(10 downto 0), -- 11-bit address
|
||||
DIB => "000000000",
|
||||
OEB => '1',
|
||||
DOB => DOB(J)
|
||||
);
|
||||
end generate;
|
||||
|
||||
-- Mask upper address bits, depending on the memory depth (1,2,4, or 8 RAMblocks)
|
||||
RPTR_MEMINDEX <= RPTR(13 downto 11) when (NBUFS = 8) else
|
||||
"0" & RPTR(12 downto 11) when (NBUFS = 4) else
|
||||
"00" & RPTR(11 downto 11) when (NBUFS = 2) else
|
||||
"000"; -- when (NBUFS = 1)
|
||||
|
||||
BUF_SIZE <= (WPTR + not (RPTR_ACKED)) and PTR_MASK;
|
||||
-- occupied space in the buffer (i.e. data waiting for transmission). Expressed in Bytes.
|
||||
|
||||
-- input flow control
|
||||
CTS_OUT <= '1' when (not BUF_SIZE(13 downto 7) /= 0) and (NBUFS = 8) else
|
||||
'1' when (not BUF_SIZE(12 downto 7) /= 0) and (NBUFS = 4) else
|
||||
'1' when (not BUF_SIZE(11 downto 7) /= 0) and (NBUFS = 2) else
|
||||
'1' when (not BUF_SIZE(10 downto 7) /= 0) and (NBUFS = 1) else
|
||||
'0';
|
||||
|
||||
-- allow more tx data in if there is room for at least 128 bytes
|
||||
|
||||
--//-- TIMEOUT ----------------------------
|
||||
TIMER_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
-- re-arm timer
|
||||
TIMER <= TIMEOUT-1;
|
||||
elsif(STATE = 1) then
|
||||
-- Decision was made to send a packet. Rearm timer
|
||||
TIMER <= TIMEOUT-1;
|
||||
elsif (TICK_4us = '1') then
|
||||
if(TIMER = 0) then
|
||||
-- re-arm timer
|
||||
TIMER <= TIMEOUT-1;
|
||||
else
|
||||
TIMER <= TIMER - 1;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--//-- READ POINTER AND STATE MACHINE ----------------------------
|
||||
-- manage read pointer
|
||||
RPTR_INC <= RPTR + 1;
|
||||
|
||||
RPTR_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
RPTR_MEMINDEX_D <= RPTR_MEMINDEX;
|
||||
|
||||
if(SYNC_RESET = '1') then
|
||||
STATE <= 0;
|
||||
RPTR <= PTR_MASK;
|
||||
RPTR_D <= PTR_MASK;
|
||||
RPTR_ACKED <= PTR_MASK;
|
||||
DATA_VALID_E <= '0';
|
||||
SOF_E <= '0';
|
||||
EOF_E <= '0';
|
||||
DATA_VALID <= '0';
|
||||
SOF <= '0';
|
||||
EOF <= '0';
|
||||
PREAMBLE_RPTR <= 16;
|
||||
RTS_OUT_local <= '0';
|
||||
else
|
||||
-- 1 CLK delay in reading data from block RAM
|
||||
RPTR_D <= RPTR;
|
||||
DATA_VALID <= DATA_VALID_E;
|
||||
SOF <= SOF_E;
|
||||
EOF <= EOF_E;
|
||||
-- reset start of sequence after 2^16 frames
|
||||
|
||||
if(STATE = 0) and (BUF_SIZE /= 0) and (RTS_OUT_local = '0') then
|
||||
-- transmit decision
|
||||
-- idle state, data is waiting in input elastic buffer. Trigger next transmit frame
|
||||
if(BUF_SIZE >= MAX_PACKET_SIZE) then
|
||||
-- tx trigger: got enough data in buffer to fill a maximum size packet
|
||||
RTS_OUT_local <= '1'; -- signal outside that a frame is ready to be send. Must be acknowledged with CTS_IN
|
||||
DATA_FIELD_SIZE <= MAX_PACKET_SIZE; -- freeze size
|
||||
STATE <= 1; -- await CTS_IN
|
||||
elsif((TICK_4us = '1') and (TIMER = 0) and (TIMEOUT_ENABLE = '1')) then
|
||||
-- timeout waiting for more data and at least one byte of payload data waiting for transmission.
|
||||
RTS_OUT_local <= '1'; -- signal outside that a frame is ready to be send. Must be acknowledged with CTS_IN
|
||||
DATA_FIELD_SIZE <= BUF_SIZE; -- freeze size
|
||||
STATE <= 1; -- await CTS_IN
|
||||
end if;
|
||||
elsif(STATE = 1) and (CTS_IN = '1') then
|
||||
-- start frame transmission
|
||||
RTS_OUT_local <= '0';
|
||||
PREAMBLE_RPTR <= 0; -- preamble data in 2 CLKs, just like reading the DPRAM
|
||||
DATA_VALID_E <= '1';
|
||||
SOF_E <= '1';
|
||||
STATE <= 2;
|
||||
elsif(STATE = 2) then
|
||||
-- sending preamble
|
||||
SOF_E <= '0';
|
||||
if(CTS_IN = '1') then
|
||||
DATA_VALID_E <= '1';
|
||||
PREAMBLE_RPTR <= PREAMBLE_RPTR + 1;
|
||||
if(PREAMBLE_RPTR >= 15) then
|
||||
-- end of preamble
|
||||
STATE <= 3;
|
||||
-- start sending payload data
|
||||
RPTR_MAX <= (RPTR_ACKED + DATA_FIELD_SIZE) and PTR_MASK;
|
||||
RPTR <= RPTR_INC and PTR_MASK; -- start transferring the first byte
|
||||
if(DATA_FIELD_SIZE = 1) then
|
||||
-- special case: 1 byte packet. EOF = SOF
|
||||
EOF_E <= '1';
|
||||
end if;
|
||||
end if;
|
||||
else
|
||||
DATA_VALID_E <= '0';
|
||||
end if;
|
||||
elsif(STATE = 3) then
|
||||
if ((RPTR and PTR_MASK) = (RPTR_MAX and PTR_MASK)) then
|
||||
-- end of packet transmission
|
||||
DATA_VALID_E <= '0';
|
||||
EOF_E <= '0';
|
||||
STATE <= 4; -- data transfer complete. wait for ACK or NAK
|
||||
TX_RETRY_TIMER <= TX_RETRY_TIMEOUT_B;
|
||||
-- this timer has two objectives:
|
||||
-- (a) make sure the state machine does not get stuck at state 4 if for some unexplained reason
|
||||
-- no ACK/NAK is received, and
|
||||
-- (b) wait a bit before retransmitting a NAK'ed packet.
|
||||
elsif (CTS_IN = '1') then
|
||||
-- not yet done transferring bytes
|
||||
RPTR <= RPTR_INC and PTR_MASK; -- continue transferring bytes
|
||||
DATA_VALID_E <= '1';
|
||||
if((RPTR_INC and PTR_MASK) = (RPTR_MAX and PTR_MASK)) then
|
||||
EOF_E <= '1';
|
||||
end if;
|
||||
else
|
||||
DATA_VALID_E <= '0';
|
||||
end if;
|
||||
elsif(STATE = 4) then
|
||||
-- data transfer complete. waiting for ACK/NAK
|
||||
if(ACK_IN = '1') or (ACK_IN_FLAG = '1') then
|
||||
-- All done.
|
||||
STATE <= 0; -- back to idle
|
||||
RPTR_ACKED <= RPTR and PTR_MASK; -- new acknowledged read pointer
|
||||
elsif(NAK_IN = '1') or (NAK_IN_FLAG = '1') then
|
||||
-- no transfer. try again later
|
||||
STATE <= 5; -- wait a bit, then re-try
|
||||
RPTR <= RPTR_ACKED and PTR_MASK; -- rewind read pointer
|
||||
elsif(TX_RETRY_TIMER = 0) then
|
||||
-- timer expired without receiving an ACK/NAK (abnormal condition). go back to idle
|
||||
STATE <= 0;
|
||||
RPTR <= RPTR_ACKED and PTR_MASK; -- rewind read pointer
|
||||
elsif(TICK_4us = '1') then
|
||||
TX_RETRY_TIMER <= TX_RETRY_TIMER - 1;
|
||||
end if;
|
||||
elsif(STATE = 5) then
|
||||
-- wait a bit then retry sending
|
||||
if(TX_RETRY_TIMER = 0) then
|
||||
-- waited long enough. try retransmitting.
|
||||
STATE <= 0;
|
||||
elsif(TICK_4us = '1') then
|
||||
TX_RETRY_TIMER <= TX_RETRY_TIMER - 1;
|
||||
end if;
|
||||
else
|
||||
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
RTS_OUT <= RTS_OUT_local;
|
||||
PACKET_TX_PULSE <= SOF_E;
|
||||
-- 1 CLK pulse when the decision to send a frame is made.
|
||||
|
||||
-- latch in the preamble when the decision is taken to send another packet
|
||||
-- preamble data
|
||||
PREAMBLE_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
STATE_D <= STATE;
|
||||
|
||||
if(SOF_E = '1') then
|
||||
PREAMBLE_IN_SHIFT <= "00" & DATA_FIELD_SIZE & PREAMBLE_IN;
|
||||
elsif(PREAMBLE_RPTR < 16) then
|
||||
PREAMBLE_IN_SHIFT(127 downto 8) <= PREAMBLE_IN_SHIFT(119 downto 0);
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
PREAMBLE_DATA <= PREAMBLE_IN_SHIFT(127 downto 120);
|
||||
|
||||
-- payload data
|
||||
PAYLOAD_DATA_GEN: process(RPTR_MEMINDEX_D, DOB)
|
||||
variable data: std_logic_vector(7 downto 0);
|
||||
begin
|
||||
for I in 0 to (NBUFS -1) loop
|
||||
if(I = RPTR_MEMINDEX_D) then
|
||||
data := DOB(I)(7 downto 0);
|
||||
end if;
|
||||
end loop;
|
||||
PAYLOAD_DATA <= data;
|
||||
end process;
|
||||
|
||||
-- ACK/NAK received flags
|
||||
ACK_NAK_FLAGS_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
ACK_IN_FLAG <= '0';
|
||||
NAK_IN_FLAG <= '0';
|
||||
else
|
||||
if(STATE = 0) then
|
||||
ACK_IN_FLAG <= '0';
|
||||
elsif(ACK_IN = '1') then
|
||||
ACK_IN_FLAG <= '1';
|
||||
end if;
|
||||
if(STATE = 0) then
|
||||
NAK_IN_FLAG <= '0';
|
||||
elsif(NAK_IN = '1') then
|
||||
NAK_IN_FLAG <= '1';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--//-- OUTPUT --------------------------------
|
||||
DATA_OUT <= PREAMBLE_DATA when (STATE_D = 2) else PAYLOAD_DATA;
|
||||
DATA_VALID_OUT <= DATA_VALID;
|
||||
SOF_OUT <= SOF;
|
||||
EOF_OUT <= EOF;
|
||||
|
||||
--//-- TEST POINTS ----------------------------
|
||||
TP(1) <= WPTR(0);
|
||||
TP(2) <= RPTR(0);
|
||||
TP(3) <= CTS_IN;
|
||||
TP(4) <= '1' when (STATE = 0) else '0';
|
||||
TP(5) <= '1' when (STATE = 1) else '0';
|
||||
TP(6) <= '1' when (BUF_SIZE >= MAX_PACKET_SIZE) else '0';
|
||||
--TP(7) <= NAK_IN_FLAG;
|
||||
--TP(8) <= SOF;
|
||||
--TP(9) <= EOF;
|
||||
--TP(9) <= DATA_VALID;
|
||||
--TP(10) <= ACK_IN_FLAG;
|
||||
end Behavioral;
|
||||
354
generic_ip/third_party_ip/tcp_server/src/arp_10G.vhd
Normal file
354
generic_ip/third_party_ip/tcp_server/src/arp_10G.vhd
Normal file
|
|
@ -0,0 +1,354 @@
|
|||
-------------------------------------------------------------
|
||||
-- MSS copyright 2003-2018
|
||||
-- Filename: ARP_10G.VHD
|
||||
-- Author: Alain Zarembowitch / MSS
|
||||
-- Version: 0
|
||||
-- Date last modified: 5/1/18
|
||||
-- Inheritance: ARP_10G.VHD version 2, 12/10/15
|
||||
--
|
||||
-- description: Address resolution protocol, 10GbE version
|
||||
-- Reads receive packet structure on the fly and generates an ARP reply.
|
||||
-- Any new received packet is presumed to be an ARP request. Within a few bytes,
|
||||
-- information is received as to the real protocol associated with the received packet.
|
||||
-- The ARP reply generation is immediately cancelled if
|
||||
-- (a) the received packet type is not an ARP request/reply
|
||||
-- (b) the Opcode does not indicate an ARP request
|
||||
-- (c) the IP address does not match
|
||||
-- (d) erroneous MAC frame
|
||||
-- Supports only Ethernet (IEEE 802.3) encapsulation
|
||||
-- ARP only applies to IPv4. For IPv6, use neighbour discovery protocol instead.
|
||||
-- Any follow-on received MAC frame is discarded while a valid ARP response awaits transmission in the elastic buffer.
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.NUMERIC_STD.ALL;
|
||||
|
||||
entity ARP_10G is
|
||||
Port (
|
||||
--// CLK, RESET
|
||||
CLK: in std_logic;
|
||||
-- Must be a global clock. No BUFG instantiation within this component.
|
||||
SYNC_RESET: in std_logic;
|
||||
|
||||
--// Packet/Frame received
|
||||
MAC_RX_DATA: in std_logic_vector(63 downto 0);
|
||||
-- USER reads the data at the rising edge of CLK when MAC_RX_DATA_VALID /= 0
|
||||
-- Bytes order: MSB was received first
|
||||
-- Bytes are left aligned: first byte in MSB, occasional follow-on fill-in Bytes in the LSB(s)
|
||||
-- The first destination address byte is always a MSB (MAC_RX_DATA(7:0))
|
||||
MAC_RX_DATA_VALID: in std_logic_vector(7 downto 0);
|
||||
-- data valid, for each byte in MAC_RX_DATA
|
||||
MAC_RX_SOF: in std_logic;
|
||||
-- '1' when sending the first byte in a received packet.
|
||||
-- Aligned with MAC_RX_DATA_VALID
|
||||
MAC_RX_EOF: in std_logic;
|
||||
-- '1' when sending the last byte in a received packet.
|
||||
-- Aligned with MAC_RX_DATA_VALID
|
||||
MAC_RX_FRAME_VALID: in std_logic;
|
||||
-- MAC frame integrity verification (at the end of frame)
|
||||
MAC_RX_WORD_COUNT: in std_logic_vector(10 downto 0);
|
||||
-- MAC word counter, 1 CLK after the input. 0 is the first word.
|
||||
|
||||
--// Configuration data: IP address, MAC address
|
||||
MAC_ADDR: in std_logic_vector(47 downto 0);
|
||||
-- MAC address. Unique for each network interface card.
|
||||
-- Natural byte order: (MSB) 0x000102030405 (LSB)
|
||||
-- as transmitted in the Ethernet packet.
|
||||
IPv4_ADDR: in std_logic_vector(31 downto 0);
|
||||
-- local IP address. 4 bytes for IPv4 only
|
||||
-- Natural order (MSB) 172.16.1.128 (LSB) as transmitted in the IP frame.
|
||||
|
||||
--// Received type
|
||||
RX_TYPE: in std_logic_vector(3 downto 0);
|
||||
-- Information stays until start of following packet.
|
||||
-- Only one valid types:
|
||||
-- 2 = Ethernet encapsulation, ARP request/reply
|
||||
RX_TYPE_RDY: in std_logic;
|
||||
-- 1 CLK-wide pulse indicating that a detection was made on the received packet
|
||||
-- type, and that RX_TYPE can be read.
|
||||
-- Detection occurs as soon as possible, two clocks after receiving byte 13 or 21.
|
||||
|
||||
--// Packet origin, already parsed in PACKET_PARSING (shared code)
|
||||
RX_SOURCE_MAC_ADDR: in std_logic_vector(47 downto 0);
|
||||
RX_SOURCE_IP_ADDR: in std_logic_vector(31 downto 0); -- IPv4 only
|
||||
|
||||
--// USER -> Transmit MAC Interface
|
||||
-- 32-bit CRC is automatically appended. User should not supply it.
|
||||
-- Synchonous with CLK
|
||||
MAC_TX_DATA: out std_logic_vector(63 downto 0);
|
||||
-- MAC reads the data at the rising edge of CLK when MAC_TX_DATA_VALID /= 0
|
||||
MAC_TX_DATA_VALID: out std_logic_vector(7 downto 0);
|
||||
-- data valid
|
||||
MAC_TX_EOF: out std_logic;
|
||||
-- '1' when sending the last byte in a packet to be transmitted.
|
||||
-- Aligned with MAC_TX_DATA_VALID
|
||||
MAC_TX_CTS: in std_logic;
|
||||
-- MAC-generated Clear To Send flow control signal. The user should check that this
|
||||
-- signal is high before sending the next MAC_TX_DATA byte.
|
||||
RTS: out std_logic;
|
||||
-- '1' when a full or partial packet is ready to be read.
|
||||
-- '0' when output buffer is empty.
|
||||
-- When the user starts reading the output buffer, it is expected that it will be
|
||||
-- read until empty.
|
||||
|
||||
|
||||
-- Test Points
|
||||
TP: out std_logic_vector(10 downto 1)
|
||||
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of ARP_10G is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
|
||||
--// STATE MACHINE ------------------
|
||||
signal STATE: unsigned(0 downto 0) := (others => '0');
|
||||
signal INPUT_ENABLED: std_logic := '1';
|
||||
signal MAC_RX_DATA_VALID_D: std_logic_vector(7 downto 0) := (others => '0');
|
||||
signal MAC_RX_SOF_D: std_logic := '0';
|
||||
signal MAC_RX_EOF_D: std_logic := '0';
|
||||
signal MAC_RX_DATA_D: std_logic_vector(63 downto 0) := (others => '0');
|
||||
signal MAC_RX_WORD_VALID_D: std_logic := '0';
|
||||
signal MAC_RX_EOF_D2: std_logic := '0';
|
||||
|
||||
--// VALIDATE ARP REQUEST -----------
|
||||
signal VALID_ARP_REQ: std_logic := '0';
|
||||
signal RX_SOURCE_MAC_ADDR0: std_logic_vector(47 downto 0) := (others => '0');
|
||||
signal RX_SOURCE_IP_ADDR0: std_logic_vector(31 downto 0) := (others => '0');
|
||||
|
||||
--// ARP REPLY -----------------
|
||||
signal MAC_TX_EOF_local: std_logic := '0';
|
||||
signal RPTR: unsigned(5 downto 0) := (others => '0'); -- range 0 - 41
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
--// STATE MACHINE ------------------
|
||||
-- A state machine is needed as this process is memoryless.
|
||||
-- State 0 = idle or incoming packet being processed. No tx packet waiting.
|
||||
-- State 1 = valid ARP request. tx packet waiting for tx capacity. Incoming packets are ignored.
|
||||
STATE_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
STATE <= (others => '0');
|
||||
elsif(MAC_RX_EOF_D2 = '1') and (VALID_ARP_REQ = '1') then
|
||||
-- event = valid ARP request. Ready to send ARP reply when tx channel opens.
|
||||
-- In the mean time, incoming packets are ignored.
|
||||
STATE <= "1";
|
||||
elsif(MAC_TX_EOF_local = '1') then
|
||||
-- event = successfully sent ARP reply. Reopen input
|
||||
STATE <= "0";
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
INPUT_ENABLED <= '1' when (STATE = 0) else '0';
|
||||
|
||||
STATE_GEN_002: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
MAC_RX_DATA_D <= (others => '0');
|
||||
MAC_RX_DATA_VALID_D <= (others => '0');
|
||||
MAC_RX_SOF_D <= '0';
|
||||
MAC_RX_EOF_D <= '0';
|
||||
MAC_RX_WORD_VALID_D <= '0';
|
||||
-- reclock data and sample clock so that they are aligned with the word count.
|
||||
elsif(INPUT_ENABLED = '0') then
|
||||
-- we still waiting to send the last ARP reply. Ignore any incoming packets until transmission is complete.
|
||||
MAC_RX_DATA_D <= (others => '0');
|
||||
MAC_RX_DATA_VALID_D <= (others => '0');
|
||||
MAC_RX_SOF_D <= '0';
|
||||
MAC_RX_EOF_D <= '0';
|
||||
MAC_RX_WORD_VALID_D <= '0';
|
||||
else
|
||||
MAC_RX_DATA_D <= MAC_RX_DATA;
|
||||
MAC_RX_DATA_VALID_D <= MAC_RX_DATA_VALID;
|
||||
MAC_RX_SOF_D <= MAC_RX_SOF;
|
||||
MAC_RX_EOF_D <= MAC_RX_EOF;
|
||||
if(unsigned(MAC_RX_DATA_VALID) /= 0) then
|
||||
MAC_RX_WORD_VALID_D <= '1';
|
||||
else
|
||||
MAC_RX_WORD_VALID_D <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
--
|
||||
--// VALIDATE ARP REQUEST -----------
|
||||
-- The ARP reply generation is immediately cancelled if
|
||||
-- (a) the received packet type is not an ARP request/reply
|
||||
-- (b) the Opcode does not indicate an ARP request
|
||||
-- (c) the IP address does not match
|
||||
-- (d) erroneous MAC frame
|
||||
-- VALID_ARP_REQ is ready at MAC_RX_EOF_D2
|
||||
VALIDITY_CHECK_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
VALID_ARP_REQ <= '1';
|
||||
MAC_RX_EOF_D2 <= '0';
|
||||
else
|
||||
MAC_RX_EOF_D2 <= MAC_RX_EOF_D;
|
||||
|
||||
if(MAC_RX_SOF_D = '1') then
|
||||
-- just received first byte. ARP request valid until proven otherwise
|
||||
VALID_ARP_REQ <= '1';
|
||||
elsif(MAC_RX_EOF = '1') and (MAC_RX_FRAME_VALID = '0') then
|
||||
-- (d) erroneous MAC frame
|
||||
VALID_ARP_REQ <= '0';
|
||||
elsif(MAC_RX_EOF_D = '1') and (unsigned(RX_TYPE) /= 2) then
|
||||
-- (a) the received packet type is not an ARP request/reply
|
||||
VALID_ARP_REQ <= '0';
|
||||
elsif (MAC_RX_WORD_VALID_D = '1') and (unsigned(MAC_RX_WORD_COUNT) = 1) then
|
||||
if (MAC_RX_DATA_D(15 downto 0) /= x"0001") then
|
||||
-- unexpected hardware type
|
||||
VALID_ARP_REQ <= '0';
|
||||
end if;
|
||||
elsif (MAC_RX_WORD_VALID_D = '1') and (unsigned(MAC_RX_WORD_COUNT) = 2) then
|
||||
if (MAC_RX_DATA_D(63 downto 32) /= x"08000604") then
|
||||
-- unexpected protocol type, hardware length or protocol length
|
||||
VALID_ARP_REQ <= '0';
|
||||
end if;
|
||||
if (MAC_RX_DATA_D(23 downto 16) /= x"01") then
|
||||
-- (b) op field does not indicate ARP request
|
||||
VALID_ARP_REQ <= '0';
|
||||
end if;
|
||||
elsif (MAC_RX_WORD_VALID_D = '1') and (unsigned(MAC_RX_WORD_COUNT) = 4) then
|
||||
if(MAC_RX_DATA_VALID_D(1 downto 0) /= "11") or (MAC_RX_DATA_D(15 downto 0) /= IPv4_ADDR(31 downto 16)) then
|
||||
-- (c) Target IP address does not match
|
||||
VALID_ARP_REQ <= '0';
|
||||
end if;
|
||||
elsif (MAC_RX_WORD_VALID_D = '1') and (unsigned(MAC_RX_WORD_COUNT) = 5) then
|
||||
if(MAC_RX_DATA_VALID_D(7 downto 6) /= "11") or (MAC_RX_DATA_D(63 downto 48) /= IPv4_ADDR(15 downto 0)) then
|
||||
-- (c) Target IP address does not match
|
||||
VALID_ARP_REQ <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--// freeze source MAC address and source IP address at the end of the packet
|
||||
-- Reason: we don't want subsequent packets to change this information while we are waiting
|
||||
-- to send the ARP reply.
|
||||
FREEZE_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
RX_SOURCE_MAC_ADDR0 <= (others => '0');
|
||||
RX_SOURCE_IP_ADDR0 <= (others => '0');
|
||||
elsif(MAC_RX_EOF = '1') and (STATE = 0) then
|
||||
RX_SOURCE_MAC_ADDR0 <= RX_SOURCE_MAC_ADDR;
|
||||
RX_SOURCE_IP_ADDR0 <= RX_SOURCE_IP_ADDR;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--// ARP REPLY -----------------
|
||||
--// Generate ARP reply packet on the fly
|
||||
ARP_RESP_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
MAC_TX_DATA <= (others => '0');
|
||||
MAC_TX_DATA_VALID <= (others => '0');
|
||||
MAC_TX_EOF_local <= '0';
|
||||
elsif(MAC_TX_CTS = '1') and (RPTR <= 6) then
|
||||
case(RPTR) is
|
||||
-- destination Ethernet address
|
||||
when "000000" =>
|
||||
MAC_TX_DATA(63 downto 16) <= RX_SOURCE_MAC_ADDR0;
|
||||
-- source Ethernet address
|
||||
MAC_TX_DATA(15 downto 0) <= MAC_ADDR(47 downto 32);
|
||||
-- our Ethernet address (2 MSBs)
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
when "000001" =>
|
||||
MAC_TX_DATA(63 downto 32) <= MAC_ADDR(31 downto 0);
|
||||
-- our Ethernet address (4 LSBs)
|
||||
MAC_TX_DATA(31 downto 0) <= x"08060001";
|
||||
-- Ethernet type, hardware type
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
when "000010" =>
|
||||
MAC_TX_DATA(63 downto 16) <= x"080006040002";
|
||||
-- protocol type
|
||||
-- hardware size, protocol size
|
||||
-- op field. ARP reply
|
||||
MAC_TX_DATA(15 downto 0) <= MAC_ADDR(47 downto 32);
|
||||
-- source Ethernet address (2 MSBs)
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
when "000011" =>
|
||||
MAC_TX_DATA(63 downto 32) <= MAC_ADDR(31 downto 0);
|
||||
-- our Ethernet address (4 LSBs)
|
||||
MAC_TX_DATA(31 downto 0) <= IPv4_ADDR(31 downto 0);
|
||||
-- sender IP address
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
when "000100" =>
|
||||
MAC_TX_DATA(63 downto 16) <= RX_SOURCE_MAC_ADDR0;
|
||||
-- destination Ethernet address
|
||||
MAC_TX_DATA(15 downto 0) <= RX_SOURCE_IP_ADDR0(31 downto 16);
|
||||
-- target IP address (2 MSBs)
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
when "000101" =>
|
||||
MAC_TX_DATA(63 downto 48) <= RX_SOURCE_IP_ADDR0(15 downto 0);
|
||||
-- target IP address (2 LSBs)
|
||||
MAC_TX_DATA(47 downto 0) <= (others => '0');
|
||||
MAC_TX_DATA_VALID <= x"C0";
|
||||
MAC_TX_EOF_local <= '1';
|
||||
when others =>
|
||||
MAC_TX_DATA <= (others => '0');
|
||||
MAC_TX_DATA_VALID <= x"00";
|
||||
MAC_TX_EOF_local <= '0';
|
||||
end case;
|
||||
else
|
||||
MAC_TX_DATA_VALID <= x"00";
|
||||
MAC_TX_EOF_local <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
MAC_TX_EOF <= MAC_TX_EOF_local;
|
||||
|
||||
--// Sequence reply transmission and Flow control
|
||||
-- Request to send when ARP reply is ready.
|
||||
RTS_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
RTS <= '0';
|
||||
RPTR <= (others => '0');
|
||||
elsif(STATE = 0) and (MAC_RX_EOF_D2 = '1') and (VALID_ARP_REQ = '1') then
|
||||
-- Valid & complete ARP request was received. Start reply transmission.
|
||||
RTS <= '1'; -- tell MAC we have a packet to send
|
||||
RPTR <= (others => '0');
|
||||
elsif(MAC_TX_CTS = '1') and (RPTR < 5) then
|
||||
-- Assemble reply on the fly.
|
||||
-- Always Ethernet encapsulation
|
||||
RPTR <= RPTR + 1; -- move read pointer in response to read request
|
||||
elsif(MAC_TX_CTS = '1') and (RPTR = 5) then
|
||||
RPTR <= RPTR + 1; -- move read pointer in response to read request
|
||||
RTS <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
|
||||
--// Test Point
|
||||
TP(1) <= MAC_RX_SOF_D;
|
||||
TP(2) <= MAC_RX_WORD_VALID_D;
|
||||
TP(3) <= STATE(0);
|
||||
TP(4) <= VALID_ARP_REQ;
|
||||
--TP(5) <= '1' when (unsigned(RX_TYPE) = 2) else '0';
|
||||
--TP(6) <= RPTR(0);
|
||||
TP(5) <= '1' when (IPv4_ADDR = x"A9FE5080") else '0';
|
||||
TP(6) <= MAC_TX_EOF_local;
|
||||
TP(10 downto 7) <= (others => '0');
|
||||
|
||||
|
||||
end Behavioral;
|
||||
1191
generic_ip/third_party_ip/tcp_server/src/arp_cache2_10G.vhd
Normal file
1191
generic_ip/third_party_ip/tcp_server/src/arp_cache2_10G.vhd
Normal file
File diff suppressed because it is too large
Load diff
150
generic_ip/third_party_ip/tcp_server/src/bram_dp2.vhd
Normal file
150
generic_ip/third_party_ip/tcp_server/src/bram_dp2.vhd
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
-------------------------------------------------------------
|
||||
-- Filename: BRAM_DP2.VHD
|
||||
-- Authors:
|
||||
-- from http://www.xilinx.com/support/documentation/sw_manuals/xilinx14_4/xst_v6s6.pdf
|
||||
-- Alain Zarembowitch / MSS
|
||||
-- Version: Rev 2
|
||||
-- Last modified: 6/29/16
|
||||
|
||||
-- Inheritance: BRAM_DP.VHD 5/7/15
|
||||
--
|
||||
-- description: synthesizable generic dual port RAM
|
||||
--
|
||||
-- Rev 1b 6/21/16 AZ
|
||||
-- Switched to numeric_std library
|
||||
-- Initialize to zero during simulation
|
||||
--
|
||||
-- Rev 2 6/29/16 AZ
|
||||
-- Added asymmetrical case (different data widths on A and B ports)
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity BRAM_DP2 is
|
||||
Generic (
|
||||
DATA_WIDTHA: integer := 9; -- MUST BE <= DATA_WIDTHB
|
||||
ADDR_WIDTHA: integer := 11;
|
||||
DATA_WIDTHB: integer := 9;
|
||||
ADDR_WIDTHB: integer := 11
|
||||
-- total size on A size MUST match total size on B side
|
||||
-- (DATA_WIDTHA * 2**ADDR_WIDTHA) == (DATA_WIDTHB * 2**ADDR_WIDTHB)
|
||||
);
|
||||
Port (
|
||||
-- chip select, active high
|
||||
|
||||
-- Port A
|
||||
CLKA : in std_logic;
|
||||
CSA: in std_logic; -- chip select, active high
|
||||
WEA : in std_logic; -- write enable, active high
|
||||
OEA : in std_logic; -- output enable, active high
|
||||
ADDRA : in std_logic_vector(ADDR_WIDTHA-1 downto 0);
|
||||
DIA : in std_logic_vector(DATA_WIDTHA-1 downto 0);
|
||||
DOA : out std_logic_vector(DATA_WIDTHA-1 downto 0);
|
||||
|
||||
-- Port B
|
||||
CLKB : in std_logic;
|
||||
CSB: in std_logic; -- chip select, active high
|
||||
WEB : in std_logic; -- write enable, active high
|
||||
OEB : in std_logic; -- output enable, active high
|
||||
ADDRB : in std_logic_vector(ADDR_WIDTHB-1 downto 0);
|
||||
DIB : in std_logic_vector(DATA_WIDTHB-1 downto 0);
|
||||
DOB : out std_logic_vector(DATA_WIDTHB-1 downto 0)
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of BRAM_DP2 is
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------function
|
||||
--function max(L,R:INTEGER) return INTEGER is
|
||||
--begin
|
||||
-- if (L > R) then
|
||||
-- return L;
|
||||
-- else
|
||||
-- return R;
|
||||
-- end if;
|
||||
--end;
|
||||
--function min(L,R:INTEGER) return INTEGER is
|
||||
--begin
|
||||
-- if(L < R) then
|
||||
-- return L;
|
||||
-- else
|
||||
-- return R;
|
||||
-- end if;
|
||||
--end;
|
||||
|
||||
-- see users constraints in generic section
|
||||
constant MIN_DATA_WIDTH: integer := DATA_WIDTHA;
|
||||
constant MAX_DATA_WIDTH: integer := DATA_WIDTHB;
|
||||
constant MIN_ADDR_WIDTH: integer := ADDR_WIDTHB;
|
||||
constant MAX_ADDR_WIDTH: integer := ADDR_WIDTHA;
|
||||
constant RATIO: integer := MAX_DATA_WIDTH / MIN_DATA_WIDTH;
|
||||
constant log2RATIO: integer := ADDR_WIDTHA - ADDR_WIDTHB;
|
||||
|
||||
-- infered
|
||||
type mem_type is array ( (2**MAX_ADDR_WIDTH)-1 downto 0 ) of std_logic_vector(MIN_DATA_WIDTH-1 downto 0);
|
||||
shared variable MEM : mem_type := (others => (others => '0'));
|
||||
signal DOA_local: std_logic_vector(DATA_WIDTHA-1 downto 0) := (others => '0');
|
||||
signal DOB_local: std_logic_vector(DATA_WIDTHB-1 downto 0) := (others => '0');
|
||||
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
-- Port A write
|
||||
process(CLKA)
|
||||
begin
|
||||
if rising_edge(CLKA) then
|
||||
if(CSA = '1') and (WEA = '1') then
|
||||
mem(to_integer(unsigned(ADDRA))) := DIA;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Port A read
|
||||
process(CLKA)
|
||||
begin
|
||||
if rising_edge(CLKA) then
|
||||
if(CSA = '1') then
|
||||
DOA_local <= mem(to_integer(unsigned(ADDRA)));
|
||||
else
|
||||
DOA_local <= (others => '0');
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- tri-state output
|
||||
DOA <= DOA_local when (CSA = '1') and (OEA = '1') else (others => 'Z');
|
||||
|
||||
-- Port B write
|
||||
process(CLKB)
|
||||
begin
|
||||
if rising_edge(CLKB) then
|
||||
if(CSB = '1') and (WEB = '1') then
|
||||
for I in 0 to RATIO-1 loop
|
||||
mem(to_integer(unsigned(ADDRB) & to_unsigned(I,log2RATIO))) := DIB((I+1)*MIN_DATA_WIDTH - 1 downto I*MIN_DATA_WIDTH);
|
||||
end loop;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Port B read
|
||||
process(CLKB)
|
||||
begin
|
||||
if rising_edge(CLKB) then
|
||||
if(CSB = '1') then
|
||||
for I in 0 to RATIO-1 loop
|
||||
DOB_local((I+1)*MIN_DATA_WIDTH - 1 downto I*MIN_DATA_WIDTH) <= mem(to_integer(unsigned(ADDRB) & to_unsigned(I,log2RATIO)));
|
||||
end loop;
|
||||
else
|
||||
DOB_local <= (others => '0');
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- tri-state output
|
||||
DOB <= DOB_local when (CSB = '1') and (OEB = '1') else (others => 'Z');
|
||||
|
||||
end Behavioral;
|
||||
2171
generic_ip/third_party_ip/tcp_server/src/com5502.vhd
Normal file
2171
generic_ip/third_party_ip/tcp_server/src/com5502.vhd
Normal file
File diff suppressed because it is too large
Load diff
57
generic_ip/third_party_ip/tcp_server/src/com5502pkg.vhd
Normal file
57
generic_ip/third_party_ip/tcp_server/src/com5502pkg.vhd
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
-------------------------------------------------------------
|
||||
-- MSS copyright 2011-2018
|
||||
-- Filename: com5502pkg.VHD
|
||||
-- Author: Alain Zarembowitch / MSS
|
||||
-- Version: 1
|
||||
-- Date last modified: 7/20/18
|
||||
-- Inheritance: com5402pkg.VHD 10/5/13
|
||||
--
|
||||
-- description: This package defines supplemental types, subtypes,
|
||||
-- constants, and functions.
|
||||
--
|
||||
-- Usage: enter the number of UDP tx and rx components, the number of TCP servers and the number of TCP clients.
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
package com5502pkg is
|
||||
|
||||
--// TCP STREAMS -----------------------------------------------------
|
||||
constant NTCPSTREAMS_MAX: integer range 0 to 255 := 1;
|
||||
-- MAXIMUM number of concurrent TCP streams handled by this component
|
||||
-- MUST BE >= NTCPSTREAM in the generic section of COM5502/COM5503
|
||||
-- limitation: <= 255 streams (some integer to 8-bit slv conversions in the memory pointers)
|
||||
-- In practice, the number of concurrent TCP streams per instantiated server is quite small as timing
|
||||
-- gets worse. If a large number of concurrent TCP streams is needed, it may be better to create
|
||||
-- multiple instantiations of the TCP_SERVER, each with a limited number of concurrent streams.
|
||||
type SLV128xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of std_logic_vector(127 downto 0);
|
||||
type SLV64xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of std_logic_vector(63 downto 0);
|
||||
type SLV32xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of std_logic_vector(31 downto 0);
|
||||
type SLV24xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of std_logic_vector(23 downto 0);
|
||||
type SLV20xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of std_logic_vector(19 downto 0);
|
||||
type SLV16xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of std_logic_vector(15 downto 0);
|
||||
type SLV17xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of std_logic_vector(16 downto 0);
|
||||
type SLV9xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of std_logic_vector(8 downto 0);
|
||||
type SLV8xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of std_logic_vector(7 downto 0);
|
||||
type SLV4xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of std_logic_vector(3 downto 0);
|
||||
type SLV2xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of std_logic_vector(1 downto 0);
|
||||
|
||||
type U64xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of unsigned(63 downto 0);
|
||||
type U32xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of unsigned(31 downto 0);
|
||||
type U24xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of unsigned(23 downto 0);
|
||||
type U17xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of unsigned(16 downto 0);
|
||||
type U16xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of unsigned(15 downto 0);
|
||||
type U8xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of unsigned(7 downto 0);
|
||||
type U4xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of unsigned(3 downto 0);
|
||||
type U2xNTCPSTREAMStype is array (integer range 0 to (NTCPSTREAMS_MAX-1)) of unsigned(1 downto 0);
|
||||
|
||||
|
||||
end com5502pkg;
|
||||
|
||||
package body com5502pkg is
|
||||
-- Future use
|
||||
|
||||
|
||||
end com5502pkg;
|
||||
|
||||
1028
generic_ip/third_party_ip/tcp_server/src/dhcp_client_10G.vhd
Normal file
1028
generic_ip/third_party_ip/tcp_server/src/dhcp_client_10G.vhd
Normal file
File diff suppressed because it is too large
Load diff
1364
generic_ip/third_party_ip/tcp_server/src/dhcp_server_10G.vhd
Normal file
1364
generic_ip/third_party_ip/tcp_server/src/dhcp_server_10G.vhd
Normal file
File diff suppressed because it is too large
Load diff
228
generic_ip/third_party_ip/tcp_server/src/dp_ram_gis.vhd
Normal file
228
generic_ip/third_party_ip/tcp_server/src/dp_ram_gis.vhd
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
-- megafunction wizard: %RAM: 2-PORT%
|
||||
-- GENERATION: STANDARD
|
||||
-- VERSION: WM1.0
|
||||
-- MODULE: altsyncram
|
||||
|
||||
-- ============================================================
|
||||
-- File Name: dp_ram_gis.vhd
|
||||
-- Megafunction Name(s):
|
||||
-- altsyncram
|
||||
--
|
||||
-- Simulation Library Files(s):
|
||||
-- altera_mf
|
||||
-- ============================================================
|
||||
-- ************************************************************
|
||||
-- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
--
|
||||
-- 18.1.0 Build 625 09/12/2018 SJ Standard Edition
|
||||
-- ************************************************************
|
||||
|
||||
|
||||
--Copyright (C) 2018 Intel Corporation. All rights reserved.
|
||||
--Your use of Intel Corporation's design tools, logic functions
|
||||
--and other software and tools, and its AMPP partner logic
|
||||
--functions, and any output files from any of the foregoing
|
||||
--(including device programming or simulation files), and any
|
||||
--associated documentation or information are expressly subject
|
||||
--to the terms and conditions of the Intel Program License
|
||||
--Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
--the Intel FPGA IP License Agreement, or other applicable license
|
||||
--agreement, including, without limitation, that your use is for
|
||||
--the sole purpose of programming logic devices manufactured by
|
||||
--Intel and sold by Intel or its authorized distributors. Please
|
||||
--refer to the applicable agreement for further details.
|
||||
|
||||
|
||||
LIBRARY ieee;
|
||||
USE ieee.std_logic_1164.all;
|
||||
|
||||
LIBRARY altera_mf;
|
||||
USE altera_mf.altera_mf_components.all;
|
||||
|
||||
ENTITY dp_ram_gis IS
|
||||
GENERIC (
|
||||
ADDR_WIDTH : natural := 11;
|
||||
DATA_WIDTH : natural := 9
|
||||
);
|
||||
PORT
|
||||
(
|
||||
address_a : IN STD_LOGIC_VECTOR (ADDR_WIDTH-1 DOWNTO 0);
|
||||
address_b : IN STD_LOGIC_VECTOR (ADDR_WIDTH-1 DOWNTO 0);
|
||||
clock : IN STD_LOGIC := '1';
|
||||
data_a : IN STD_LOGIC_VECTOR (DATA_WIDTH-1 DOWNTO 0);
|
||||
data_b : IN STD_LOGIC_VECTOR (DATA_WIDTH-1 DOWNTO 0);
|
||||
wren_a : IN STD_LOGIC := '0';
|
||||
wren_b : IN STD_LOGIC := '0';
|
||||
q_a : OUT STD_LOGIC_VECTOR (DATA_WIDTH-1 DOWNTO 0);
|
||||
q_b : OUT STD_LOGIC_VECTOR (DATA_WIDTH-1 DOWNTO 0)
|
||||
);
|
||||
END dp_ram_gis;
|
||||
|
||||
|
||||
ARCHITECTURE SYN OF dp_ram_gis IS
|
||||
|
||||
SIGNAL sub_wire0 : STD_LOGIC_VECTOR (DATA_WIDTH-1 DOWNTO 0);
|
||||
SIGNAL sub_wire1 : STD_LOGIC_VECTOR (DATA_WIDTH-1 DOWNTO 0);
|
||||
|
||||
BEGIN
|
||||
q_a <= sub_wire0(DATA_WIDTH-1 DOWNTO 0);
|
||||
q_b <= sub_wire1(DATA_WIDTH-1 DOWNTO 0);
|
||||
|
||||
altsyncram_component : altsyncram
|
||||
GENERIC MAP (
|
||||
address_reg_b => "CLOCK0",
|
||||
clock_enable_input_a => "BYPASS",
|
||||
clock_enable_input_b => "BYPASS",
|
||||
clock_enable_output_a => "BYPASS",
|
||||
clock_enable_output_b => "BYPASS",
|
||||
indata_reg_b => "CLOCK0",
|
||||
intended_device_family => "Cyclone V",
|
||||
lpm_type => "altsyncram",
|
||||
numwords_a => 2**ADDR_WIDTH,
|
||||
numwords_b => 2**ADDR_WIDTH,
|
||||
operation_mode => "BIDIR_DUAL_PORT",
|
||||
outdata_aclr_a => "NONE",
|
||||
outdata_aclr_b => "NONE",
|
||||
outdata_reg_a => "UNREGISTERED",
|
||||
outdata_reg_b => "UNREGISTERED",
|
||||
power_up_uninitialized => "FALSE",
|
||||
read_during_write_mode_mixed_ports => "DONT_CARE",
|
||||
read_during_write_mode_port_a => "NEW_DATA_NO_NBE_READ",
|
||||
read_during_write_mode_port_b => "NEW_DATA_NO_NBE_READ",
|
||||
widthad_a => ADDR_WIDTH,
|
||||
widthad_b => ADDR_WIDTH,
|
||||
width_a => DATA_WIDTH,
|
||||
width_b => DATA_WIDTH,
|
||||
width_byteena_a => 1,
|
||||
width_byteena_b => 1,
|
||||
wrcontrol_wraddress_reg_b => "CLOCK0"
|
||||
)
|
||||
PORT MAP (
|
||||
address_a => address_a,
|
||||
address_b => address_b,
|
||||
clock0 => clock,
|
||||
data_a => data_a,
|
||||
data_b => data_b,
|
||||
wren_a => wren_a,
|
||||
wren_b => wren_b,
|
||||
q_a => sub_wire0,
|
||||
q_b => sub_wire1
|
||||
);
|
||||
|
||||
|
||||
|
||||
END SYN;
|
||||
|
||||
-- ============================================================
|
||||
-- CNX file retrieval info
|
||||
-- ============================================================
|
||||
-- Retrieval info: PRIVATE: ADDRESSSTALL_A NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: ADDRESSSTALL_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: BYTEENA_ACLR_A NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: BYTEENA_ACLR_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: BYTE_ENABLE_A NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: BYTE_ENABLE_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: BYTE_SIZE NUMERIC "8"
|
||||
-- Retrieval info: PRIVATE: BlankMemory NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_A NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_A NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRdata NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRq NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRrdaddress NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRrren NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRwraddress NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRwren NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: Clock NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: Clock_A NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: Clock_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: IMPLEMENT_IN_LES NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: INDATA_ACLR_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: INDATA_REG_B NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: INIT_FILE_LAYOUT STRING "PORT_A"
|
||||
-- Retrieval info: PRIVATE: INIT_TO_SIM_X NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone V"
|
||||
-- Retrieval info: PRIVATE: JTAG_ENABLED NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: JTAG_ID STRING "NONE"
|
||||
-- Retrieval info: PRIVATE: MAXIMUM_DEPTH NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: MEMSIZE NUMERIC "262144"
|
||||
-- Retrieval info: PRIVATE: MEM_IN_BITS NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: MIFfilename STRING ""
|
||||
-- Retrieval info: PRIVATE: OPERATION_MODE NUMERIC "3"
|
||||
-- Retrieval info: PRIVATE: OUTDATA_ACLR_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: OUTDATA_REG_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_MIXED_PORTS NUMERIC "2"
|
||||
-- Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_PORT_A NUMERIC "3"
|
||||
-- Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_PORT_B NUMERIC "3"
|
||||
-- Retrieval info: PRIVATE: REGdata NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: REGq NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: REGrdaddress NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: REGrren NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: REGwraddress NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: REGwren NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
|
||||
-- Retrieval info: PRIVATE: USE_DIFF_CLKEN NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: UseDPRAM NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: VarWidth NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: WIDTH_READ_A NUMERIC "64"
|
||||
-- Retrieval info: PRIVATE: WIDTH_READ_B NUMERIC "64"
|
||||
-- Retrieval info: PRIVATE: WIDTH_WRITE_A NUMERIC "64"
|
||||
-- Retrieval info: PRIVATE: WIDTH_WRITE_B NUMERIC "64"
|
||||
-- Retrieval info: PRIVATE: WRADDR_ACLR_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: WRADDR_REG_B NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: WRCTRL_ACLR_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: enable NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: rden NUMERIC "0"
|
||||
-- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
|
||||
-- Retrieval info: CONSTANT: ADDRESS_REG_B STRING "CLOCK0"
|
||||
-- Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_A STRING "BYPASS"
|
||||
-- Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_B STRING "BYPASS"
|
||||
-- Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_A STRING "BYPASS"
|
||||
-- Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_B STRING "BYPASS"
|
||||
-- Retrieval info: CONSTANT: INDATA_REG_B STRING "CLOCK0"
|
||||
-- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone V"
|
||||
-- Retrieval info: CONSTANT: LPM_TYPE STRING "altsyncram"
|
||||
-- Retrieval info: CONSTANT: NUMWORDS_A NUMERIC "4096"
|
||||
-- Retrieval info: CONSTANT: NUMWORDS_B NUMERIC "4096"
|
||||
-- Retrieval info: CONSTANT: OPERATION_MODE STRING "BIDIR_DUAL_PORT"
|
||||
-- Retrieval info: CONSTANT: OUTDATA_ACLR_A STRING "NONE"
|
||||
-- Retrieval info: CONSTANT: OUTDATA_ACLR_B STRING "NONE"
|
||||
-- Retrieval info: CONSTANT: OUTDATA_REG_A STRING "UNREGISTERED"
|
||||
-- Retrieval info: CONSTANT: OUTDATA_REG_B STRING "UNREGISTERED"
|
||||
-- Retrieval info: CONSTANT: POWER_UP_UNINITIALIZED STRING "FALSE"
|
||||
-- Retrieval info: CONSTANT: READ_DURING_WRITE_MODE_MIXED_PORTS STRING "DONT_CARE"
|
||||
-- Retrieval info: CONSTANT: READ_DURING_WRITE_MODE_PORT_A STRING "NEW_DATA_NO_NBE_READ"
|
||||
-- Retrieval info: CONSTANT: READ_DURING_WRITE_MODE_PORT_B STRING "NEW_DATA_NO_NBE_READ"
|
||||
-- Retrieval info: CONSTANT: WIDTHAD_A NUMERIC "12"
|
||||
-- Retrieval info: CONSTANT: WIDTHAD_B NUMERIC "12"
|
||||
-- Retrieval info: CONSTANT: WIDTH_A NUMERIC "64"
|
||||
-- Retrieval info: CONSTANT: WIDTH_B NUMERIC "64"
|
||||
-- Retrieval info: CONSTANT: WIDTH_BYTEENA_A NUMERIC "1"
|
||||
-- Retrieval info: CONSTANT: WIDTH_BYTEENA_B NUMERIC "1"
|
||||
-- Retrieval info: CONSTANT: WRCONTROL_WRADDRESS_REG_B STRING "CLOCK0"
|
||||
-- Retrieval info: USED_PORT: address_a 0 0 12 0 INPUT NODEFVAL "address_a[11..0]"
|
||||
-- Retrieval info: USED_PORT: address_b 0 0 12 0 INPUT NODEFVAL "address_b[11..0]"
|
||||
-- Retrieval info: USED_PORT: clock 0 0 0 0 INPUT VCC "clock"
|
||||
-- Retrieval info: USED_PORT: data_a 0 0 64 0 INPUT NODEFVAL "data_a[63..0]"
|
||||
-- Retrieval info: USED_PORT: data_b 0 0 64 0 INPUT NODEFVAL "data_b[63..0]"
|
||||
-- Retrieval info: USED_PORT: q_a 0 0 64 0 OUTPUT NODEFVAL "q_a[63..0]"
|
||||
-- Retrieval info: USED_PORT: q_b 0 0 64 0 OUTPUT NODEFVAL "q_b[63..0]"
|
||||
-- Retrieval info: USED_PORT: wren_a 0 0 0 0 INPUT GND "wren_a"
|
||||
-- Retrieval info: USED_PORT: wren_b 0 0 0 0 INPUT GND "wren_b"
|
||||
-- Retrieval info: CONNECT: @address_a 0 0 12 0 address_a 0 0 12 0
|
||||
-- Retrieval info: CONNECT: @address_b 0 0 12 0 address_b 0 0 12 0
|
||||
-- Retrieval info: CONNECT: @clock0 0 0 0 0 clock 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @data_a 0 0 64 0 data_a 0 0 64 0
|
||||
-- Retrieval info: CONNECT: @data_b 0 0 64 0 data_b 0 0 64 0
|
||||
-- Retrieval info: CONNECT: @wren_a 0 0 0 0 wren_a 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @wren_b 0 0 0 0 wren_b 0 0 0 0
|
||||
-- Retrieval info: CONNECT: q_a 0 0 64 0 @q_a 0 0 64 0
|
||||
-- Retrieval info: CONNECT: q_b 0 0 64 0 @q_b 0 0 64 0
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL dp_ram_gis.vhd TRUE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL dp_ram_gis.inc FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL dp_ram_gis.cmp TRUE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL dp_ram_gis.bsf FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL tdp_ram_inst.vhd FALSE
|
||||
-- Retrieval info: LIB_FILE: altera_mf
|
||||
418
generic_ip/third_party_ip/tcp_server/src/icmpv6_10G.vhd
Normal file
418
generic_ip/third_party_ip/tcp_server/src/icmpv6_10G.vhd
Normal file
|
|
@ -0,0 +1,418 @@
|
|||
-------------------------------------------------------------
|
||||
-- MSS copyright 2018
|
||||
-- Filename: ICMPV6_10G.VHD
|
||||
-- Author: Alain Zarembowitch / MSS
|
||||
-- Version: 0
|
||||
-- Date last modified: 3/4/18
|
||||
-- Inheritance: n/a
|
||||
--
|
||||
-- description: ICMPV6 protocol, 10Gb
|
||||
-- Reads a received IP/ICMP frame on the fly and generate responses (Ethernet format).
|
||||
-- Any new received frame is presumed to be a valid ICMPv6 message. Within a few bytes,
|
||||
-- information is received as to the real protocol associated with the received packet.
|
||||
-- The ping echo generation is immediately cancelled if
|
||||
-- (a) not IPv6
|
||||
-- (b) invalid target IP (unicast or multicast)
|
||||
-- (c) not ICMPv6
|
||||
-- (d) ICMPv6 type not a neighbor solicitation
|
||||
-- (e) ICMPv6 solicited IP address does not match
|
||||
-- (f) erroneous MAC frame
|
||||
-- Any follow-on received IP frame is discarded while a valid response awaits transmission in the elastic buffer.
|
||||
--
|
||||
-- Device utilization (IPv6_ENABLED='1')
|
||||
-- FF: 301
|
||||
-- LUT: 835
|
||||
-- DSP48: 0
|
||||
-- 18Kb BRAM: 0
|
||||
-- BUFG: 1
|
||||
-- Minimum period: 4.683ns (Maximum Frequency: 213.516MHz) Artix7-100T -1 speed grade
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.NUMERIC_STD.ALL;
|
||||
|
||||
entity ICMPV6_10G is
|
||||
Port (
|
||||
--// CLK, RESET
|
||||
CLK: in std_logic;
|
||||
-- Must be a global clock. No BUFG instantiation within this component.
|
||||
SYNC_RESET: in std_logic;
|
||||
-- CLK-synchronous reset. MANDATORY!
|
||||
|
||||
--// ICMP frame received
|
||||
IP_RX_DATA: in std_logic_vector(63 downto 0);
|
||||
IP_RX_DATA_VALID: in std_logic_vector(7 downto 0);
|
||||
IP_RX_SOF: in std_logic;
|
||||
IP_RX_EOF: in std_logic;
|
||||
IP_RX_WORD_COUNT: in std_logic_vector(10 downto 0);
|
||||
|
||||
--// Partial checks (done in PACKET_PARSING common code)
|
||||
--// basic IP validity check
|
||||
IP_RX_FRAME_VALID: in std_logic;
|
||||
-- The received IP frame is presumed valid until proven otherwise.
|
||||
-- IP frame validity checks include:
|
||||
-- (a) protocol is IP
|
||||
-- (b) unicast or multicast destination IP address matches
|
||||
-- (c) correct IP header checksum (IPv4 only)
|
||||
-- (d) allowed IPv6
|
||||
-- (e) Ethernet frame is valid (correct FCS, dest address)
|
||||
-- Ready at IP_RX_VALID_D (= MAC_RX_DATA_VALID_D3)
|
||||
|
||||
--// Partial checks (done in PACKET_PARSING common code)
|
||||
RX_SOURCE_MAC_ADDR: in std_logic_vector(47 downto 0);
|
||||
-- Packet origin, already parsed in PACKET_PARSING (shared code)
|
||||
RX_SOURCE_IP_ADDR: in std_logic_vector(127 downto 0); -- IPv4,IPv6,ARP
|
||||
|
||||
--// Configuration data: IP address, MAC address
|
||||
MAC_ADDR: in std_logic_vector(47 downto 0);
|
||||
-- MAC address. Unique for each network interface card.
|
||||
-- Natural byte order: (MSB) 0x000102030405 (LSB)
|
||||
-- as transmitted in the Ethernet packet.
|
||||
IPv6_ADDR: in std_logic_vector(127 downto 0);
|
||||
-- local IP address. 4 bytes for IPv4, 16 bytes for IPv6
|
||||
-- Natural order (MSB) 172.16.1.128 (LSB) as transmitted in the IP frame.
|
||||
|
||||
--// IP type:
|
||||
RX_IPv4_6n: in std_logic;
|
||||
-- IP version. 4 or 6
|
||||
RX_IP_PROTOCOL: in std_logic_vector(7 downto 0);
|
||||
-- read between RX_IP_PROTOCOL_RDY (inclusive)(i.e. before IP_PAYLOAD_SOF) and IP_PAYLOAD_EOF (inclusive)
|
||||
-- most common protocols:
|
||||
-- 0 = unknown, 1 = ICMP, 2 = IGMP, 6 = TCP, 17 = UDP, 41 = IPv6 encapsulation,
|
||||
-- 58 = ICMPv6, 89 = OSPF, 132 = SCTP
|
||||
RX_IP_PROTOCOL_RDY: in std_logic;
|
||||
-- 1 CLK wide pulse.
|
||||
|
||||
--// USER -> Transmit MAC Interface
|
||||
-- 32-bit CRC is automatically appended. User should not supply it.
|
||||
-- Synchonous with CLK
|
||||
MAC_TX_DATA: out std_logic_vector(63 downto 0);
|
||||
-- MAC reads the data at the rising edge of CLK when MAC_TX_DATA_VALID /= 0
|
||||
MAC_TX_DATA_VALID: out std_logic_vector(7 downto 0);
|
||||
-- data valid
|
||||
MAC_TX_EOF: out std_logic;
|
||||
-- '1' when sending the last byte in a packet to be transmitted.
|
||||
-- Aligned with MAC_TX_DATA_VALID
|
||||
MAC_TX_CTS: in std_logic;
|
||||
-- MAC-generated Clear To Send flow control signal. The user should check that this
|
||||
-- signal is high before sending the next MAC_TX_DATA byte.
|
||||
RTS: out std_logic;
|
||||
-- '1' when a full or partial packet is ready to be read.
|
||||
-- '0' when output buffer is empty.
|
||||
-- When the user starts reading the output buffer, it is expected that it will be
|
||||
-- read until empty.
|
||||
|
||||
-- Test Points
|
||||
TP: out std_logic_vector(10 downto 1)
|
||||
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of ICMPV6_10G is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
--// STATE MACHINE ------------------
|
||||
signal STATE: unsigned(0 downto 0) := (others => '0');
|
||||
signal INPUT_ENABLED: std_logic := '1';
|
||||
signal IP_RX_WORD_VALID: std_logic := '0';
|
||||
signal IP_RX_EOF_D: std_logic := '0';
|
||||
|
||||
--// VALIDATE ICMP MESSAGE -----------
|
||||
signal VALID_ICMP_MSG0: std_logic := '0';
|
||||
signal VALID_ICMP_MSG: std_logic := '0';
|
||||
signal NEIGHBOR_SOLICITATION_FLAG: std_logic := '0';
|
||||
signal ECHO_REQUEST_FLAG: std_logic := '0';
|
||||
signal VALID_NEIGHBOR_SOLICITATION_MSG: std_logic := '0';
|
||||
--signal VALID_ECHO_REQUEST_MSG: std_logic := '0';
|
||||
signal RX_SOURCE_MAC_ADDR0: std_logic_vector(47 downto 0) := (others => '0');
|
||||
signal RX_SOURCE_IP_ADDR0: std_logic_vector(127 downto 0) := (others => '0');
|
||||
signal REPLY_CHECKSUM: unsigned(15 downto 0) := (others => '0');
|
||||
|
||||
--// ICMP CHECKSUM -----------------
|
||||
signal CKSUM_SEQ_CNTR: unsigned(2 downto 0) := "000";
|
||||
signal CKSUM_PART1: unsigned(19 downto 0) := (others => '0');
|
||||
signal CKSUM_PART2: unsigned(19 downto 0) := (others => '0');
|
||||
|
||||
--// ICMP REPLY -----------------
|
||||
signal MAC_TX_EOF_local: std_logic := '0';
|
||||
signal RPTR: unsigned(5 downto 0) := (others => '0'); -- range 0 - 10
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
--// STATE MACHINE ------------------
|
||||
-- A state machine is needed as this process is memoryless.
|
||||
-- State 0 = idle or incoming packet being processed. No tx packet waiting.
|
||||
-- State 1 = valid ICMP request. tx packet waiting for tx capacity. Incoming packets are ignored.
|
||||
STATE_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
STATE <= (others => '0');
|
||||
elsif(IP_RX_EOF_D = '1') and (INPUT_ENABLED = '1') and (VALID_NEIGHBOR_SOLICITATION_MSG = '1') then
|
||||
-- event = valid ICMP message. Ready to send reply when tx channel opens.
|
||||
-- In the mean time, incoming packets are ignored.
|
||||
STATE <= "1";
|
||||
elsif(MAC_TX_EOF_local = '1') then
|
||||
-- event = successfully sent ICMP reply. Reopen input
|
||||
STATE <= "0";
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
INPUT_ENABLED <= '1' when (STATE = 0) else '0';
|
||||
|
||||
--// VALIDATE ICMP MESSAGE -----------
|
||||
IP_RX_WORD_VALID <= '1' when (unsigned(IP_RX_DATA_VALID) /= 0) else '0';
|
||||
|
||||
VALIDITY_CHECK_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
IP_RX_EOF_D <= IP_RX_EOF;
|
||||
|
||||
if(INPUT_ENABLED = '1') then
|
||||
if(IP_RX_SOF = '1') then
|
||||
-- just received first byte. ICMP message valid until proven otherwise
|
||||
VALID_ICMP_MSG0 <= '1';
|
||||
else
|
||||
if(RX_IPv4_6n = '1') then
|
||||
-- (a) not IPv6
|
||||
VALID_ICMP_MSG0 <= '0';
|
||||
end if;
|
||||
if(RX_IP_PROTOCOL_RDY = '1') and (unsigned(RX_IP_PROTOCOL) /= 58) then
|
||||
-- (c) not ICMPv6
|
||||
VALID_ICMP_MSG0 <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
VALID_ICMP_MSG <= VALID_ICMP_MSG0 and IP_RX_FRAME_VALID; -- combine with the other checks done in parsing.vhd
|
||||
|
||||
-- Neighbor solicitation flag
|
||||
VALIDITY_CHECK_002: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(INPUT_ENABLED = '1') and (IP_RX_SOF = '1') then
|
||||
NEIGHBOR_SOLICITATION_FLAG <= '1';
|
||||
elsif(INPUT_ENABLED = '1') and (IP_RX_WORD_VALID = '1') then
|
||||
if (unsigned(IP_RX_WORD_COUNT) = 6) and (IP_RX_DATA(63 downto 48) /= x"8700") then
|
||||
-- (e) ICMPv6 type not a neighbor solicitation
|
||||
NEIGHBOR_SOLICITATION_FLAG <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
VALID_NEIGHBOR_SOLICITATION_MSG <= VALID_ICMP_MSG and NEIGHBOR_SOLICITATION_FLAG;
|
||||
|
||||
---- Echo (ping) request flag (Note: implemented in PING.VHD)
|
||||
--VALIDITY_CHECK_003: process(CLK)
|
||||
--begin
|
||||
-- if rising_edge(CLK) then
|
||||
-- if(INPUT_ENABLED = '1') and (IP_RX_SOF = '1') then
|
||||
-- ECHO_REQUEST_FLAG <= '1';
|
||||
-- elsif(INPUT_ENABLED = '1') and (IP_RX_WORD_VALID = '1') and (unsigned(IP_RX_WORD_COUNT) = 6) and (IP_RX_DATA(63 downto 48) /= x"8000") then
|
||||
-- -- (d) ICMPv6 type not an echo request
|
||||
-- ECHO_REQUEST_FLAG <= '0';
|
||||
-- end if;
|
||||
-- end if;
|
||||
--end process;
|
||||
--VALID_ECHO_REQUEST_MSG <= VALID_ICMP_MSG and ECHO_REQUEST_FLAG;
|
||||
|
||||
--// freeze source MAC address and source IP address at the end of the packet
|
||||
-- Reason: we don't want subsequent packets to change this information while we are waiting
|
||||
-- to send the ICMP reply.
|
||||
FREEZE_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
RX_SOURCE_MAC_ADDR0 <= (others => '0');
|
||||
RX_SOURCE_IP_ADDR0 <= (others => '0');
|
||||
elsif(IP_RX_EOF = '1') and (INPUT_ENABLED = '1') then
|
||||
RX_SOURCE_MAC_ADDR0 <= RX_SOURCE_MAC_ADDR;
|
||||
RX_SOURCE_IP_ADDR0 <= RX_SOURCE_IP_ADDR;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--// ICMP CHECKSUM -----------------
|
||||
-- The ICMP reply checksum is computed in two parts: one part at reset, based on the IPv6_ADDR and MAC_ADDR.
|
||||
-- The second part is computed for each valid received ICMP message.
|
||||
CKSUM_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
CKSUM_SEQ_CNTR <= "101";
|
||||
elsif(CKSUM_SEQ_CNTR > 0) then
|
||||
CKSUM_SEQ_CNTR <= CKSUM_SEQ_CNTR - 1;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
CKSUM_002: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
-- fixed part of the checksum is initialized at reset
|
||||
if(SYNC_RESET = '1') then
|
||||
CKSUM_PART1 <= resize(unsigned(IPv6_ADDR(127 downto 112)& "0"),20) + resize(unsigned(IPv6_ADDR(111 downto 96)& "0"),20);
|
||||
elsif(CKSUM_SEQ_CNTR = "101") then
|
||||
CKSUM_PART1 <= CKSUM_PART1 + resize(unsigned(IPv6_ADDR(95 downto 80)& "0"),20) + resize(unsigned(IPv6_ADDR(79 downto 64)& "0"),20);
|
||||
elsif(CKSUM_SEQ_CNTR = "100") then
|
||||
CKSUM_PART1 <= CKSUM_PART1 + resize(unsigned(IPv6_ADDR(63 downto 48)& "0"),20) + resize(unsigned(IPv6_ADDR(47 downto 32)& "0"),20);
|
||||
elsif(CKSUM_SEQ_CNTR = "011") then
|
||||
CKSUM_PART1 <= CKSUM_PART1 + resize(unsigned(IPv6_ADDR(31 downto 16)& "0"),20) + resize(unsigned(IPv6_ADDR(15 downto 0)& "0"),20);
|
||||
elsif(CKSUM_SEQ_CNTR = "010") then
|
||||
CKSUM_PART1 <= CKSUM_PART1 + resize(unsigned(MAC_ADDR(47 downto 32)),20) + resize(unsigned(MAC_ADDR(31 downto 16)),20);
|
||||
elsif(CKSUM_SEQ_CNTR = "001") then
|
||||
CKSUM_PART1 <= CKSUM_PART1 + resize(unsigned(MAC_ADDR(15 downto 0)),20) + x"EA5B";
|
||||
-- constant is the sum of 3A + 20 + 8800 + 6000 + 0201
|
||||
end if;
|
||||
|
||||
if(MAC_TX_CTS = '1') then
|
||||
-- variable part of the checksum depends on the ICMP message originator
|
||||
case(RPTR) is
|
||||
when "000001" =>
|
||||
CKSUM_PART2 <= CKSUM_PART1 + resize(unsigned(RX_SOURCE_IP_ADDR0(127 downto 112)),20) + resize(unsigned(RX_SOURCE_IP_ADDR0(111 downto 96)),20);
|
||||
when "000010" =>
|
||||
CKSUM_PART2 <= CKSUM_PART2 + resize(unsigned(RX_SOURCE_IP_ADDR0(95 downto 80)),20) + resize(unsigned(RX_SOURCE_IP_ADDR0(79 downto 64)),20);
|
||||
when "000011" =>
|
||||
CKSUM_PART2 <= CKSUM_PART2 + resize(unsigned(RX_SOURCE_IP_ADDR0(63 downto 48)),20) + resize(unsigned(RX_SOURCE_IP_ADDR0(47 downto 32)),20);
|
||||
when "000100" =>
|
||||
CKSUM_PART2 <= CKSUM_PART2 + resize(unsigned(RX_SOURCE_IP_ADDR0(31 downto 16)),20) + resize(unsigned(RX_SOURCE_IP_ADDR0(15 downto 0)),20);
|
||||
when "000101" =>
|
||||
CKSUM_PART2 <= resize(unsigned(CKSUM_PART2(15 downto 0)),20) + resize(unsigned(CKSUM_PART2(19 downto 16)),20);
|
||||
when "000110" =>
|
||||
CKSUM_PART2 <= resize(unsigned(CKSUM_PART2(15 downto 0)),20) + resize(unsigned(CKSUM_PART2(19 downto 16)),20);
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
REPLY_CHECKSUM <= not CKSUM_PART2(15 downto 0);
|
||||
|
||||
--// ICMP REPLY -----------------
|
||||
--// Generate ICMP reply packet on the fly
|
||||
ICMP_RESP_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
MAC_TX_DATA <= (others => '0');
|
||||
MAC_TX_DATA_VALID <= (others => '0');
|
||||
MAC_TX_EOF_local <= '0';
|
||||
elsif(MAC_TX_CTS = '1') and (RPTR <= 10) then
|
||||
case(RPTR) is
|
||||
|
||||
when "000000" =>
|
||||
MAC_TX_DATA(63 downto 16) <= RX_SOURCE_MAC_ADDR0;
|
||||
-- destination ethernet address
|
||||
MAC_TX_DATA(15 downto 0) <= MAC_ADDR(47 downto 32);
|
||||
-- our Ethernet address (2 MSBs)
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
when "000001" =>
|
||||
MAC_TX_DATA(63 downto 32) <= MAC_ADDR(31 downto 0);
|
||||
-- our Ethernet address (4 LSBs)
|
||||
MAC_TX_DATA(31 downto 0) <= x"86DD6000";
|
||||
-- Ethernet type, hardware type IPv6
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
when "000010" =>
|
||||
MAC_TX_DATA(63 downto 16) <= x"000000203aff";
|
||||
-- ICMPv6,32 bytes header length, hop
|
||||
MAC_TX_DATA(15 downto 0) <= IPv6_ADDR(127 downto 112);
|
||||
-- our source IPv6 address (2 MSBs)
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
when "000011" =>
|
||||
MAC_TX_DATA <= IPv6_ADDR(111 downto 48);
|
||||
-- our source IPv6 address (cont'd)
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
when "000100" =>
|
||||
MAC_TX_DATA(63 downto 16) <= IPv6_ADDR(47 downto 0);
|
||||
-- our source IPv6 address (LSBs)
|
||||
MAC_TX_DATA(15 downto 0) <= RX_SOURCE_IP_ADDR0(127 downto 112);
|
||||
-- target IP address (2 MSBs)
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
when "000101" =>
|
||||
MAC_TX_DATA <= RX_SOURCE_IP_ADDR0(111 downto 48);
|
||||
-- target IP address (cont'd)
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
when "000110" =>
|
||||
MAC_TX_DATA(63 downto 16) <= RX_SOURCE_IP_ADDR0(47 downto 0);
|
||||
-- target IP address (LSBs)
|
||||
MAC_TX_DATA(15 downto 0) <= x"8800";
|
||||
-- neighbor advertisement message, code 0
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
when "000111" =>
|
||||
MAC_TX_DATA(63 downto 48) <= std_logic_vector(REPLY_CHECKSUM);
|
||||
-- checksum
|
||||
MAC_TX_DATA(47 downto 16) <= x"60000000";
|
||||
-- router flag = 0, solicited flag = 1, overide cache entry = 1
|
||||
MAC_TX_DATA(15 downto 0) <= IPv6_ADDR(127 downto 112);
|
||||
-- target address
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
when "001000" =>
|
||||
MAC_TX_DATA <= IPv6_ADDR(111 downto 48);
|
||||
-- target IP address (cont'd)
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
when "001001" =>
|
||||
MAC_TX_DATA(63 downto 16) <= IPv6_ADDR(47 downto 0);
|
||||
-- target IP address (LSBs)
|
||||
MAC_TX_DATA(15 downto 0) <= x"0201";
|
||||
-- target link layer address, length 8 bytes
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
when "001010" =>
|
||||
MAC_TX_DATA(63 downto 16) <= MAC_ADDR;
|
||||
MAC_TX_DATA(15 downto 0) <= x"0000";
|
||||
-- our Ethernet address
|
||||
MAC_TX_DATA_VALID <= x"FC";
|
||||
MAC_TX_EOF_local <= '1';
|
||||
when others =>
|
||||
MAC_TX_DATA <= (others => '0');
|
||||
MAC_TX_DATA_VALID <= x"00";
|
||||
MAC_TX_EOF_local <= '0';
|
||||
end case;
|
||||
else
|
||||
MAC_TX_DATA_VALID <= x"00";
|
||||
MAC_TX_EOF_local <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
MAC_TX_EOF <= MAC_TX_EOF_local;
|
||||
|
||||
--// Sequence reply transmission and Flow control
|
||||
-- Request to send when ICMP reply is ready.
|
||||
RTS_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
RTS <= '0';
|
||||
RPTR <= (others => '0');
|
||||
elsif(IP_RX_EOF_D = '1') and (INPUT_ENABLED = '1') and (VALID_NEIGHBOR_SOLICITATION_MSG = '1') then
|
||||
-- Valid & complete ICMP neighbor solicitation was received. Start reply transmission.
|
||||
RTS <= '1'; -- tell MAC we have a packet to send
|
||||
RPTR <= (others => '0');
|
||||
elsif(MAC_TX_CTS = '1') and (RPTR < 10) then
|
||||
-- Assemble reply on the fly.
|
||||
-- Always Ethernet encapsulation
|
||||
RPTR <= RPTR + 1; -- move read pointer in response to read request
|
||||
elsif(MAC_TX_CTS = '1') and (RPTR = 10) then
|
||||
RPTR <= RPTR + 1; -- move read pointer in response to read request
|
||||
RTS <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--// TEST POINTS --------------------------
|
||||
TP(1) <= STATE(0);
|
||||
TP(2) <= IP_RX_WORD_VALID;
|
||||
TP(3) <= VALID_NEIGHBOR_SOLICITATION_MSG;
|
||||
TP(4) <= MAC_TX_EOF_local;
|
||||
TP(5) <= MAC_TX_CTS;
|
||||
TP(6) <= RPTR(0);
|
||||
|
||||
|
||||
|
||||
end Behavioral;
|
||||
161
generic_ip/third_party_ip/tcp_server/src/igmp_query_10G.vhd
Normal file
161
generic_ip/third_party_ip/tcp_server/src/igmp_query_10G.vhd
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
-------------------------------------------------------------
|
||||
-- MSS copyright 2019
|
||||
-- Filename: IGMP_QUERY_10G.VHD
|
||||
-- Author: Alain Zarembowitch / MSS
|
||||
-- Version: 0
|
||||
-- Date last modified: 4/27/19
|
||||
-- Inheritance: IGMP_QUERY.vhd 12/27/14
|
||||
--
|
||||
-- description: detect a valid IGMP membership query and trigger a response when applicable
|
||||
--
|
||||
-- Expects the following external validation checks (in PARSING):
|
||||
-- MAC address(just multicast bit), IP type, IP header checksum
|
||||
-- NO prior validation for complete MAC address, IP multicast destination address, IGMP checksum
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.numeric_std.ALL;
|
||||
|
||||
entity IGMP_QUERY_10G is
|
||||
Port (
|
||||
--// CLK, RESET
|
||||
CLK: in std_logic;
|
||||
SYNC_RESET: in std_logic;
|
||||
|
||||
--// Configuration
|
||||
MULTICAST_IP_ADDR : IN std_logic_vector(31 downto 0);
|
||||
-- our multicast IP address (just one)
|
||||
|
||||
--// Received IP frame payload
|
||||
-- Excludes MAC layer header and IP header.
|
||||
IP_PAYLOAD_DATA: in std_logic_vector(63 downto 0);
|
||||
IP_PAYLOAD_DATA_VALID: in std_logic_vector(7 downto 0);
|
||||
IP_PAYLOAD_SOF: in std_logic;
|
||||
IP_PAYLOAD_EOF: in std_logic;
|
||||
IP_PAYLOAD_WORD_COUNT: in std_logic_vector(10 downto 0);
|
||||
|
||||
--// Partial checks (done in PACKET_PARSING common code)
|
||||
--// basic IP validity check
|
||||
IP_RX_FRAME_VALID2: in std_logic;
|
||||
-- As the IP frame validity is checked on-the-fly, the user should always check if
|
||||
-- the IP_RX_FRAME_VALID is high AT THE END of the IP payload frame (IP_PAYLOAD_EOF) to confirm that the
|
||||
-- ENTIRE IP frame is valid.
|
||||
-- The received IP frame is presumed valid until proven otherwise.
|
||||
-- IP frame validity checks include:
|
||||
-- (a) protocol is IP
|
||||
-- (c) correct IP header checksum (IPv4 only)
|
||||
-- (d) allowed IPv6
|
||||
-- (e) Ethernet frame is valid (correct FCS, dest address)
|
||||
-- Note: ignore IP destination check in parsing. We do it within this component.
|
||||
-- Ready at IP_RX_EOF_D2 = IP_PAYLOAD_EOF
|
||||
RX_IP_PROTOCOL: in std_logic_vector(7 downto 0);
|
||||
-- read between RX_IP_PROTOCOL_RDY (inclusive)(i.e. before IP_PAYLOAD_SOF) and IP_PAYLOAD_EOF (inclusive)
|
||||
-- This component responds to protocol 2 = IGMP
|
||||
VALID_MULTICAST_DEST_IP: IN std_logic;
|
||||
VALID_IP_PAYLOAD_CHECKSUM: in std_logic;
|
||||
-- '1' when valid IP payload checksum. Read at IP_RX_EOF_D2 or IP_PAYLOAD_EOF_D
|
||||
RX_DEST_IP_ADDR: in std_logic_vector(31 downto 0);
|
||||
--
|
||||
|
||||
--// Output
|
||||
TRIGGER_RESPONSE: out std_logic;
|
||||
-- aligned with IP_PAYLOAD_EOF_D
|
||||
|
||||
-- Test Points
|
||||
TP: out std_logic_vector(10 downto 1)
|
||||
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of IGMP_QUERY_10G is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
|
||||
--// CHECK IGMP QUERY VALIDITY -----------------------------
|
||||
signal VALID_RX_IGMP0: std_logic := '0';
|
||||
signal VALID_RX_IGMP1: std_logic := '0';
|
||||
signal VALID_RX_IGMP2: std_logic := '0';
|
||||
signal VALID_RX_IGMP: std_logic := '0';
|
||||
signal IP_PAYLOAD_EOF_D: std_logic := '0';
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
--// CHECK IGMP QUERY VALIDITY -----------------------------
|
||||
-- The IGMP packet reception is immediately cancelled if
|
||||
-- (a) the received packet type is not an IP datagram (done in common code PACKET_PARSING)
|
||||
-- (b) invalid destination IP (done in common code PACKET_PARSING)
|
||||
-- (c) incorrect IP header checksum (done in common code PACKET_PARSING)
|
||||
-- (d) the received IP type is not IGMP
|
||||
-- (e) IGMP type is not membership request
|
||||
-- (f) IGMP checksum is incorrect
|
||||
-- (g) group address in IGMP query does not match our multicast IP address
|
||||
|
||||
VALIDITY_CHECK_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
IP_PAYLOAD_EOF_D <= IP_PAYLOAD_EOF;
|
||||
|
||||
if(IP_PAYLOAD_SOF = '1') then
|
||||
if(unsigned(RX_IP_PROTOCOL) /= 2) then
|
||||
-- (d) the received IP type is not IGMP
|
||||
VALID_RX_IGMP0 <= '0';
|
||||
elsif(IP_PAYLOAD_DATA(63 downto 56) /= x"11") then
|
||||
-- (e) IGMP type is not membership request
|
||||
VALID_RX_IGMP0 <= '0';
|
||||
else
|
||||
VALID_RX_IGMP0 <= '1';
|
||||
end if;
|
||||
end if;
|
||||
|
||||
-- for IGMPv2, IP_PAYLOAD_SOF and IP_PAYLOAD_EOF can be concurrent
|
||||
if(IP_PAYLOAD_EOF = '1') then
|
||||
if (IP_RX_FRAME_VALID2 = '0') then
|
||||
-- invalid IP frame
|
||||
VALID_RX_IGMP1 <= '0';
|
||||
else
|
||||
VALID_RX_IGMP1 <= '1';
|
||||
end if;
|
||||
end if;
|
||||
|
||||
if(IP_PAYLOAD_DATA_VALID(3 downto 0) = x"F") and (unsigned(IP_PAYLOAD_WORD_COUNT) = 1) then
|
||||
-- expecting group address
|
||||
if(RX_DEST_IP_ADDR = x"E0000001") then
|
||||
-- general IGMP query is sent to address 224.0.0.1 (all hosts)
|
||||
-- The group field is zeroed when sending a General Query
|
||||
if (unsigned(IP_PAYLOAD_DATA(31 downto 0)) = 0) then
|
||||
VALID_RX_IGMP2 <= '1';
|
||||
else
|
||||
-- invalid combination of zero group field and unexpected destination IP address
|
||||
VALID_RX_IGMP2 <= '0';
|
||||
end if;
|
||||
elsif(IP_PAYLOAD_DATA(31 downto 0) /= MULTICAST_IP_ADDR) then
|
||||
-- group-specific IGMP query
|
||||
-- (g) group address does not match our multicast IP address
|
||||
VALID_RX_IGMP2 <= '0';
|
||||
else
|
||||
VALID_RX_IGMP2 <= '1';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
-- combine with the other checks done in parsing.vhd
|
||||
VALID_RX_IGMP <= VALID_RX_IGMP0 and VALID_RX_IGMP1 and VALID_RX_IGMP2 and
|
||||
VALID_MULTICAST_DEST_IP and VALID_IP_PAYLOAD_CHECKSUM;
|
||||
|
||||
-- trigger a response to a query
|
||||
TRIGGER_RESPONSE <= VALID_RX_IGMP and IP_PAYLOAD_EOF_D;
|
||||
|
||||
--// Test Point
|
||||
TP(1) <= IP_PAYLOAD_EOF_D;
|
||||
TP(2) <= VALID_RX_IGMP0;
|
||||
TP(3) <= VALID_RX_IGMP1;
|
||||
TP(4) <= VALID_RX_IGMP2;
|
||||
TP(6) <= VALID_RX_IGMP;
|
||||
TP(7) <= VALID_RX_IGMP and IP_PAYLOAD_EOF_D;
|
||||
end Behavioral;
|
||||
267
generic_ip/third_party_ip/tcp_server/src/igmp_report_10G.vhd
Normal file
267
generic_ip/third_party_ip/tcp_server/src/igmp_report_10G.vhd
Normal file
|
|
@ -0,0 +1,267 @@
|
|||
-------------------------------------------------------------
|
||||
-- MSS copyright 2019
|
||||
-- Filename: IGMP_REPORT_10G.VHD
|
||||
-- Author: Alain Zarembowitch / MSS
|
||||
-- Version: 0
|
||||
-- Date last modified: 4/28/19
|
||||
-- Inheritance: IGMP_REPORT.VHD rev1 12/26/12
|
||||
--
|
||||
-- description: send an IGMP membership report out to whom it may concern
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.numeric_std.all;
|
||||
|
||||
entity IGMP_REPORT_10G is
|
||||
Port (
|
||||
--// CLK, RESET
|
||||
CLK: in std_logic;
|
||||
SYNC_RESET: in std_logic;
|
||||
-- CLK-synchronous reset. MANDATORY after IPv4_ADDR and MULTICAST_IP_ADDR are defined.
|
||||
|
||||
--// Control
|
||||
IGMP_START: in std_logic;
|
||||
-- 1 CLK pulse to start the IGMP report
|
||||
-- new requests will be ignored until the module is
|
||||
-- finished with the previous request.
|
||||
|
||||
--// Configuration data: IP address, MAC address
|
||||
MAC_ADDR: in std_logic_vector(47 downto 0);
|
||||
-- MAC address. Unique for each network interface card.
|
||||
-- Natural byte order: (MSB) 0x000102030405 (LSB)
|
||||
-- as transmitted in the Ethernet packet.
|
||||
IPv4_ADDR: in std_logic_vector(31 downto 0);
|
||||
-- local IP address
|
||||
-- Natural order (MSB) 172.16.1.128 (LSB)
|
||||
IP_ID: in std_logic_vector(15 downto 0);
|
||||
-- 16-bit IP ID, unique for each IP frame. Incremented every time
|
||||
-- an IP frame is sent .
|
||||
MULTICAST_IP_ADDR : IN std_logic_vector(31 downto 0);
|
||||
-- multicast IP address to report.
|
||||
|
||||
--// Transmit frame/packet to MAC interface
|
||||
-- 32-bit CRC is automatically appended. User should not supply it.
|
||||
-- Synchonous with CLK
|
||||
MAC_TX_DATA: out std_logic_vector(63 downto 0);
|
||||
-- MAC reads the data at the rising edge of CLK when MAC_TX_DATA_VALID /= 0
|
||||
MAC_TX_DATA_VALID: out std_logic_vector(7 downto 0);
|
||||
-- data valid
|
||||
MAC_TX_EOF: out std_logic;
|
||||
-- '1' when sending the last byte in a packet to be transmitted.
|
||||
-- Aligned with MAC_TX_DATA_VALID
|
||||
MAC_TX_CTS: in std_logic;
|
||||
-- MAC-generated Clear To Send flow control signal. The user should check that this
|
||||
-- signal is high before sending the next MAC_TX_DATA byte.
|
||||
RTS: out std_logic;
|
||||
-- '1' when a full or partial packet is ready to be read.
|
||||
-- '0' when output buffer is empty.
|
||||
-- When the user starts reading the output buffer, it is expected that it will be
|
||||
-- read until empty.
|
||||
|
||||
|
||||
-- Test Points
|
||||
TP: out std_logic_vector(10 downto 1)
|
||||
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of IGMP_REPORT_10G is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
|
||||
signal STATE: std_logic := '0';
|
||||
signal TX_PACKET_SEQUENCE: unsigned(4 downto 0) := (others => '1'); -- 46 bytes max
|
||||
signal MAC_TX_DATA_VALID_E: std_logic := '0';
|
||||
signal MAC_TX_EOF_local: std_logic := '0';
|
||||
signal RTS_local: std_logic := '0';
|
||||
signal IP_ID_D: std_logic_vector(15 downto 0):= (others => '0');
|
||||
|
||||
--// ICMP CHECKSUM -----------------
|
||||
signal CKSUM_SEQ_CNTR: unsigned(1 downto 0) := (others => '0');
|
||||
signal IP_HEADER_CKSUM0: unsigned(17 downto 0) := (others => '0');
|
||||
signal IP_HEADER_CKSUM_FINAL: unsigned(17 downto 0) := (others => '0');
|
||||
signal IGMP_CKSUM: unsigned(17 downto 0) := (others => '0');
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
TX_SEQUENCE_GEN: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') or ((IGMP_START = '1') and (STATE = '0')) or (MAC_TX_EOF_local = '1') then
|
||||
TX_PACKET_SEQUENCE <= (others => '1');
|
||||
MAC_TX_DATA_VALID_E <= '0';
|
||||
elsif(STATE = '1') and (MAC_TX_CTS = '1') then
|
||||
-- read the next word
|
||||
TX_PACKET_SEQUENCE <= TX_PACKET_SEQUENCE + 1;
|
||||
MAC_TX_DATA_VALID_E <= '1';
|
||||
else
|
||||
MAC_TX_DATA_VALID_E <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- aligned with MAC_TX_DATA_VALID
|
||||
MAX_TX_EOF_GEN: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') or (MAC_TX_EOF_local = '1') then
|
||||
MAC_TX_EOF_local <= '0';
|
||||
MAC_TX_DATA_VALID <= x"00";
|
||||
elsif(MAC_TX_DATA_VALID_E = '1') then
|
||||
if(TX_PACKET_SEQUENCE = 5) then
|
||||
-- IGMP report done. transmitting the last word (46-bytes)
|
||||
MAC_TX_DATA_VALID <= x"FC"; -- last word contains only 6 bytes
|
||||
MAC_TX_EOF_local <= '1';
|
||||
else
|
||||
MAC_TX_DATA_VALID <= x"ff";
|
||||
MAC_TX_EOF_local <= '0';
|
||||
end if;
|
||||
else
|
||||
MAC_TX_DATA_VALID <= x"00";
|
||||
MAC_TX_EOF_local <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
MAC_TX_EOF <= MAC_TX_EOF_local;
|
||||
|
||||
-- State machine
|
||||
RTS_GEN: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
RTS_local <= '0';
|
||||
STATE <= '0';
|
||||
else
|
||||
if(IGMP_START = '1') and (STATE = '0') then
|
||||
-- new transaction. Sending IGMP report
|
||||
RTS_local <= '1';
|
||||
STATE <= '1';
|
||||
-- freeze IP_ID
|
||||
IP_ID_D <= IP_ID;
|
||||
elsif(MAC_TX_EOF_local = '1') then
|
||||
-- done. transmitting the last word
|
||||
RTS_local <= '0';
|
||||
STATE <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
RTS <= RTS_local;
|
||||
|
||||
----// Generate IGMP report
|
||||
MAC_TX_DATA_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
MAC_TX_DATA <= (others => '0');
|
||||
elsif(MAC_TX_CTS = '1') then
|
||||
case TX_PACKET_SEQUENCE is
|
||||
-- Ethernet header
|
||||
when "00000" =>
|
||||
-- reserved a block of Ethernet addresses that map on to the Class D multicast addresses
|
||||
-- The reserved address 0x0100.5e00.0000 is used by Ethernet to determine a unique multicast MAC
|
||||
-- destination MAC address: multicast.
|
||||
MAC_TX_DATA(63 downto 39) <= x"01005E" & "0";
|
||||
MAC_TX_DATA(38 downto 16) <= MULTICAST_IP_ADDR(22 downto 0);
|
||||
MAC_TX_DATA(15 downto 0) <= MAC_ADDR(47 downto 32);
|
||||
when "00001" =>
|
||||
MAC_TX_DATA(63 downto 32) <= MAC_ADDR(31 downto 0);
|
||||
MAC_TX_DATA(31 downto 0) <= x"08004600"; -- Ethernet type, IP version 4, 24-byte header length, DSCP 0
|
||||
when "00010" =>
|
||||
MAC_TX_DATA(63 downto 48) <= x"0020"; -- total length 32
|
||||
MAC_TX_DATA(47 downto 32) <= IP_ID_D;
|
||||
MAC_TX_DATA(31 downto 0) <= x"00000102"; -- flags, fragment offset, TTL always 1, protocol IGMP
|
||||
when "00011" =>
|
||||
MAC_TX_DATA(63 downto 48) <= std_logic_vector(IP_HEADER_CKSUM_FINAL(15 downto 0)); -- IP header checksum
|
||||
MAC_TX_DATA(47 downto 16) <= IPv4_ADDR; -- sender IP address
|
||||
MAC_TX_DATA(15 downto 0) <= MULTICAST_IP_ADDR(31 downto 16); -- multicast IP address being reported
|
||||
when "00100" =>
|
||||
MAC_TX_DATA(63 downto 48) <= MULTICAST_IP_ADDR(15 downto 0); -- multicast IP address being reported
|
||||
-- options
|
||||
MAC_TX_DATA(47 downto 16) <= x"94040000"; -- router alert: every router examines packet
|
||||
-- IGMPv2
|
||||
MAC_TX_DATA(15 downto 0) <= x"1600"; -- membership report, maximum response time
|
||||
when others =>
|
||||
--when "00101" =>
|
||||
MAC_TX_DATA(63 downto 48) <= std_logic_vector(IGMP_CKSUM(15 downto 0)); -- IP checksum
|
||||
MAC_TX_DATA(47 downto 16) <= MULTICAST_IP_ADDR; -- group address
|
||||
MAC_TX_DATA(15 downto 0) <= (others => '0');
|
||||
end case;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--// IP HEADER CHECKSUM -----------------
|
||||
-- Computed at reset, since all the information is fixed (except for IP_ID which changes at every message)
|
||||
CKSUM_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
CKSUM_SEQ_CNTR <= "11";
|
||||
elsif(CKSUM_SEQ_CNTR > 0) then
|
||||
CKSUM_SEQ_CNTR <= CKSUM_SEQ_CNTR - 1;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
IP_HEADER_CKSUM_002: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
-- fixed part of the IP header checksum.
|
||||
if(SYNC_RESET = '1') then
|
||||
IP_HEADER_CKSUM0 <= resize(unsigned(IPv4_ADDR(31 downto 16)),18) + resize(unsigned(IPv4_ADDR(15 downto 0)),18);
|
||||
elsif(CKSUM_SEQ_CNTR = "11") then
|
||||
IP_HEADER_CKSUM0 <= IP_HEADER_CKSUM0 + resize(unsigned(MULTICAST_IP_ADDR(31 downto 16)),18);
|
||||
elsif(CKSUM_SEQ_CNTR = "10") then
|
||||
IP_HEADER_CKSUM0 <= IP_HEADER_CKSUM0 + resize(unsigned(MULTICAST_IP_ADDR(15 downto 0)),18);
|
||||
elsif(CKSUM_SEQ_CNTR = "01") then
|
||||
IP_HEADER_CKSUM0 <= IP_HEADER_CKSUM0 + ("00" & x"DB26");
|
||||
-- constant is the sum of x4600 + x0020 + x0102 + x9404
|
||||
end if;
|
||||
|
||||
-- variable part of the IP header checksum. Add IP_ID
|
||||
if(MAC_TX_CTS = '1') then
|
||||
if(TX_PACKET_SEQUENCE = "00000") then
|
||||
IP_HEADER_CKSUM_FINAL <= IP_HEADER_CKSUM0 + resize(unsigned(IP_ID_D), 18);
|
||||
elsif(TX_PACKET_SEQUENCE = "00001") then
|
||||
-- carry, first pass
|
||||
IP_HEADER_CKSUM_FINAL <= resize(IP_HEADER_CKSUM_FINAL(15 downto 0), 18) + resize(IP_HEADER_CKSUM_FINAL(17 downto 16), 18);
|
||||
elsif(TX_PACKET_SEQUENCE = "00010") then
|
||||
-- final carry + final inversion
|
||||
IP_HEADER_CKSUM_FINAL <= not(resize(IP_HEADER_CKSUM_FINAL(15 downto 0), 18) + resize(IP_HEADER_CKSUM_FINAL(17 downto 16), 18));
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
IGMP_CKSUM_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
-- fixed part of the IGMP checksum.
|
||||
if(SYNC_RESET = '1') then
|
||||
IGMP_CKSUM <= resize(unsigned(MULTICAST_IP_ADDR(31 downto 16)),18) + resize(unsigned(MULTICAST_IP_ADDR(15 downto 0)),18);
|
||||
elsif(CKSUM_SEQ_CNTR = "11") then
|
||||
IGMP_CKSUM <= IGMP_CKSUM + ("00" & x"1600");
|
||||
-- constant
|
||||
elsif(CKSUM_SEQ_CNTR = "10") then
|
||||
-- possible carry + final inversion
|
||||
IGMP_CKSUM <= not(resize(IGMP_CKSUM(15 downto 0), 18) + resize(IGMP_CKSUM(17 downto 16), 18));
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
|
||||
--// Test Point
|
||||
--TP(1) <= IGMP_START;
|
||||
--TP(2) <= MAC_TX_CTS;
|
||||
--TP(3) <= MAC_TX_DATA_VALID_E;
|
||||
--TP(4) <= MAX_TX_EOF_local;
|
||||
--TP(5) <= RTS_local;
|
||||
|
||||
end Behavioral;
|
||||
1351
generic_ip/third_party_ip/tcp_server/src/packet_parsing_10G.vhd
Normal file
1351
generic_ip/third_party_ip/tcp_server/src/packet_parsing_10G.vhd
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,270 @@
|
|||
-------------------------------------------------------------
|
||||
-- MSS copyright 2011-2018
|
||||
-- Filename: PACKETS_2_STREAM_10G.VHD
|
||||
-- Author: Alain Zarembowitch / MSS
|
||||
-- Version: 0
|
||||
-- Date last modified: 7/20/16
|
||||
-- Inheritance: PACKETS_2_STREAM.VHD 1G 7/20/16
|
||||
--
|
||||
-- description: Receive packets (in sequence) and reassemble a stream.
|
||||
-- The packets validity is checked upon receiving the last packet byte. Any failure
|
||||
-- will cause this component to discard the invalid packet and rewind the write pointer in the
|
||||
-- elastic buffer to the previous valid location.
|
||||
-- No flow control on the packets side. Flow-control (see APP_CTS) on the application side.
|
||||
--
|
||||
-- This component can interface seemlessly with USB_RX.vhd at the input to receive
|
||||
-- input packets conveyed as UDP frames over the network.
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.NUMERIC_STD.ALL;
|
||||
|
||||
entity PACKETS_2_STREAM_10G is
|
||||
generic (
|
||||
ADDR_WIDTH: integer := 8
|
||||
-- allocates buffer space: 73 bits * 2^ADDR_WIDTH words
|
||||
);
|
||||
Port (
|
||||
--// CLK, RESET
|
||||
CLK: in std_logic; -- synchronous clock
|
||||
-- Must be a global clocks. No BUFG instantiation within this component.
|
||||
SYNC_RESET: in std_logic;
|
||||
|
||||
--// INPUT PACKETS
|
||||
-- For example, interfaces with UDP_RX
|
||||
PACKET_DATA_IN: in std_logic_vector(63 downto 0);
|
||||
PACKET_DATA_VALID_IN: in std_logic_vector(7 downto 0);
|
||||
PACKET_FRAME_VALID_IN: in std_logic;
|
||||
PACKET_EOF_IN: in std_logic;
|
||||
-- 1 CLK pulse indicating that PACKET_DATA_IN is the last byte in the received packet.
|
||||
-- ALWAYS CHECK PACKET_FRAME_VALID_IN at the end of packet (PACKET_EOF_IN = '1') to confirm
|
||||
-- that the packet is valid. Internal elastic buffer may have to backtrack to the the last
|
||||
-- valid pointer to discard an invalid packet.
|
||||
-- Reason: we only knows about bad UDP packets at the end.
|
||||
PACKET_CTS_OUT: out std_logic; -- Clear To Send = transmit flow control.
|
||||
|
||||
|
||||
--// OUTPUT STREAM
|
||||
STREAM_DATA_OUT: out std_logic_vector(63 downto 0);
|
||||
STREAM_DATA_VALID_OUT: out std_logic_vector(7 downto 0);
|
||||
STREAM_CTS_IN: in std_logic; -- flow control, clear-to-send
|
||||
|
||||
STREAM_SOF_OUT: out std_logic;
|
||||
STREAM_EOF_OUT: out std_logic;
|
||||
-- optional SOF/EOF markers
|
||||
|
||||
--// TEST POINTS, MONITORING
|
||||
BAD_PACKET: out std_logic;
|
||||
-- 1 CLK wide pulse indicating a bad packet
|
||||
TP: out std_logic_vector(10 downto 1)
|
||||
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of PACKETS_2_STREAM_10G is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
|
||||
-- GIS Edit : replaced the memory model with one compatible with Intel devices
|
||||
/*
|
||||
COMPONENT BRAM_DP2
|
||||
GENERIC(
|
||||
DATA_WIDTHA: integer;
|
||||
ADDR_WIDTHA: integer;
|
||||
DATA_WIDTHB: integer;
|
||||
ADDR_WIDTHB: integer
|
||||
);
|
||||
PORT(
|
||||
CSA : IN std_logic;
|
||||
CLKA : in std_logic;
|
||||
WEA : in std_logic;
|
||||
OEA : IN std_logic;
|
||||
ADDRA : in std_logic_vector(ADDR_WIDTHA-1 downto 0);
|
||||
DIA : in std_logic_vector(DATA_WIDTHA-1 downto 0);
|
||||
DOA : out std_logic_vector(DATA_WIDTHA-1 downto 0);
|
||||
CSB : IN std_logic;
|
||||
CLKB : in std_logic;
|
||||
WEB : in std_logic;
|
||||
OEB : IN std_logic;
|
||||
ADDRB : in std_logic_vector(ADDR_WIDTHB-1 downto 0);
|
||||
DIB : in std_logic_vector(DATA_WIDTHB-1 downto 0);
|
||||
DOB : out std_logic_vector(DATA_WIDTHB-1 downto 0)
|
||||
);
|
||||
END COMPONENT;
|
||||
*/
|
||||
component tdp_ram is
|
||||
generic (
|
||||
ADDR_WIDTH : natural;
|
||||
DATA_WIDTH : integer);
|
||||
port (
|
||||
clka : in std_logic;
|
||||
clkb : in std_logic;
|
||||
ena : in std_logic := '1';
|
||||
enb : in std_logic := '1';
|
||||
wea : in std_logic;
|
||||
web : in std_logic;
|
||||
addra : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
addrb : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
dia : in std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
dib : in std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
doa : out std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
dob : out std_logic_vector(DATA_WIDTH-1 downto 0));
|
||||
end component tdp_ram;
|
||||
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
-- Suffix _D indicates a one CLK delayed version of the net with the same name
|
||||
-- Suffix _E indicates a one CLK early version of the net with the same name
|
||||
-- Suffix _X indicates an extended precision version of the net with the same name
|
||||
-- Suffix _N indicates an inverted version of the net with the same name
|
||||
|
||||
--//-- ELASTIC BUFFER ---------------------------
|
||||
signal WPTR: unsigned(ADDR_WIDTH-1 downto 0) := (others => '0');
|
||||
signal WPTR_ACKED: unsigned(ADDR_WIDTH-1 downto 0) := (others => '0');
|
||||
signal WEA: std_logic := '0';
|
||||
signal DIAx: std_logic_vector(72 downto 0) := (others => '0');
|
||||
signal RPTR: unsigned(ADDR_WIDTH-1 downto 0) := (others => '1');
|
||||
signal RPTR_D: unsigned(ADDR_WIDTH-1 downto 0) := (others => '1');
|
||||
signal BUF_SIZE: unsigned(ADDR_WIDTH-1 downto 0) := (others => '0');
|
||||
signal BUF_SIZE_ACKED: unsigned(ADDR_WIDTH-1 downto 0) := (others => '0');
|
||||
signal DOBx: std_logic_vector(72 downto 0) := (others => '0');
|
||||
signal DATA_VALID_E: std_logic := '0';
|
||||
signal DATA_VALID: std_logic := '0';
|
||||
signal SOFn_FLAG: std_logic := '0';
|
||||
signal STREAM_EOF_OUT_local: std_logic := '0';
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
-- report a bad input packet
|
||||
BAD_PACKET <= PACKET_EOF_IN and (not PACKET_FRAME_VALID_IN);
|
||||
|
||||
--//-- ELASTIC BUFFER ---------------------------
|
||||
WEA <= '1' when (unsigned(PACKET_DATA_VALID_IN) /= 0) else '0';
|
||||
WPTR_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
WPTR <= (others => '0');
|
||||
WPTR_ACKED <= (others => '0');
|
||||
elsif(WEA = '1') then
|
||||
WPTR <= WPTR + 1;
|
||||
if(PACKET_EOF_IN = '1') then
|
||||
-- last byte in the received packet. Packet is valid. Remember the next start of packet
|
||||
WPTR_ACKED <= WPTR + 1;
|
||||
end if;
|
||||
elsif(PACKET_EOF_IN = '1')then
|
||||
-- last byte in the received packet. Packet is invalid. Discard it (i.e. rewind the write pointer)
|
||||
WPTR <= WPTR_ACKED;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
DIAx <= PACKET_EOF_IN & PACKET_DATA_VALID_IN & PACKET_DATA_IN;
|
||||
-- Buffer size is controlled by generic ADDR_WIDTH
|
||||
/*
|
||||
BRAM_DP2_001: BRAM_DP2
|
||||
GENERIC MAP(
|
||||
DATA_WIDTHA => 73,
|
||||
ADDR_WIDTHA => ADDR_WIDTH,
|
||||
DATA_WIDTHB => 73,
|
||||
ADDR_WIDTHB => ADDR_WIDTH
|
||||
)
|
||||
PORT MAP(
|
||||
CSA => '1',
|
||||
CLKA => CLK,
|
||||
WEA => WEA, -- Port A Write Enable Input
|
||||
ADDRA => std_logic_vector(WPTR),
|
||||
DIA => DIAx,
|
||||
OEA => '0',
|
||||
DOA => open,
|
||||
CSB => '1',
|
||||
CLKB => CLK,
|
||||
WEB => '0',
|
||||
ADDRB => std_logic_vector(RPTR),
|
||||
DIB => (others => '0'),
|
||||
OEB => '1',
|
||||
DOB => DOBx
|
||||
);
|
||||
*/
|
||||
BRAM_DP2_001: TDP_RAM
|
||||
GENERIC MAP(
|
||||
DATA_WIDTH => 73,
|
||||
ADDR_WIDTH => ADDR_WIDTH)
|
||||
PORT MAP(
|
||||
CLKA => CLK,
|
||||
WEA => WEA, -- Port A Write Enable Input
|
||||
ADDRA => std_logic_vector(WPTR),
|
||||
DIA => DIAx,
|
||||
DOA => open,
|
||||
CLKB => CLK,
|
||||
WEB => '0',
|
||||
ADDRB => std_logic_vector(RPTR),
|
||||
DIB => (others => '0'),
|
||||
DOB => DOBx
|
||||
);
|
||||
|
||||
BUF_SIZE <= WPTR + not (RPTR);
|
||||
BUF_SIZE_ACKED <= WPTR_ACKED + not (RPTR);
|
||||
-- occupied space in the buffer
|
||||
-- confirmed and unconfirmed
|
||||
|
||||
-- input flow control (buffer 3/4 full)
|
||||
PACKET_CTS_OUT <= '0' when (BUF_SIZE(ADDR_WIDTH-1 downto ADDR_WIDTH-2) = "11") else '1';
|
||||
|
||||
-- manage read pointer
|
||||
RPTR_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
RPTR <= (others => '1');
|
||||
RPTR_D <= (others => '1');
|
||||
DATA_VALID_E <= '0';
|
||||
DATA_VALID <= '0';
|
||||
else
|
||||
-- 1 CLK delay in reading data from block RAM
|
||||
RPTR_D <= RPTR;
|
||||
DATA_VALID <= DATA_VALID_E;
|
||||
|
||||
if(STREAM_CTS_IN = '1') and (BUF_SIZE_ACKED /= 0) then
|
||||
RPTR <= RPTR + 1;
|
||||
DATA_VALID_E <= '1';
|
||||
else
|
||||
DATA_VALID_E <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--//-- OUTPUT --------------------------------
|
||||
STREAM_DATA_OUT <= DOBx(63 downto 0);
|
||||
STREAM_DATA_VALID_OUT <= DOBx(71 downto 64) when (DATA_VALID = '1') else (others => '0');
|
||||
STREAM_EOF_OUT_local <= DOBx(72) and DATA_VALID;
|
||||
STREAM_EOF_OUT <= STREAM_EOF_OUT_local;
|
||||
STREAM_SOF_OUT <= DATA_VALID and (not SOFn_FLAG);
|
||||
|
||||
-- reconstruct SOF marker
|
||||
SOF_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
SOFn_FLAG <= '0'; -- arm
|
||||
elsif(STREAM_EOF_OUT_local = '1') then
|
||||
SOFn_FLAG <= '0'; -- arm
|
||||
elsif(DATA_VALID = '1') then
|
||||
SOFn_FLAG <= '1'; -- clear
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--//-- TEST POINTS ----------------------------
|
||||
TP(1) <= WPTR(0);
|
||||
TP(2) <= RPTR(0);
|
||||
TP(3) <= WPTR(ADDR_WIDTH-1);
|
||||
TP(4) <= RPTR(ADDR_WIDTH-1);
|
||||
TP(5) <= '1' when (BUF_SIZE = 0) else '0';
|
||||
TP(6) <= '1' when (BUF_SIZE_ACKED = 0) else '0';
|
||||
end Behavioral;
|
||||
574
generic_ip/third_party_ip/tcp_server/src/ping_10G.vhd
Normal file
574
generic_ip/third_party_ip/tcp_server/src/ping_10G.vhd
Normal file
|
|
@ -0,0 +1,574 @@
|
|||
-------------------------------------------------------------
|
||||
-- MSS copyright 2018
|
||||
-- Filename: PING_10G.VHD
|
||||
-- Author: Alain Zarembowitch / MSS
|
||||
-- Version: 0
|
||||
-- Date last modified: 3/4/18
|
||||
-- Inheritance: PING.VHD rev 4, 12/10/15
|
||||
--
|
||||
-- description: PING protocol, 10Gb, for IPv4 and IPv6
|
||||
-- Reads a received IP/ICMP frame on the fly and generates a ping echo (Ethernet format).
|
||||
-- Any new received frame is presumed to be an ICMP echo (ping) request. Within a few bytes,
|
||||
-- information is received as to the real protocol associated with the received packet.
|
||||
-- The ping echo generation is immediately cancelled if
|
||||
-- (a) the received packet type is not an IP datagram or IPv6 is not allowed
|
||||
-- (b) the received IP type is not ICMP/ICMP6
|
||||
-- (c) invalid unicast destination IP (IPv4 or IPv6)
|
||||
-- (d) packet size is greater than MAX_PING_SIZE (units = 64-bit words, including IP/ICMP headers)
|
||||
-- (e) ICMP incoming packet is not an echo request (ICMP type /= x"0800") or (ICMP6 type /= 128)
|
||||
-- (f) incorrect IP header checksum (IPv4 only)
|
||||
-- (g) erroneous MAC frame (incorrect FCS, wrong dest MAC address)
|
||||
-- Any follow-on received IP frame is discarded while a valid ping response awaits transmission in the elastic buffer.
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.NUMERIC_STD.ALL;
|
||||
|
||||
entity PING_10G is
|
||||
generic (
|
||||
IPv6_ENABLED: std_logic := '0';
|
||||
-- 0 to minimize size, 1 to allow IPv6 in addition to IPv4 (larger size)
|
||||
MAX_PING_SIZE: std_logic_vector(7 downto 0) := x"FE"
|
||||
-- maximum IP/ICMP size (excluding Ethernet/MAC, but including the IP/ICMP header) in 64-bit words. Larger echo requests will be ignored.
|
||||
-- The ping buffer contains up to 18Kbits total (for a queued IP/ICMP response waiting for the tx path
|
||||
-- to become available)
|
||||
|
||||
);
|
||||
Port (
|
||||
--// CLK, RESET
|
||||
CLK: in std_logic;
|
||||
-- Must be a global clock. No BUFG instantiation within this component.
|
||||
SYNC_RESET: in std_logic;
|
||||
|
||||
--// ICMP frame received
|
||||
IP_RX_DATA: in std_logic_vector(63 downto 0);
|
||||
IP_RX_DATA_VALID: in std_logic_vector(7 downto 0);
|
||||
IP_RX_SOF: in std_logic;
|
||||
IP_RX_EOF: in std_logic;
|
||||
IP_RX_WORD_COUNT: in std_logic_vector(10 downto 0);
|
||||
|
||||
--// Partial checks (done in PACKET_PARSING common code)
|
||||
--// basic IP validity check
|
||||
IP_RX_FRAME_VALID2: in std_logic;
|
||||
-- The received IP frame is presumed valid until proven otherwise.
|
||||
-- IP frame validity checks include:
|
||||
-- (a) protocol is IP
|
||||
-- (b) unicast or multicast destination IP address matches
|
||||
-- (c) correct IP header checksum (IPv4 only)
|
||||
-- (d) allowed IPv6
|
||||
-- (e) Ethernet frame is valid (correct FCS, dest address)
|
||||
-- Also compute IP_RX_FRAME_VALID2 (no IP destination check)
|
||||
-- Ready at IP_RX_VALID_D (= MAC_RX_DATA_VALID_D3)
|
||||
VALID_UNICAST_DEST_IP: in std_logic;
|
||||
VALID_DEST_IP_RDY : in std_logic;
|
||||
-- Unicast destination address verification
|
||||
RX_SOURCE_MAC_ADDR: in std_logic_vector(47 downto 0);
|
||||
RX_SOURCE_IP_ADDR: in std_logic_vector(127 downto 0);
|
||||
-- Packet origin, already parsed in PACKET_PARSING (shared code)
|
||||
|
||||
--// Configuration data: IP address, MAC address
|
||||
MAC_ADDR: in std_logic_vector(47 downto 0);
|
||||
-- MAC address. Unique for each network interface card.
|
||||
-- Natural byte order: (MSB) 0x000102030405 (LSB)
|
||||
-- as transmitted in the Ethernet packet.
|
||||
IPv4_ADDR: in std_logic_vector(31 downto 0);
|
||||
IPv6_ADDR: in std_logic_vector(127 downto 0);
|
||||
-- local IP address. 4 bytes for IPv4, 16 bytes for IPv6
|
||||
-- Natural order (MSB) 172.16.1.128 (LSB) as transmitted in the IP frame.
|
||||
|
||||
--// IP type, already parsed in PACKET_PARSING (shared code)
|
||||
RX_IPv4_6n: in std_logic;
|
||||
-- IP version. 4 or 6
|
||||
RX_IP_PROTOCOL: in std_logic_vector(7 downto 0);
|
||||
-- read between RX_IP_PROTOCOL_RDY (inclusive)(i.e. before IP_PAYLOAD_SOF) and IP_PAYLOAD_EOF (inclusive)
|
||||
-- most common protocols:
|
||||
-- 0 = unknown, 1 = ICMP, 2 = IGMP, 6 = TCP, 17 = UDP, 41 = IPv6 encapsulation, 89 = OSPF, 132 = SCTP
|
||||
RX_IP_PROTOCOL_RDY: in std_logic;
|
||||
-- 1 CLK wide pulse.
|
||||
|
||||
--// USER -> Transmit MAC Interface
|
||||
-- 32-bit CRC is automatically appended. User should not supply it.
|
||||
-- Synchonous with CLK
|
||||
MAC_TX_DATA: out std_logic_vector(63 downto 0);
|
||||
-- MAC reads the data at the rising edge of CLK when MAC_TX_DATA_VALID /= 0
|
||||
MAC_TX_DATA_VALID: out std_logic_vector(7 downto 0);
|
||||
-- data valid
|
||||
MAC_TX_EOF: out std_logic;
|
||||
-- '1' when sending the last byte in a packet to be transmitted.
|
||||
-- Aligned with MAC_TX_DATA_VALID
|
||||
MAC_TX_CTS: in std_logic;
|
||||
-- MAC-generated Clear To Send flow control signal. The user should check that this
|
||||
-- signal is high before sending the next MAC_TX_DATA byte.
|
||||
RTS: out std_logic;
|
||||
-- '1' when a full or partial packet is ready to be read.
|
||||
-- '0' when output buffer is empty.
|
||||
-- When the user starts reading the output buffer, it is expected that it will be
|
||||
-- read until empty.
|
||||
|
||||
-- Test Points
|
||||
TP: out std_logic_vector(10 downto 1)
|
||||
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of PING_10G is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
-- GIS Edit : replaced the memory model with one compatible with Intel devices
|
||||
/*
|
||||
COMPONENT BRAM_DP2
|
||||
GENERIC(
|
||||
DATA_WIDTHA: integer;
|
||||
ADDR_WIDTHA: integer;
|
||||
DATA_WIDTHB: integer;
|
||||
ADDR_WIDTHB: integer
|
||||
);
|
||||
PORT(
|
||||
CLKA : in std_logic;
|
||||
CSA: in std_logic;
|
||||
WEA : in std_logic;
|
||||
OEA : in std_logic;
|
||||
ADDRA : in std_logic_vector(ADDR_WIDTHA-1 downto 0);
|
||||
DIA : in std_logic_vector(DATA_WIDTHA-1 downto 0);
|
||||
DOA : out std_logic_vector(DATA_WIDTHA-1 downto 0);
|
||||
CLKB : in std_logic;
|
||||
CSB: in std_logic;
|
||||
WEB : in std_logic;
|
||||
OEB : in std_logic;
|
||||
ADDRB : in std_logic_vector(ADDR_WIDTHB-1 downto 0);
|
||||
DIB : in std_logic_vector(DATA_WIDTHB-1 downto 0);
|
||||
DOB : out std_logic_vector(DATA_WIDTHB-1 downto 0)
|
||||
);
|
||||
END COMPONENT;
|
||||
*/
|
||||
component tdp_ram is
|
||||
generic (
|
||||
ADDR_WIDTH : natural;
|
||||
DATA_WIDTH : integer);
|
||||
port (
|
||||
clka : in std_logic;
|
||||
clkb : in std_logic;
|
||||
ena : in std_logic := '1';
|
||||
enb : in std_logic := '1';
|
||||
wea : in std_logic;
|
||||
web : in std_logic;
|
||||
addra : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
addrb : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
dia : in std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
dib : in std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
doa : out std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
dob : out std_logic_vector(DATA_WIDTH-1 downto 0));
|
||||
end component tdp_ram;
|
||||
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
--// STATE MACHINE ------------------
|
||||
signal STATE: unsigned(0 downto 0) := (others => '0');
|
||||
signal INPUT_ENABLED: std_logic := '1';
|
||||
signal IP_RX_WORD_VALID: std_logic := '0';
|
||||
signal RX_IPv4_6n0: std_logic := '0';
|
||||
|
||||
signal IP_RX_DATA_PREVIOUS: std_logic_vector(63 downto 0) := (others => '0');
|
||||
signal IP_RX_DATA_MOD: std_logic_vector(63 downto 0) := (others => '0');
|
||||
signal REPLY_CHECKSUM: unsigned(15 downto 0) := (others => '0');
|
||||
signal IP_RX_DATA_VALID_D: std_logic_vector(7 downto 0) := (others => '0');
|
||||
signal IP_RX_EOF_D: std_logic := '0';
|
||||
|
||||
--// ELASTIC BUFFER ----------------------
|
||||
signal WPTR: unsigned(7 downto 0) := (others => '0');
|
||||
signal WPTR_CONFIRMED: unsigned(7 downto 0) := (others => '0');
|
||||
signal WEA: std_logic := '0';
|
||||
signal DIA: std_logic_vector(72 downto 0) := (others => '0');
|
||||
signal DOB: std_logic_vector(72 downto 0) := (others => '0');
|
||||
signal DOB_PREVIOUS: std_logic_vector(72 downto 0) := (others => '0');
|
||||
signal RPTR: unsigned(7 downto 0) := (others => '1');
|
||||
signal BUF_SIZE: unsigned(7 downto 0) := (others => '0');
|
||||
|
||||
--// VALIDATE PING REQUEST -----------
|
||||
signal VALID_PING_REQ0: std_logic := '0';
|
||||
signal VALID_PING_REQ: std_logic := '0';
|
||||
|
||||
--// OUTPUT SECTION -------------------
|
||||
signal TX_SEQUENCE_CNTR: unsigned(7 downto 0) := (others => '0');
|
||||
signal TX_SEQUENCE_CNTR_D: unsigned(7 downto 0) := (others => '0');
|
||||
signal DOB_SAMPLE_CLK_E: std_logic := '0';
|
||||
signal DOB_SAMPLE_CLK: std_logic := '0';
|
||||
signal MAC_TX_CTS_D: std_logic := '0';
|
||||
signal MAC_TX_CTS_D2: std_logic := '0';
|
||||
signal MAC_TX_EOF_local: std_logic := '0';
|
||||
signal MAC_TX_DATA_VALID_local: std_logic_vector(7 downto 0) := (others => '0');
|
||||
signal RTS_local: std_logic := '0';
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
--// STATE MACHINE ------------------
|
||||
-- A state machine is needed as this process is memoryless.
|
||||
-- State 0 = idle or incoming IP frame being processed.
|
||||
-- State 1 = valid ping request. tx packet waiting for tx capacity. Incoming IP frames are discarded.
|
||||
STATE_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
STATE <= (others => '0');
|
||||
elsif(IP_RX_EOF_D = '1') and (VALID_PING_REQ = '1') then
|
||||
-- event = valid PING request. Ready to send PING reply when tx channel opens.
|
||||
-- In the mean time, incoming IP frames are discarded.
|
||||
STATE <= "1";
|
||||
elsif(MAC_TX_EOF_local = '1') then
|
||||
-- event = successfully sent PING reply. Reopen input
|
||||
STATE <= "0";
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
INPUT_ENABLED <= '1' when (STATE = 0) else '0';
|
||||
|
||||
|
||||
-- save previous IP word (needed information to swap fields)
|
||||
IN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
IP_RX_DATA_PREVIOUS <= (others => '0');
|
||||
elsif(IP_RX_DATA_VALID /= x"00") then
|
||||
IP_RX_DATA_PREVIOUS <= IP_RX_DATA;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--// freeze some parameters at the end of the packet
|
||||
-- Reason: we don't want subsequent packets to change this information while we are waiting
|
||||
-- to send the echo .
|
||||
FREEZE_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(IP_RX_EOF = '1') and (INPUT_ENABLED = '1') then
|
||||
RX_IPv4_6n0 <= RX_IPv4_6n;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--// FIELDS ALTERATIONS --------------------
|
||||
-- Modify the incoming words on the fly before temporary storage into elastic buffer
|
||||
IN_002: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
IP_RX_EOF_D <= IP_RX_EOF;
|
||||
IP_RX_DATA_VALID_D <= IP_RX_DATA_VALID;
|
||||
|
||||
if(SYNC_RESET = '1') or (INPUT_ENABLED = '0') then
|
||||
IP_RX_DATA_MOD <= (others => '0');
|
||||
elsif(RX_IPv4_6n = '1') then
|
||||
if(unsigned(IP_RX_WORD_COUNT) = 2) then
|
||||
IP_RX_DATA_MOD(63 downto 32) <= IP_RX_DATA(63 downto 32);
|
||||
IP_RX_DATA_MOD(31 downto 0) <= IPv4_ADDR; -- source is our IP address
|
||||
elsif(unsigned(IP_RX_WORD_COUNT) = 3) then
|
||||
IP_RX_DATA_MOD(63 downto 32) <= IP_RX_DATA_PREVIOUS(31 downto 0); -- swap source/dest IP addresses in response
|
||||
IP_RX_DATA_MOD(31 downto 24) <= x"00"; -- ICMP echo reply IPv4 type
|
||||
IP_RX_DATA_MOD(23 downto 16) <= IP_RX_DATA(23 downto 16); -- ICMP echo reply IPv4 code
|
||||
IP_RX_DATA_MOD(15 downto 0) <= std_logic_vector(REPLY_CHECKSUM); -- ICMP echo reply IPv4 checksum
|
||||
elsif(IP_RX_DATA_VALID /= x"00") then
|
||||
IP_RX_DATA_MOD <= IP_RX_DATA;
|
||||
end if;
|
||||
elsif(IPv6_ENABLED = '1') and (RX_IPv4_6n = '0') then
|
||||
if(unsigned(IP_RX_WORD_COUNT) = 2) then
|
||||
IP_RX_DATA_MOD <= IPv6_ADDR(127 downto 64); -- source is our IP address
|
||||
elsif(unsigned(IP_RX_WORD_COUNT) = 3) then
|
||||
IP_RX_DATA_MOD <= IPv6_ADDR(63 downto 0); -- source is our IP address
|
||||
elsif(unsigned(IP_RX_WORD_COUNT) = 4) then
|
||||
IP_RX_DATA_MOD <= RX_SOURCE_IP_ADDR(127 downto 64); -- destination IP
|
||||
elsif(unsigned(IP_RX_WORD_COUNT) = 5) then
|
||||
IP_RX_DATA_MOD <= RX_SOURCE_IP_ADDR(63 downto 0); -- destination IP
|
||||
elsif(unsigned(IP_RX_WORD_COUNT) = 6) then
|
||||
IP_RX_DATA_MOD <= x"8100" & std_logic_vector(REPLY_CHECKSUM) & IP_RX_DATA(31 downto 0); -- modify the ICMP checksum
|
||||
elsif(IP_RX_DATA_VALID /= x"00") then
|
||||
IP_RX_DATA_MOD <= IP_RX_DATA;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
REPLY_CHECKSUM_GEN: process(IP_RX_DATA, RX_IPv4_6n)
|
||||
variable CKSUM: unsigned(16 downto 0);
|
||||
begin
|
||||
if(RX_IPv4_6n = '1') then -- IPv4
|
||||
CKSUM := resize(unsigned(IP_RX_DATA(15 downto 0)),17);
|
||||
CKSUM := CKSUM + x"0800";
|
||||
else -- IPv6
|
||||
CKSUM := resize(unsigned(IP_RX_DATA(47 downto 32)),17);
|
||||
CKSUM := CKSUM - x"0100";
|
||||
end if;
|
||||
if(CKSUM(16) = '1') then
|
||||
CKSUM := CKSUM + 1;
|
||||
end if;
|
||||
REPLY_CHECKSUM <= CKSUM(15 downto 0);
|
||||
end process;
|
||||
|
||||
--// ELASTIC BUFFER ----------------------
|
||||
-- Stores the IP/ICMP frame until validity check is complete and transmission path is open
|
||||
WEA_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
WEA <= '0';
|
||||
elsif(unsigned(IP_RX_DATA_VALID) /= 0) and (INPUT_ENABLED = '1') then
|
||||
WEA <= '1';
|
||||
else
|
||||
WEA <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- write pointer management
|
||||
WPTR_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
WPTR <= (others => '0');
|
||||
elsif(IP_RX_SOF = '1') then
|
||||
-- rewind write pointer
|
||||
WPTR <= (others => '0');
|
||||
elsif(WEA = '1') then
|
||||
WPTR <= WPTR + 1;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- confirm WPTR when valid IP/ICMP request
|
||||
WPTR_CONFIRMED_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') or (MAC_TX_EOF_local = '1') then
|
||||
WPTR_CONFIRMED <= (others => '0');
|
||||
elsif(IP_RX_EOF_D = '1') and (VALID_PING_REQ = '1') then
|
||||
WPTR_CONFIRMED <= WPTR+1;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- elastic buffer.
|
||||
-- 18Kbit buffer(s)
|
||||
DIA <= IP_RX_EOF_D & IP_RX_DATA_VALID_D & IP_RX_DATA_MOD;
|
||||
|
||||
-- GIS Edit : replaced the memory model with one compatible with Intel devices
|
||||
/*
|
||||
BRAM_DP2_001: BRAM_DP2
|
||||
GENERIC MAP(
|
||||
DATA_WIDTHA => 73,
|
||||
ADDR_WIDTHA => 8,
|
||||
DATA_WIDTHB => 73,
|
||||
ADDR_WIDTHB => 8
|
||||
|
||||
)
|
||||
PORT MAP(
|
||||
CSA => '1',
|
||||
CLKA => CLK,
|
||||
WEA => WEA, -- Port A Write Enable Input
|
||||
ADDRA => std_logic_vector(WPTR), -- Port A 8-bit Address Input
|
||||
DIA => DIA, -- Port A 65-bit Data Input
|
||||
OEA => '0',
|
||||
DOA => open,
|
||||
CSB => '1',
|
||||
CLKB => CLK,
|
||||
WEB => '0',
|
||||
ADDRB => std_logic_vector(RPTR), -- Port B 8-bit Address Input
|
||||
DIB => (others => '0'), -- Port B 65-bit Data Input
|
||||
OEB => '1',
|
||||
DOB => DOB -- Port B 65-bit Data Output
|
||||
);
|
||||
*/
|
||||
|
||||
BRAM_DP2_001: TDP_RAM
|
||||
GENERIC MAP(
|
||||
DATA_WIDTH => 73,
|
||||
ADDR_WIDTH => 8)
|
||||
PORT MAP(
|
||||
CLKA => CLK,
|
||||
WEA => WEA, -- Port A Write Enable Input
|
||||
ADDRA => std_logic_vector(WPTR), -- Port A 8-bit Address Input
|
||||
DIA => DIA, -- Port A 65-bit Data Input
|
||||
DOA => open,
|
||||
CLKB => CLK,
|
||||
WEB => '0',
|
||||
ADDRB => std_logic_vector(RPTR), -- Port B 8-bit Address Input
|
||||
DIB => (others => '0'), -- Port B 65-bit Data Input
|
||||
DOB => DOB); -- Port B 65-bit Data Output
|
||||
|
||||
-- occupied buffer space, in bytes
|
||||
BUF_SIZE <= WPTR_CONFIRMED + (not RPTR);
|
||||
|
||||
--// VALIDATE PING REQUEST -----------
|
||||
-- The ping echo generation is immediately cancelled if
|
||||
-- (a) the received packet type is not an IP datagram or IPv6 is not allowed
|
||||
-- (b) the received IP type is not ICMP/ICMP6
|
||||
-- (c) invalid unicast destination IP (IPv4 or IPv6)
|
||||
-- (d) packet size is greater than MAX_PING_SIZE (units = 64-bit words, including IP/ICMP headers)
|
||||
-- (e) ICMP incoming packet is not an echo request (ICMP type /= x"0800") or (ICMP6 type /= 128)
|
||||
-- (f) incorrect IP header checksum (IPv4 only)
|
||||
-- (g) erroneous MAC frame (incorrect FCS, wrong dest MAC address)
|
||||
|
||||
IP_RX_WORD_VALID <= '1' when (unsigned(IP_RX_DATA_VALID) /= 0) else '0';
|
||||
|
||||
VALIDITY_CHECK_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
VALID_PING_REQ0 <= '1';
|
||||
elsif(IP_RX_SOF = '1') then
|
||||
-- just received first word in an IP frame. Assume validity
|
||||
VALID_PING_REQ0 <= '1';
|
||||
else
|
||||
if(RX_IP_PROTOCOL_RDY = '1') and (unsigned(RX_IP_PROTOCOL) /= 1) and (unsigned(RX_IP_PROTOCOL) /= 58) then
|
||||
-- (b) not ICMP nor ICMPv6
|
||||
VALID_PING_REQ0 <= '0';
|
||||
end if;
|
||||
if(IP_RX_WORD_VALID = '1') and (unsigned(IP_RX_WORD_COUNT) = 3) and (RX_IPv4_6n = '1') and (IP_RX_DATA(31 downto 16) /= x"0800") then
|
||||
-- (e) IPv4 and ICMP incoming packet is not an echo request (ICMP type /= 8)
|
||||
VALID_PING_REQ0 <= '0';
|
||||
end if;
|
||||
if(VALID_DEST_IP_RDY = '1') and (VALID_UNICAST_DEST_IP = '0') then
|
||||
-- (c) invalid destination IP (IPv4 or IPv6)
|
||||
VALID_PING_REQ0 <= '0';
|
||||
end if;
|
||||
if(IP_RX_WORD_VALID = '1') and (unsigned(IP_RX_WORD_COUNT) = 6) and (RX_IPv4_6n = '0') and
|
||||
((IP_RX_DATA(63 downto 48) /= x"8000") or (IPv6_ENABLED = '0')) then
|
||||
-- (e) IPv6 and ICMP6 incoming packet is not an echo request (ICMP6 type /= 128)
|
||||
VALID_PING_REQ0 <= '0';
|
||||
end if;
|
||||
if(IP_RX_WORD_VALID = '1') and (unsigned(IP_RX_WORD_COUNT(MAX_PING_SIZE'left downto 0)) > unsigned(MAX_PING_SIZE)) then
|
||||
-- (d) packet size is greater than MAX_PING_SIZE (units = 64-bit words, including IP/ICMP headers)
|
||||
VALID_PING_REQ0 <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
VALID_PING_REQ <= VALID_PING_REQ0 and IP_RX_FRAME_VALID2; -- combine with the other checks done in parsing.vhd
|
||||
|
||||
--// OUTPUT SECTION -------------------
|
||||
-- send request to send when a valid IP/ICMP echo response is ready
|
||||
RTS_local <= '1' when (BUF_SIZE /= 0) else '0';
|
||||
RTS <= RTS_local;
|
||||
|
||||
-- Output MAC frame generation
|
||||
RPTR_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
DOB_SAMPLE_CLK <= DOB_SAMPLE_CLK_E; -- latency to read from RAM
|
||||
TX_SEQUENCE_CNTR_D <= TX_SEQUENCE_CNTR;
|
||||
MAC_TX_CTS_D <= MAC_TX_CTS;
|
||||
MAC_TX_CTS_D2 <= MAC_TX_CTS_D;
|
||||
|
||||
if(SYNC_RESET = '1') or (MAC_TX_EOF_local = '1') then
|
||||
TX_SEQUENCE_CNTR <= (others => '0');
|
||||
RPTR <= (others => '1');
|
||||
DOB_SAMPLE_CLK_E <= '0';
|
||||
elsif(RTS_local = '1') and (MAC_TX_CTS = '1') then
|
||||
-- buffer is not empty and MAC requests another byte
|
||||
TX_SEQUENCE_CNTR <= TX_SEQUENCE_CNTR + 1;
|
||||
DOB_SAMPLE_CLK_E <= '1';
|
||||
if(TX_SEQUENCE_CNTR > 0) then
|
||||
RPTR <= RPTR + 1;
|
||||
end if;
|
||||
else
|
||||
DOB_SAMPLE_CLK_E <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- remember previous word
|
||||
DOB_PREVIOUS_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(DOB_SAMPLE_CLK = '1') then
|
||||
DOB_PREVIOUS <= DOB;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
MAC_TX_DATA_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
case TX_SEQUENCE_CNTR_D is
|
||||
when x"01" =>
|
||||
MAC_TX_DATA(63 downto 16) <= RX_SOURCE_MAC_ADDR; -- source <-> destination MAC
|
||||
MAC_TX_DATA(15 downto 0) <= MAC_ADDR(47 downto 32);
|
||||
when x"02" =>
|
||||
MAC_TX_DATA(63 downto 32) <= MAC_ADDR(31 downto 0); -- source <-> destination MAC
|
||||
if(RX_IPv4_6n0 = '1') then
|
||||
MAC_TX_DATA(31 downto 16) <= x"0800"; -- IPv4
|
||||
else
|
||||
MAC_TX_DATA(31 downto 16) <= x"86dd"; -- IPv6
|
||||
end if;
|
||||
MAC_TX_DATA(15 downto 0) <= DOB(63 downto 48);
|
||||
when others =>
|
||||
MAC_TX_DATA(63 downto 16) <= DOB_PREVIOUS(47 downto 0);
|
||||
MAC_TX_DATA(15 downto 0) <= DOB(63 downto 48);
|
||||
end case;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
MAC_TX_DATA_VALID_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') or (MAC_TX_EOF_local = '1') or (STATE = "0") then
|
||||
MAC_TX_DATA_VALID_local <= x"00";
|
||||
elsif(DOB_SAMPLE_CLK = '1') then
|
||||
if(unsigned(TX_SEQUENCE_CNTR_D) < 3) then
|
||||
MAC_TX_DATA_VALID_local <= x"FF";
|
||||
else
|
||||
MAC_TX_DATA_VALID_local(7 downto 2) <= DOB_PREVIOUS(69 downto 64);
|
||||
MAC_TX_DATA_VALID_local(1 downto 0) <= DOB(71 downto 70);
|
||||
end if;
|
||||
elsif(MAC_TX_CTS_D2 = '1') and (unsigned(DOB_PREVIOUS(69 downto 64)) /= 0) then
|
||||
-- flush last bytes
|
||||
MAC_TX_DATA_VALID_local(7 downto 2) <= DOB_PREVIOUS(69 downto 64);
|
||||
MAC_TX_DATA_VALID_local(1 downto 0) <= "00";
|
||||
else
|
||||
MAC_TX_DATA_VALID_local <= x"00";
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
MAC_TX_DATA_VALID <= MAC_TX_DATA_VALID_local;
|
||||
|
||||
MAC_TX_EOF_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') or (MAC_TX_EOF_local = '1') or (STATE = "0") then
|
||||
MAC_TX_EOF_local <= '0';
|
||||
elsif(DOB_SAMPLE_CLK = '1') then
|
||||
if (DOB_SAMPLE_CLK_E = '0') and (BUF_SIZE = 0) and (unsigned(DOB(69 downto 64)) = 0) then
|
||||
MAC_TX_EOF_local <= '1';
|
||||
end if;
|
||||
elsif(DOB_SAMPLE_CLK = '0') and (MAC_TX_CTS_D2 = '1') and (unsigned(DOB_PREVIOUS(69 downto 64)) /= 0) then
|
||||
-- flush last bytes
|
||||
MAC_TX_EOF_local <= '1';
|
||||
else
|
||||
MAC_TX_EOF_local <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
MAC_TX_EOF <= MAC_TX_EOF_local;
|
||||
|
||||
|
||||
|
||||
|
||||
--// TEST POINTS --------------------------
|
||||
TP(1) <= IP_RX_EOF_D and VALID_PING_REQ;
|
||||
--TP(1) <= IP_RX_SOF;
|
||||
TP(2) <= '1' when (IP_RX_DATA_VALID /= x"00") else '0';
|
||||
TP(3) <= IP_RX_EOF;
|
||||
TP(4) <= VALID_PING_REQ0;
|
||||
TP(5) <= VALID_UNICAST_DEST_IP and VALID_DEST_IP_RDY;
|
||||
TP(6) <= IP_RX_FRAME_VALID2;
|
||||
TP(7) <= DOB_SAMPLE_CLK;
|
||||
TP(8) <= MAC_TX_EOF_local;
|
||||
TP(9) <= '1' when (MAC_TX_DATA_VALID_local /= x"00") else '0';
|
||||
TP(10)<= MAC_TX_CTS;
|
||||
|
||||
|
||||
|
||||
end Behavioral;
|
||||
48
generic_ip/third_party_ip/tcp_server/src/sdp_ram.vhd
Normal file
48
generic_ip/third_party_ip/tcp_server/src/sdp_ram.vhd
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
-- Simple Dual-Port Block RAM with Two Clocks
|
||||
-- Correct Modelization with a Shared Variable
|
||||
-- File: simple_dual_two_clocks.vhd
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_unsigned.all;
|
||||
|
||||
entity sdp_ram is
|
||||
generic(
|
||||
ADDR_WIDTH: natural := 11;
|
||||
DATA_WIDTH: integer := 9);
|
||||
port(
|
||||
clka : in std_logic;
|
||||
clkb : in std_logic;
|
||||
ena : in std_logic;
|
||||
enb : in std_logic;
|
||||
wea : in std_logic;
|
||||
addra : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
addrb : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
dia : in std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
dob : out std_logic_vector(DATA_WIDTH-1 downto 0));
|
||||
end sdp_ram;
|
||||
|
||||
architecture syn of sdp_ram is
|
||||
type ram_type is array (2**ADDR_WIDTH-1 downto 0) of std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
shared variable RAM : ram_type;
|
||||
begin
|
||||
process(clka)
|
||||
begin
|
||||
if clka'event and clka = '1' then
|
||||
if ena = '1' then
|
||||
if wea = '1' then
|
||||
RAM(conv_integer(addra)) := dia;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
process(clkb)
|
||||
begin
|
||||
if clkb'event and clkb = '1' then
|
||||
if enb = '1' then
|
||||
dob <= RAM(conv_integer(addrb));
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
end syn;
|
||||
204
generic_ip/third_party_ip/tcp_server/src/serial64b_8b.vhd
Normal file
204
generic_ip/third_party_ip/tcp_server/src/serial64b_8b.vhd
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
-------------------------------------------------------------
|
||||
-- MSS copyright 2018-2019
|
||||
-- Filename: SERIAL_64b_8b.VHD
|
||||
-- Author: Alain Zarembowitch / MSS
|
||||
-- Version: 1b
|
||||
-- Date last modified: 4/19/19
|
||||
-- Inheritance: n/a
|
||||
--
|
||||
-- description: Specialized component to get 8-byte data words (typically from the COM5502 TCP receive interface)
|
||||
-- and queues the bytes into a simpler output buffer.
|
||||
-- Flow control is used from sink to source.
|
||||
-- The main reason for this component is the complexity of the 64-bit TCP rx interface.
|
||||
-- Simplicity comes at the price of throughput as the byte-wide interface is 8 times slower than the 64-bit interface.
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.NUMERIC_STD.ALL;
|
||||
|
||||
entity SERIAL_64b_8b is
|
||||
generic (
|
||||
LOOK_AHEAD: std_logic := '1'
|
||||
-- '1' is DATA_OUT is ready before output request CTS_IN (CTS_IN then means 'move to the next byte')
|
||||
-- '0' if DATA_OUT follows CTS_IN
|
||||
);
|
||||
Port (
|
||||
--// CLK, RESET
|
||||
CLK: in std_logic; -- synchronous clock
|
||||
-- Must be a global clocks. No BUFG instantiation within this component.
|
||||
SYNC_RESET: in std_logic;
|
||||
|
||||
--// INPUT PACKETS
|
||||
DATA_IN: in std_logic_vector(63 downto 0);
|
||||
-- packed MSB first
|
||||
DATA_VALID_IN: in std_logic_vector(7 downto 0);
|
||||
-- MSb first
|
||||
-- FF indicates that DATA_IN contains a complete 8-byte word (one CLK pulse only)
|
||||
-- 80,C0,E0,F0,F8,FC,FE indicate a partially fully DATA_IN (can last more than one clock until the word becomes full)
|
||||
RTS_IN: in std_logic; -- Ready To Send
|
||||
CTS_OUT: out std_logic; -- Clear To Send
|
||||
CTS_OUT_ACK: in std_logic; -- CTS_OUT accepted. New (partial) word at the next clock
|
||||
|
||||
|
||||
--// OUTPUT STREAM
|
||||
DATA_OUT: out std_logic_vector(7 downto 0);
|
||||
DATA_VALID_OUT: out std_logic;
|
||||
CTS_IN: in std_logic; -- flow control, clear-to-send (1 clk pulse requesting a byte)
|
||||
RTS_OUT: out std_logic; -- indicates at least one byte awaiting to be read. User must raise CTS_IN for 1 clk to get it.
|
||||
|
||||
--// TEST POINTS, MONITORING
|
||||
TP: out std_logic_vector(10 downto 1)
|
||||
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of SERIAL_64b_8b is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
-- Suffix _D indicates a one CLK delayed version of the net with the same name
|
||||
-- Suffix _E indicates a one CLK early version of the net with the same name
|
||||
-- Suffix _X indicates an extended precision version of the net with the same name
|
||||
-- Suffix _N indicates an inverted version of the net with the same name
|
||||
|
||||
signal SERIALIZING_IN_PROGRESS: std_logic := '0';
|
||||
signal DATA_VALID_IN_EXTENDED: std_logic := '0';
|
||||
signal DATA_VALID_IN_D: std_logic_vector(7 downto 0) := (others => '0');
|
||||
signal NEED_NEXT_WORD: std_logic := '0';
|
||||
signal CTS_OUT_local: std_logic := '0';
|
||||
signal CTS_OUT_D: std_logic := '0';
|
||||
signal NEXT_BYTE: std_logic_vector(7 downto 0) := (others => '0');
|
||||
signal RTS_OUT_local: std_logic := '0';
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
-- flow control
|
||||
SERIALIZING_IN_PROGRESS_GEN: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
SERIALIZING_IN_PROGRESS <= '0';
|
||||
elsif(CTS_OUT_ACK = '1') then
|
||||
-- new incoming word (partial or full)
|
||||
SERIALIZING_IN_PROGRESS <= '1';
|
||||
elsif(NEXT_BYTE(0) = '1') and (CTS_IN = '1') then
|
||||
SERIALIZING_IN_PROGRESS <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- extend the DATA_VALID_IN=xFF (a single clk pulse) until the next byte (first in next word) is received
|
||||
EXTEND_DATA_VALID_IN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
DATA_VALID_IN_EXTENDED <= '0';
|
||||
elsif(NEXT_BYTE(0) = '1') and (CTS_IN = '1') then
|
||||
-- reading the last byte in a word. clear
|
||||
DATA_VALID_IN_EXTENDED <= '0';
|
||||
elsif(DATA_VALID_IN = x"FF") then
|
||||
DATA_VALID_IN_EXTENDED <= '1';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- need next word
|
||||
NEED_NEXT_WORD <= '1' when (NEXT_BYTE = x"80") else '0';
|
||||
|
||||
-- send request for next word
|
||||
CTS_OUT_local <= RTS_IN and (not SERIALIZING_IN_PROGRESS) and NEED_NEXT_WORD and not(CTS_OUT_D);
|
||||
CTS_OUT <= CTS_OUT_local;
|
||||
|
||||
-- flow control
|
||||
CTS_GEN: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
CTS_OUT_D <= CTS_OUT_local;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- byte pointer. Indicates the next byte to read.
|
||||
NEXT_BYTE_GEN: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
-- Point to first byte (MSB)
|
||||
NEXT_BYTE <= "10000000";
|
||||
elsif(CTS_IN = '1') and (RTS_OUT_local = '1') then
|
||||
-- sink requests the next byte and it is available
|
||||
-- circular shift of a single '1' from left to right
|
||||
NEXT_BYTE <= NEXT_BYTE(0) & NEXT_BYTE(7 downto 1);
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
LH0: if (LOOK_AHEAD = '0') generate
|
||||
DATA_OUT_GEN: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
DATA_VALID_OUT <= RTS_OUT_local and CTS_IN;
|
||||
|
||||
if(SYNC_RESET = '1') then
|
||||
DATA_OUT <= (others => '0');
|
||||
elsif(CTS_IN = '1') then
|
||||
if (NEXT_BYTE(7) = '1') then -- MSB first
|
||||
DATA_OUT <= DATA_IN(63 downto 56);
|
||||
elsif (NEXT_BYTE(6) = '1') then
|
||||
DATA_OUT <= DATA_IN(55 downto 48);
|
||||
elsif (NEXT_BYTE(5) = '1') then
|
||||
DATA_OUT <= DATA_IN(47 downto 40);
|
||||
elsif (NEXT_BYTE(4) = '1') then
|
||||
DATA_OUT <= DATA_IN(39 downto 32);
|
||||
elsif (NEXT_BYTE(3) = '1') then
|
||||
DATA_OUT <= DATA_IN(31 downto 24);
|
||||
elsif (NEXT_BYTE(2) = '1') then
|
||||
DATA_OUT <= DATA_IN(23 downto 16);
|
||||
elsif (NEXT_BYTE(1) = '1') then
|
||||
DATA_OUT <= DATA_IN(15 downto 8);
|
||||
else
|
||||
--elsif (NEXT_BYTE(0) = '1') then
|
||||
DATA_OUT <= DATA_IN(7 downto 0);
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
RTS_OUT_local <= '1' when ((NEXT_BYTE and DATA_VALID_IN) /= x"00") or (DATA_VALID_IN_EXTENDED = '1') else '0';
|
||||
end generate;
|
||||
|
||||
LH1: if (LOOK_AHEAD = '1') generate
|
||||
DATA_OUT_GEN: process(NEXT_BYTE, DATA_IN)
|
||||
begin
|
||||
if (NEXT_BYTE(7) = '1') then -- MSB first
|
||||
DATA_OUT <= DATA_IN(63 downto 56);
|
||||
elsif (NEXT_BYTE(6) = '1') then
|
||||
DATA_OUT <= DATA_IN(55 downto 48);
|
||||
elsif (NEXT_BYTE(5) = '1') then
|
||||
DATA_OUT <= DATA_IN(47 downto 40);
|
||||
elsif (NEXT_BYTE(4) = '1') then
|
||||
DATA_OUT <= DATA_IN(39 downto 32);
|
||||
elsif (NEXT_BYTE(3) = '1') then
|
||||
DATA_OUT <= DATA_IN(31 downto 24);
|
||||
elsif (NEXT_BYTE(2) = '1') then
|
||||
DATA_OUT <= DATA_IN(23 downto 16);
|
||||
elsif (NEXT_BYTE(1) = '1') then
|
||||
DATA_OUT <= DATA_IN(15 downto 8);
|
||||
else
|
||||
--elsif (NEXT_BYTE(0) = '1') then
|
||||
DATA_OUT <= DATA_IN(7 downto 0);
|
||||
end if;
|
||||
end process;
|
||||
|
||||
DATA_VALID_OUT <= RTS_OUT_local and CTS_IN;
|
||||
|
||||
RTS_OUT_local <= '1' when ((NEXT_BYTE and DATA_VALID_IN) /= x"00") or (DATA_VALID_IN_EXTENDED = '1') else '0';
|
||||
|
||||
end generate;
|
||||
|
||||
RTS_OUT <= RTS_OUT_local;
|
||||
end Behavioral;
|
||||
|
|
@ -0,0 +1,440 @@
|
|||
-------------------------------------------------------------
|
||||
-- MSS copyright 2018
|
||||
-- Filename: STREAM_2_PACKETS_10G.VHD
|
||||
-- Author: Alain Zarembowitch / MSS
|
||||
-- Version: 0
|
||||
-- Date last modified: 3/11/18
|
||||
-- Inheritance: COM-5402 STREAM_2_PACKETS.VHD 8/18/11 rev1
|
||||
--
|
||||
-- description: Send a stream in the form of packets.
|
||||
-- 10Gbits/s speed.
|
||||
-- Fully portable VHDL.
|
||||
-- The input stream is segmented into data packets. The packet transmission
|
||||
-- is triggered when one of two events occur:
|
||||
-- (a) full packet: the number of bytes waiting for transmission is greater or equal than
|
||||
-- the maximum packet size (see constant MAX_PACKET_SIZE within), or
|
||||
-- (b) no-new-input timeout: there are a few bytes waiting for transmission but no new input
|
||||
-- bytes were received in the last 200us (or adjust constant TX_IDLE_TIMEOUT within).
|
||||
--
|
||||
-- If the follow-on transmission component is unable to immediately send the packet
|
||||
-- (for example if UDP_TX is missing routing information) it will return a negative acknowledgement (NAK).
|
||||
-- This component is responsible for triggering a re-transmission at a later time.
|
||||
-- The wait before the next retransmission attempt is defined by the constant TX_RETRY_TIMEOUT within.
|
||||
--
|
||||
-- This component can interface seemlessly with PRBS11P.vhd at the input for generating
|
||||
-- a high-speed pseudo-random test pattern generation (perfect for throughput and BER
|
||||
-- measurements).
|
||||
--
|
||||
-- This component can interface seemlessly with USB_TX.vhd at the output to encapsulate
|
||||
-- the output packets within UDP frames for network transmission.
|
||||
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.NUMERIC_STD.ALL;
|
||||
|
||||
entity STREAM_2_PACKETS_10G is
|
||||
generic (
|
||||
MAX_PACKET_SIZE: integer := 256;
|
||||
-- in number of 64-bit words.
|
||||
TX_IDLE_TIMEOUT: integer range 0 to 50 := 50;
|
||||
-- inactive input timeout, expressed in 4us units. -- 50*4us = 200us
|
||||
ADDR_WIDTH: integer := 8;
|
||||
-- allocates buffer space: 72 bits * 2^ADDR_WIDTH words
|
||||
-- CAREFUL: if the buffer allocation is too small, the maximum frame size may not be reached
|
||||
-- and only the (slow) timer will trigger a packet transmission
|
||||
SIMULATION: std_logic := '0'
|
||||
);
|
||||
Port (
|
||||
--// CLK, RESET
|
||||
SYNC_RESET: in std_logic;
|
||||
CLK: in std_logic; -- synchronous clock
|
||||
-- Must be a global clocks. No BUFG instantiation within this component.
|
||||
TICK_4US: in std_logic;
|
||||
|
||||
--// INPUT STREAM
|
||||
STREAM_DATA: in std_logic_vector(63 downto 0);
|
||||
STREAM_DATA_VALID: in std_logic_vector(7 downto 0);
|
||||
-- valid must be either 0x00 or 0xFF. No partial word allowed here.
|
||||
STREAM_CTS: out std_logic; -- flow control
|
||||
|
||||
--// OUTPUT PACKETS
|
||||
-- For example, interfaces with UDP_TX
|
||||
DATA_OUT: out std_logic_vector(63 downto 0);
|
||||
DATA_VALID_OUT: out std_logic_vector(7 downto 0);
|
||||
SOF_OUT: out std_logic; -- also resets internal state machine
|
||||
EOF_OUT: out std_logic;
|
||||
CTS_IN: in std_logic; -- Clear To Send = transmit flow control.
|
||||
ACK_IN: in std_logic;
|
||||
-- previous packet is accepted for transmission.
|
||||
-- ACK/NAK can arrive anytime after SOF_OUT, even before the packet is fully transferred
|
||||
NAK_IN: in std_logic;
|
||||
-- could not send the packet (for example, no routing information available for the selected
|
||||
-- LAN destination IP). Try later.
|
||||
|
||||
--// TEST POINTS
|
||||
TP: out std_logic_vector(10 downto 1)
|
||||
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of STREAM_2_PACKETS_10G is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
-- GIS Edit : replaced the memory model with one compatible with Intel devices
|
||||
/*
|
||||
COMPONENT BRAM_DP2
|
||||
GENERIC(
|
||||
DATA_WIDTHA: integer;
|
||||
ADDR_WIDTHA: integer;
|
||||
DATA_WIDTHB: integer;
|
||||
ADDR_WIDTHB: integer
|
||||
);
|
||||
PORT(
|
||||
CSA : IN std_logic;
|
||||
CLKA : in std_logic;
|
||||
WEA : in std_logic;
|
||||
OEA : IN std_logic;
|
||||
ADDRA : in std_logic_vector(ADDR_WIDTHA-1 downto 0);
|
||||
DIA : in std_logic_vector(DATA_WIDTHA-1 downto 0);
|
||||
DOA : out std_logic_vector(DATA_WIDTHA-1 downto 0);
|
||||
CSB : IN std_logic;
|
||||
CLKB : in std_logic;
|
||||
WEB : in std_logic;
|
||||
OEB : IN std_logic;
|
||||
ADDRB : in std_logic_vector(ADDR_WIDTHB-1 downto 0);
|
||||
DIB : in std_logic_vector(DATA_WIDTHB-1 downto 0);
|
||||
DOB : out std_logic_vector(DATA_WIDTHB-1 downto 0)
|
||||
);
|
||||
END COMPONENT;
|
||||
*/
|
||||
component tdp_ram is
|
||||
generic (
|
||||
ADDR_WIDTH : natural;
|
||||
DATA_WIDTH : integer);
|
||||
port (
|
||||
clka : in std_logic;
|
||||
clkb : in std_logic;
|
||||
ena : in std_logic := '1';
|
||||
enb : in std_logic := '1';
|
||||
wea : in std_logic;
|
||||
web : in std_logic;
|
||||
addra : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
addrb : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
dia : in std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
dib : in std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
doa : out std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
dob : out std_logic_vector(DATA_WIDTH-1 downto 0));
|
||||
end component tdp_ram;
|
||||
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
-- Suffix _D indicates a one CLK delayed version of the net with the same name
|
||||
-- Suffix _E indicates a one CLK early version of the net with the same name
|
||||
-- Suffix _X indicates an extended precision version of the net with the same name
|
||||
-- Suffix _N indicates an inverted version of the net with the same name
|
||||
|
||||
--//-- COMPONENT CONFIGURATION (FIXED AT PRE-SYNTHESIS) ---------------
|
||||
constant TX_RETRY_TIMEOUT: integer range 0 to 1023 := 500; -- expressed in 4us units. -- 500*4us = 2ms
|
||||
constant TX_RETRY_TIMEOUT_SIM: integer range 0 to 1023 := 10; -- shorter timer during simulations
|
||||
-- wait time after a NAK before trying a retransmission, expressed in 4us units. -- 500*4us = 2ms
|
||||
-- IMPORTANT: the timeout starts at the SOF. It therefore includes the output data transfer duration (MAX_PACKET_SIZE/fCLK).
|
||||
-- Always make sure the timeout is always greater than the output data transfer duration.
|
||||
|
||||
|
||||
--//-- INPUT IDLE DETECTION ---------------------------
|
||||
signal TX_IDLE_TIMER: integer range 0 to 50 := TX_IDLE_TIMEOUT;
|
||||
signal TX_IDLE: std_logic := '0';
|
||||
|
||||
--//-- ELASTIC BUFFER ---------------------------
|
||||
signal WPTR: unsigned(ADDR_WIDTH-1 downto 0) := (others => '0');
|
||||
signal RPTR: unsigned(ADDR_WIDTH-1 downto 0) := (others => '1');
|
||||
signal RPTR_INC: unsigned(ADDR_WIDTH-1 downto 0) := (others => '1');
|
||||
signal RPTR_ACKED: unsigned(ADDR_WIDTH-1 downto 0) := (others => '1');
|
||||
signal RPTR_MAX: unsigned(ADDR_WIDTH-1 downto 0) := (others => '1');
|
||||
signal BUF_SIZE: unsigned(ADDR_WIDTH-1 downto 0) := (others => '0');
|
||||
signal BUF_SIZE_ACKED: unsigned(ADDR_WIDTH-1 downto 0) := (others => '0');
|
||||
signal WEA: std_logic := '0';
|
||||
signal DIA: std_logic_vector(71 downto 0) := (others => '0');
|
||||
signal DOB: std_logic_vector(71 downto 0) := (others => '0');
|
||||
|
||||
--//-- READ POINTER AND STATE MACHINE ----------------------------
|
||||
signal STATE: integer range 0 to 3 := 0;
|
||||
signal WORD_VALID_E: std_logic := '0';
|
||||
signal WORD_VALID: std_logic := '0';
|
||||
signal SOF_E: std_logic := '0';
|
||||
signal SOF: std_logic := '0';
|
||||
signal EOF_E: std_logic := '0';
|
||||
signal EOF: std_logic := '0';
|
||||
signal TX_RETRY_TIMER: integer range 0 to 1023 := 0;
|
||||
signal TX_RETRY_TIMEOUT_B: integer range 0 to 1023 := 0;
|
||||
|
||||
signal ACK_IN_FLAG: std_logic := '0';
|
||||
signal NAK_IN_FLAG: std_logic := '0';
|
||||
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
-- during simulations, reduce long timer values
|
||||
TX_RETRY_TIMEOUT_B <= TX_RETRY_TIMEOUT when (SIMULATION = '0') else TX_RETRY_TIMEOUT_SIM;
|
||||
|
||||
--//-- INPUT IDLE DETECTION ---------------------------
|
||||
-- Raise a flag when no new Tx data is received in the last 200 us.
|
||||
-- Keep track for each stream.
|
||||
TX_IDLE_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
TX_IDLE_TIMER <= TX_IDLE_TIMEOUT;
|
||||
elsif(WEA = '1') then
|
||||
-- new transmit data, reset counter
|
||||
--TX_IDLE_TIMER <= 1; -- TEST TEST TEST FOR SIMULATION PURPOSES ONLY
|
||||
TX_IDLE_TIMER <= TX_IDLE_TIMEOUT;
|
||||
elsif(TICK_4US = '1') and (TX_IDLE_TIMER /= 0) then
|
||||
-- otherwise, decrement until counter reaches 0 (TX_IDLE condition)
|
||||
TX_IDLE_TIMER <= TX_IDLE_TIMER -1;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
TX_IDLE <= '1' when (TX_IDLE_TIMER = 0) and (WEA = '0') else '0';
|
||||
|
||||
--//-- ELASTIC BUFFER ---------------------------
|
||||
WEA <= '1' when (unsigned(STREAM_DATA_VALID) /= 0) else '0';
|
||||
|
||||
WPTR_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
WPTR <= (others => '0');
|
||||
elsif(WEA = '1') then
|
||||
WPTR <= WPTR + 1;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
DIA(63 downto 0) <= STREAM_DATA;
|
||||
DIA(71 downto 64) <= STREAM_DATA_VALID;
|
||||
|
||||
-- Buffer size is controlled by generic ADDR_WIDTH
|
||||
-- GIS Edit : replaced the memory model with one compatible with Intel devices
|
||||
/*
|
||||
BRAM_DP2_001: BRAM_DP2
|
||||
GENERIC MAP(
|
||||
DATA_WIDTHA => 72,
|
||||
ADDR_WIDTHA => ADDR_WIDTH,
|
||||
DATA_WIDTHB => 72,
|
||||
ADDR_WIDTHB => ADDR_WIDTH
|
||||
)
|
||||
PORT MAP(
|
||||
CSA => '1',
|
||||
CLKA => CLK,
|
||||
WEA => WEA, -- Port A Write Enable Input
|
||||
ADDRA => std_logic_vector(WPTR),
|
||||
DIA => DIA,
|
||||
OEA => '0',
|
||||
DOA => open,
|
||||
CSB => '1',
|
||||
CLKB => CLK,
|
||||
WEB => '0',
|
||||
ADDRB => std_logic_vector(RPTR),
|
||||
DIB => (others => '0'),
|
||||
OEB => '1',
|
||||
DOB => DOB
|
||||
);
|
||||
*/
|
||||
|
||||
BRAM_DP2_001: TDP_RAM
|
||||
GENERIC MAP(
|
||||
DATA_WIDTH => 72,
|
||||
ADDR_WIDTH => ADDR_WIDTH)
|
||||
PORT MAP(
|
||||
CLKA => CLK,
|
||||
WEA => WEA, -- Port A Write Enable Input
|
||||
ADDRA => std_logic_vector(WPTR),
|
||||
DIA => DIA,
|
||||
DOA => open,
|
||||
CLKB => CLK,
|
||||
WEB => '0',
|
||||
ADDRB => std_logic_vector(RPTR),
|
||||
DIB => (others => '0'),
|
||||
DOB => DOB);
|
||||
|
||||
BUF_SIZE <= WPTR + not (RPTR);
|
||||
-- occupied space in the buffer (i.e. data waiting for transmission)
|
||||
BUF_SIZE_ACKED <= WPTR + not (RPTR_ACKED);
|
||||
-- input flow control (buffer 3/4 full)
|
||||
STREAM_CTS <= '0' when (BUF_SIZE_ACKED(ADDR_WIDTH-1 downto ADDR_WIDTH-2) = "11") else '1';
|
||||
|
||||
--//-- READ POINTER AND STATE MACHINE ----------------------------
|
||||
-- manage read pointer
|
||||
RPTR_INC <= RPTR + 1;
|
||||
RPTR_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
-- 1 CLK delay in reading data from block RAM
|
||||
WORD_VALID <= WORD_VALID_E;
|
||||
SOF <= SOF_E;
|
||||
EOF <= EOF_E;
|
||||
|
||||
if(SYNC_RESET = '1') then
|
||||
STATE <= 0;
|
||||
RPTR <= (others => '1');
|
||||
WORD_VALID_E <= '0';
|
||||
SOF_E <= '0';
|
||||
EOF_E <= '0';
|
||||
WORD_VALID <= '0';
|
||||
SOF <= '0';
|
||||
EOF <= '0';
|
||||
elsif(STATE = 0) and (CTS_IN = '1') and (BUF_SIZE /= 0) then
|
||||
-- idle state, destination ready for tx and data is waiting in input elastic buffer
|
||||
if(BUF_SIZE >= MAX_PACKET_SIZE) then
|
||||
-- tx trigger 2: got enough data in buffer to fill a maximum size packet
|
||||
STATE <= 1;
|
||||
RPTR_MAX <= RPTR_ACKED + MAX_PACKET_SIZE;
|
||||
RPTR <= RPTR + 1; -- start transferring the first word
|
||||
WORD_VALID_E <= '1';
|
||||
SOF_E <= '1';
|
||||
if(MAX_PACKET_SIZE = 1) then
|
||||
-- special case: 1 word packet. EOF = SOF
|
||||
EOF_E <= '1';
|
||||
end if;
|
||||
elsif(TX_IDLE = '1') then
|
||||
-- tx trigger 1: timeout waiting for fresh input bytes
|
||||
STATE <= 1;
|
||||
RPTR_MAX <= WPTR - 1;
|
||||
RPTR <= RPTR + 1; -- start transferring the first word
|
||||
WORD_VALID_E <= '1';
|
||||
SOF_E <= '1';
|
||||
if(BUF_SIZE = 1) then
|
||||
-- special case: 1 byte packet. EOF = SOF
|
||||
EOF_E <= '1';
|
||||
end if;
|
||||
end if;
|
||||
elsif(STATE = 1) then
|
||||
SOF_E <= '0';
|
||||
if (RPTR = RPTR_MAX) then
|
||||
-- end of packet transmission
|
||||
WORD_VALID_E <= '0';
|
||||
EOF_E <= '0';
|
||||
STATE <= 2; -- data transfer complete. wait for ACK or NAK
|
||||
TX_RETRY_TIMER <= TX_RETRY_TIMEOUT_B;
|
||||
-- this timer has two objectives:
|
||||
-- (a) make sure the state machine does not get stuck at state 2 if for some unexplained reason
|
||||
-- no ACK/NAK is received, and
|
||||
-- (b) wait a bit before retransmitting a NAK'ed packet.
|
||||
else
|
||||
-- not yet done transferring bytes
|
||||
if(CTS_IN = '1') then
|
||||
RPTR <= RPTR + 1; -- continue transferring bytes
|
||||
WORD_VALID_E <= '1';
|
||||
if(RPTR_INC = RPTR_MAX) then
|
||||
EOF_E <= '1';
|
||||
end if;
|
||||
else
|
||||
WORD_VALID_E <= '0';
|
||||
end if;
|
||||
end if;
|
||||
elsif(STATE = 2) then
|
||||
-- data transfer complete. waiting for ACK/NAK
|
||||
if(ACK_IN = '1') or (ACK_IN_FLAG = '1') then
|
||||
-- All done.
|
||||
if (CTS_IN = '1') and (BUF_SIZE >= MAX_PACKET_SIZE) then
|
||||
-- don't waste a clock. skip going to STATE=0
|
||||
-- tx trigger 2: got enough data in buffer to fill a maximum size packet
|
||||
STATE <= 1;
|
||||
RPTR_MAX <= RPTR + MAX_PACKET_SIZE;
|
||||
RPTR <= RPTR + 1; -- start transferring the first word
|
||||
WORD_VALID_E <= '1';
|
||||
SOF_E <= '1';
|
||||
if(MAX_PACKET_SIZE = 1) then
|
||||
-- special case: 1 word packet. EOF = SOF
|
||||
EOF_E <= '1';
|
||||
end if;
|
||||
else
|
||||
-- wait for the next trigger condition
|
||||
STATE <= 0; -- back to idle
|
||||
end if;
|
||||
elsif(NAK_IN = '1') or (NAK_IN_FLAG = '1') then
|
||||
-- no transfer. try again later
|
||||
STATE <= 3; -- wait a bit, then re-try
|
||||
RPTR <= RPTR_ACKED; -- rewind read pointer
|
||||
elsif(TX_RETRY_TIMER = 0) then
|
||||
-- timer expired without receiving an ACK/NAK (abnormal condition). go back to idle
|
||||
STATE <= 0;
|
||||
RPTR <= RPTR_ACKED; -- rewind read pointer
|
||||
elsif(TICK_4US = '1') then
|
||||
TX_RETRY_TIMER <= TX_RETRY_TIMER - 1;
|
||||
end if;
|
||||
elsif(STATE = 3) then
|
||||
-- wait a bit then retry sending
|
||||
if(TX_RETRY_TIMER = 0) then
|
||||
-- waited long enough. try retransmitting.
|
||||
STATE <= 0;
|
||||
elsif(TICK_4US = '1') then
|
||||
TX_RETRY_TIMER <= TX_RETRY_TIMER - 1;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- split complex state machine into smaller simpler processes for better timing
|
||||
RPTR_GEN_002: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
RPTR_ACKED <= (others => '1');
|
||||
elsif(STATE = 2) then
|
||||
-- data transfer complete. waiting for ACK/NAK
|
||||
if(ACK_IN = '1') or (ACK_IN_FLAG = '1') then
|
||||
-- All done.
|
||||
RPTR_ACKED <= RPTR; -- new acknowledged read pointer
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- ACK/NAK received flags
|
||||
ACK_NAK_FLAGS_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
ACK_IN_FLAG <= '0';
|
||||
NAK_IN_FLAG <= '0';
|
||||
else
|
||||
if(STATE = 0) or ((STATE = 2) and (ACK_IN = '1')) then
|
||||
ACK_IN_FLAG <= '0';
|
||||
elsif(ACK_IN = '1') then
|
||||
ACK_IN_FLAG <= '1';
|
||||
end if;
|
||||
if(STATE = 0) then
|
||||
NAK_IN_FLAG <= '0';
|
||||
elsif(NAK_IN = '1') then
|
||||
NAK_IN_FLAG <= '1';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--//-- OUTPUT --------------------------------
|
||||
DATA_OUT <= DOB(63 downto 0);
|
||||
DATA_VALID_OUT <= DOB(71 downto 64) when (WORD_VALID = '1') else x"00";
|
||||
SOF_OUT <= SOF;
|
||||
EOF_OUT <= EOF;
|
||||
|
||||
--//-- TEST POINTS ----------------------------
|
||||
TP(1) <= '1' when (STATE = 0) else '0';
|
||||
TP(2) <= '1' when (STATE = 1) else '0';
|
||||
TP(3) <= '1' when (STATE = 2) else '0';
|
||||
TP(4) <= '1' when (STATE = 3) else '0';
|
||||
TP(5) <= RPTR(0);
|
||||
TP(6) <= NAK_IN_FLAG;
|
||||
TP(7) <= SOF;
|
||||
TP(8) <= EOF;
|
||||
TP(9) <= WORD_VALID;
|
||||
TP(10) <= ACK_IN_FLAG;
|
||||
end Behavioral;
|
||||
|
|
@ -0,0 +1,602 @@
|
|||
-------------------------------------------------------------
|
||||
-- MSS copyright 2019
|
||||
-- Filename: TCP_RXBUFNDEMUX2_10G.VHD
|
||||
-- Author: Alain Zarembowitch / MSS
|
||||
-- Version: 1
|
||||
-- Date last modified: 4/25/19 AZ
|
||||
-- Inheritance: COM-5402SOFT TCP_RXBUFNDEMUX2.VHD rev2 12/8/15
|
||||
--
|
||||
-- description: This component has two objectives:
|
||||
-- (1) tentatively hold a received TCP frame on the fly until its validity is confirmed at the end of frame.
|
||||
-- Discard if invalid or further process if valid.
|
||||
-- (2) demultiplex multiple TCP streams, based on the destination port number
|
||||
-- 10G version. Portable.
|
||||
--
|
||||
-- Because of the TCP protocol, data can only be validated at the end of a packet.
|
||||
-- So the buffer management has to be able to backtrack, discard previous data and
|
||||
-- reposition pointer.
|
||||
--
|
||||
-- The overall buffer size (which affects overall throughput) is user selected in the generic section.
|
||||
-- This component is written of a single TCP stream.
|
||||
--
|
||||
-- This component is written for NTCPSTREAMS TCP tx streams. Adjust as needed in the com5402pkg package.
|
||||
--
|
||||
-- Note: This component should work in all application case, at the expense of many block RAM.
|
||||
-- Use the more efficient TCP_RXBUFNDEMUX only when the application is reading data faster than the data source
|
||||
-- and when RAMBs are at a premium.
|
||||
--
|
||||
-- Rev1 4/25/19 AZ
|
||||
-- Corrected bug regarding RX_APP_DATA_VALID
|
||||
-- Corrected sensitivity lists
|
||||
-- Corrected bug regarding BUF_SIZE.
|
||||
--
|
||||
-- Minimum period: 4.537ns (Maximum Frequency: 220.410MHz)
|
||||
-- FF: 386
|
||||
-- LUT: 583
|
||||
-- BRAM: 4
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.NUMERIC_STD.ALL;
|
||||
use work.com5502pkg.all; -- defines global types, number of TCP streams, etc
|
||||
|
||||
entity TCP_RXBUFNDEMUX2_10G is
|
||||
generic (
|
||||
NTCPSTREAMS: integer := 1;
|
||||
-- number of concurrent TCP streams handled by this component
|
||||
ADDR_WIDTH: integer range 8 to 12:= 11
|
||||
-- size of the dual-port RAM buffers instantiated within for each stream = 64b * 2^ADDR_WIDTH
|
||||
-- Trade-off buffer depth and overall TCP throughput.
|
||||
-- Recommended value for 10GbE: at least 11
|
||||
);
|
||||
Port (
|
||||
--// CLK, RESET
|
||||
SYNC_RESET: in std_logic;
|
||||
CLK: in std_logic; -- synchronous clock
|
||||
-- Must be global clocks. No BUFG instantiation within this component.
|
||||
|
||||
--// TCP RX protocol -> RX BUFFER
|
||||
RX_DATA: in std_logic_vector(63 downto 0);
|
||||
-- TCP payload data field. Each byte validity is in RX_DATA_VALID(I)
|
||||
-- IMPORTANT: always left aligned (MSB first): RX_DATA_VALID is x80,xc0,xe0,xf0,....x01,x00
|
||||
RX_DATA_VALID: in std_logic_vector(7 downto 0);
|
||||
-- delineates the TCP payload data field
|
||||
RX_SOF: in std_logic;
|
||||
-- 1st word of RX_DATA
|
||||
-- Read ancillary information at this time:
|
||||
-- (a) destination RX_STREAM_NO (based on the destination TCP port)
|
||||
RX_TCP_STREAM_SEL: in std_logic_vector((NTCPSTREAMS-1) downto 0);
|
||||
-- stream number based on the destination TCP port
|
||||
RX_EOF: in std_logic;
|
||||
-- 1 CLK pulse indicating that RX_DATA is the last byte in the TCP data field.
|
||||
-- ALWAYS CHECK RX_FRAME_VALID at the end of packet (RX_EOF = '1') to confirm
|
||||
-- that the TCP packet is valid.
|
||||
-- Note: All packet information stored is tentative until
|
||||
-- the entire frame is confirmed (RX_EOF = '1') and (RX_FRAME_VALID = '1').
|
||||
-- MSbs are dropped.
|
||||
-- If the frame is invalid, the data and ancillary information just received is discarded.
|
||||
-- Reason: we only knows about bad TCP packets at the end.
|
||||
RX_FRAME_VALID: in std_logic;
|
||||
-- verify the entire frame validity at the end of frame (RX_EOF = '1')
|
||||
RX_FREE_SPACE: out SLV16xNTCPSTREAMStype;
|
||||
-- buffer available space, expressed in bytes.
|
||||
-- Beware of delay (as data may be in transit and information is slightly old).
|
||||
RX_BUF_CLR: in std_logic_vector((NTCPSTREAMS-1) downto 0);
|
||||
-- '1' to clear the elastic buffer (for example after closing the connection)
|
||||
|
||||
--// RX BUFFER -> APPLICATION INTERFACE
|
||||
-- NTCPSTREAMS can operate independently and concurrently. No scheduling arbitration needed here.
|
||||
-- Usage: RX_APP_RTS goes high when at least one byte is in the output queue (i.e. not yet visible at the
|
||||
-- output RX_APP_DATA). The application should then raise RX_APP_CTS for one clock to fetch the next word 2 CLKs later.
|
||||
-- Note that the next word may be partial (<8 bytes) or full.
|
||||
-- RX_APP_DATA and RX_APP_DATA_VALID are updated automatically without the application intervention as the
|
||||
-- 8-byte output is being filled.
|
||||
-- Thus, the application may have to check periodically RX_APP_DATA_VALID while waiting for the complete 8 bytes.
|
||||
-- RX_APP_CTS pulse will cause a move to the next word IF AND ONLY IF the next word has at least one available byte.
|
||||
RX_APP_DATA: out SLV64xNTCPSTREAMStype;
|
||||
RX_APP_DATA_VALID: out SLV8xNTCPSTREAMStype;
|
||||
RX_APP_RTS: out std_logic_vector((NTCPSTREAMS-1) downto 0);
|
||||
RX_APP_CTS: in std_logic_vector((NTCPSTREAMS-1) downto 0);
|
||||
-- 1 CLK pulse to read the next (partial) word RX_APP_DATA
|
||||
-- Latency: 2 CLKs to RX_APP_DATA, but only IF AND ONLY IF the next word has at least one available byte.
|
||||
RX_APP_CTS_ACK: out std_logic_vector((NTCPSTREAMS-1) downto 0);
|
||||
-- '1' the RX_APP_CTS request for new data is accepted:
|
||||
-- indicating that a new (maybe partial) word will be placed on the output RX_APP_DATA at the next CLK.
|
||||
|
||||
|
||||
TP: out std_logic_vector(10 downto 1)
|
||||
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of TCP_RXBUFNDEMUX2_10G is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
|
||||
-- GIS Edit : replaced the memory model with one compatible with Intel devices
|
||||
/*
|
||||
COMPONENT BRAM_DP2
|
||||
GENERIC(
|
||||
DATA_WIDTHA: integer;
|
||||
ADDR_WIDTHA: integer;
|
||||
DATA_WIDTHB: integer;
|
||||
ADDR_WIDTHB: integer
|
||||
);
|
||||
PORT(
|
||||
CLKA : in std_logic;
|
||||
CSA: in std_logic;
|
||||
WEA : in std_logic;
|
||||
OEA : in std_logic;
|
||||
ADDRA : in std_logic_vector(ADDR_WIDTHA-1 downto 0);
|
||||
DIA : in std_logic_vector(DATA_WIDTHA-1 downto 0);
|
||||
DOA : out std_logic_vector(DATA_WIDTHA-1 downto 0);
|
||||
CLKB : in std_logic;
|
||||
CSB: in std_logic;
|
||||
WEB : in std_logic;
|
||||
OEB : in std_logic;
|
||||
ADDRB : in std_logic_vector(ADDR_WIDTHB-1 downto 0);
|
||||
DIB : in std_logic_vector(DATA_WIDTHB-1 downto 0);
|
||||
DOB : out std_logic_vector(DATA_WIDTHB-1 downto 0)
|
||||
);
|
||||
END COMPONENT;
|
||||
*/
|
||||
component tdp_ram is
|
||||
generic (
|
||||
ADDR_WIDTH : natural;
|
||||
DATA_WIDTH : integer);
|
||||
port (
|
||||
clka : in std_logic;
|
||||
clkb : in std_logic;
|
||||
ena : in std_logic := '1';
|
||||
enb : in std_logic := '1';
|
||||
wea : in std_logic;
|
||||
web : in std_logic;
|
||||
addra : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
addrb : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
dia : in std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
dib : in std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
doa : out std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
dob : out std_logic_vector(DATA_WIDTH-1 downto 0));
|
||||
end component tdp_ram;
|
||||
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
signal RESETn: std_logic := '0';
|
||||
signal RESET_CNTR: unsigned(2 downto 0) := (others => '0');
|
||||
|
||||
-- freeze ancilliary input data at the SOF
|
||||
signal RX_TCP_STREAM_SEL_D: std_logic_vector(NTCPSTREAMS-1 downto 0) := (others => '0');
|
||||
|
||||
--//-- ELASTIC BUFFER ---------------------------
|
||||
signal RX_DATA_SHIFT: std_logic_vector(127 downto 0) := (others => '0');
|
||||
signal RX_DATA_VALID1: std_logic_vector(15 downto 0) := (others => '0');
|
||||
signal RX_DATA_REMAIN: std_logic_vector(63 downto 0) := (others => '0');
|
||||
signal RX_DATA_REMAIN_VALID: std_logic_vector(7 downto 0) := (others => '0');
|
||||
--signal FLUSH_RX_DATA_REMAIN: std_logic := '0';
|
||||
signal RX_DATA_D: std_logic_vector(63 downto 0) := (others => '0');
|
||||
signal RX_DATA_VALID_D: std_logic_vector(7 downto 0) := (others => '0');
|
||||
signal RX_SOF_D: std_logic := '0';
|
||||
signal RX_EOF_D: std_logic := '0';
|
||||
signal RX_EOF_D2: std_logic := '0';
|
||||
signal RX_EOF_D3: std_logic := '0';
|
||||
signal RX_WORD_VALID_D: std_logic := '0';
|
||||
signal RX_WORD_VALID_D2: std_logic := '0';
|
||||
signal RX_FRAME_VALID_D: std_logic := '0';
|
||||
signal RX_FRAME_VALID_D2: std_logic := '0';
|
||||
signal WPTR_INCREMENT: integer range 0 to 8 := 0;
|
||||
signal WPTRA_E: unsigned(ADDR_WIDTH+3 downto 0) := (others => '0');
|
||||
signal WPTRA: unsigned(ADDR_WIDTH+3 downto 0) := (others => '0');
|
||||
signal WPTRAb3_D: std_logic := '0';
|
||||
signal RPTRA: unsigned(ADDR_WIDTH+3 downto 0) := (others => '0');
|
||||
signal ADDRA: std_logic_vector(ADDR_WIDTH-1 downto 0) := (others => '0');
|
||||
signal WEA: std_logic_vector(NTCPSTREAMS-1 downto 0) := (others => '0');
|
||||
signal DIA: std_logic_vector(63 downto 0) := (others => '0');
|
||||
type PTRtype is array (integer range 0 to (NTCPSTREAMS-1)) of unsigned(ADDR_WIDTH+3 downto 0);
|
||||
signal WPTR0: PTRtype := (others => (others => '0'));
|
||||
signal WPTR_CONFIRMED: PTRtype := (others => (others => '0'));
|
||||
signal RPTR: PTRtype := (others => (others => '0'));
|
||||
signal RPTR_MIN: PTRtype := (others => (others => '0'));
|
||||
signal BUF_SIZE: PTRtype := (others => (others => '0'));
|
||||
signal BUF_SIZE_D: PTRtype := (others => (others => '0'));
|
||||
type DOtype is array (integer range 0 to (NTCPSTREAMS-1)) of std_logic_vector(63 downto 0);
|
||||
signal DOA: DOtype := (others => (others => '0'));
|
||||
signal DOB: DOtype := (others => (others => '0'));
|
||||
signal FIRST_APP_DATA: std_logic_vector(NTCPSTREAMS-1 downto 0) := (others => '0');
|
||||
signal RX_APP_RTS_local: std_logic_vector(NTCPSTREAMS-1 downto 0) := (others => '0');
|
||||
signal RX_APP_CTS_ACK_local: std_logic_vector(NTCPSTREAMS-1 downto 0) := (others => '0');
|
||||
signal RX_APP_CTS_ACK_D: std_logic_vector(NTCPSTREAMS-1 downto 0) := (others => '0');
|
||||
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
-- create a local reset (because we want RPTR to be initialized to all '1's among other things
|
||||
RESETN_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(RESET_CNTR(RESET_CNTR'left) = '0') then
|
||||
RESET_CNTR <= RESET_CNTR + 1;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
RESETn <= RESET_CNTR(RESET_CNTR'left);
|
||||
|
||||
-- freeze ancilliary data at the SOF
|
||||
FREEZE_INPUT: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(RX_SOF = '1') then
|
||||
RX_TCP_STREAM_SEL_D <= RX_TCP_STREAM_SEL;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- clean unused input bytes (because of follow-on ORing)
|
||||
-- Justification: TCP_SERVER_10G does a sloppy job filtering out unnecessary bytes
|
||||
CLEAN_INPUT: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
RX_DATA_VALID_D <= RX_DATA_VALID;
|
||||
RX_SOF_D <= RX_SOF;
|
||||
RX_EOF_D <= RX_EOF;
|
||||
RX_EOF_D2 <= RX_EOF_D;
|
||||
RX_EOF_D3 <= RX_EOF_D2;
|
||||
RX_FRAME_VALID_D <= RX_FRAME_VALID;
|
||||
RX_FRAME_VALID_D2 <= RX_FRAME_VALID_D;
|
||||
RX_WORD_VALID_D <= RX_DATA_VALID(7);
|
||||
RX_WORD_VALID_D2 <= RX_WORD_VALID_D;
|
||||
|
||||
for I in 0 to 7 loop
|
||||
if(RX_DATA_VALID(I) = '1') then
|
||||
RX_DATA_D(8*I+7 downto 8*I) <= RX_DATA(8*I+7 downto 8*I);
|
||||
else
|
||||
RX_DATA_D(8*I+7 downto 8*I) <= x"00";
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
end if;
|
||||
end process;
|
||||
|
||||
|
||||
--//-- ELASTIC BUFFER ---------------------------
|
||||
-- write pointer management.
|
||||
WPTR_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(RX_DATA_VALID(0) = '1') then
|
||||
WPTR_INCREMENT <= 8;
|
||||
elsif(RX_DATA_VALID(1) = '1') then
|
||||
WPTR_INCREMENT <= 7;
|
||||
elsif(RX_DATA_VALID(2) = '1') then
|
||||
WPTR_INCREMENT <= 6;
|
||||
elsif(RX_DATA_VALID(3) = '1') then
|
||||
WPTR_INCREMENT <= 5;
|
||||
elsif(RX_DATA_VALID(4) = '1') then
|
||||
WPTR_INCREMENT <= 4;
|
||||
elsif(RX_DATA_VALID(5) = '1') then
|
||||
WPTR_INCREMENT <= 3;
|
||||
elsif(RX_DATA_VALID(6) = '1') then
|
||||
WPTR_INCREMENT <= 2;
|
||||
elsif(RX_DATA_VALID(7) = '1') then
|
||||
WPTR_INCREMENT <= 1;
|
||||
else
|
||||
WPTR_INCREMENT <= 0;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--
|
||||
WPTR_GEN_002a: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
WPTRAb3_D <= WPTRA(3);
|
||||
|
||||
if(SYNC_RESET = '1') or (RX_EOF_D3 = '1') then
|
||||
WPTRA_E <= (others => '0');
|
||||
WPTRA <= (others => '0');
|
||||
elsif(RX_SOF = '1') then
|
||||
-- for each received frame, position the write pointer as per the last confirmed pointer position
|
||||
for I in 0 to NTCPSTREAMS-1 loop
|
||||
if(RX_TCP_STREAM_SEL(I) = '1') then
|
||||
WPTRA_E <= WPTR_CONFIRMED(I);
|
||||
end if;
|
||||
end loop;
|
||||
elsif(RX_WORD_VALID_D = '1') then
|
||||
-- about to write at least one payload byte
|
||||
-- prepare the next address
|
||||
WPTRA_E <= WPTRA_E + WPTR_INCREMENT;
|
||||
WPTRA <= WPTRA_E;
|
||||
else
|
||||
WPTRA <= WPTRA_E;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
WPTR_GEN_X: for I in 0 to NTCPSTREAMS-1 generate
|
||||
WPTR_GEN_002b: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
WPTR_CONFIRMED(I) <= (others => '0');
|
||||
elsif(RX_TCP_STREAM_SEL_D(I) = '1') then
|
||||
if(RX_BUF_CLR(I) = '1') then
|
||||
WPTR_CONFIRMED(I) <= (others => '0');
|
||||
elsif (RX_EOF_D2 = '1') and (RX_FRAME_VALID_D2 = '1') then
|
||||
-- last frame confirmed valid. Remember the writer position (next location to write to)
|
||||
WPTR_CONFIRMED(I) <= WPTRA_E;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
-- keep track if this is the first output data for this session/stream
|
||||
-- Any output data before that is meaningless.
|
||||
if(SYNC_RESET = '1') or (RX_BUF_CLR(I) = '1') then
|
||||
FIRST_APP_DATA(I) <= '0';
|
||||
elsif(RX_APP_CTS_ACK_local(I) = '1') then
|
||||
-- first output data will appear at the next clock
|
||||
FIRST_APP_DATA(I) <= '1';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
end generate;
|
||||
|
||||
-- remember the wptr for each stream (we need it to compute free space)
|
||||
WPTR_GEN_003: FOR I in 0 to (NTCPSTREAMS-1) generate
|
||||
WPTR_GEN_002: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') or (RX_BUF_CLR(I) = '1') then
|
||||
WPTR0(I) <= (others => '0');
|
||||
elsif(RX_TCP_STREAM_SEL_D(I) = '1') and (RX_WORD_VALID_D = '1') then
|
||||
WPTR0(I) <= WPTRA_E + WPTR_INCREMENT;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
end generate;
|
||||
|
||||
-- shift input word depending on the next write byte address WPTRA(2 downto 0)
|
||||
-- ready at RX_DATA_VALID_D2
|
||||
SHIFT_RX_DATA_IN_001:process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(RX_SOF = '1') or (RX_EOF_D2 = '1') then
|
||||
RX_DATA_VALID1 <= (others => '0');
|
||||
RX_DATA_SHIFT <= (others => '0');
|
||||
elsif(RX_WORD_VALID_D = '1') then
|
||||
-- at RX_WORD_VALID_D
|
||||
case(WPTRA_E(2 downto 0)) is
|
||||
when "000" => RX_DATA_SHIFT <= RX_DATA_D & x"0000000000000000";
|
||||
RX_DATA_VALID1 <= RX_DATA_VALID_D & "00000000";
|
||||
when "001" => RX_DATA_SHIFT <= x"00" & RX_DATA_D & x"00000000000000";
|
||||
RX_DATA_VALID1 <= "0" & RX_DATA_VALID_D & "0000000";
|
||||
when "010" => RX_DATA_SHIFT <= x"0000" & RX_DATA_D & x"000000000000";
|
||||
RX_DATA_VALID1 <= "00" & RX_DATA_VALID_D & "000000";
|
||||
when "011" => RX_DATA_SHIFT <= x"000000" & RX_DATA_D & x"0000000000";
|
||||
RX_DATA_VALID1 <= "000" & RX_DATA_VALID_D & "00000";
|
||||
when "100" => RX_DATA_SHIFT <= x"00000000" & RX_DATA_D & x"00000000";
|
||||
RX_DATA_VALID1 <= "0000" & RX_DATA_VALID_D & "0000";
|
||||
when "101" => RX_DATA_SHIFT <= x"0000000000" & RX_DATA_D & x"000000";
|
||||
RX_DATA_VALID1 <= "00000" & RX_DATA_VALID_D & "000";
|
||||
when "110" => RX_DATA_SHIFT <= x"000000000000" & RX_DATA_D & x"0000";
|
||||
RX_DATA_VALID1 <= "000000" & RX_DATA_VALID_D & "00";
|
||||
when others => RX_DATA_SHIFT <= x"00000000000000" & RX_DATA_D & x"00";
|
||||
RX_DATA_VALID1 <= "0000000" & RX_DATA_VALID_D & "0";
|
||||
end case;
|
||||
end if;
|
||||
|
||||
-- At the start of frame, we need to re-initialize RX_DATA_REMAIN as two successive frames
|
||||
-- may target different streams
|
||||
-- This is to avoid storing RX_DATA_REMAIN for each stream
|
||||
if (RX_EOF_D3 = '1') then
|
||||
-- cleaner
|
||||
RX_DATA_REMAIN <= (others => '0');
|
||||
elsif(RX_SOF_D = '1') then
|
||||
for I in 0 to NTCPSTREAMS-1 loop
|
||||
if(RX_TCP_STREAM_SEL_D(I) = '1') then
|
||||
RX_DATA_REMAIN <= DOA(I);
|
||||
end if;
|
||||
end loop;
|
||||
elsif((RX_WORD_VALID_D2 = '1') and (RX_DATA_VALID1(8) = '1')) then
|
||||
-- writing complete word to memory. shift remaining bytes to the left
|
||||
RX_DATA_REMAIN <= RX_DATA_SHIFT(63 downto 0);
|
||||
RX_DATA_REMAIN_VALID <= RX_DATA_VALID1(7 downto 0);
|
||||
elsif(RX_WORD_VALID_D2 = '1') and (RX_DATA_VALID1(8) = '0') then
|
||||
-- not enough new bytes to fill a 8-byte word and write to memory. No shift
|
||||
RX_DATA_REMAIN <= DIA(63 downto 0);
|
||||
RX_DATA_REMAIN_VALID <= RX_DATA_VALID1(15 downto 8);
|
||||
else
|
||||
RX_DATA_REMAIN_VALID <= (others => '0');
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- create new hybrid word to write to memory
|
||||
DIA <= RX_DATA_REMAIN or RX_DATA_SHIFT(127 downto 64);
|
||||
|
||||
-- Need to flush the last few bytes in RX_DATA_REMAIN
|
||||
--FLUSH_001: process(CLK)
|
||||
--begin
|
||||
-- if rising_edge(CLK) then
|
||||
-- if(RX_EOF_D2 = '1') and (RX_DATA_VALID1(15) = '1') then
|
||||
-- FLUSH_RX_DATA_REMAIN <= '1';
|
||||
-- else
|
||||
-- FLUSH_RX_DATA_REMAIN <= '0';
|
||||
-- end if;
|
||||
-- end if;
|
||||
--end process;
|
||||
|
||||
-- select which RAMBlock to write to.
|
||||
WEA_GENx: process(RX_TCP_STREAM_SEL_D, RX_EOF_D3, RX_DATA_REMAIN_VALID, WPTRA, WPTRAb3_D, RX_WORD_VALID_D2)
|
||||
begin
|
||||
for I in 0 to (NTCPSTREAMS-1) loop
|
||||
if(RX_TCP_STREAM_SEL_D(I) = '1') then
|
||||
if(RX_EOF_D3 = '1') and (RX_DATA_REMAIN_VALID /= x"00") and (WPTRA(3) /= WPTRAb3_D) then
|
||||
-- Write flush remainder at RX_EOF_D3, when remainder is not empty and spills over the next 64-bit word
|
||||
WEA(I) <= '1';
|
||||
elsif(RX_WORD_VALID_D2 = '1') then
|
||||
-- Write partial or full word.
|
||||
WEA(I) <= '1';
|
||||
else
|
||||
WEA(I) <= '0';
|
||||
end if;
|
||||
else
|
||||
WEA(I) <= '0';
|
||||
end if;
|
||||
end loop;
|
||||
end process;
|
||||
|
||||
-- read the last (partial) word at the SOF, before writing the frame first (partial) word.
|
||||
ADDRA_GEN_001: process(RX_TCP_STREAM_SEL, WPTR_CONFIRMED)
|
||||
variable RPTRAv: unsigned(ADDR_WIDTH+3 downto 0);
|
||||
begin
|
||||
-- for each received frame, position the write pointer as per the last confirmed pointer position
|
||||
RPTRAv := (others => '0');
|
||||
for I in 0 to NTCPSTREAMS-1 loop
|
||||
if(RX_TCP_STREAM_SEL(I) = '1') then
|
||||
RPTRAv := WPTR_CONFIRMED(I);
|
||||
end if;
|
||||
end loop;
|
||||
RPTRA <= RPTRAv;
|
||||
end process;
|
||||
|
||||
ADDRA_GEN: process(RPTRA, RX_SOF, WPTRA)
|
||||
begin
|
||||
if(RX_SOF = '1') then
|
||||
ADDRA <= std_logic_vector(RPTRA(ADDR_WIDTH+2 downto 3));
|
||||
else
|
||||
ADDRA <= std_logic_vector(WPTRA(ADDR_WIDTH+2 downto 3));
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Latency 1 CLK from ADDRx to DOx
|
||||
BRAM_DP2_X: for I in 0 to (NTCPSTREAMS-1) generate
|
||||
-- GIS Edit : replaced the memory model with one compatible with Intel devices
|
||||
/*
|
||||
BRAM_DP2_001: BRAM_DP2
|
||||
GENERIC MAP(
|
||||
DATA_WIDTHA => 64,
|
||||
ADDR_WIDTHA => ADDR_WIDTH,
|
||||
DATA_WIDTHB => 64,
|
||||
ADDR_WIDTHB => ADDR_WIDTH
|
||||
|
||||
)
|
||||
PORT MAP(
|
||||
CSA => '1',
|
||||
CLKA => CLK,
|
||||
WEA => WEA(I), -- Port A Write Enable Input
|
||||
OEA => '1',
|
||||
ADDRA => ADDRA, -- Port A Address Input
|
||||
DIA => DIA, -- Port A Data Input
|
||||
DOA => DOA(I),
|
||||
CSB => '1',
|
||||
CLKB => CLK,
|
||||
WEB => '0',
|
||||
OEB => '1',
|
||||
ADDRB => std_logic_vector(RPTR(I)(ADDR_WIDTH+2 downto 3)), -- Port B Address Input
|
||||
DIB => (others => '0'), -- Port B Data Input
|
||||
DOB => DOB(I) -- Port B Data Output
|
||||
);
|
||||
*/
|
||||
BRAM_DP2_001: TDP_RAM
|
||||
GENERIC MAP(
|
||||
DATA_WIDTH => 64,
|
||||
ADDR_WIDTH => ADDR_WIDTH)
|
||||
PORT MAP(
|
||||
CLKA => CLK,
|
||||
WEA => WEA(I), -- Port A Write Enable Input
|
||||
ADDRA => ADDRA, -- Port A Address Input
|
||||
DIA => DIA, -- Port A Data Input
|
||||
DOA => DOA(I),
|
||||
CLKB => CLK,
|
||||
WEB => '0',
|
||||
ADDRB => std_logic_vector(RPTR(I)(ADDR_WIDTH+2 downto 3)), -- Port B Address Input
|
||||
DIB => (others => '0'), -- Port B Data Input
|
||||
DOB => DOB(I)); -- Port B Data Output
|
||||
end generate;
|
||||
|
||||
-- How many bytes are waiting to be read?
|
||||
-- BUF_SIZE can be slightly negative when waiting for a few more bytes to complete a word
|
||||
RX_BUFFER_SIZE_GENx: for I in 0 to (NTCPSTREAMS - 1) generate
|
||||
BUF_SIZE(I) <= WPTR_CONFIRMED(I) + (not RPTR(I));
|
||||
-- tell the application when data is available to read
|
||||
RX_APP_RTS_local(I) <= '0' when (BUF_SIZE(I) = 0) or (BUF_SIZE(I)(ADDR_WIDTH+3) = '1') or (RESETn = '0') else '1';
|
||||
end generate;
|
||||
RX_APP_RTS <= RX_APP_RTS_local;
|
||||
|
||||
-- read pointer management
|
||||
-- Rule #1: RPTR points to the next memory location to be read (Units: words)
|
||||
RPTR_GENx: FOR I in 0 to (NTCPSTREAMS-1) generate
|
||||
RPTR_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
BUF_SIZE_D(I) <= BUF_SIZE(I);
|
||||
RX_APP_CTS_ACK_D(I) <= RX_APP_CTS_ACK_local(I);
|
||||
|
||||
if(SYNC_RESET = '1') or (RESETn = '0') or (RX_BUF_CLR(I) = '1') then
|
||||
RPTR(I) <= (others => '1');
|
||||
RX_APP_CTS_ACK_local(I) <= '0';
|
||||
elsif(RX_APP_RTS_local(I) = '0') then
|
||||
-- current output word DOB is not full (when BUF_SIZE is slightly negative). Do not increment the read pointer.
|
||||
RX_APP_CTS_ACK_local(I) <= '0';
|
||||
elsif(BUF_SIZE(I) /= 0) and (RX_APP_CTS(I) = '1') then
|
||||
-- At least one byte is available to read in memory
|
||||
-- and the application is ready to accept it. Read one (full or partial) word.
|
||||
RPTR(I) <= RPTR(I) + 8;
|
||||
RX_APP_CTS_ACK_local(I) <= '1';
|
||||
else
|
||||
RX_APP_CTS_ACK_local(I) <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
-- design note: RPTR(I) is always ending in 111. As we do not know exactly how many bytes are
|
||||
-- read by the application, RPTR(I) should be considered as a range spanning 8 bytes.
|
||||
-- For example 3FFF really means 3FF8-3FFF.
|
||||
-- This is an important consideration in computing the available free space.
|
||||
RPTR_MIN(I) <= RPTR(I)(ADDR_WIDTH+3 downto 3) & "000";
|
||||
end generate;
|
||||
RX_APP_CTS_ACK <= RX_APP_CTS_ACK_local;
|
||||
|
||||
OUTPUT_GEN: process(DOB, FIRST_APP_DATA, BUF_SIZE, BUF_SIZE_D, RX_APP_CTS_ACK_D)
|
||||
begin
|
||||
for I in 0 to (NTCPSTREAMS-1) loop
|
||||
RX_APP_DATA(I) <= DOB(I);
|
||||
|
||||
if(FIRST_APP_DATA(I) = '0') then
|
||||
-- nothing to read
|
||||
RX_APP_DATA_VALID(I) <= x"00";
|
||||
elsif (BUF_SIZE_D(I)(ADDR_WIDTH+3) = '1') and (BUF_SIZE(I)(ADDR_WIDTH+3) = '0')then
|
||||
-- previously partial word is now filled
|
||||
RX_APP_DATA_VALID(I) <= x"FF";
|
||||
elsif (BUF_SIZE_D(I)(ADDR_WIDTH+3) = '0') and (RX_APP_CTS_ACK_D(I) = '1')then
|
||||
-- new full word
|
||||
RX_APP_DATA_VALID(I) <= x"FF";
|
||||
elsif (BUF_SIZE_D(I)(ADDR_WIDTH+3) = '1') then
|
||||
-- reading last word in buffer, 1-8 bytes
|
||||
case(BUF_SIZE_D(I)(2 downto 0)) is
|
||||
when "001" => RX_APP_DATA_VALID(I) <= x"80";
|
||||
when "010" => RX_APP_DATA_VALID(I) <= x"C0";
|
||||
when "011" => RX_APP_DATA_VALID(I) <= x"E0";
|
||||
when "100" => RX_APP_DATA_VALID(I) <= x"F0";
|
||||
when "101" => RX_APP_DATA_VALID(I) <= x"F8";
|
||||
when "110" => RX_APP_DATA_VALID(I) <= x"FC";
|
||||
when "111" => RX_APP_DATA_VALID(I) <= x"FE";
|
||||
when others => RX_APP_DATA_VALID(I) <= x"00";
|
||||
end case;
|
||||
else
|
||||
RX_APP_DATA_VALID(I) <= x"00";
|
||||
end if;
|
||||
end loop;
|
||||
end process;
|
||||
|
||||
-- report the worst case available space to the TCP engine (including space currently occupied by invalid frames)
|
||||
FREE_SPACE_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
for I in 0 to (NTCPSTREAMS-1) loop
|
||||
RX_FREE_SPACE(I) <= std_logic_vector(resize(RPTR_MIN(I)(ADDR_WIDTH+2 downto 0) - WPTR0(I)(ADDR_WIDTH+2 downto 0),RX_FREE_SPACE(I)'length));
|
||||
end loop;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
end Behavioral;
|
||||
1980
generic_ip/third_party_ip/tcp_server/src/tcp_server_10G.vhd
Normal file
1980
generic_ip/third_party_ip/tcp_server/src/tcp_server_10G.vhd
Normal file
File diff suppressed because it is too large
Load diff
776
generic_ip/third_party_ip/tcp_server/src/tcp_tx_10G.vhd
Normal file
776
generic_ip/third_party_ip/tcp_server/src/tcp_tx_10G.vhd
Normal file
|
|
@ -0,0 +1,776 @@
|
|||
-------------------------------------------------------------
|
||||
-- MSS copyright 2018-2020
|
||||
-- Filename: TCP_TX_10G.VHD
|
||||
-- Author: Alain Zarembowitch / MSS
|
||||
-- Version: 1
|
||||
-- Date last modified: 1/18/20
|
||||
-- Inheritance: COM-5402 (1G) TCP_TX.VHD rev2 12/10/15
|
||||
--
|
||||
-- description: Sends a TCP packet, including the IP and MAC headers. 10Gbits/s.
|
||||
-- All input information is available at the time of the transmit trigger.
|
||||
--
|
||||
-- Device utilization (MSS = 1460, IPv6_ENABLED='1')
|
||||
-- FF: 681
|
||||
-- LUT: 1331
|
||||
-- DSP48: 0
|
||||
-- 18Kb BRAM: 0
|
||||
-- BUFG: 1
|
||||
-- Minimum period: 6.408ns (Maximum Frequency: 156.055MHz) Artix7-100T -1 speed grade
|
||||
--
|
||||
-- Rev 1 1/18/20 AZ
|
||||
-- corrected bug in the TCP option field (MSS size)
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.NUMERIC_STD.ALL;
|
||||
|
||||
entity TCP_TX_10G is
|
||||
generic (
|
||||
MSSv4: integer := 1460;
|
||||
MSSv6: integer := 1440;
|
||||
-- The Maximum Segment Size (MSS) is the largest segment of TCP data that can be transmitted.
|
||||
-- Fixed as the Ethernet MTU (Maximum Transmission Unit) of 1500-9000 bytes - 40(IPv4) or -60(IPv6) overhead bytes
|
||||
IPv6_ENABLED: std_logic := '1'
|
||||
-- 0 to minimize size, 1 to allow IPv6 in addition to IPv4 (larger size)
|
||||
);
|
||||
Port (
|
||||
--// CLK, RESET
|
||||
CLK: in std_logic;
|
||||
-- Must be a global clock. No BUFG instantiation within this component.
|
||||
SYNC_RESET: in std_logic;
|
||||
-- CLK-synchronous reset. MANDATORY!
|
||||
|
||||
--// CONFIGURATION PARAMETERS
|
||||
MAC_ADDR: in std_logic_vector(47 downto 0);
|
||||
-- MAC address. Unique for each network interface card.
|
||||
-- Natural byte order: (MSB) 0x000102030405 (LSB)
|
||||
-- as transmitted in the Ethernet packet.
|
||||
IPv4_ADDR: in std_logic_vector(31 downto 0);
|
||||
IPv6_ADDR: in std_logic_vector(127 downto 0);
|
||||
|
||||
|
||||
--// INPUT: HEADERS
|
||||
TX_PACKET_SEQUENCE_START: in std_logic;
|
||||
-- 1 CLK pulse to trigger packet transmission. The decision to transmit is taken by TCP_SERVER.
|
||||
-- From this trigger pulse to the end of frame, this component assembles and send data bytes
|
||||
-- like clockwork.
|
||||
-- Note that the payload data has to be ready at exactly the right time to be appended.
|
||||
|
||||
-- These variables MUST be fixed at the start of packet and not change until the transmit EOF.
|
||||
-- They can change from packet to packet (internal code is entirely memoryless).
|
||||
TX_DEST_MAC_ADDR_IN: in std_logic_vector(47 downto 0);
|
||||
TX_DEST_IP_ADDR_IN: in std_logic_vector(127 downto 0);
|
||||
TX_DEST_PORT_NO_IN: in std_logic_vector(15 downto 0);
|
||||
TX_SOURCE_PORT_NO_IN: in std_logic_vector(15 downto 0);
|
||||
TX_IPv4_6n_IN: in std_logic;
|
||||
TX_SEQ_NO_IN: in std_logic_vector(31 downto 0);
|
||||
TX_ACK_NO_IN: in std_logic_vector(31 downto 0);
|
||||
TX_ACK_WINDOW_LENGTH_IN: in std_logic_vector(15 downto 0);
|
||||
IP_ID_IN: in std_logic_vector(15 downto 0);
|
||||
-- 16-bit IP ID, unique for each datagram. Incremented every time
|
||||
-- an IP datagram is sent (not just for this socket).
|
||||
TX_FLAGS_IN: in std_logic_vector(7 downto 0);
|
||||
TX_PACKET_TYPE_IN : in std_logic_vector(1 downto 0);
|
||||
-- 0 = undefined
|
||||
-- 1 = SYN, no data, 24-byte header
|
||||
-- 2 = ACK, no data, 20-byte header
|
||||
-- 3 = payload data, 20-byte header
|
||||
|
||||
|
||||
--// INPUT: EXTERNAL TX BUFFER -> TX TCP PAYLOAD
|
||||
TX_PAYLOAD_DATA: in std_logic_vector(63 downto 0);
|
||||
-- TCP payload data field when TX_PAYLOAD_DATA_VALID = '1'
|
||||
TX_PAYLOAD_DATA_VALID: in std_logic_vector(7 downto 0);
|
||||
TX_PAYLOAD_WORD_VALID: in std_logic;
|
||||
-- delineates the TCP payload data field
|
||||
TX_PAYLOAD_DATA_EOF: in std_logic;
|
||||
-- End Of Frame. 1 CLK-wide pulse aligned with TX_PAYLOAD_DATA_VALID
|
||||
TX_PAYLOAD_RTS: in std_logic;
|
||||
-- '1' to tell TX TCP layer that the application has a packet ready to send
|
||||
-- Must stay high at least until TX_CTS goes high, but not beyond TX_EOF.
|
||||
TX_PAYLOAD_CTS: out std_logic;
|
||||
-- clear to send. 2 CLK latency until 1st data byte is available at TX_PAYLOAD_DATA
|
||||
TX_PAYLOAD_SIZE: in std_logic_vector(15 downto 0);
|
||||
-- packet size (TCP payload data only). valid (and fixed) while TX_RTS = '1'.
|
||||
TX_PAYLOAD_CHECKSUM: in std_logic_vector(17 downto 0);
|
||||
-- partial TCP checksum computation. payload only, no header. bits 17:16 are the carry, add later.
|
||||
-- valid only when TX_PAYLOAD_RTS = '1', ignore otherwise
|
||||
|
||||
|
||||
--// OUTPUT: TX TCP layer -> Transmit MAC Interface
|
||||
-- 32-bit CRC is automatically appended by MAC. Not supplied here.
|
||||
-- Synchonous with the user-side CLK
|
||||
MAC_TX_DATA: out std_logic_vector(63 downto 0) := (others => '0');
|
||||
-- MAC reads the data at the rising edge of CLK when MAC_TX_DATA_VALID = '1'
|
||||
MAC_TX_DATA_VALID: out std_logic_vector(7 downto 0) := x"00";
|
||||
-- data valid
|
||||
MAC_TX_EOF: out std_logic := '0';
|
||||
-- '1' when sending the last byte in a packet to be transmitted.
|
||||
-- Aligned with MAC_TX_DATA_VALID
|
||||
MAC_TX_CTS: in std_logic;
|
||||
-- MAC-generated Clear To Send flow control signal, indicating room in the
|
||||
-- MAC tx elastic buffer for a complete maximum size frame 1518B.
|
||||
-- The user should check that this signal is high before deciding to send
|
||||
-- sending the next frame.
|
||||
-- Note: MAC_TX_CTS may go low while the frame is transfered in. Ignore it as space is guaranteed
|
||||
-- at the start of frame.
|
||||
|
||||
|
||||
|
||||
-- -- Test Points
|
||||
TP: out std_logic_vector(10 downto 1)
|
||||
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of TCP_TX_10G is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
|
||||
--//---- FREEZE INPUTS -----------------------
|
||||
signal TX_DEST_MAC_ADDR: std_logic_vector(47 downto 0) := (others => '0');
|
||||
signal TX_DEST_IP_ADDR: std_logic_vector(127 downto 0) := (others => '0');
|
||||
signal TX_DEST_PORT_NO: std_logic_vector(15 downto 0) := (others => '0');
|
||||
signal TX_SOURCE_PORT_NO: std_logic_vector(15 downto 0) := (others => '0');
|
||||
signal TX_IPv4_6n: std_logic := '0';
|
||||
signal TX_TCP_HEADER_LENGTH: unsigned(3 downto 0) := (others => '0'); -- in 32-bit words
|
||||
--signal TX_TCP_HEADER_LENGTH_DEC: unsigned(3 downto 0) := (others => '0'); -- in 32-bit words
|
||||
signal TX_TCP_PAYLOAD_SIZE: std_logic_vector(15 downto 0) := (others => '0'); -- TCP payload size in bytes.
|
||||
signal TX_SEQ_NO: std_logic_vector(31 downto 0) := (others => '0');
|
||||
signal TX_ACK_NO: std_logic_vector(31 downto 0) := (others => '0');
|
||||
signal TX_ACK_WINDOW_LENGTH: std_logic_vector(15 downto 0) := (others => '0');
|
||||
signal IP_ID: std_logic_vector(15 downto 0) := (others => '0');
|
||||
signal TX_FLAGS: std_logic_vector(7 downto 0) := (others => '0');
|
||||
signal TX_PACKET_TYPE: unsigned(1 downto 0) := (others => '0');
|
||||
|
||||
--// TX IP HEADER CHECKSUM ---------------------------------------------
|
||||
signal TX_PACKET_SEQUENCE_START_SHIFT: std_logic_vector(7 downto 0) := (others => '0');
|
||||
signal CKSUM_PART1: unsigned(18 downto 0) := (others => '0');
|
||||
signal CKSUM_SEQ_CNTR: unsigned(2 downto 0) := (others => '0');
|
||||
signal IP_HEADER_CHECKSUM: unsigned(17 downto 0) := (others => '0');
|
||||
signal IP_HEADER_CHECKSUM0: unsigned(17 downto 0) := (others => '0');
|
||||
signal IP_HEADER_CHECKSUM_PLUS: unsigned(17 downto 0) := (others => '0');
|
||||
signal IP_HEADER_CHECKSUM_FINAL: std_logic_vector(15 downto 0) := (others => '0');
|
||||
|
||||
--//-- TCP TX CHECKSUM ---------------------------
|
||||
signal CKSUM4: unsigned(17 downto 0) := (others => '0');
|
||||
signal CKSUM5: unsigned(17 downto 0) := (others => '0');
|
||||
signal CKSUM6: unsigned(17 downto 0) := (others => '0');
|
||||
signal CKSUM7: unsigned(17 downto 0) := (others => '0');
|
||||
signal CKSUM8: unsigned(17 downto 0) := (others => '0');
|
||||
signal CKSUM_CARRY2: unsigned(3 downto 0) := (others => '0');
|
||||
signal CKSUM_CARRY4: unsigned(3 downto 0) := (others => '0');
|
||||
signal TCP_CHECKSUM: unsigned(15 downto 0) := (others => '0');
|
||||
|
||||
--//---- TX PACKET ASSEMBLY ----------------------
|
||||
signal TX_PAYLOAD_CTS_FLAG: std_logic := '0';
|
||||
signal TCP_HEADER_BYTE12_13: std_logic_vector(15 downto 0) := (others => '0');
|
||||
signal TX_PAYLOAD_DATA_PREVIOUS: std_logic_vector(63 downto 0) := (others => '0');
|
||||
signal TX_PAYLOAD_DATA_VALID_PREVIOUS: std_logic_vector(7 downto 0) := (others => '0');
|
||||
signal TX_PAYLOAD_DATA_EOF_PREVIOUS: std_logic := '0';
|
||||
signal MAC_TX_CTS_D: std_logic := '0';
|
||||
signal MAC_TX_CTS_D2: std_logic := '0';
|
||||
signal TX_PAYLOAD_CTS_FLAG0: std_logic := '0';
|
||||
signal TX_ACTIVE0: std_logic := '0';
|
||||
signal TX_ACTIVE: std_logic := '0';
|
||||
signal TX_WORD_COUNTER: unsigned(10 downto 0) := (others => '0');
|
||||
signal TX_WORD_COUNTER_D: unsigned(10 downto 0) := (others => '0');
|
||||
signal MAC_TX_WORD_VALID_E2: std_logic := '0';
|
||||
signal MAC_TX_WORD_VALID_E: std_logic := '0';
|
||||
signal MAC_TX_WORD_VALID: std_logic := '0';
|
||||
|
||||
signal MAC_TX_EOF_local: std_logic := '0';
|
||||
signal TX_TCP_LAST_HEADER_BYTE: std_logic := '0';
|
||||
signal TX_IP_LENGTH: unsigned(15 downto 0) := (others => '0');
|
||||
|
||||
signal MAC_TX_DATA_D: std_logic_vector(7 downto 0) := (others => '0');
|
||||
|
||||
--// TX TCP CHECKSUM ---------------------------------------------
|
||||
--signal TX_TCP_HEADER_D: std_logic := '0';
|
||||
--signal TX_TCP_CKSUM_DATA: std_logic_vector(15 downto 0) := (others => '0');
|
||||
--signal TX_TCP_CKSUM_FLAG: std_logic := '0';
|
||||
--signal TX_TCP_CHECKSUM: unsigned(16 downto 0) := (others => '0');
|
||||
--signal TX_TCP_CHECKSUM_FINAL: unsigned(15 downto 0) := (others => '0');
|
||||
signal TX_TCP_LENGTH: unsigned(15 downto 0) := (others => '0');
|
||||
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
--//---- FREEZE INPUTS -----------------------
|
||||
-- Latch in all key fields at the start trigger
|
||||
FREEZE_KEY_FIELDS_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(TX_PACKET_SEQUENCE_START = '1') then
|
||||
-- Freeze parameters which can change
|
||||
-- while we are sending the TCP packet to the MAC layer
|
||||
TX_DEST_MAC_ADDR <= TX_DEST_MAC_ADDR_IN;
|
||||
TX_DEST_IP_ADDR <= TX_DEST_IP_ADDR_IN;
|
||||
TX_DEST_PORT_NO <= TX_DEST_PORT_NO_IN;
|
||||
TX_SOURCE_PORT_NO <= TX_SOURCE_PORT_NO_IN;
|
||||
TX_IPv4_6n <= TX_IPv4_6n_IN;
|
||||
IP_ID <= IP_ID_IN;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
FREEZE_KEY_FIELDS_002: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(TX_PACKET_SEQUENCE_START = '1') then
|
||||
-- latch in key fields at start of packet assembly (they can change during packet assembly,
|
||||
-- for example if an ACK is received).
|
||||
TX_SEQ_NO <= TX_SEQ_NO_IN;
|
||||
TX_ACK_NO <= TX_ACK_NO_IN;
|
||||
TX_ACK_WINDOW_LENGTH <= TX_ACK_WINDOW_LENGTH_IN;
|
||||
TX_FLAGS <= TX_FLAGS_IN;
|
||||
TX_PACKET_TYPE <= unsigned(TX_PACKET_TYPE_IN);
|
||||
if(unsigned(TX_PACKET_TYPE_IN) = 1) then
|
||||
TX_TCP_HEADER_LENGTH <= x"6"; -- 24 bytes, includes MSS option.
|
||||
else
|
||||
-- default length
|
||||
TX_TCP_HEADER_LENGTH <= x"5"; -- 20 bytes, default
|
||||
end if;
|
||||
if(unsigned(TX_PACKET_TYPE_IN) = 3) then
|
||||
-- payload size from TCP_TXBUF
|
||||
TX_TCP_PAYLOAD_SIZE <= TX_PAYLOAD_SIZE;
|
||||
else
|
||||
-- no payload
|
||||
TX_TCP_PAYLOAD_SIZE <= (others => '0');
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--//---- TX PACKET SIZE ---------------------------
|
||||
TX_PACKET_TYPE_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
TX_TCP_LENGTH <= unsigned("0000000000" & TX_TCP_HEADER_LENGTH & "00") + unsigned(TX_TCP_PAYLOAD_SIZE) ;
|
||||
-- total TCP frame size, in bytes. Part of TCP pseudo-header needed for TCP checksum computation
|
||||
|
||||
-- total IP frame size, in bytes. IP header is always the standard size of 20 bytes (IPv4) or 40 bytes (IPv6)
|
||||
-- ready at TX_PACKET_SEQUENCE_START_D3
|
||||
if(TX_IPv4_6n = '1') then
|
||||
TX_IP_LENGTH <= TX_TCP_LENGTH + 20;
|
||||
else
|
||||
TX_IP_LENGTH <= TX_TCP_LENGTH + 40;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--// IP HEADER CHECKSUM ----------------------
|
||||
-- Transmit IP packet header checksum. Only applies to IPv4 (no header checksum in IPv6)
|
||||
-- We must start the checksum early as the checksum field is not the last word in the header.
|
||||
-- perform 1's complement sum of all 16-bit words within the header.
|
||||
-- the checksum must be ready when TX_WORD_COUNTER_D=3
|
||||
---- Note: same code used in udp_tx.vhd
|
||||
|
||||
IP_HEADER_CHECKSUM_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
IP_HEADER_CHECKSUM0 <= ("01" & x"8406") + resize(unsigned(IPv4_ADDR(31 downto 16)),18) + resize(unsigned(IPv4_ADDR(15 downto 0)),18); -- x"4500" + x"4000" + x"FF06"
|
||||
|
||||
if (TX_PACKET_SEQUENCE_START = '1') and (TX_IPv4_6n_IN = '0') then
|
||||
-- the IP header checksum applies only to IPv4
|
||||
IP_HEADER_CHECKSUM <= (others => '0');
|
||||
elsif (TX_PACKET_SEQUENCE_START = '1') and (TX_IPv4_6n_IN = '1') then
|
||||
IP_HEADER_CHECKSUM <= resize(unsigned(IP_HEADER_CHECKSUM0(15 downto 0)),18) + resize(unsigned(IP_HEADER_CHECKSUM0(17 downto 16)),18) + resize(unsigned(IP_ID_IN),18);
|
||||
elsif(TX_PACKET_SEQUENCE_START_SHIFT(0) = '1') then
|
||||
IP_HEADER_CHECKSUM <= IP_HEADER_CHECKSUM_PLUS + resize(unsigned(TX_DEST_IP_ADDR(15 downto 0)),18);
|
||||
elsif(TX_PACKET_SEQUENCE_START_SHIFT(1) = '1') then
|
||||
IP_HEADER_CHECKSUM <= IP_HEADER_CHECKSUM_PLUS + resize(unsigned(TX_DEST_IP_ADDR(31 downto 16)),18);
|
||||
elsif(TX_PACKET_SEQUENCE_START_SHIFT(2) = '1') then
|
||||
IP_HEADER_CHECKSUM <= IP_HEADER_CHECKSUM_PLUS + resize(TX_IP_LENGTH,18);
|
||||
elsif(TX_PACKET_SEQUENCE_START_SHIFT(3) = '1') then
|
||||
IP_HEADER_CHECKSUM <= IP_HEADER_CHECKSUM_PLUS ;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
IP_HEADER_CHECKSUM_PLUS <= resize(unsigned(IP_HEADER_CHECKSUM(15 downto 0)),18) + resize(unsigned(IP_HEADER_CHECKSUM(17 downto 16)),18);
|
||||
IP_HEADER_CHECKSUM_FINAL <= x"FFFF" when (IP_HEADER_CHECKSUM(16) = '1') and (IP_HEADER_CHECKSUM(0) = '0') else
|
||||
x"FFFE" when (IP_HEADER_CHECKSUM(16) = '1') and (IP_HEADER_CHECKSUM(0) = '1') else
|
||||
not(std_logic_vector(IP_HEADER_CHECKSUM(15 downto 0)));
|
||||
|
||||
--//-- TCP TX CHECKSUM ---------------------------
|
||||
-- Compute the TCP payload checksum (excluding headers).
|
||||
-- Different pseudo-headers are used for IPv4 and IPv6
|
||||
|
||||
-- for IPv6, pre-compute the IPv6 address checksum. Only once at reset.
|
||||
TCP_CKSUM_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
CKSUM_SEQ_CNTR <= "110";
|
||||
elsif(CKSUM_SEQ_CNTR > 0) then
|
||||
CKSUM_SEQ_CNTR <= CKSUM_SEQ_CNTR - 1;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
TCP_CKSUM_002: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
-- fixed part of the checksum is initialized at reset
|
||||
if(SYNC_RESET = '1') then
|
||||
CKSUM_PART1 <= resize(unsigned(IPv6_ADDR(127 downto 112)),19) + resize(unsigned(IPv6_ADDR(111 downto 96)),19);
|
||||
elsif(CKSUM_SEQ_CNTR = "110") then
|
||||
CKSUM_PART1 <= CKSUM_PART1 + resize(unsigned(IPv6_ADDR(95 downto 80)),19);
|
||||
elsif(CKSUM_SEQ_CNTR = "101") then
|
||||
CKSUM_PART1 <= CKSUM_PART1 + resize(unsigned(IPv6_ADDR(79 downto 64)),19);
|
||||
elsif(CKSUM_SEQ_CNTR = "100") then
|
||||
CKSUM_PART1 <= CKSUM_PART1 + resize(unsigned(IPv6_ADDR(63 downto 48)),19);
|
||||
elsif(CKSUM_SEQ_CNTR = "011") then
|
||||
CKSUM_PART1 <= CKSUM_PART1 + resize(unsigned(IPv6_ADDR(47 downto 32)),19);
|
||||
elsif(CKSUM_SEQ_CNTR = "010") then
|
||||
CKSUM_PART1 <= CKSUM_PART1 + resize(unsigned(IPv6_ADDR(31 downto 16)),19);
|
||||
elsif(CKSUM_SEQ_CNTR = "001") then
|
||||
CKSUM_PART1 <= CKSUM_PART1 + resize(unsigned(IPv6_ADDR(15 downto 0)),19);
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
|
||||
|
||||
-- Checksum computation must be complete by the time TX_WORD_COUNTER reaches 5(IPv4) or 7 (IPv6). So we only have 5 iterations maximum to sum the pseudo header.
|
||||
TCP_CKSUM_003: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
TX_PACKET_SEQUENCE_START_SHIFT(7 downto 0) <= TX_PACKET_SEQUENCE_START_SHIFT(6 downto 0) & TX_PACKET_SEQUENCE_START;
|
||||
|
||||
if(TX_PACKET_SEQUENCE_START = '1') then
|
||||
if(unsigned(TX_PACKET_TYPE_IN) = 3) then
|
||||
-- payload size from TCP_TXBUF
|
||||
CKSUM4 <= resize(unsigned(TX_PAYLOAD_CHECKSUM(15 downto 0)),18) + x"0006"; -- data checksum + TCP protocol
|
||||
elsif(unsigned(TX_PACKET_TYPE_IN) = 1) then
|
||||
-- TCP option: MSS, no payload data
|
||||
if(TX_IPv4_6n_IN = '1') then
|
||||
CKSUM4 <= resize((MSSv4+ x"020A"),18); -- TCP protocol + MSS option
|
||||
else
|
||||
CKSUM4 <= resize((MSSv6+ x"020A"),18); -- TCP protocol + MSS option
|
||||
end if;
|
||||
else -- (unsigned(TX_PACKET_TYPE_IN) = 2) then
|
||||
-- no payload data
|
||||
CKSUM4 <= "00" & x"0006"; -- TCP protocol
|
||||
end if;
|
||||
CKSUM5 <= resize(unsigned(TX_SOURCE_PORT_NO_IN),18) + resize(unsigned(TX_DEST_PORT_NO_IN),18); -- src + dest ports
|
||||
CKSUM6 <= resize(unsigned(TX_SEQ_NO_IN(31 downto 16)),18) + resize(unsigned(TX_SEQ_NO_IN(15 downto 0)),18);
|
||||
CKSUM7 <= resize(unsigned(TX_ACK_NO_IN(31 downto 16)),18) + resize(unsigned(TX_ACK_NO_IN(15 downto 0)),18);
|
||||
if(unsigned(TX_PACKET_TYPE_IN) = 3) then
|
||||
-- payload size from TCP_TXBUF
|
||||
CKSUM8 <= resize(unsigned(TX_PAYLOAD_CHECKSUM(17 downto 16)),18) ; -- carry bits
|
||||
else
|
||||
CKSUM8 <= (others => '0');
|
||||
end if;
|
||||
else
|
||||
if(TX_IPv4_6n = '1') then -- IPv4
|
||||
if(TX_PACKET_SEQUENCE_START_SHIFT(0) = '1') then
|
||||
CKSUM4 <= resize(CKSUM4(15 downto 0),18) + resize(unsigned(IPv4_ADDR(31 downto 16)),18); -- src IP address
|
||||
CKSUM5 <= resize(CKSUM5(15 downto 0),18) + resize(unsigned(IPv4_ADDR(15 downto 0)),18); -- src IP address
|
||||
CKSUM6 <= resize(CKSUM6(15 downto 0),18) + resize(unsigned(TX_DEST_IP_ADDR(31 downto 16)),18); -- dest IP address
|
||||
CKSUM7 <= resize(CKSUM7(15 downto 0),18) + resize(unsigned(TX_DEST_IP_ADDR(15 downto 0)),18); -- dest IP address
|
||||
CKSUM8 <= CKSUM8 + resize(CKSUM_CARRY4,18); -- carry
|
||||
elsif(TX_PACKET_SEQUENCE_START_SHIFT(1) = '1') then
|
||||
CKSUM4 <= resize(CKSUM4(15 downto 0),18) + resize(unsigned(TCP_HEADER_BYTE12_13),18);
|
||||
CKSUM5 <= resize(CKSUM5(15 downto 0),18) + resize(unsigned(TX_ACK_WINDOW_LENGTH),18);
|
||||
CKSUM6 <= resize(CKSUM6(15 downto 0),18) + resize(TX_TCP_LENGTH,18); -- + TCP length
|
||||
CKSUM7(17 downto 16) <= "00";
|
||||
CKSUM8 <= CKSUM8 + resize(CKSUM_CARRY4,18); -- carry
|
||||
elsif(TX_PACKET_SEQUENCE_START_SHIFT(2) = '1') then
|
||||
CKSUM4 <= resize(CKSUM4(15 downto 0),18) + resize(CKSUM6(15 downto 0),18);
|
||||
CKSUM5 <= resize(CKSUM5(15 downto 0),18) + resize(CKSUM7(15 downto 0),18);
|
||||
CKSUM8 <= CKSUM8 + resize(CKSUM_CARRY4,18); -- carry
|
||||
elsif(TX_PACKET_SEQUENCE_START_SHIFT(3) = '1') then
|
||||
CKSUM4 <= resize(CKSUM4(15 downto 0),18) + resize(CKSUM5(15 downto 0),18);
|
||||
CKSUM8 <= CKSUM8 + resize(CKSUM_CARRY2,18); -- carry
|
||||
elsif(TX_PACKET_SEQUENCE_START_SHIFT(4) = '1') then
|
||||
CKSUM8 <= CKSUM8 + resize(CKSUM4(15 downto 0),18) + CKSUM4(17 downto 16);
|
||||
elsif(TX_PACKET_SEQUENCE_START_SHIFT(5) = '1') then
|
||||
CKSUM8 <= resize(CKSUM8(15 downto 0),18) + CKSUM8(17 downto 16);
|
||||
end if;
|
||||
elsif(IPv6_ENABLED = '1') then -- IPv6
|
||||
if(TX_PACKET_SEQUENCE_START_SHIFT(0) = '1') then
|
||||
CKSUM4 <= resize(CKSUM4(15 downto 0),18) + resize(CKSUM_PART1(15 downto 0),18) ;
|
||||
CKSUM5 <= resize(CKSUM5(15 downto 0),18) + resize(CKSUM_PART1(18 downto 16),18);
|
||||
CKSUM6 <= resize(CKSUM6(15 downto 0),18) + resize(unsigned(TX_DEST_IP_ADDR(127 downto 112)),18);
|
||||
CKSUM7 <= resize(CKSUM7(15 downto 0),18) + resize(unsigned(TX_DEST_IP_ADDR(111 downto 96)),18);
|
||||
CKSUM8 <= CKSUM8 + resize(CKSUM_CARRY4,18); -- carry
|
||||
elsif(TX_PACKET_SEQUENCE_START_SHIFT(1) = '1') then
|
||||
CKSUM4 <= resize(CKSUM4(15 downto 0),18) + resize(unsigned(TX_DEST_IP_ADDR(95 downto 80)),18); -- dest IP address
|
||||
CKSUM5 <= resize(CKSUM5(15 downto 0),18) + resize(unsigned(TX_DEST_IP_ADDR(79 downto 64)),18); -- dest IP address
|
||||
CKSUM6 <= resize(CKSUM6(15 downto 0),18) + resize(unsigned(TX_DEST_IP_ADDR(63 downto 48)),18);
|
||||
CKSUM7 <= resize(CKSUM7(15 downto 0),18) + resize(unsigned(TX_DEST_IP_ADDR(47 downto 32)),18);
|
||||
CKSUM8 <= CKSUM8 + resize(CKSUM_CARRY4,18); -- carry
|
||||
elsif(TX_PACKET_SEQUENCE_START_SHIFT(2) = '1') then
|
||||
CKSUM4 <= resize(CKSUM4(15 downto 0),18) + resize(unsigned(TX_DEST_IP_ADDR(31 downto 16)),18); -- dest IP address
|
||||
CKSUM5 <= resize(CKSUM5(15 downto 0),18) + resize(unsigned(TX_DEST_IP_ADDR(15 downto 0)),18); -- dest IP address
|
||||
CKSUM6 <= resize(CKSUM6(15 downto 0),18) + resize(unsigned(TCP_HEADER_BYTE12_13),18);
|
||||
CKSUM7 <= resize(CKSUM7(15 downto 0),18) + resize(unsigned(TX_ACK_WINDOW_LENGTH),18);
|
||||
CKSUM8 <= CKSUM8 + resize(CKSUM_CARRY4,18); -- carry
|
||||
elsif(TX_PACKET_SEQUENCE_START_SHIFT(3) = '1') then
|
||||
CKSUM4 <= resize(CKSUM4(15 downto 0),18) + resize(TX_TCP_LENGTH,18); -- + TCP length
|
||||
CKSUM5 <= resize(CKSUM5(15 downto 0),18) + resize(CKSUM7(15 downto 0),18);
|
||||
CKSUM6(17 downto 16) <= "00";
|
||||
CKSUM7(17 downto 16) <= "00";
|
||||
CKSUM8 <= CKSUM8 + resize(CKSUM_CARRY4,18); -- carry
|
||||
elsif(TX_PACKET_SEQUENCE_START_SHIFT(4) = '1') then
|
||||
CKSUM4 <= resize(CKSUM4(15 downto 0),18) + resize(CKSUM6(15 downto 0),18);
|
||||
CKSUM5(17 downto 16) <= "00";
|
||||
CKSUM8 <= CKSUM8 + resize(CKSUM_CARRY2,18); -- carry
|
||||
elsif(TX_PACKET_SEQUENCE_START_SHIFT(5) = '1') then
|
||||
CKSUM4 <= resize(CKSUM4(15 downto 0),18) + resize(CKSUM5(15 downto 0),18);
|
||||
CKSUM8 <= CKSUM8 + resize(CKSUM_CARRY2,18); -- carry
|
||||
elsif(TX_PACKET_SEQUENCE_START_SHIFT(6) = '1') then
|
||||
CKSUM8 <= CKSUM8 + resize(CKSUM4(15 downto 0),18) + CKSUM4(17 downto 16);
|
||||
elsif(TX_PACKET_SEQUENCE_START_SHIFT(7) = '1') then
|
||||
CKSUM8 <= resize(CKSUM8(15 downto 0),18) + CKSUM8(17 downto 16);
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
CKSUM_CARRY2 <= resize(CKSUM4(17 downto 16),4) + resize(CKSUM5(17 downto 16),4);
|
||||
CKSUM_CARRY4 <= resize(CKSUM4(17 downto 16),4) + resize(CKSUM5(17 downto 16),4) + resize(CKSUM6(17 downto 16),4) + resize(CKSUM7(17 downto 16),4);
|
||||
TCP_CHECKSUM <= not CKSUM8(15 downto 0);
|
||||
|
||||
--//---- TX PACKET ASSEMBLY ---------------------
|
||||
-- Transmit packet is assembled on the fly, consistent with our design goal
|
||||
-- of minimizing storage in each TCP_SERVER component.
|
||||
-- The packet includes the lower layers, i.e. IP layer and Ethernet layer.
|
||||
--
|
||||
-- First, we tell the outsider arbitration that we are ready to send by raising RTS high.
|
||||
-- When the transmit path becomes available, the arbiter tells us to go ahead with the transmission MAC_TX_CTS = '1'
|
||||
|
||||
STATE_MACHINE_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
TX_ACTIVE0 <= '0';
|
||||
elsif (TX_PACKET_SEQUENCE_START = '1') then
|
||||
TX_ACTIVE0 <= '1';
|
||||
elsif(MAC_TX_EOF_local = '1') then
|
||||
TX_ACTIVE0 <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
TX_ACTIVE <= TX_ACTIVE0 and (not MAC_TX_EOF_local);
|
||||
|
||||
TX_SCHEDULER_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
|
||||
if(SYNC_RESET = '1') then
|
||||
TX_WORD_COUNTER <= (others => '1');
|
||||
TX_WORD_COUNTER_D <= (others => '1');
|
||||
MAC_TX_WORD_VALID_E2 <= '0';
|
||||
MAC_TX_WORD_VALID_E <= '0';
|
||||
else
|
||||
MAC_TX_WORD_VALID_E <= MAC_TX_WORD_VALID_E2;
|
||||
TX_WORD_COUNTER_D <= TX_WORD_COUNTER;
|
||||
|
||||
if (TX_PACKET_SEQUENCE_START = '1') then
|
||||
TX_WORD_COUNTER <= (others => '1');
|
||||
MAC_TX_WORD_VALID_E2 <= '0';
|
||||
elsif(TX_ACTIVE = '1') and (MAC_TX_CTS = '1') then
|
||||
TX_WORD_COUNTER <= TX_WORD_COUNTER + 1;
|
||||
MAC_TX_WORD_VALID_E2 <= '1'; -- enable path to MAC
|
||||
else
|
||||
MAC_TX_WORD_VALID_E2 <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
TCP_HEADER_BYTE12_13(15 downto 12) <= std_logic_vector(TX_TCP_HEADER_LENGTH);
|
||||
TCP_HEADER_BYTE12_13(11 downto 8) <= "0000";
|
||||
TCP_HEADER_BYTE12_13(7 downto 0) <= TX_FLAGS;
|
||||
|
||||
-- re-align bytes from payload data word to MAC_TX_DATA word
|
||||
WORD_ALIGN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
MAC_TX_CTS_D <= MAC_TX_CTS;
|
||||
MAC_TX_CTS_D2 <= MAC_TX_CTS_D;
|
||||
|
||||
if(TX_PAYLOAD_WORD_VALID = '1') then -- = MAC_TX_CTS_D2 when there is payload data
|
||||
TX_PAYLOAD_DATA_PREVIOUS <= TX_PAYLOAD_DATA;
|
||||
TX_PAYLOAD_DATA_VALID_PREVIOUS <= TX_PAYLOAD_DATA_VALID;
|
||||
TX_PAYLOAD_DATA_EOF_PREVIOUS <= TX_PAYLOAD_DATA_EOF;
|
||||
elsif(TX_PAYLOAD_DATA_EOF_PREVIOUS = '1') and (MAC_TX_CTS_D2 = '1') then
|
||||
TX_PAYLOAD_DATA_VALID_PREVIOUS <= x"00";
|
||||
TX_PAYLOAD_DATA_EOF_PREVIOUS <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
MAC_TX_DATA_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(TX_IPv4_6n = '1') then -- IPv4
|
||||
case TX_WORD_COUNTER_D is
|
||||
when "00000000000" =>
|
||||
MAC_TX_DATA(63 downto 16) <= TX_DEST_MAC_ADDR;
|
||||
MAC_TX_DATA(15 downto 0) <= MAC_ADDR(47 downto 32);
|
||||
when "00000000001" =>
|
||||
MAC_TX_DATA(63 downto 32) <= MAC_ADDR(31 downto 0);
|
||||
MAC_TX_DATA(31 downto 0) <= x"08004500";
|
||||
when "00000000010" =>
|
||||
MAC_TX_DATA(63 downto 48) <= std_logic_vector(TX_IP_LENGTH);
|
||||
MAC_TX_DATA(47 downto 32) <= IP_ID;
|
||||
MAC_TX_DATA(31 downto 0) <= x"4000FF06"; -- don't fragment, 255 hop limit, TCP
|
||||
when "00000000011" =>
|
||||
MAC_TX_DATA(63 downto 48) <= IP_HEADER_CHECKSUM_FINAL; -- IP header checksum
|
||||
MAC_TX_DATA(47 downto 16) <= IPv4_ADDR; -- source IP address
|
||||
MAC_TX_DATA(15 downto 0) <= TX_DEST_IP_ADDR(31 downto 16); -- destination IP address
|
||||
when "00000000100" =>
|
||||
MAC_TX_DATA(63 downto 48) <= TX_DEST_IP_ADDR(15 downto 0); -- destination IP address
|
||||
MAC_TX_DATA(47 downto 32) <= TX_SOURCE_PORT_NO;
|
||||
MAC_TX_DATA(31 downto 16) <= TX_DEST_PORT_NO;
|
||||
MAC_TX_DATA(15 downto 0) <= TX_SEQ_NO(31 downto 16);
|
||||
when "00000000101" =>
|
||||
MAC_TX_DATA(63 downto 48) <= TX_SEQ_NO(15 downto 0);
|
||||
MAC_TX_DATA(47 downto 16) <= TX_ACK_NO(31 downto 0); -- ack number;
|
||||
MAC_TX_DATA(15 downto 0) <= TCP_HEADER_BYTE12_13;
|
||||
when "00000000110" =>
|
||||
MAC_TX_DATA(63 downto 48) <= TX_ACK_WINDOW_LENGTH;
|
||||
MAC_TX_DATA(47 downto 32) <= std_logic_vector(TCP_CHECKSUM);
|
||||
MAC_TX_DATA(31 downto 16) <= X"0000";
|
||||
if(TX_PACKET_TYPE = 1) then
|
||||
-- TCP option: MSS
|
||||
MAC_TX_DATA(15 downto 0) <= x"0204";
|
||||
elsif(TX_PACKET_TYPE = 3) and (TX_PAYLOAD_WORD_VALID = '1') then
|
||||
MAC_TX_DATA(15 downto 0) <= TX_PAYLOAD_DATA(63 downto 48);
|
||||
else
|
||||
MAC_TX_DATA(15 downto 0) <= (others => '0');
|
||||
end if;
|
||||
when others =>
|
||||
if(TX_WORD_COUNTER_D = 7) and (TX_PACKET_TYPE = 1) then
|
||||
-- TCP option: MSS. No payload data
|
||||
MAC_TX_DATA(63 downto 48) <= std_logic_vector(to_unsigned(MSSv4,16));
|
||||
MAC_TX_DATA(47 downto 0) <= (others => '0');
|
||||
elsif(TX_PACKET_TYPE = 3) then
|
||||
if (TX_PAYLOAD_WORD_VALID = '1') then
|
||||
MAC_TX_DATA(63 downto 16) <= TX_PAYLOAD_DATA_PREVIOUS(47 downto 0);
|
||||
MAC_TX_DATA(15 downto 0) <= TX_PAYLOAD_DATA(63 downto 48);
|
||||
elsif(MAC_TX_CTS_D2 = '1') and (TX_PAYLOAD_DATA_EOF_PREVIOUS = '1') and (TX_PAYLOAD_DATA_VALID_PREVIOUS(5) = '1') then
|
||||
-- flush partial last word
|
||||
MAC_TX_DATA(63 downto 16) <= TX_PAYLOAD_DATA_PREVIOUS(47 downto 0);
|
||||
MAC_TX_DATA(15 downto 0) <= (others => '0');
|
||||
end if;
|
||||
end if;
|
||||
end case;
|
||||
elsif(IPv6_ENABLED = '1') then -- IPv6
|
||||
case TX_WORD_COUNTER_D is
|
||||
when "00000000000" =>
|
||||
MAC_TX_DATA(63 downto 16) <= TX_DEST_MAC_ADDR;
|
||||
MAC_TX_DATA(15 downto 0) <= MAC_ADDR(47 downto 32);
|
||||
when "00000000001" =>
|
||||
MAC_TX_DATA(63 downto 32) <= MAC_ADDR(31 downto 0);
|
||||
MAC_TX_DATA(31 downto 0) <= x"86dd6000";
|
||||
when "00000000010" =>
|
||||
MAC_TX_DATA(63 downto 48) <= x"0000";
|
||||
MAC_TX_DATA(47 downto 32) <= std_logic_vector(TX_TCP_LENGTH); -- payload length
|
||||
MAC_TX_DATA(31 downto 16) <= x"06FF"; -- TCP, 255 hop limit
|
||||
MAC_TX_DATA(15 downto 0) <= IPv6_ADDR(127 downto 112);
|
||||
when "00000000011" =>
|
||||
MAC_TX_DATA <= IPv6_ADDR(111 downto 48);
|
||||
when "00000000100" =>
|
||||
MAC_TX_DATA(63 downto 16) <= IPv6_ADDR(47 downto 0);
|
||||
MAC_TX_DATA(15 downto 0) <= TX_DEST_IP_ADDR(127 downto 112);
|
||||
when "00000000101" =>
|
||||
MAC_TX_DATA <= TX_DEST_IP_ADDR(111 downto 48);
|
||||
when "00000000110" =>
|
||||
MAC_TX_DATA(63 downto 16) <= TX_DEST_IP_ADDR(47 downto 0);
|
||||
MAC_TX_DATA(15 downto 0) <= TX_SOURCE_PORT_NO;
|
||||
when "00000000111" =>
|
||||
MAC_TX_DATA(63 downto 48) <= TX_DEST_PORT_NO;
|
||||
MAC_TX_DATA(47 downto 16) <= TX_SEQ_NO(31 downto 0);
|
||||
MAC_TX_DATA(15 downto 0) <= TX_ACK_NO(31 downto 16);
|
||||
when "00000001000" =>
|
||||
MAC_TX_DATA(63 downto 48) <= TX_ACK_NO(15 downto 0);
|
||||
MAC_TX_DATA(47 downto 32) <= TCP_HEADER_BYTE12_13;
|
||||
MAC_TX_DATA(31 downto 16) <= TX_ACK_WINDOW_LENGTH;
|
||||
MAC_TX_DATA(15 downto 0) <= std_logic_vector(TCP_CHECKSUM);
|
||||
when "00000001001" =>
|
||||
MAC_TX_DATA(63 downto 48) <= x"0000";
|
||||
if(TX_PACKET_TYPE = 1) then
|
||||
-- TCP option: MSS
|
||||
MAC_TX_DATA(47 downto 32) <= x"0240";
|
||||
MAC_TX_DATA(31 downto 16) <= std_logic_vector(to_unsigned(MSSv6,16));
|
||||
MAC_TX_DATA(15 downto 0) <= x"0000";
|
||||
elsif(TX_PACKET_TYPE = 3) and (TX_PAYLOAD_WORD_VALID = '1') then
|
||||
MAC_TX_DATA(47 downto 0) <= TX_PAYLOAD_DATA(63 downto 16);
|
||||
else
|
||||
MAC_TX_DATA(47 downto 0) <= (others => '0');
|
||||
end if;
|
||||
when others =>
|
||||
if(TX_PACKET_TYPE = 3) then
|
||||
if (TX_PAYLOAD_WORD_VALID = '1') then
|
||||
MAC_TX_DATA(63 downto 48) <= TX_PAYLOAD_DATA_PREVIOUS(15 downto 0);
|
||||
MAC_TX_DATA(47 downto 0) <= TX_PAYLOAD_DATA(63 downto 16);
|
||||
elsif(MAC_TX_CTS_D2 = '1') and (TX_PAYLOAD_DATA_EOF_PREVIOUS = '1') and (TX_PAYLOAD_DATA_VALID_PREVIOUS(1) = '1') then
|
||||
-- flush partial last word
|
||||
MAC_TX_DATA(63 downto 48) <= TX_PAYLOAD_DATA_PREVIOUS(15 downto 0);
|
||||
MAC_TX_DATA(47 downto 0) <= (others => '0');
|
||||
end if;
|
||||
end if;
|
||||
end case;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
MAC_TX_DATA_VALID_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
MAC_TX_WORD_VALID <= MAC_TX_WORD_VALID_E;
|
||||
|
||||
if(MAC_TX_WORD_VALID_E = '1') then
|
||||
if(TX_IPv4_6n = '1') then -- IPv4
|
||||
if(TX_WORD_COUNTER_D <= 5) then
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
elsif(TX_WORD_COUNTER_D = 6) then
|
||||
if(TX_PACKET_TYPE = 1) then
|
||||
-- TCP option: MSS
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
elsif(TX_PACKET_TYPE = 3) and (TX_PAYLOAD_WORD_VALID = '1') then
|
||||
MAC_TX_DATA_VALID <="111111" & TX_PAYLOAD_DATA_VALID(7 downto 6);
|
||||
else -- TX_PACKET_TYPE = 2
|
||||
MAC_TX_DATA_VALID <= x"FC";
|
||||
end if;
|
||||
elsif(TX_WORD_COUNTER_D = 7) then
|
||||
if(TX_PACKET_TYPE = 1) then
|
||||
-- TCP option: MSS
|
||||
MAC_TX_DATA_VALID <= x"C0";
|
||||
elsif(TX_PACKET_TYPE = 3) then
|
||||
if (TX_PAYLOAD_WORD_VALID = '1') then
|
||||
MAC_TX_DATA_VALID <= TX_PAYLOAD_DATA_VALID_PREVIOUS(5 downto 0) & TX_PAYLOAD_DATA_VALID(7 downto 6);
|
||||
elsif(MAC_TX_CTS_D2 = '1') then
|
||||
-- flush partial last word
|
||||
MAC_TX_DATA_VALID <= TX_PAYLOAD_DATA_VALID_PREVIOUS(5 downto 0) & "00";
|
||||
end if;
|
||||
else
|
||||
MAC_TX_DATA_VALID <= x"00";
|
||||
end if;
|
||||
elsif(TX_PACKET_TYPE = 3) then
|
||||
if (TX_PAYLOAD_WORD_VALID = '1') then
|
||||
MAC_TX_DATA_VALID <= TX_PAYLOAD_DATA_VALID_PREVIOUS(5 downto 0) & TX_PAYLOAD_DATA_VALID(7 downto 6);
|
||||
elsif(MAC_TX_CTS_D2 = '1') and (TX_PAYLOAD_DATA_EOF_PREVIOUS = '1') and (TX_PAYLOAD_DATA_VALID_PREVIOUS(5) = '1') then
|
||||
-- flush partial last word
|
||||
MAC_TX_DATA_VALID <= TX_PAYLOAD_DATA_VALID_PREVIOUS(5 downto 0) & "00";
|
||||
else
|
||||
MAC_TX_DATA_VALID <= x"00";
|
||||
end if;
|
||||
else
|
||||
MAC_TX_DATA_VALID <= x"00";
|
||||
end if;
|
||||
elsif(IPv6_ENABLED = '1') then -- IPv6
|
||||
if(TX_WORD_COUNTER_D <= 8) then
|
||||
MAC_TX_DATA_VALID <= x"FF";
|
||||
elsif(TX_WORD_COUNTER_D = 9) then
|
||||
if(TX_PACKET_TYPE = 1) then
|
||||
-- TCP option: MSS
|
||||
MAC_TX_DATA_VALID <= x"FC";
|
||||
elsif(TX_PACKET_TYPE = 3) and (TX_PAYLOAD_WORD_VALID = '1') then
|
||||
MAC_TX_DATA_VALID <="11" & TX_PAYLOAD_DATA_VALID(7 downto 2);
|
||||
else -- (including TX_PACKET_TYPE = 2)
|
||||
MAC_TX_DATA_VALID <= x"C0";
|
||||
end if;
|
||||
elsif(TX_PACKET_TYPE = 3) then
|
||||
if (TX_PAYLOAD_WORD_VALID = '1') then
|
||||
MAC_TX_DATA_VALID <= TX_PAYLOAD_DATA_VALID_PREVIOUS(1 downto 0) & TX_PAYLOAD_DATA_VALID(7 downto 2);
|
||||
elsif(MAC_TX_CTS_D2 = '1') and (TX_PAYLOAD_DATA_EOF_PREVIOUS = '1') and (TX_PAYLOAD_DATA_VALID_PREVIOUS(1) = '1') then
|
||||
-- flush partial last word
|
||||
MAC_TX_DATA_VALID <= TX_PAYLOAD_DATA_VALID_PREVIOUS(1 downto 0) & "000000";
|
||||
else
|
||||
MAC_TX_DATA_VALID <= x"00";
|
||||
end if;
|
||||
else
|
||||
MAC_TX_DATA_VALID <= x"00";
|
||||
end if;
|
||||
end if;
|
||||
else
|
||||
MAC_TX_DATA_VALID <= x"00";
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
MAC_TX_EOF_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
MAC_TX_EOF_local <= '0';
|
||||
elsif(MAC_TX_WORD_VALID_E = '1') then
|
||||
if(TX_IPv4_6n = '1') then
|
||||
if(TX_WORD_COUNTER_D = 6) and (((TX_PAYLOAD_DATA_VALID(5) = '0') and (TX_PACKET_TYPE = 3)) or (TX_PACKET_TYPE = 2)) then
|
||||
MAC_TX_EOF_local <= '1';
|
||||
elsif(TX_WORD_COUNTER_D = 7) and (TX_PACKET_TYPE = 1) then
|
||||
MAC_TX_EOF_local <= '1';
|
||||
elsif (TX_PACKET_TYPE = 3) and (TX_WORD_COUNTER_D > 6) then
|
||||
if (TX_PAYLOAD_WORD_VALID = '1') and (TX_PAYLOAD_DATA_VALID(5) = '0') then
|
||||
MAC_TX_EOF_local <= '1';
|
||||
elsif (MAC_TX_CTS_D2 = '1') and (TX_PAYLOAD_DATA_EOF_PREVIOUS = '1') and (TX_PAYLOAD_DATA_VALID_PREVIOUS(5) = '1') then
|
||||
-- flush partial last word
|
||||
MAC_TX_EOF_local <= '1';
|
||||
else
|
||||
MAC_TX_EOF_local <= '0';
|
||||
end if;
|
||||
else
|
||||
MAC_TX_EOF_local <= '0';
|
||||
end if;
|
||||
elsif(IPv6_ENABLED = '1') then -- IPv6
|
||||
if(TX_WORD_COUNTER_D = 9) and ((TX_PAYLOAD_DATA_VALID(1) = '0') or (TX_PACKET_TYPE = 1)) then
|
||||
MAC_TX_EOF_local <= '1';
|
||||
elsif (TX_PACKET_TYPE = 3) and (TX_WORD_COUNTER_D > 9) then
|
||||
if (TX_PAYLOAD_WORD_VALID = '1') and (TX_PAYLOAD_DATA_VALID(1) = '0') then
|
||||
MAC_TX_EOF_local <= '1';
|
||||
elsif (MAC_TX_CTS_D2 = '1') and (TX_PAYLOAD_DATA_EOF_PREVIOUS = '1') and (TX_PAYLOAD_DATA_VALID_PREVIOUS(1) = '1') then
|
||||
-- flush partial last word
|
||||
MAC_TX_EOF_local <= '1';
|
||||
else
|
||||
MAC_TX_EOF_local <= '0';
|
||||
end if;
|
||||
else
|
||||
MAC_TX_EOF_local <= '0';
|
||||
end if;
|
||||
else
|
||||
MAC_TX_EOF_local <= '0';
|
||||
end if;
|
||||
else
|
||||
MAC_TX_EOF_local <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
MAC_TX_EOF <= MAC_TX_EOF_local;
|
||||
|
||||
-- when to ask for next word from TCP tx buffer
|
||||
TX_PAYLOAD_CTS_FLAG_GEN: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
TX_PAYLOAD_CTS_FLAG0 <= '0';
|
||||
elsif (TX_PACKET_SEQUENCE_START = '1') then
|
||||
TX_PAYLOAD_CTS_FLAG0 <= '0';
|
||||
elsif(MAC_TX_CTS = '1') and (TX_PACKET_TYPE = "11") and
|
||||
(((TX_IPv4_6n = '1') and (TX_WORD_COUNTER = 4)) or ((IPv6_ENABLED = '1') and (TX_IPv4_6n = '0') and (TX_WORD_COUNTER = 7))) then
|
||||
TX_PAYLOAD_CTS_FLAG0 <= '1';
|
||||
elsif(TX_PAYLOAD_DATA_EOF = '1') then
|
||||
-- received the last word in a frame from TCP_TXBUF
|
||||
TX_PAYLOAD_CTS_FLAG0 <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
TX_PAYLOAD_CTS_FLAG <= TX_PAYLOAD_CTS_FLAG0 and (not TX_PAYLOAD_DATA_EOF);
|
||||
|
||||
-- clear to send. Ask TCP_TXBUF to send payload data
|
||||
TX_PAYLOAD_CTS <= MAC_TX_CTS and TX_PAYLOAD_CTS_FLAG;
|
||||
-- 2 CLK latency until 1st data byte is available at TX_PAYLOAD_DATA
|
||||
-- IPv4: first word has to arrive here when TX_WORD_COUNTER_D = 6
|
||||
-- IPv6: first word has to arrive here when TX_WORD_COUNTER_D = 9
|
||||
|
||||
end Behavioral;
|
||||
1302
generic_ip/third_party_ip/tcp_server/src/tcp_txbuf_10G.vhd
Normal file
1302
generic_ip/third_party_ip/tcp_server/src/tcp_txbuf_10G.vhd
Normal file
File diff suppressed because it is too large
Load diff
76
generic_ip/third_party_ip/tcp_server/src/tdp_ram.vhd
Normal file
76
generic_ip/third_party_ip/tcp_server/src/tdp_ram.vhd
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
-- True Dual-Port Block RAM with Two Clocks
|
||||
-- Correct Modelization with a Shared Variable
|
||||
-- File: true_dual_two_clocks.vhd
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_unsigned.all;
|
||||
|
||||
entity tdp_ram is
|
||||
generic(
|
||||
ADDR_WIDTH: natural := 11;
|
||||
DATA_WIDTH: integer := 9);
|
||||
port(
|
||||
clka : in std_logic;
|
||||
clkb : in std_logic;
|
||||
ena : in std_logic;
|
||||
enb : in std_logic;
|
||||
wea : in std_logic;
|
||||
web : in std_logic;
|
||||
addra : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
addrb : in std_logic_vector(ADDR_WIDTH-1 downto 0);
|
||||
dia : in std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
dib : in std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
doa : out std_logic_vector(DATA_WIDTH-1 downto 0) := (others => '0');
|
||||
dob : out std_logic_vector(DATA_WIDTH-1 downto 0) := (others => '0')
|
||||
);
|
||||
end tdp_ram;
|
||||
|
||||
architecture syn of tdp_ram is
|
||||
|
||||
type ram_type is array (2**ADDR_WIDTH-1 downto 0) of std_logic_vector(DATA_WIDTH-1 downto 0);
|
||||
--shared variable RAM : ram_type;
|
||||
signal RAM : ram_type := (others => (others => '0'));
|
||||
|
||||
begin
|
||||
|
||||
-- dp_ram_inst : entity work.dp_ram_gis
|
||||
-- generic map (
|
||||
-- ADDR_WIDTH => ADDR_WIDTH,
|
||||
-- DATA_WIDTH => DATA_WIDTH
|
||||
-- )
|
||||
-- port map
|
||||
-- (
|
||||
-- address_a => addra, -- : in std_logic_vector (11 downto 0);
|
||||
-- address_b => addrb, -- : in std_logic_vector (11 downto 0);
|
||||
-- clock => clka, -- : in std_logic := '1';
|
||||
-- data_a => dia, -- : in std_logic_vector (63 downto 0);
|
||||
-- data_b => dib, -- : in std_logic_vector (63 downto 0);
|
||||
-- wren_a => wea, -- : in std_logic := '0';
|
||||
-- wren_b => web, -- : in std_logic := '0';
|
||||
-- q_a => doa, -- : out std_logic_vector (63 downto 0);
|
||||
-- q_b => dob -- : out std_logic_vector (63 downto 0)
|
||||
-- );
|
||||
|
||||
process(clka)
|
||||
begin
|
||||
if clka'event and clka = '1' then
|
||||
|
||||
doa <= RAM(conv_integer(addra));
|
||||
dob <= RAM(conv_integer(addrb));
|
||||
|
||||
if ena = '1' then
|
||||
if wea = '1' then
|
||||
RAM(conv_integer(addra)) <= dia;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
if enb = '1' then
|
||||
if web = '1' then
|
||||
RAM(conv_integer(addrb)) <= dib;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
end if;
|
||||
end process;
|
||||
|
||||
end syn;
|
||||
100
generic_ip/third_party_ip/tcp_server/src/timer_4us.vhd
Normal file
100
generic_ip/third_party_ip/tcp_server/src/timer_4us.vhd
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
-------------------------------------------------------------
|
||||
-- MSS copyright 2004-2015
|
||||
-- Filename: TIMER_1MS.VHD
|
||||
-- Author: Alain Zarembowitch / MSS
|
||||
-- Version: 5
|
||||
-- Date last modified: 12/10/15
|
||||
-- Inheritance: none
|
||||
--
|
||||
-- description: Creates a 4us timer tick which can be used to create other timers
|
||||
-- with 4us increment. Function is shared with all.
|
||||
--
|
||||
-- Rev 3 5/15/11 AZ
|
||||
-- Added 100ms tick
|
||||
--
|
||||
-- Rev 4 1/11/14 AZ
|
||||
-- Extended CLK_COUNTER precision to operate at higher FPGA clock frequency (from ?????? ???????)
|
||||
-- Switched to numeric_std.
|
||||
--
|
||||
-- Rev 5 12/10/15 AZ
|
||||
-- replaced ASYNC_RESET with SYNC_RESET
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.NUMERIC_STD.ALL;
|
||||
|
||||
entity TIMER_4US is
|
||||
generic (
|
||||
CLK_FREQUENCY: integer := 120
|
||||
-- CLK frequency in MHz. Needed to compute actual delays.
|
||||
);
|
||||
Port (
|
||||
--// CLK, RESET
|
||||
CLK: in std_logic;
|
||||
-- usage: specify the CLK frequency in MHz in the generic section above
|
||||
SYNC_RESET: in std_logic;
|
||||
|
||||
TICK_4US: out std_logic;
|
||||
TICK_100MS: out std_logic
|
||||
-- 1 CLK-wide pulse every four microseconds and 100ms
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of TIMER_4US is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
signal CLK_COUNTER: unsigned(9 downto 0) := (others => '0');
|
||||
constant CLK_DIV: integer := (CLK_FREQUENCY * 4 - 1); -- CLK_FREQ MHz*4usec -1;
|
||||
signal TICK_4US_local: std_logic := '0';
|
||||
signal CLK_COUNTER2: unsigned(15 downto 0) := (others => '0');
|
||||
constant CLK_DIV2: integer := 24999; -- 100ms/4us - 1
|
||||
-- TEST TEST TEST TEST
|
||||
--constant CLK_DIV2: integer := 24; -- 100Us/4us - 1
|
||||
--constant CLK_DIV2: integer := 2; -- 10Us/4us - 1
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
CLK_DIV_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
CLK_COUNTER <= (others => '0');
|
||||
TICK_4US_local <= '0';
|
||||
elsif(CLK_COUNTER /= CLK_DIV) then
|
||||
CLK_COUNTER <= CLK_COUNTER + 1;
|
||||
TICK_4US_local <= '0';
|
||||
else
|
||||
CLK_COUNTER <= (others => '0');
|
||||
TICK_4US_local <= '1';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
TICK_4US <= TICK_4US_local;
|
||||
|
||||
TICK_100MS_GEN: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
CLK_COUNTER2 <= (others => '0');
|
||||
TICK_100MS <= '0';
|
||||
elsif(TICK_4US_local = '1') then
|
||||
if(CLK_COUNTER2 /= CLK_DIV2) then
|
||||
CLK_COUNTER2 <= CLK_COUNTER2 + 1;
|
||||
TICK_100MS <= '0';
|
||||
else
|
||||
CLK_COUNTER2 <= (others => '0');
|
||||
TICK_100MS <= '1';
|
||||
end if;
|
||||
else
|
||||
TICK_100MS <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
end Behavioral;
|
||||
215
generic_ip/third_party_ip/tcp_server/src/udp_rx_10G.vhd
Normal file
215
generic_ip/third_party_ip/tcp_server/src/udp_rx_10G.vhd
Normal file
|
|
@ -0,0 +1,215 @@
|
|||
-------------------------------------------------------------
|
||||
-- MSS copyright 2018
|
||||
-- Filename: UDP_RX_10G.VHD
|
||||
-- Author: Alain Zarembowitch / MSS
|
||||
-- Version: 0
|
||||
-- Date last modified: 4/29/18
|
||||
-- Inheritance: COM-5402 UDP_RX.VHD 7/31/15
|
||||
--
|
||||
-- description: UDP protocol (receive-only) 10Gb, for IPv4 and IPv6
|
||||
-- Receives and validates UDP frames. The data segment of the UDP frame is immediately
|
||||
-- forwarded to the application without any intermediate storage in an elastic buffer.
|
||||
-- Thus the application must be capable of receiving data at full speed (156.25MHz/64-bit wide).
|
||||
--
|
||||
-- Various validation checks are performed in real-time while receiving a new frame.
|
||||
-- If any of the check fails, the UDP_RX_DATA_VALID is cleared. It is therefore IMPORTANT
|
||||
-- that the application rejects frame if UDP_RX_FRAME_VALID = '0' at the end of the frame
|
||||
-- (UDP_RX_EOF = '1').
|
||||
--
|
||||
-- Validation checks:
|
||||
-- MAC address, IP type, IP destination address, UDP protocol,
|
||||
-- UDP destination port, IP header checksum, UDP checksum
|
||||
--
|
||||
-- As there is no difference between IPv4 and IPv6 for UDP, this component is compatible with
|
||||
-- both IPv4 and IPv6.
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.numeric_std.ALL;
|
||||
|
||||
entity UDP_RX_10G is
|
||||
Port (
|
||||
--// CLK, RESET
|
||||
CLK: in std_logic;
|
||||
SYNC_RESET: in std_logic;
|
||||
|
||||
--// RECEIVED IP PAYLOAD ---------------------------------------------
|
||||
-- Excludes MAC layer header, IP header.
|
||||
IP_PAYLOAD_DATA: in std_logic_vector(63 downto 0);
|
||||
IP_PAYLOAD_DATA_VALID: in std_logic_vector(7 downto 0);
|
||||
IP_PAYLOAD_SOF: in std_logic;
|
||||
IP_PAYLOAD_EOF: in std_logic;
|
||||
IP_PAYLOAD_WORD_COUNT: in std_logic_vector(10 downto 0);
|
||||
|
||||
--// Partial checks (done in PACKET_PARSING common code)
|
||||
--// basic IP validity check
|
||||
IP_RX_FRAME_VALID: in std_logic;
|
||||
-- As the IP frame validity is checked on-the-fly, the user should always check if
|
||||
-- the IP_RX_FRAME_VALID is high AT THE END of the IP payload frame (IP_PAYLOAD_EOF) to confirm that the
|
||||
-- ENTIRE IP frame is valid.
|
||||
-- The received IP frame is presumed valid until proven otherwise.
|
||||
-- IP frame validity checks include:
|
||||
-- (a) protocol is IP
|
||||
-- (b) unicast or multicast destination IP address matches
|
||||
-- (c) correct IP header checksum (IPv4 only)
|
||||
-- (d) allowed IPv6
|
||||
-- (e) Ethernet frame is valid (correct FCS, dest address)
|
||||
-- Ready at IP_RX_EOF_D2 = IP_PAYLOAD_EOF
|
||||
RX_IP_PROTOCOL: in std_logic_vector(7 downto 0);
|
||||
-- read between RX_IP_PROTOCOL_RDY (inclusive)(i.e. before IP_PAYLOAD_SOF) and IP_PAYLOAD_EOF (inclusive)
|
||||
-- This component responds to protocol 17 = UDP
|
||||
VALID_UDP_CHECKSUM: in std_logic;
|
||||
-- '1' when valid UDP checksum. Read at IP_RX_EOF_D2 = IP_PAYLOAD_EOF_D
|
||||
|
||||
--// configuration
|
||||
PORT_NO: in std_logic_vector(15 downto 0);
|
||||
-- accepts UDP packets with a destination port PORT_NO
|
||||
CHECK_UDP_RX_DEST_PORT_NO: in std_logic;
|
||||
-- check the destination port number matches PORT_NO (1) or ignore it (0)
|
||||
-- The latter case is useful when this component is shared among multiple UDP ports
|
||||
|
||||
--// Application interface
|
||||
-- Latency: 0
|
||||
UDP_RX_DATA: out std_logic_vector(63 downto 0);
|
||||
-- UDP data field when UDP_RX_DATA_VALID = '1'
|
||||
UDP_RX_DATA_VALID: out std_logic_vector(7 downto 0);
|
||||
-- delineates the UDP data field
|
||||
UDP_RX_SOF: out std_logic;
|
||||
-- 1 CLK pulse indicating that UDP_RX_DATA is the first byte in the UDP data field.
|
||||
UDP_RX_EOF: out std_logic;
|
||||
-- 1 CLK pulse indicating that UDP_RX_DATA is the last byte in the UDP data field.
|
||||
-- ALWAYS CHECK UDP_RX_FRAME_VALID at the end of packet (UDP_RX_EOF = '1') to confirm
|
||||
-- that the UDP packet is valid. External buffer may have to backtrack to the the last
|
||||
-- valid pointer to discard an invalid UDP packet.
|
||||
-- Reason: we only knows about bad UDP packets at the end.
|
||||
UDP_RX_FRAME_VALID: out std_logic;
|
||||
-- check entire frame validity at UDP_RX_EOF
|
||||
UDP_RX_SRC_PORT: out std_logic_vector(15 downto 0);
|
||||
-- Identify the source UDP port. Read when UDP_RX_EOF = '1'
|
||||
UDP_RX_DEST_PORT: out std_logic_vector(15 downto 0);
|
||||
-- Identify the destination UDP port. Read when UDP_RX_EOF = '1'
|
||||
|
||||
|
||||
-- Test Points
|
||||
TP: out std_logic_vector(10 downto 1)
|
||||
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of UDP_RX_10G is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
--// PARSE UDP HEADER --------------------------
|
||||
signal LENGTH: std_logic_vector(15 downto 0) := (others => '0');
|
||||
|
||||
--// CHECK UDP VALIDITY -----------------------------
|
||||
signal VALID_RX_UDP0: std_logic := '0';
|
||||
signal VALID_RX_UDP: std_logic := '0';
|
||||
|
||||
-- Remove UDP header
|
||||
signal UDP_PAYLOAD_FLAG: std_logic := '0';
|
||||
signal UDP_PAYLOAD_SOF_FLAG: std_logic := '0';
|
||||
signal UDP_RX_EOF_local: std_logic := '0';
|
||||
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
--// PARSE UDP HEADER --------------------------
|
||||
UDP_HEADER_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(IP_PAYLOAD_SOF = '1') then
|
||||
UDP_RX_SRC_PORT <= IP_PAYLOAD_DATA(63 downto 48);
|
||||
UDP_RX_DEST_PORT <= IP_PAYLOAD_DATA(47 downto 32);
|
||||
LENGTH <= IP_PAYLOAD_DATA(31 downto 16);
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--// CHECK UDP VALIDITY -----------------------------
|
||||
-- The UDP packet reception is immediately cancelled if
|
||||
-- (a) the received packet type is not an IP datagram (done in common code PACKET_PARSING)
|
||||
-- (b) invalid destination IP (done in common code PACKET_PARSING)
|
||||
-- (c) incorrect IP header checksum (IPv4 only) (done in common code PACKET_PARSING)
|
||||
-- (d) the received IP type is not UDP
|
||||
-- (e) destination port number is not the specified PORT_NO (checking is user-enabled)
|
||||
-- (f) UDP checksum is incorrect
|
||||
|
||||
VALIDITY_CHECK_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(IP_PAYLOAD_SOF = '1') then
|
||||
if(unsigned(RX_IP_PROTOCOL) /= 17) then
|
||||
-- received protocol is not UDP
|
||||
VALID_RX_UDP0 <= '0';
|
||||
elsif(CHECK_UDP_RX_DEST_PORT_NO = '1') and (PORT_NO /= IP_PAYLOAD_DATA(47 downto 32)) then
|
||||
-- user asked us to check the destination port number and it does not match.
|
||||
-- Note: in some applications where UDP_RX_10G.vhd is shared by multiple UDP ports (DHCP server for example),
|
||||
-- the destination port number check is better done outside this component.
|
||||
VALID_RX_UDP0 <= '0';
|
||||
else
|
||||
VALID_RX_UDP0 <= '1';
|
||||
end if;
|
||||
elsif(IP_PAYLOAD_EOF = '1') and (IP_RX_FRAME_VALID = '0') then
|
||||
VALID_RX_UDP0 <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
UDP_RX_FRAME_VALID <= VALID_RX_UDP0 and VALID_UDP_CHECKSUM and UDP_RX_EOF_local; -- combine with the other checks done in parsing.vhd
|
||||
-- validity assessment is complete at IP_PAYLOAD_EOF_D = UDP_RX_EOF
|
||||
|
||||
|
||||
--// COPY UDP DATA TO APPLICATION INTERFACE ------------------------
|
||||
-- Algorithm: UDP header is 8-byte long = 1 word. So just skip the first IP payload word.
|
||||
-- TODO: verify that in the case of very short (<60 bytes) Ethernet frames, the zero padding
|
||||
-- is removed in packet_parsing.vhd
|
||||
|
||||
-- Remove UDP header
|
||||
UDP_PAYLOAD_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(IP_PAYLOAD_EOF = '1') then
|
||||
UDP_PAYLOAD_FLAG <= '0';
|
||||
elsif(IP_PAYLOAD_SOF = '1') then
|
||||
UDP_PAYLOAD_FLAG <= '1';
|
||||
end if;
|
||||
|
||||
if(IP_PAYLOAD_SOF = '1') and (IP_PAYLOAD_EOF = '0')then
|
||||
UDP_PAYLOAD_SOF_FLAG <= '1';
|
||||
elsif(unsigned(IP_PAYLOAD_DATA_VALID) /= 0) or (IP_PAYLOAD_EOF = '1') then
|
||||
UDP_PAYLOAD_SOF_FLAG <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- reclock to align UDP_RX_EOF with the late arrival of VALID_UDP_CHECKSUM
|
||||
OUTPUT_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
UDP_RX_DATA <= IP_PAYLOAD_DATA;
|
||||
if(UDP_PAYLOAD_FLAG = '1') and (VALID_RX_UDP0 = '1') then
|
||||
UDP_RX_DATA_VALID <= IP_PAYLOAD_DATA_VALID ;
|
||||
else
|
||||
UDP_RX_DATA_VALID <= (others => '0');
|
||||
end if;
|
||||
if(UDP_PAYLOAD_SOF_FLAG = '1') and (VALID_RX_UDP0 = '1') and (unsigned(IP_PAYLOAD_DATA_VALID) /= 0) then
|
||||
UDP_RX_SOF <= '1';
|
||||
else
|
||||
UDP_RX_SOF <= '0';
|
||||
end if;
|
||||
UDP_RX_EOF_local <= IP_PAYLOAD_EOF and UDP_PAYLOAD_FLAG and VALID_RX_UDP0;
|
||||
end if;
|
||||
end process;
|
||||
UDP_RX_EOF <= UDP_RX_EOF_local;
|
||||
|
||||
--// Test Point
|
||||
-- unused here
|
||||
-- TP(1) <= ...
|
||||
|
||||
end Behavioral;
|
||||
1011
generic_ip/third_party_ip/tcp_server/src/udp_tx_10G.vhd
Normal file
1011
generic_ip/third_party_ip/tcp_server/src/udp_tx_10G.vhd
Normal file
File diff suppressed because it is too large
Load diff
293
generic_ip/third_party_ip/tcp_server/src/whois2_10G.vhd
Normal file
293
generic_ip/third_party_ip/tcp_server/src/whois2_10G.vhd
Normal file
|
|
@ -0,0 +1,293 @@
|
|||
-------------------------------------------------------------
|
||||
-- MSS copyright 2018
|
||||
-- Filename: WHOIS2_10G.VHD
|
||||
-- Author: Alain Zarembowitch / MSS
|
||||
-- Version: 0
|
||||
-- Date last modified: 7/30/18
|
||||
-- Inheritance: COM-5402 WHOIS2.VHD rev1 8/8/12
|
||||
--
|
||||
-- description: Asks around who is (given IP address) using the
|
||||
-- Address Resolution Protocol (ARP) for IPv4 or Neighbor Discovery Protocol (NDP) for IPv6. 10Gb.
|
||||
---------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.NUMERIC_STD.ALL;
|
||||
|
||||
entity WHOIS2_10G is
|
||||
generic (
|
||||
IPv6_ENABLED: std_logic := '0'
|
||||
-- 0 to minimize size, 1 to allow IPv6 in addition to IPv4 (larger size)
|
||||
);
|
||||
Port (
|
||||
--// CLK, RESET
|
||||
SYNC_RESET: in std_logic;
|
||||
CLK: in std_logic;
|
||||
|
||||
--// User interface
|
||||
WHOIS_IP_ADDR: in std_logic_vector(127 downto 0);
|
||||
-- user query: IP address to resolve. read at WHOIS_START
|
||||
-- use 32LSbs for IPv4
|
||||
WHOIS_IPv4_6n: in std_logic;
|
||||
-- address type IPv4(1) or IPv6(0)
|
||||
WHOIS_START: in std_logic;
|
||||
-- 1 CLK pulse to start the ARP query
|
||||
-- new WHOIS requests will be ignored until the module is
|
||||
-- finished with the previous request/reply transaction.
|
||||
WHOIS_RDY: out std_logic;
|
||||
-- always check WHOIS_RDY before requesting a WHOIS transaction with WHOIS_START, otherwise
|
||||
-- there is risk that WHOIS is busy and that the request will be ignored.
|
||||
|
||||
--// Configuration data: IP address, MAC address
|
||||
MAC_ADDR: in std_logic_vector(47 downto 0);
|
||||
-- MAC address. Unique for each network interface card.
|
||||
-- Natural byte order: (MSB = REG32) 0x000102030405 (LSB = REG37)
|
||||
-- as transmitted in the Ethernet packet.
|
||||
IPv4_ADDR: in std_logic_vector(31 downto 0);
|
||||
IPv6_ADDR: in std_logic_vector(127 downto 0);
|
||||
-- local IP address. 4 bytes for IPv4, 16 bytes for IPv6
|
||||
-- Natural order (MSB) 172.16.1.128 (LSB) as transmitted in the IP frame.
|
||||
|
||||
--// Transmit frame/packet
|
||||
MAC_TX_DATA: out std_logic_vector(63 downto 0);
|
||||
MAC_TX_DATA_VALID: out std_logic_vector(7 downto 0);
|
||||
-- one CLK-wide pulse indicating a new word is sent on MAC_TX_DATA
|
||||
MAC_TX_EOF: out std_logic;
|
||||
-- End of Frame: one CLK-wide pulse indicating the last word in the transmit frame.
|
||||
-- aligned with MAC_TX_DATA_VALID.
|
||||
MAC_TX_CTS: in std_logic;
|
||||
-- 1 CLK-wide pulse requesting output samples. Check RTS first.
|
||||
RTS: out std_logic;
|
||||
-- '1' when a full or partial packet is ready to be read.
|
||||
-- '0' when output buffer is empty.
|
||||
-- When the user starts reading the output buffer, it is expected that it will be
|
||||
-- read until empty.
|
||||
|
||||
-- Test Points
|
||||
TP: out std_logic_vector(10 downto 1)
|
||||
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture Behavioral of WHOIS2_10G is
|
||||
--------------------------------------------------------
|
||||
-- COMPONENTS
|
||||
--------------------------------------------------------
|
||||
--------------------------------------------------------
|
||||
-- SIGNALS
|
||||
--------------------------------------------------------
|
||||
signal WHOIS_STATE: std_logic := '0';
|
||||
signal WHOIS_IP_ADDR_D: std_logic_vector(127 downto 0) := (others => '0');
|
||||
signal DEST_IPv6_ADDR: std_logic_vector(127 downto 0) := (others => '0');
|
||||
signal WHOIS_IPv4_6n_D: std_logic := '0';
|
||||
|
||||
--// ICMP CHECKSUM -----------------
|
||||
signal CKSUM_SEQ_CNTR: unsigned(2 downto 0) := "000";
|
||||
signal CKSUM_PART1: unsigned(19 downto 0) := (others => '0');
|
||||
signal CKSUM_PART2: unsigned(19 downto 0) := (others => '0');
|
||||
signal CKSUM: std_logic_vector(15 downto 0) := (others => '0');
|
||||
|
||||
--// ARP request
|
||||
signal TX_PACKET_SEQUENCE: unsigned(4 downto 0) := (others => '1'); -- 42 bytes max IPv4, ? IPv6
|
||||
signal MAC_TX_DATA_VALID_E: std_logic := '0';
|
||||
signal MAC_TX_EOF_local: std_logic := '0';
|
||||
signal RTS_local: std_logic := '0';
|
||||
--------------------------------------------------------
|
||||
-- IMPLEMENTATION
|
||||
--------------------------------------------------------
|
||||
begin
|
||||
|
||||
DEST_IPv6_ADDR <= x"FF0200000000000000000001FF" & WHOIS_IP_ADDR_D(23 downto 0);
|
||||
|
||||
--// Generate ARP/NDP query
|
||||
ARP_RESP_GEN_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
MAC_TX_DATA <= (others => '0');
|
||||
elsif(WHOIS_IPv4_6n_D = '1') then
|
||||
-- IPv4 address -> send an ARP request. 42 bytes.
|
||||
case(TX_PACKET_SEQUENCE) is
|
||||
-- Ethernet header
|
||||
when "00000" => MAC_TX_DATA <= x"FFFFFFFFFFFF" & MAC_ADDR(47 downto 32);
|
||||
-- destination MAC address: broadcast. fixed at the time of connection establishment.
|
||||
when "00001" => MAC_TX_DATA <= MAC_ADDR(31 downto 0) & x"08060001";
|
||||
-- source Ethernet address + Ethernet type + hardware type
|
||||
when "00010" => MAC_TX_DATA <= x"080006040001" & MAC_ADDR(47 downto 32);
|
||||
-- protocol type + hardware size, protocol size + op field. ARP request + sender Ethernet address
|
||||
when "00011" => MAC_TX_DATA <= MAC_ADDR(31 downto 0) & IPv4_ADDR;
|
||||
-- sender Ethernet address + sender IP address
|
||||
when "00100" => MAC_TX_DATA <= x"000000000000" & WHOIS_IP_ADDR_D(31 downto 16);
|
||||
-- target Ethernet address + target IP address
|
||||
when "00101" => MAC_TX_DATA <= WHOIS_IP_ADDR_D(15 downto 0) & x"000000000000";
|
||||
-- target IP address
|
||||
when others => MAC_TX_DATA <= (others => '0'); -- default & trailer
|
||||
end case;
|
||||
elsif(IPv6_ENABLED = '1') then
|
||||
-- IPv6 address -> send a Neighbor solicitation message.86 bytes
|
||||
case(TX_PACKET_SEQUENCE) is
|
||||
-- Ethernet header
|
||||
when "00000" => MAC_TX_DATA <= x"3333ff" & WHOIS_IP_ADDR_D(23 downto 0) & MAC_ADDR(47 downto 32);
|
||||
-- destination MAC address: broadcast. fixed at the time of connection establishment.
|
||||
when "00001" => MAC_TX_DATA <= MAC_ADDR(31 downto 0) & x"86DD6000";
|
||||
-- source Ethernet address + Ethernet type IPv6 + hardware type
|
||||
when "00010" => MAC_TX_DATA <= x"000000203AFF" & IPv6_ADDR(127 downto 112);
|
||||
-- payload length (32), next header ICMPv6 (58), hop limit (255), source IP address
|
||||
when "00011" => MAC_TX_DATA <= IPv6_ADDR(111 downto 48);
|
||||
-- source IP address
|
||||
when "00100" => MAC_TX_DATA <= IPv6_ADDR(47 downto 0) & x"FF02";
|
||||
-- source IP address, destination IP address
|
||||
when "00101" => MAC_TX_DATA <= x"0000000000000000";
|
||||
-- destination IP address
|
||||
when "00110" => MAC_TX_DATA <= x"0001FF" & WHOIS_IP_ADDR_D(23 downto 0) & x"8700";
|
||||
-- destination IP address, ICMPv6 neighbor solicitation
|
||||
when "00111" => MAC_TX_DATA <= CKSUM & x"00000000" & WHOIS_IP_ADDR_D(127 downto 112);
|
||||
-- checksum, target address
|
||||
when "01000" => MAC_TX_DATA <= WHOIS_IP_ADDR_D(111 downto 48);
|
||||
-- target address
|
||||
when "01001" => MAC_TX_DATA <= WHOIS_IP_ADDR_D(47 downto 0) & x"0101";
|
||||
-- target IP address, ICMPv6 option
|
||||
when "01010" => MAC_TX_DATA <= MAC_ADDR & x"0000";
|
||||
-- link layer address
|
||||
when others => MAC_TX_DATA <= (others => '0'); -- default & trailer
|
||||
end case;
|
||||
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--// ICMP CHECKSUM -----------------
|
||||
-- The ICMP reply checksum is computed in two parts: one part at reset, based on the IPv6_ADDR and MAC_ADDR.
|
||||
-- The second part is computed for each valid received ICMP message.
|
||||
IPv6ONLY: if(IPv6_ENABLED = '1') generate
|
||||
CKSUM_001: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
CKSUM_SEQ_CNTR <= "101";
|
||||
elsif(CKSUM_SEQ_CNTR > 0) then
|
||||
CKSUM_SEQ_CNTR <= CKSUM_SEQ_CNTR - 1;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
CKSUM_002: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
-- fixed part of the checksum is initialized at reset
|
||||
if(SYNC_RESET = '1') then
|
||||
CKSUM_PART1 <= resize(unsigned(IPv6_ADDR(127 downto 112)),20) + resize(unsigned(IPv6_ADDR(111 downto 96)),20);
|
||||
elsif(CKSUM_SEQ_CNTR = "101") then
|
||||
CKSUM_PART1 <= CKSUM_PART1 + resize(unsigned(IPv6_ADDR(95 downto 80)),20) + resize(unsigned(IPv6_ADDR(79 downto 64)),20);
|
||||
elsif(CKSUM_SEQ_CNTR = "100") then
|
||||
CKSUM_PART1 <= CKSUM_PART1 + resize(unsigned(IPv6_ADDR(63 downto 48)),20) + resize(unsigned(IPv6_ADDR(47 downto 32)),20);
|
||||
elsif(CKSUM_SEQ_CNTR = "011") then
|
||||
CKSUM_PART1 <= CKSUM_PART1 + resize(unsigned(IPv6_ADDR(31 downto 16)),20) + resize(unsigned(IPv6_ADDR(15 downto 0)),20);
|
||||
elsif(CKSUM_SEQ_CNTR = "010") then
|
||||
CKSUM_PART1 <= CKSUM_PART1 + resize(unsigned(MAC_ADDR(47 downto 32)),20) + resize(unsigned(MAC_ADDR(31 downto 16)),20);
|
||||
elsif(CKSUM_SEQ_CNTR = "001") then
|
||||
CKSUM_PART1 <= CKSUM_PART1 + resize(unsigned(MAC_ADDR(15 downto 0)),20) + x"875F";
|
||||
-- constant is the sum of 3A + 20 + 8700 + 0101 + FF02 + 0001
|
||||
end if;
|
||||
|
||||
if(MAC_TX_CTS = '1') then
|
||||
-- variable part of the checksum depends on the ICMP message originator
|
||||
case(TX_PACKET_SEQUENCE) is
|
||||
when "11111" =>
|
||||
CKSUM_PART2 <= CKSUM_PART1 + resize(unsigned(WHOIS_IP_ADDR_D(127 downto 112)),20) + resize(unsigned(WHOIS_IP_ADDR_D(111 downto 96)),20);
|
||||
when "00000" =>
|
||||
CKSUM_PART2 <= CKSUM_PART2 + resize(unsigned(WHOIS_IP_ADDR_D(95 downto 80)),20) + resize(unsigned(WHOIS_IP_ADDR_D(79 downto 64)),20);
|
||||
when "00001" =>
|
||||
CKSUM_PART2 <= CKSUM_PART2 + resize(unsigned(WHOIS_IP_ADDR_D(63 downto 48)),20) + resize(unsigned(WHOIS_IP_ADDR_D(47 downto 32)),20);
|
||||
when "00010" =>
|
||||
CKSUM_PART2 <= CKSUM_PART2 + resize(unsigned(WHOIS_IP_ADDR_D(31 downto 16)),20) + resize(unsigned(WHOIS_IP_ADDR_D(15 downto 0) & "0"),20); -- the 2 LSBs are summed twice
|
||||
when "00011" =>
|
||||
CKSUM_PART2 <= resize(unsigned(CKSUM_PART2(15 downto 0)),20) + resize(unsigned(CKSUM_PART2(19 downto 16)),20) + resize(unsigned(DEST_IPv6_ADDR(31 downto 16)),20);
|
||||
when "00100" =>
|
||||
CKSUM_PART2 <= resize(unsigned(CKSUM_PART2(15 downto 0)),20) + resize(unsigned(CKSUM_PART2(19 downto 16)),20);
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
CKSUM <= std_logic_vector(not CKSUM_PART2(15 downto 0));
|
||||
end generate;
|
||||
|
||||
TX_SEQUENCE_GEN: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') or ((WHOIS_START = '1') and (WHOIS_STATE = '0')) or (MAC_TX_EOF_local = '1') then -- *073018
|
||||
TX_PACKET_SEQUENCE <= (others => '1');
|
||||
MAC_TX_DATA_VALID_E <= '0';
|
||||
elsif(WHOIS_STATE = '1') and (MAC_TX_CTS = '1') then
|
||||
-- read the next word
|
||||
TX_PACKET_SEQUENCE <= TX_PACKET_SEQUENCE + 1;
|
||||
MAC_TX_DATA_VALID_E <= '1';
|
||||
else
|
||||
MAC_TX_DATA_VALID_E <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- aligned with MAC_TX_DATA_VALID
|
||||
MAX_TX_EOF_GEN: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') or (MAC_TX_EOF_local = '1') then
|
||||
MAC_TX_EOF_local <= '0';
|
||||
MAC_TX_DATA_VALID <= x"00";
|
||||
elsif(MAC_TX_DATA_VALID_E = '1') then
|
||||
if(WHOIS_IPv4_6n_D = '1') and (TX_PACKET_SEQUENCE = 5) then
|
||||
-- IPv4 ARP done. transmitting the last word (42-bytes)
|
||||
MAC_TX_DATA_VALID <= x"c0"; -- last word contains only 2 bytes
|
||||
MAC_TX_EOF_local <= '1';
|
||||
elsif(WHOIS_IPv4_6n_D = '0') and (TX_PACKET_SEQUENCE = 10) then
|
||||
-- IPv6 Neighbor solicitation done. transmitting the last word (86-bytes)
|
||||
MAC_TX_DATA_VALID <= x"fc"; -- last word contains only 6 bytes
|
||||
MAC_TX_EOF_local <= '1';
|
||||
else
|
||||
MAC_TX_DATA_VALID <= x"ff";
|
||||
MAC_TX_EOF_local <= '0';
|
||||
end if;
|
||||
else
|
||||
MAC_TX_DATA_VALID <= x"00";
|
||||
MAC_TX_EOF_local <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
MAC_TX_EOF <= MAC_TX_EOF_local;
|
||||
|
||||
-- WHOIS state machine
|
||||
RTS_GEN: process(CLK)
|
||||
begin
|
||||
if rising_edge(CLK) then
|
||||
if(SYNC_RESET = '1') then
|
||||
RTS_local <= '0';
|
||||
WHOIS_STATE <= '0';
|
||||
else
|
||||
if(WHOIS_START = '1') and (WHOIS_STATE = '0') then
|
||||
-- new transaction. Sending ARP or NDP request
|
||||
RTS_local <= '1';
|
||||
WHOIS_STATE <= '1';
|
||||
-- freeze whois IP address and IPversion
|
||||
WHOIS_IP_ADDR_D <= WHOIS_IP_ADDR;
|
||||
WHOIS_IPv4_6n_D <= WHOIS_IPv4_6n;
|
||||
elsif(MAC_TX_EOF_local = '1') then
|
||||
-- done. transmitting the last word
|
||||
RTS_local <= '0';
|
||||
WHOIS_STATE <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
RTS <= RTS_local;
|
||||
WHOIS_RDY <= RTS_local or WHOIS_START;
|
||||
|
||||
|
||||
--// Test Point
|
||||
TP(1) <= WHOIS_START;
|
||||
TP(2) <= MAC_TX_CTS;
|
||||
--TP(3) <= MAC_TX_DATA_VALID_E;
|
||||
TP(4) <= MAC_TX_EOF_local;
|
||||
TP(5) <= RTS_local;
|
||||
|
||||
end Behavioral;
|
||||
Binary file not shown.
303
generic_ip/third_party_ip/xaui_phy_itf/src/xaui_phy_itf.vhd
Normal file
303
generic_ip/third_party_ip/xaui_phy_itf/src/xaui_phy_itf.vhd
Normal file
|
|
@ -0,0 +1,303 @@
|
|||
-- megafunction wizard: %XAUI PHY Intel FPGA IP v18.1%
|
||||
-- GENERATION: XML
|
||||
-- xaui_phy_itf.vhd
|
||||
|
||||
-- Generated using ACDS version 18.1 625
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.numeric_std.all;
|
||||
|
||||
entity xaui_phy_itf is
|
||||
port (
|
||||
pll_ref_clk : in std_logic := '0'; -- pll_ref_clk.clk
|
||||
xgmii_tx_clk : in std_logic := '0'; -- xgmii_tx_clk.clk
|
||||
xgmii_rx_clk : out std_logic; -- xgmii_rx_clk.clk
|
||||
xgmii_rx_dc : out std_logic_vector(71 downto 0); -- xgmii_rx_dc.data
|
||||
xgmii_tx_dc : in std_logic_vector(71 downto 0) := (others => '0'); -- xgmii_tx_dc.data
|
||||
xaui_rx_serial_data : in std_logic_vector(3 downto 0) := (others => '0'); -- xaui_rx_serial_data.export
|
||||
xaui_tx_serial_data : out std_logic_vector(3 downto 0); -- xaui_tx_serial_data.export
|
||||
rx_ready : out std_logic; -- rx_ready.export
|
||||
tx_ready : out std_logic; -- tx_ready.export
|
||||
phy_mgmt_clk : in std_logic := '0'; -- phy_mgmt_clk.clk
|
||||
phy_mgmt_clk_reset : in std_logic := '0'; -- phy_mgmt_clk_reset.reset
|
||||
phy_mgmt_address : in std_logic_vector(8 downto 0) := (others => '0'); -- phy_mgmt.address
|
||||
phy_mgmt_read : in std_logic := '0'; -- .read
|
||||
phy_mgmt_readdata : out std_logic_vector(31 downto 0); -- .readdata
|
||||
phy_mgmt_write : in std_logic := '0'; -- .write
|
||||
phy_mgmt_writedata : in std_logic_vector(31 downto 0) := (others => '0'); -- .writedata
|
||||
phy_mgmt_waitrequest : out std_logic; -- .waitrequest
|
||||
reconfig_from_xcvr : out std_logic_vector(229 downto 0); -- reconfig_from_xcvr.data
|
||||
reconfig_to_xcvr : in std_logic_vector(349 downto 0) := (others => '0') -- reconfig_to_xcvr.data
|
||||
);
|
||||
end entity xaui_phy_itf;
|
||||
|
||||
architecture rtl of xaui_phy_itf is
|
||||
component altera_xcvr_xaui is
|
||||
generic (
|
||||
device_family : string := "Stratix IV";
|
||||
starting_channel_number : integer := 0;
|
||||
interface_type : string := "Select";
|
||||
data_rate : string := "3125 Mbps";
|
||||
xaui_pll_type : string := "AUTO";
|
||||
BASE_DATA_RATE : string := "";
|
||||
en_synce_support : integer := 0;
|
||||
use_control_and_status_ports : integer := 0;
|
||||
external_pma_ctrl_reconf : integer := 0;
|
||||
recovered_clk_out : integer := 0;
|
||||
number_of_interfaces : integer := 1;
|
||||
reconfig_interfaces : integer := 1;
|
||||
use_rx_rate_match : integer := 0;
|
||||
tx_termination : string := "OCT_100_OHMS";
|
||||
tx_vod_selection : integer := 4;
|
||||
tx_preemp_pretap : integer := 0;
|
||||
tx_preemp_pretap_inv : string := "false";
|
||||
tx_preemp_tap_1 : integer := 0;
|
||||
tx_preemp_tap_2 : integer := 0;
|
||||
tx_preemp_tap_2_inv : string := "false";
|
||||
rx_common_mode : string := "0.82v";
|
||||
rx_termination : string := "OCT_100_OHMS";
|
||||
rx_eq_dc_gain : integer := 0;
|
||||
rx_eq_ctrl : integer := 0;
|
||||
pll_external_enable : integer := 0;
|
||||
en_dual_fifo : integer := 0;
|
||||
enable_rx_coreclkin : integer := 0;
|
||||
disable_embedded_sdc : integer := 1;
|
||||
mgmt_clk_in_mhz : integer := 150
|
||||
);
|
||||
port (
|
||||
pll_ref_clk : in std_logic := 'X'; -- clk
|
||||
xgmii_tx_clk : in std_logic := 'X'; -- clk
|
||||
xgmii_rx_clk : out std_logic; -- clk
|
||||
xgmii_rx_dc : out std_logic_vector(71 downto 0); -- data
|
||||
xgmii_tx_dc : in std_logic_vector(71 downto 0) := (others => 'X'); -- data
|
||||
xaui_rx_serial_data : in std_logic_vector(3 downto 0) := (others => 'X'); -- export
|
||||
xaui_tx_serial_data : out std_logic_vector(3 downto 0); -- export
|
||||
rx_ready : out std_logic; -- export
|
||||
tx_ready : out std_logic; -- export
|
||||
phy_mgmt_clk : in std_logic := 'X'; -- clk
|
||||
phy_mgmt_clk_reset : in std_logic := 'X'; -- reset
|
||||
phy_mgmt_address : in std_logic_vector(8 downto 0) := (others => 'X'); -- address
|
||||
phy_mgmt_read : in std_logic := 'X'; -- read
|
||||
phy_mgmt_readdata : out std_logic_vector(31 downto 0); -- readdata
|
||||
phy_mgmt_write : in std_logic := 'X'; -- write
|
||||
phy_mgmt_writedata : in std_logic_vector(31 downto 0) := (others => 'X'); -- writedata
|
||||
phy_mgmt_waitrequest : out std_logic; -- waitrequest
|
||||
reconfig_from_xcvr : out std_logic_vector(229 downto 0); -- data
|
||||
reconfig_to_xcvr : in std_logic_vector(349 downto 0) := (others => 'X'); -- data
|
||||
rx_recovered_clk : out std_logic_vector(3 downto 0); -- export
|
||||
tx_clk312_5 : out std_logic; -- export
|
||||
rx_digitalreset : in std_logic := 'X'; -- export
|
||||
tx_digitalreset : in std_logic := 'X'; -- export
|
||||
rx_channelaligned : out std_logic; -- export
|
||||
rx_syncstatus : out std_logic_vector(7 downto 0); -- export
|
||||
rx_disperr : out std_logic_vector(7 downto 0); -- export
|
||||
rx_errdetect : out std_logic_vector(7 downto 0); -- export
|
||||
rx_analogreset : in std_logic := 'X'; -- export
|
||||
rx_invpolarity : in std_logic_vector(3 downto 0) := (others => 'X'); -- export
|
||||
rx_set_locktodata : in std_logic_vector(3 downto 0) := (others => 'X'); -- export
|
||||
rx_set_locktoref : in std_logic_vector(3 downto 0) := (others => 'X'); -- export
|
||||
rx_seriallpbken : in std_logic_vector(3 downto 0) := (others => 'X'); -- export
|
||||
tx_invpolarity : in std_logic_vector(3 downto 0) := (others => 'X'); -- export
|
||||
rx_is_lockedtodata : out std_logic_vector(3 downto 0); -- export
|
||||
rx_phase_comp_fifo_error : out std_logic_vector(3 downto 0); -- export
|
||||
rx_is_lockedtoref : out std_logic_vector(3 downto 0); -- export
|
||||
rx_rlv : out std_logic_vector(3 downto 0); -- export
|
||||
rx_rmfifoempty : out std_logic_vector(3 downto 0); -- export
|
||||
rx_rmfifofull : out std_logic_vector(3 downto 0); -- export
|
||||
tx_phase_comp_fifo_error : out std_logic_vector(3 downto 0); -- export
|
||||
rx_patterndetect : out std_logic_vector(7 downto 0); -- export
|
||||
rx_rmfifodatadeleted : out std_logic_vector(7 downto 0); -- export
|
||||
rx_rmfifodatainserted : out std_logic_vector(7 downto 0); -- export
|
||||
rx_runningdisp : out std_logic_vector(7 downto 0); -- export
|
||||
cal_blk_powerdown : in std_logic := 'X'; -- export
|
||||
pll_powerdown : in std_logic := 'X'; -- export
|
||||
gxb_powerdown : in std_logic := 'X'; -- export
|
||||
pll_locked : out std_logic; -- export
|
||||
cdr_ref_clk : in std_logic := 'X'; -- export
|
||||
pll_locked_i : in std_logic := 'X'; -- export
|
||||
ext_pll_clk : in std_logic_vector(3 downto 0) := (others => 'X'); -- export
|
||||
rx_coreclkin : in std_logic := 'X'; -- export
|
||||
reconfig_clk : in std_logic := 'X'; -- export
|
||||
reconfig_reset : in std_logic := 'X'; -- export
|
||||
reconfig_address : in std_logic_vector(11 downto 0) := (others => 'X'); -- export
|
||||
reconfig_read : in std_logic := 'X'; -- export
|
||||
reconfig_write : in std_logic := 'X'; -- export
|
||||
reconfig_writedata : in std_logic_vector(31 downto 0) := (others => 'X'); -- export
|
||||
reconfig_readdata : out std_logic_vector(31 downto 0); -- export
|
||||
reconfig_waitrequest : out std_logic; -- export
|
||||
tx_bonding_clocks : in std_logic_vector(5 downto 0) := (others => 'X'); -- export
|
||||
pll_powerdown_o : out std_logic; -- export
|
||||
pll_cal_busy_i : in std_logic := 'X'; -- export
|
||||
xgmii_rx_inclk : in std_logic := 'X' -- export
|
||||
);
|
||||
end component altera_xcvr_xaui;
|
||||
|
||||
begin
|
||||
|
||||
xaui_phy_itf_inst : component altera_xcvr_xaui
|
||||
generic map (
|
||||
device_family => "Cyclone V",
|
||||
starting_channel_number => 0,
|
||||
interface_type => "Soft XAUI",
|
||||
data_rate => "3125 Mbps",
|
||||
xaui_pll_type => "CMU",
|
||||
BASE_DATA_RATE => "3125 Mbps",
|
||||
en_synce_support => 0,
|
||||
use_control_and_status_ports => 0,
|
||||
external_pma_ctrl_reconf => 0,
|
||||
recovered_clk_out => 0,
|
||||
number_of_interfaces => 1,
|
||||
reconfig_interfaces => 5,
|
||||
use_rx_rate_match => 0,
|
||||
tx_termination => "OCT_100_OHMS",
|
||||
tx_vod_selection => 4,
|
||||
tx_preemp_pretap => 0,
|
||||
tx_preemp_pretap_inv => "false",
|
||||
tx_preemp_tap_1 => 0,
|
||||
tx_preemp_tap_2 => 0,
|
||||
tx_preemp_tap_2_inv => "false",
|
||||
rx_common_mode => "0.82v",
|
||||
rx_termination => "OCT_100_OHMS",
|
||||
rx_eq_dc_gain => 0,
|
||||
rx_eq_ctrl => 0,
|
||||
pll_external_enable => 0,
|
||||
en_dual_fifo => 0,
|
||||
enable_rx_coreclkin => 0,
|
||||
disable_embedded_sdc => 1,
|
||||
mgmt_clk_in_mhz => 150
|
||||
)
|
||||
port map (
|
||||
pll_ref_clk => pll_ref_clk, -- pll_ref_clk.clk
|
||||
xgmii_tx_clk => xgmii_tx_clk, -- xgmii_tx_clk.clk
|
||||
xgmii_rx_clk => xgmii_rx_clk, -- xgmii_rx_clk.clk
|
||||
xgmii_rx_dc => xgmii_rx_dc, -- xgmii_rx_dc.data
|
||||
xgmii_tx_dc => xgmii_tx_dc, -- xgmii_tx_dc.data
|
||||
xaui_rx_serial_data => xaui_rx_serial_data, -- xaui_rx_serial_data.export
|
||||
xaui_tx_serial_data => xaui_tx_serial_data, -- xaui_tx_serial_data.export
|
||||
rx_ready => rx_ready, -- rx_ready.export
|
||||
tx_ready => tx_ready, -- tx_ready.export
|
||||
phy_mgmt_clk => phy_mgmt_clk, -- phy_mgmt_clk.clk
|
||||
phy_mgmt_clk_reset => phy_mgmt_clk_reset, -- phy_mgmt_clk_reset.reset
|
||||
phy_mgmt_address => phy_mgmt_address, -- phy_mgmt.address
|
||||
phy_mgmt_read => phy_mgmt_read, -- .read
|
||||
phy_mgmt_readdata => phy_mgmt_readdata, -- .readdata
|
||||
phy_mgmt_write => phy_mgmt_write, -- .write
|
||||
phy_mgmt_writedata => phy_mgmt_writedata, -- .writedata
|
||||
phy_mgmt_waitrequest => phy_mgmt_waitrequest, -- .waitrequest
|
||||
reconfig_from_xcvr => reconfig_from_xcvr, -- reconfig_from_xcvr.data
|
||||
reconfig_to_xcvr => reconfig_to_xcvr, -- reconfig_to_xcvr.data
|
||||
rx_recovered_clk => open, -- (terminated)
|
||||
tx_clk312_5 => open, -- (terminated)
|
||||
rx_digitalreset => '0', -- (terminated)
|
||||
tx_digitalreset => '0', -- (terminated)
|
||||
rx_channelaligned => open, -- (terminated)
|
||||
rx_syncstatus => open, -- (terminated)
|
||||
rx_disperr => open, -- (terminated)
|
||||
rx_errdetect => open, -- (terminated)
|
||||
rx_analogreset => '0', -- (terminated)
|
||||
rx_invpolarity => "0000", -- (terminated)
|
||||
rx_set_locktodata => "0000", -- (terminated)
|
||||
rx_set_locktoref => "0000", -- (terminated)
|
||||
rx_seriallpbken => "0000", -- (terminated)
|
||||
tx_invpolarity => "0000", -- (terminated)
|
||||
rx_is_lockedtodata => open, -- (terminated)
|
||||
rx_phase_comp_fifo_error => open, -- (terminated)
|
||||
rx_is_lockedtoref => open, -- (terminated)
|
||||
rx_rlv => open, -- (terminated)
|
||||
rx_rmfifoempty => open, -- (terminated)
|
||||
rx_rmfifofull => open, -- (terminated)
|
||||
tx_phase_comp_fifo_error => open, -- (terminated)
|
||||
rx_patterndetect => open, -- (terminated)
|
||||
rx_rmfifodatadeleted => open, -- (terminated)
|
||||
rx_rmfifodatainserted => open, -- (terminated)
|
||||
rx_runningdisp => open, -- (terminated)
|
||||
cal_blk_powerdown => '0', -- (terminated)
|
||||
pll_powerdown => '0', -- (terminated)
|
||||
gxb_powerdown => '0', -- (terminated)
|
||||
pll_locked => open, -- (terminated)
|
||||
cdr_ref_clk => '0', -- (terminated)
|
||||
pll_locked_i => '0', -- (terminated)
|
||||
ext_pll_clk => "0000", -- (terminated)
|
||||
rx_coreclkin => '0', -- (terminated)
|
||||
reconfig_clk => '0', -- (terminated)
|
||||
reconfig_reset => '0', -- (terminated)
|
||||
reconfig_address => "000000000000", -- (terminated)
|
||||
reconfig_read => '0', -- (terminated)
|
||||
reconfig_write => '0', -- (terminated)
|
||||
reconfig_writedata => "00000000000000000000000000000000", -- (terminated)
|
||||
reconfig_readdata => open, -- (terminated)
|
||||
reconfig_waitrequest => open, -- (terminated)
|
||||
tx_bonding_clocks => "000000", -- (terminated)
|
||||
pll_powerdown_o => open, -- (terminated)
|
||||
pll_cal_busy_i => '0', -- (terminated)
|
||||
xgmii_rx_inclk => '0' -- (terminated)
|
||||
);
|
||||
|
||||
end architecture rtl; -- of xaui_phy_itf
|
||||
-- Retrieval info: <?xml version="1.0"?>
|
||||
--<!--
|
||||
-- Generated by Altera MegaWizard Launcher Utility version 1.0
|
||||
-- ************************************************************
|
||||
-- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
-- ************************************************************
|
||||
-- Copyright (C) 1991-2020 Altera Corporation
|
||||
-- Any megafunction design, and related net list (encrypted or decrypted),
|
||||
-- support information, device programming or simulation file, and any other
|
||||
-- associated documentation or information provided by Altera or a partner
|
||||
-- under Altera's Megafunction Partnership Program may be used only to
|
||||
-- program PLD devices (but not masked PLD devices) from Altera. Any other
|
||||
-- use of such megafunction design, net list, support information, device
|
||||
-- programming or simulation file, or any other related documentation or
|
||||
-- information is prohibited for any other purpose, including, but not
|
||||
-- limited to modification, reverse engineering, de-compiling, or use with
|
||||
-- any other silicon devices, unless such use is explicitly licensed under
|
||||
-- a separate agreement with Altera or a megafunction partner. Title to
|
||||
-- the intellectual property, including patents, copyrights, trademarks,
|
||||
-- trade secrets, or maskworks, embodied in any such megafunction design,
|
||||
-- net list, support information, device programming or simulation file, or
|
||||
-- any other related documentation or information provided by Altera or a
|
||||
-- megafunction partner, remains with Altera, the megafunction partner, or
|
||||
-- their respective licensors. No other licenses, including any licenses
|
||||
-- needed under any third party's intellectual property, are provided herein.
|
||||
---->
|
||||
-- Retrieval info: <instance entity-name="altera_xcvr_xaui" version="18.1" >
|
||||
-- Retrieval info: <generic name="device_family" value="Cyclone V" />
|
||||
-- Retrieval info: <generic name="starting_channel_number" value="0" />
|
||||
-- Retrieval info: <generic name="interface_type" value="Soft XAUI" />
|
||||
-- Retrieval info: <generic name="soft_xaui_cfg" value="Only Soft XAUI is supported for this device." />
|
||||
-- Retrieval info: <generic name="hard_xaui_cfg" value="Only Hard XAUI is supported for this device." />
|
||||
-- Retrieval info: <generic name="gui_pll_type" value="CMU" />
|
||||
-- Retrieval info: <generic name="GUI_BASE_DATA_RATE" value="" />
|
||||
-- Retrieval info: <generic name="en_synce_support" value="0" />
|
||||
-- Retrieval info: <generic name="use_control_and_status_ports" value="0" />
|
||||
-- Retrieval info: <generic name="external_pma_ctrl_reconf" value="0" />
|
||||
-- Retrieval info: <generic name="dyn_reconf" value="0" />
|
||||
-- Retrieval info: <generic name="recovered_clk_out" value="0" />
|
||||
-- Retrieval info: <generic name="number_of_interfaces" value="1" />
|
||||
-- Retrieval info: <generic name="use_rx_rate_match" value="0" />
|
||||
-- Retrieval info: <generic name="tx_termination" value="OCT_100_OHMS" />
|
||||
-- Retrieval info: <generic name="tx_vod_selection" value="4" />
|
||||
-- Retrieval info: <generic name="tx_preemp_pretap" value="0" />
|
||||
-- Retrieval info: <generic name="tx_preemp_pretap_inv" value="false" />
|
||||
-- Retrieval info: <generic name="tx_preemp_tap_1" value="0" />
|
||||
-- Retrieval info: <generic name="tx_preemp_tap_2" value="0" />
|
||||
-- Retrieval info: <generic name="tx_preemp_tap_2_inv" value="false" />
|
||||
-- Retrieval info: <generic name="rx_common_mode" value="0.82v" />
|
||||
-- Retrieval info: <generic name="rx_termination" value="OCT_100_OHMS" />
|
||||
-- Retrieval info: <generic name="rx_eq_dc_gain" value="0" />
|
||||
-- Retrieval info: <generic name="rx_eq_ctrl" value="0" />
|
||||
-- Retrieval info: <generic name="pll_external_enable" value="0" />
|
||||
-- Retrieval info: <generic name="en_dual_fifo" value="0" />
|
||||
-- Retrieval info: <generic name="enable_rx_coreclkin" value="0" />
|
||||
-- Retrieval info: <generic name="disable_embedded_sdc" value="1" />
|
||||
-- Retrieval info: <generic name="xcvr_rcfg_jtag_enable" value="0" />
|
||||
-- Retrieval info: <generic name="xcvr_set_capability_reg_enable" value="0" />
|
||||
-- Retrieval info: <generic name="xcvr_set_user_identifier" value="0" />
|
||||
-- Retrieval info: <generic name="xcvr_set_csr_soft_logic_enable" value="0" />
|
||||
-- Retrieval info: <generic name="xcvr_set_prbs_soft_logic_enable" value="0" />
|
||||
-- Retrieval info: <generic name="mgmt_clk_in_hz" value="150000000" />
|
||||
-- Retrieval info: <generic name="part_trait_bd" value="" />
|
||||
-- Retrieval info: </instance>
|
||||
-- IPFS_FILES : xaui_phy_itf.vho
|
||||
-- RELATED_FILES: xaui_phy_itf.vhd, altera_xcvr_functions.sv, alt_pma_functions.sv, altera_xcvr_xaui.sv, hxaui_csr_h.sv, hxaui_csr.sv, alt_xcvr_mgmt2dec_phyreconfig.sv, alt_xcvr_mgmt2dec_xaui.sv, alt_pma_controller_tgx.v, alt_reset_ctrl_lego.sv, alt_reset_ctrl_tgx_cdrauto.sv, alt_xcvr_resync.sv, alt_xcvr_csr_common_h.sv, alt_xcvr_csr_common.sv, alt_xcvr_csr_pcs8g_h.sv, alt_xcvr_csr_pcs8g.sv, alt_xcvr_csr_selector.sv, alt_xcvr_mgmt2dec.sv, altera_wait_generate.v, altera_xcvr_reset_control.sv, alt_xcvr_reset_counter.sv, alt_soft_xaui_pcs.v, alt_soft_xaui_reset.v, alt_soft_xaui_rx.v, alt_soft_xaui_rx_8b10b_dec.v, alt_soft_xaui_rx_channel_synch.v, alt_soft_xaui_rx_deskew.v, alt_soft_xaui_rx_deskew_channel.v, alt_soft_xaui_rx_deskew_ram.v, altera_soft_xaui_rx_deskew_ram.v, alt_soft_xaui_rx_invalid_code_det.v, alt_soft_xaui_rx_parity.v, alt_soft_xaui_rx_parity_4b.v, alt_soft_xaui_rx_parity_6b.v, alt_soft_xaui_rx_rate_match.v, alt_soft_xaui_rx_rate_match_ram.v, alt_soft_xaui_rx_rl_chk_6g.v, alt_soft_xaui_rx_sm.v, alt_soft_xaui_tx.v, alt_soft_xaui_tx_8b10b_enc.v, alt_soft_xaui_tx_idle_conv.v, l_modules.v, serdes_4_unit_lc_siv.v, serdes_4_unit_siv.v, serdes_4unit.v, altera_std_synchronizer_nocut.v, sxaui.v, cv_xcvr_xaui.sv, av_xcvr_low_latency_phy_nr.sv, sv_reconfig_bundle_to_xcvr.sv, sv_reconfig_bundle_to_ip.sv, sv_reconfig_bundle_merger.sv, av_xcvr_h.sv, av_xcvr_avmm_csr.sv, av_tx_pma_ch.sv, av_tx_pma.sv, av_rx_pma.sv, av_pma.sv, av_pcs_ch.sv, av_pcs.sv, av_xcvr_avmm.sv, av_xcvr_native.sv, av_xcvr_plls.sv, av_xcvr_data_adapter.sv, av_reconfig_bundle_to_basic.sv, av_reconfig_bundle_to_xcvr.sv, av_hssi_8g_rx_pcs_rbc.sv, av_hssi_8g_tx_pcs_rbc.sv, av_hssi_common_pcs_pma_interface_rbc.sv, av_hssi_common_pld_pcs_interface_rbc.sv, av_hssi_pipe_gen1_2_rbc.sv, av_hssi_rx_pcs_pma_interface_rbc.sv, av_hssi_rx_pld_pcs_interface_rbc.sv, av_hssi_tx_pcs_pma_interface_rbc.sv, av_hssi_tx_pld_pcs_interface_rbc.sv, av_xcvr_custom_native.sv, alt_xcvr_arbiter.sv, alt_xcvr_m2s.sv
|
||||
|
|
@ -0,0 +1,198 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
`timescale 1ns/10ps
|
||||
module alt_pma_controller_tgx #(
|
||||
parameter number_of_plls = 1,// One controller only control the possible merged pll. If more pll is needed, user can use multiplier controller for none share plls.
|
||||
parameter tx_pll_reset_hold_time = 0,// ignored - now calculated according to system clock
|
||||
parameter sync_depth = 2,
|
||||
parameter sys_clk_in_mhz = 50 // needed for 1us and 4us delay timers
|
||||
)
|
||||
(
|
||||
input rst, // controller logic reset
|
||||
output tx_pll_ready,
|
||||
|
||||
// user data (avalon-MM formatted)
|
||||
input wire clk,
|
||||
input wire [1:0] pma_mgmt_address,
|
||||
input wire pma_mgmt_read,
|
||||
output reg [31:0] pma_mgmt_readdata,
|
||||
input wire pma_mgmt_write,
|
||||
input wire [31:0] pma_mgmt_writedata,
|
||||
output wire pma_mgmt_waitrequest,
|
||||
|
||||
// user data (avalon-clock formatted)
|
||||
input wire cal_blk_clk,
|
||||
|
||||
// user data: pll control (avalon-ST formatted)
|
||||
output wire cal_blk_pdn,//sync with cal_blk_clk
|
||||
output wire gx_pdn,//sync with clk
|
||||
output wire [number_of_plls-1:0] pll_pdn, //sync with clk
|
||||
input wire [number_of_plls-1:0] pll_locked //
|
||||
);
|
||||
|
||||
localparam clk_in_mhz =
|
||||
`ifdef QUARTUS__SIMGEN
|
||||
2; // simulation-only value
|
||||
`elsif ALTERA_RESERVED_QIS
|
||||
sys_clk_in_mhz; // use real counter lengths for normal Quartus synthesis
|
||||
`else
|
||||
2; // simulation-only value
|
||||
`endif
|
||||
localparam t_pll_powerdown = clk_in_mhz; // 1 us minimum
|
||||
localparam t_ltd_auto = clk_in_mhz*4; // 4 us minimum
|
||||
|
||||
wire [number_of_plls-1:0] pll_locked_sync;
|
||||
reg cal_blk_pdn_reg;
|
||||
reg read_delay;
|
||||
reg gx_pdn_reg;
|
||||
reg pll_pdn_resetall_avmm;
|
||||
wire pll_pdn_int;
|
||||
reg pll_pdn_reg;
|
||||
|
||||
wire gx_pdn_int;
|
||||
wire gx_pdn_done;
|
||||
|
||||
altera_wait_generate wait_gen(
|
||||
.rst(rst),
|
||||
.clk(clk),
|
||||
.launch_signal(pma_mgmt_read),
|
||||
.wait_req(pma_mgmt_waitrequest)
|
||||
);
|
||||
|
||||
alt_reset_ctrl_lego
|
||||
#(
|
||||
.reset_hold_cycles (t_pll_powerdown) // reset pulse length in clock cycles
|
||||
) pll_pdn_rst
|
||||
(
|
||||
.clock(clk),
|
||||
.start(1'b1 ),
|
||||
.reset(pll_pdn_int),
|
||||
.rdone(pll_locked), // reset done signal
|
||||
.aclr(rst),
|
||||
.sdone(tx_pll_ready) // sequence done for this lego
|
||||
);
|
||||
|
||||
alt_reset_ctrl_lego
|
||||
#(
|
||||
.reset_hold_cycles (2) // reset pulse length in clock cycles
|
||||
) gx_pdn_rst
|
||||
(
|
||||
.clock(clk),
|
||||
.start(1'b1 ),
|
||||
.reset(gx_pdn_int),
|
||||
.rdone(1'b1), // reset done signal
|
||||
.aclr(rst),
|
||||
.sdone(gx_pdn_done) // sequence done for this lego
|
||||
);
|
||||
|
||||
assign pll_pdn= pll_pdn_reg | {number_of_plls{pll_pdn_int}} ;
|
||||
|
||||
initial
|
||||
begin
|
||||
pll_pdn_reg <= 0;
|
||||
end
|
||||
always @ (posedge clk, posedge rst)
|
||||
begin
|
||||
if(rst) begin
|
||||
pll_pdn_reg <= 1'b0;
|
||||
end
|
||||
else if (pma_mgmt_write==1'b1 & pma_mgmt_address==2'b00) begin
|
||||
pll_pdn_reg <= pma_mgmt_writedata[number_of_plls -1 :0];
|
||||
end
|
||||
end
|
||||
|
||||
initial
|
||||
begin
|
||||
pma_mgmt_readdata <= 0;
|
||||
end
|
||||
always @ (posedge clk, posedge rst)
|
||||
begin
|
||||
if(rst) begin
|
||||
pma_mgmt_readdata <= 0;
|
||||
end
|
||||
else if (pma_mgmt_read==1'b1 & pma_mgmt_address==2'b00) begin
|
||||
pma_mgmt_readdata[number_of_plls -1 :0] <= pll_pdn;
|
||||
end
|
||||
else if (pma_mgmt_read==1'b1 & pma_mgmt_address==2'b01) begin
|
||||
pma_mgmt_readdata[0] <= cal_blk_pdn_reg;
|
||||
pma_mgmt_readdata[1] <= gx_pdn;
|
||||
end
|
||||
else if (pma_mgmt_read==1'b1 & pma_mgmt_address==2'b10) begin
|
||||
pma_mgmt_readdata[number_of_plls -1 :0] <= pll_locked_sync;
|
||||
end
|
||||
else
|
||||
pma_mgmt_readdata <= 0;
|
||||
end
|
||||
|
||||
generate
|
||||
genvar i;
|
||||
for (i=0; i<number_of_plls; i=i+1)
|
||||
begin: lock_sync
|
||||
altera_std_synchronizer
|
||||
#(
|
||||
.depth (sync_depth) // reset pulse length in clock cycles
|
||||
)stdsync
|
||||
(
|
||||
.clk(clk),
|
||||
.din(pll_locked[i]),
|
||||
.dout(pll_locked_sync[i]),
|
||||
.reset_n((~ rst))
|
||||
);
|
||||
end
|
||||
endgenerate
|
||||
|
||||
initial
|
||||
begin
|
||||
cal_blk_pdn_reg <= 0;
|
||||
end
|
||||
always @ (posedge clk, posedge rst)
|
||||
begin
|
||||
if(rst) begin
|
||||
cal_blk_pdn_reg <= 0;
|
||||
end
|
||||
else if (pma_mgmt_write==1'b1 & pma_mgmt_address==2'b01) begin
|
||||
cal_blk_pdn_reg <= pma_mgmt_writedata[0];
|
||||
end
|
||||
end
|
||||
altera_std_synchronizer
|
||||
#(
|
||||
.depth (sync_depth) // reset pulse length in clock cycles
|
||||
)stdsync
|
||||
(
|
||||
.clk(cal_blk_clk),
|
||||
.din(cal_blk_pdn_reg),
|
||||
.dout(cal_blk_pdn),
|
||||
.reset_n((~ rst))
|
||||
);
|
||||
|
||||
assign gx_pdn = gx_pdn_reg | gx_pdn_int;
|
||||
initial
|
||||
begin
|
||||
gx_pdn_reg <= 0;
|
||||
end
|
||||
always @ (posedge clk, posedge rst)
|
||||
begin
|
||||
if(rst) begin
|
||||
gx_pdn_reg <= 0;
|
||||
end
|
||||
else if (pma_mgmt_write==1'b1 & pma_mgmt_address==2'b01) begin
|
||||
gx_pdn_reg <= pma_mgmt_writedata[1];
|
||||
end
|
||||
else begin
|
||||
gx_pdn_reg <= gx_pdn_reg;
|
||||
end
|
||||
|
||||
end
|
||||
endmodule
|
||||
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
//
|
||||
// Common functions for PMA serdes
|
||||
//
|
||||
// $Header$
|
||||
//
|
||||
// PACKAGE DECLARATION
|
||||
package alt_pma_functions;
|
||||
|
||||
// convert "xx.xxx MHz" to ps
|
||||
function integer freq2ps;
|
||||
input [8*16:1] s;
|
||||
|
||||
integer in_freq_khz;
|
||||
integer period_ps;
|
||||
|
||||
in_freq_khz = mega2k(s);
|
||||
freq2ps = 1000000000/(in_freq_khz);
|
||||
endfunction
|
||||
|
||||
|
||||
// convert "xx.xxx MHz" string to integer with hz as unit
|
||||
function integer mega2k;
|
||||
input [8*16:1] s;
|
||||
|
||||
reg [8*16:1] reg_s;
|
||||
reg [8:1] digit;
|
||||
reg [8:1] tmp;
|
||||
integer m, magnitude;
|
||||
integer final_mag;
|
||||
integer unit_mag;
|
||||
integer point_pos;
|
||||
|
||||
begin
|
||||
magnitude = 0;
|
||||
reg_s = s;
|
||||
unit_mag = 1000000;
|
||||
point_pos = 0;
|
||||
for (m=1; m<=16; m=m+1)
|
||||
begin
|
||||
tmp = reg_s[128:121];
|
||||
digit = tmp & 8'b00001111;
|
||||
reg_s = reg_s << 8;
|
||||
// Accumulate ascii digits 0-9 only.
|
||||
if (tmp == 77)
|
||||
unit_mag = 1000; // Found a 'M' character, Mhz
|
||||
if (tmp == 46)
|
||||
point_pos = 1; // Found a '.' character, point
|
||||
if ((tmp>=48) && (tmp<=57)) begin
|
||||
magnitude = (magnitude * 10) + digit;
|
||||
point_pos = point_pos *10;
|
||||
end
|
||||
end
|
||||
if(point_pos > 0)
|
||||
mega2k = magnitude*unit_mag/point_pos;
|
||||
else
|
||||
mega2k = magnitude*unit_mag;
|
||||
end
|
||||
endfunction
|
||||
|
||||
endpackage
|
||||
|
|
@ -0,0 +1,265 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
//
|
||||
// Reset controller building block.
|
||||
//
|
||||
// Handles a single reset stage. Can be daisy-chained with other blocks for purely sequential resets.
|
||||
// Options include reset pulse length in clock cycles, and a counter for sdone stability checking.
|
||||
//
|
||||
// $Header$
|
||||
//
|
||||
|
||||
`timescale 1 ns / 1 ns
|
||||
|
||||
module alt_reset_ctrl_lego
|
||||
#(
|
||||
parameter reset_hold_til_rdone = 0, // 1 means reset stays high until rdone arrives
|
||||
// 0 means fixed pulse length, defined by reset_hold_cycles
|
||||
parameter reset_hold_cycles = 1, // reset pulse length in clock cycles
|
||||
parameter sdone_delay_cycles = 0, // optional delay from rdone received til sdone sent to next block
|
||||
parameter rdone_is_edge_sensitive = 0 // default is level sensitive rdone
|
||||
)
|
||||
(
|
||||
// clocks and PLLs
|
||||
input wire clock,
|
||||
input wire start,
|
||||
input tri0 aclr, // active-high asynchronous reset
|
||||
output wire reset,
|
||||
input tri0 rdone, // reset done signal
|
||||
output reg sdone // sequence done for this lego
|
||||
);
|
||||
localparam max_precision = 32; // VCS requires this declaration outside the function
|
||||
function integer ceil_log2;
|
||||
input [max_precision-1:0] input_num;
|
||||
integer i;
|
||||
reg [max_precision-1:0] try_result;
|
||||
begin
|
||||
i = 0;
|
||||
try_result = 1;
|
||||
while ((try_result << i) < input_num && i < max_precision)
|
||||
i = i + 1;
|
||||
ceil_log2 = i;
|
||||
end
|
||||
endfunction
|
||||
|
||||
// How many bits are needed for 'reset_hold_cycles' counter?
|
||||
localparam rhc_bits = ceil_log2(reset_hold_cycles);
|
||||
localparam rhc_load_constant = (1 << rhc_bits) | (reset_hold_cycles-1);
|
||||
// How many bits are needed for 'sdone_delay_cycles' counter?
|
||||
localparam sdc_bits = ceil_log2(sdone_delay_cycles);
|
||||
localparam sdc_load_constant = (1 << sdc_bits)
|
||||
| ((rdone_is_edge_sensitive == 1 && sdone_delay_cycles > 1) ? sdone_delay_cycles-2 : sdone_delay_cycles-1);
|
||||
localparam sdone_stable_cycles = (sdone_delay_cycles > 1 ? sdone_delay_cycles+1 : 0);
|
||||
|
||||
wire spulse; // synchronous detection of 'start' 0-to-1 transition
|
||||
wire rhold;
|
||||
wire timed_reset_in_progress;
|
||||
wire rinit_next; // combinatorial input to rinit DFF
|
||||
wire rdonei; // internal selector between rdone and rdsave (rdone_is_edge_sensitive==1)
|
||||
wire rdpulse; // synchronous detection of 'rdone' 0-to-1 transition, when rdone_is_edge_sensitive==1
|
||||
|
||||
reg zstart = 0; // delayed value of 'start' input, used for detection of 0-to-1 transition
|
||||
reg rinit = 0; // state bit that indicates sequence is in progress
|
||||
|
||||
initial begin
|
||||
sdone = 0; // 1 indicates sequence is done
|
||||
end
|
||||
|
||||
|
||||
// 'start' input, detect 0-to-1 transition that triggers sequence
|
||||
assign spulse = start & ~zstart;
|
||||
always @(posedge clock or posedge aclr)
|
||||
if (aclr == 1'b1)
|
||||
zstart <= 0;
|
||||
else
|
||||
zstart <= start;
|
||||
|
||||
// rinit state bit, triggered by spulse, waits while rhold = 1
|
||||
assign rinit_next = spulse | (rinit & (rhold | ~rdonei | rdpulse)) | timed_reset_in_progress;
|
||||
always @(posedge clock or posedge aclr)
|
||||
if (aclr == 1'b1)
|
||||
rinit <= 0;
|
||||
else
|
||||
rinit <= rinit_next;
|
||||
|
||||
// optional internal 'rdone' generation logic, if rdone_is_edge_sensitive==1
|
||||
generate
|
||||
if (rdone_is_edge_sensitive == 0) begin
|
||||
assign rdpulse = 0;
|
||||
assign rdonei = rdone;
|
||||
end
|
||||
else begin
|
||||
// instantiate synchronous edge-detection logic for rdone
|
||||
reg zrdone = 0; // for edge-sensitive rdone, detect 0-to-1 transition synchronously
|
||||
reg rdsave = 0; // for edge-sensitive rdone, use this as internal rdone
|
||||
always @(posedge clock or posedge aclr) begin
|
||||
if (aclr == 1'b1) begin
|
||||
zrdone <= 0;
|
||||
rdsave <= 0;
|
||||
end
|
||||
else begin
|
||||
zrdone <= rdone; // previous value of rdone for synchronous edge detection
|
||||
rdsave <= ~spulse & (rdpulse | rdsave);
|
||||
end
|
||||
end
|
||||
assign rdpulse = rdone & ~zrdone;
|
||||
assign rdonei = rdsave;
|
||||
end
|
||||
endgenerate
|
||||
|
||||
// rhold depends on sdone_delay_cycles and rdone_is_edge_sensitive
|
||||
generate
|
||||
if (sdone_delay_cycles == 0 || (sdone_delay_cycles == 1 && rdone_is_edge_sensitive == 1))
|
||||
assign rhold = ~rdonei; // sdone_delay_cycles=0
|
||||
else begin
|
||||
// declare only when needed to avoid Quartus synthesis warnings
|
||||
reg [sdc_bits:0] rhold_reg = 0; // for sdone_delay_cycles > 0
|
||||
if (sdone_delay_cycles == 1) begin
|
||||
always @(posedge clock or posedge aclr) begin
|
||||
if (aclr == 1'b1)
|
||||
rhold_reg <= 0;
|
||||
else
|
||||
rhold_reg <= ~(rinit & rdonei);
|
||||
end
|
||||
assign rhold = rhold_reg[0]; // sdone_delay_cycles=1
|
||||
end
|
||||
else begin
|
||||
// need to count cycles to make sure rdone is stable
|
||||
always @(posedge clock or posedge aclr)
|
||||
begin
|
||||
if (aclr == 1'b1)
|
||||
rhold_reg <= 0;
|
||||
else if ((rinit & rdonei & ~rdpulse) == 0)
|
||||
// keep load value until rinit & rdone both high, and no new rdone pulses
|
||||
rhold_reg <= sdc_load_constant[sdc_bits:0];
|
||||
else
|
||||
rhold_reg <= rhold_reg - 1'b1;
|
||||
end
|
||||
assign rhold = rhold_reg[sdc_bits]; // sdone_delay_cycles > 1
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
|
||||
// sdone state bit indicates that reset sequence completed. Clear again on 'start'
|
||||
always @(posedge clock or posedge aclr)
|
||||
if (aclr == 1'b1)
|
||||
sdone <= 0;
|
||||
else
|
||||
sdone <= ~spulse & (sdone | (rinit & ~rinit_next));
|
||||
|
||||
// reset pulse generation logic depends on 2 parameters
|
||||
generate
|
||||
if (reset_hold_til_rdone == 1) begin
|
||||
assign reset = rinit;
|
||||
assign timed_reset_in_progress = 0;
|
||||
end
|
||||
else if (reset_hold_cycles < 1) begin // 0 is legal, but catch negative (illegal) values too
|
||||
assign reset = spulse;
|
||||
assign timed_reset_in_progress = 0;
|
||||
end
|
||||
else begin
|
||||
// declare only when needed to avoid Quartus synthesis warnings
|
||||
reg [rhc_bits:0] zspulse = 0; // bits for reset pulse if fixed length
|
||||
assign timed_reset_in_progress = zspulse[rhc_bits];
|
||||
assign reset = zspulse[rhc_bits];
|
||||
|
||||
if (reset_hold_cycles == 1)
|
||||
// a single-cycle reset pulse needs 1 register
|
||||
always @(posedge clock or posedge aclr)
|
||||
if (aclr == 1'b1)
|
||||
zspulse <= 0;
|
||||
else
|
||||
zspulse <= spulse;
|
||||
else begin
|
||||
// multi-cycle reset pulse needs a counter
|
||||
always @(posedge clock or posedge aclr)
|
||||
begin
|
||||
if (aclr == 1'b1)
|
||||
zspulse <= 0;
|
||||
else if (spulse == 1)
|
||||
zspulse <= rhc_load_constant[rhc_bits:0];
|
||||
else if (zspulse[rhc_bits] == 1)
|
||||
zspulse <= zspulse - 1'b1;
|
||||
end
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
|
||||
// generate
|
||||
// case (reset_hold_til_rdone)
|
||||
// 0 : m1 U1 (a, b, c);
|
||||
// 2 : m2 U1 (a, b, c);
|
||||
// default : m3 U1 (a, b, c);
|
||||
// endcase
|
||||
// endgenerate
|
||||
|
||||
// general assertions
|
||||
//synopsys translate_off
|
||||
// vlog/vcs/ncverilog: +define+ALTERA_XCVR_ASSERTIONS
|
||||
`ifdef ALTERA_XCVR_ASSERTIONS
|
||||
// when rdone is edge sensitive, last rdone +ve edge triggers sdone +ve edge,
|
||||
// 'sdone_delay_cycles' later. "##1 1" is an always-true cycle to match $rise(sdone)
|
||||
sequence rdone_last_edge;
|
||||
@(posedge clock) $rose(rdone) ##1 !$rose(rdone) [*sdone_delay_cycles] ##1 1;
|
||||
endsequence
|
||||
|
||||
// when rdone is level sensitive, stable rdone for 'sdone_delay_cycles' consecutive cycles
|
||||
// triggers sdone +ve edge. "##1 1" is an always-true cycle to match $rise(sdone)
|
||||
sequence rdone_stable_level;
|
||||
@(posedge clock) rdone [*(sdone_delay_cycles+1)] ##1 1;
|
||||
endsequence
|
||||
|
||||
// Most assertions aren't valid when 'aclr' is active
|
||||
//`define assert_awake(arg) assert property (disable iff (aclr) arg )
|
||||
always @(aclr)
|
||||
if (aclr) $assertkill;
|
||||
else $asserton;
|
||||
|
||||
generate
|
||||
always @(posedge clock) begin
|
||||
// A rising edge on start will result in reset high within 1 clock cycle
|
||||
assert property ($rose(start & ~aclr) |-> ##[0:1] reset);
|
||||
// A rising edge on reset will result in sdone low within 1 clock cycle
|
||||
assert property ($rose(reset) |-> ##[0:1] !sdone);
|
||||
|
||||
// assertions for optional behavior: reset pulse length options
|
||||
if (reset_hold_til_rdone == 0 && reset_hold_cycles > 1)
|
||||
// Verify fixed-length reset pulse option
|
||||
assert property ($rose(reset) |-> reset [*reset_hold_cycles] ##1 !reset)
|
||||
else $error("Reset pulse length should be %d", reset_hold_cycles);
|
||||
if (reset_hold_til_rdone == 0 && reset_hold_cycles == 1)
|
||||
// Verify fixed 1-length reset pulse option
|
||||
assert property ($rose(reset) |=> !reset);
|
||||
if (reset_hold_til_rdone == 0 && reset_hold_cycles == 0)
|
||||
// Verify minimal-length reset pulse option, which mirrors 'start' edge detection
|
||||
assert property ($rose(start & ~aclr) |-> reset ##1 !reset);
|
||||
if (reset_hold_til_rdone == 1) begin
|
||||
// with hold-til-rdone, reset should not deassert until after rdone asserts, then deassert immediately
|
||||
assert property ($rose(reset) && !rdone |=> $stable(reset) [*0:$] ##1 (reset && rdone) ##1 !reset);
|
||||
assert property ($rose(reset) && rdone ##1 rdone [*sdone_delay_cycles] |=> !reset); // rdone was already high
|
||||
//assert property ($rose(reset) && !rdone |-> ##[0:$] rdone ##1 !reset);
|
||||
end
|
||||
|
||||
// assertions for optional behavior: sdone delay options and rdone edge sensitive option
|
||||
if (rdone_is_edge_sensitive == 1)
|
||||
// rdone edge-sensitive option only has an effect when sdone_delay_cycles > 0
|
||||
assert property ($rose(sdone) |-> rdone_last_edge.ended);
|
||||
if (rdone_is_edge_sensitive == 0)
|
||||
// rdone defaults to level-sensitive
|
||||
assert property ($rose(sdone) |-> (rdone_stable_level.ended or $past($fell(reset),1)));
|
||||
end
|
||||
endgenerate
|
||||
`endif // ALTERA_XCVR_ASSERTIONS
|
||||
//synopsys translate_on
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,201 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
//
|
||||
// Reset controller for Stratix IV transceivers with RX CDR in auto-lock mode.
|
||||
//
|
||||
// Uses alt_reset_ctrl_lego to handle each reset stage, with 3 required for the overall sequence.
|
||||
// Parameter defaults for pll-powerdown and lock-to-data-auto timers assume 50 MHz system clock
|
||||
//
|
||||
// $Header$
|
||||
//
|
||||
|
||||
`timescale 1 ns / 1 ns
|
||||
|
||||
(* altera_attribute = "-name MERGE_TX_PLL_DRIVEN_BY_REGISTERS_WITH_SAME_CLEAR ON -to \"alt_reset_ctrl_lego:lego_pll_powerdown|zspulse\" " *)
|
||||
module alt_reset_ctrl_tgx_cdrauto
|
||||
#(
|
||||
parameter sys_clk_in_mhz = 50 // needed for 1us and 4us delay timers
|
||||
)
|
||||
(
|
||||
// User inputs and outputs
|
||||
input wire clock,
|
||||
input wire reset_all,
|
||||
input tri0 reset_tx_digital,
|
||||
input tri0 reset_rx_digital,
|
||||
input wire powerdown_all,
|
||||
output wire tx_ready,
|
||||
output wire rx_ready,
|
||||
|
||||
// I/O to Stratix IV transceiver control & status
|
||||
output wire pll_powerdown, // reset TX PLL
|
||||
output wire tx_digitalreset, // reset TX PCS
|
||||
output wire rx_analogreset, // reset RX PMA
|
||||
output wire rx_digitalreset, // reset RX PCS
|
||||
output wire gxb_powerdown, // powerdown whole quad
|
||||
input wire pll_is_locked, // TX PLL is locked status
|
||||
input tri0 tx_cal_busy, // TX channel calibration status
|
||||
input tri0 rx_cal_busy, // RX channel calibration status
|
||||
input tri0 rx_is_lockedtodata, // RX CDR PLL is locked to data status
|
||||
input tri0 manual_mode // 0=Automatically reset RX after loss of rx_is_lockedtodata
|
||||
);
|
||||
|
||||
localparam clk_in_mhz =
|
||||
`ifdef QUARTUS__SIMGEN
|
||||
2; // simulation-only value
|
||||
`elsif ALTERA_RESERVED_QIS
|
||||
sys_clk_in_mhz; // use real counter lengths for normal Quartus synthesis
|
||||
`else
|
||||
2; // simulation-only value
|
||||
`endif
|
||||
localparam t_pll_powerdown = clk_in_mhz; // 1 us minimum
|
||||
localparam t_ltd_auto = clk_in_mhz*4; // 4 us minimum
|
||||
|
||||
|
||||
wire pll_is_locked_r; // pll_is_locked resynchronized
|
||||
wire tx_cal_busy_r; // tx_cal_busy resynchronized
|
||||
wire rx_cal_busy_r; // rx_cal_busy resynchronized
|
||||
wire rx_is_lockedtodata_r; // rx_is_lockedtodata resynchronized
|
||||
|
||||
wire sdone_lego_pll_powerdown; // 'sequence done' output of pll_powerdown lego
|
||||
wire sdone_lego_tx_digitalreset;// 'sequence done' output of tx_digitalreset lego
|
||||
wire sdone_lego_rx_digitalreset;// 'sequence done' output of rx_digitalreset lego
|
||||
wire sdone_lego_rx_analogreset; // 'sequence done' output of rx_analogreset lego
|
||||
wire wire_tx_digital_only_reset;// reset output for TX digital-only
|
||||
wire wire_rx_digital_only_reset;// reset output for RX digital-only
|
||||
wire wire_tx_digitalreset; // TX digital full-reset source
|
||||
wire wire_rx_digitalreset; // RX digital full-reset source
|
||||
wire wire_rx_digital_retrigger; // Trigger new RX digital sequence after main sequence completes, and lose lock-to-data
|
||||
|
||||
// Resynchronize input signals
|
||||
alt_xcvr_resync #(
|
||||
.WIDTH(2)
|
||||
) alt_xcvr_resync_inst_0 (
|
||||
.clk (clock),
|
||||
.reset (1'b0),
|
||||
.d ({pll_is_locked ,rx_is_lockedtodata }),
|
||||
.q ({pll_is_locked_r,rx_is_lockedtodata_r})
|
||||
);
|
||||
|
||||
alt_xcvr_resync #(
|
||||
.WIDTH(2),
|
||||
.INIT_VALUE(1)
|
||||
) alt_xcvr_resync_inst_1 (
|
||||
.clk (clock),
|
||||
.reset (1'b0),
|
||||
.d ({rx_cal_busy,tx_cal_busy}),
|
||||
.q ({rx_cal_busy_r,tx_cal_busy_r})
|
||||
);
|
||||
|
||||
// First reset ctrl sequencer lego is for pll_powerdown generation
|
||||
alt_reset_ctrl_lego #(
|
||||
.reset_hold_cycles(t_pll_powerdown) // hold pll_powerdown for 1us
|
||||
) lego_pll_powerdown ( .clock(clock),
|
||||
.start(reset_all), // Do not use resynched version of reset_all here
|
||||
.aclr(powerdown_all),
|
||||
.reset(pll_powerdown),
|
||||
.rdone(pll_is_locked_r),
|
||||
.sdone(sdone_lego_pll_powerdown));
|
||||
|
||||
// next reset ctrl sequencer lego is for tx_digitalreset generation
|
||||
alt_reset_ctrl_lego #(
|
||||
.reset_hold_til_rdone(1) // hold until rdone arrives for this test case
|
||||
) lego_tx_digitalreset ( .clock(clock),
|
||||
.start(reset_all),
|
||||
.aclr(powerdown_all),
|
||||
.reset(wire_tx_digitalreset),
|
||||
.rdone(sdone_lego_pll_powerdown & ~tx_cal_busy_r),
|
||||
.sdone(sdone_lego_tx_digitalreset));
|
||||
|
||||
// next reset ctrl sequencer lego is for rx_analogreset generation
|
||||
alt_reset_ctrl_lego #(
|
||||
.reset_hold_til_rdone(1), // hold until rdone arrives for this test case
|
||||
.sdone_delay_cycles(2) // hold rx_analogreset 2 parallel_clock cycles after offset cancellation done
|
||||
) lego_rx_analogreset ( .clock(clock),
|
||||
.start(reset_all),
|
||||
.aclr(powerdown_all),
|
||||
.reset(rx_analogreset),
|
||||
.rdone(sdone_lego_tx_digitalreset & ~rx_cal_busy_r),
|
||||
.sdone(sdone_lego_rx_analogreset));
|
||||
|
||||
// last reset ctrl sequencer lego is for rx_digitalreset generation
|
||||
alt_reset_ctrl_lego #(
|
||||
.reset_hold_til_rdone(1), // hold until rdone arrives for this test case
|
||||
.sdone_delay_cycles(t_ltd_auto) // hold rx_digitalreset for 4us
|
||||
) lego_rx_digitalreset ( .clock(clock),
|
||||
.start(~manual_mode & reset_all | wire_rx_digital_retrigger),
|
||||
.aclr(powerdown_all),
|
||||
.reset(wire_rx_digitalreset),
|
||||
.rdone(sdone_lego_rx_analogreset & rx_is_lockedtodata_r),
|
||||
.sdone(sdone_lego_rx_digitalreset));
|
||||
|
||||
//////////// digital-only reset ////////////
|
||||
// separate reset ctrl sequencer lego for digital-only reset generation
|
||||
alt_reset_ctrl_lego #(
|
||||
.reset_hold_cycles(3) // hold 2 parallel clock cycles (assumes sysclk slower or same freq as parallel clock)
|
||||
) lego_tx_digitalonly ( .clock(clock),
|
||||
.start(reset_tx_digital | reset_all),
|
||||
.aclr(powerdown_all),
|
||||
.reset(wire_tx_digital_only_reset),
|
||||
.rdone(sdone_lego_tx_digitalreset),
|
||||
.sdone(tx_ready)); // TX status indicator for user
|
||||
|
||||
alt_reset_ctrl_lego #(
|
||||
.reset_hold_cycles(3) // hold 2 parallel clock cycles (assumes sysclk slower or same freq as parallel clock)
|
||||
) lego_rx_digitalonly ( .clock(clock),
|
||||
.start(reset_rx_digital | (reset_all & ~manual_mode) | wire_rx_digital_retrigger),
|
||||
.aclr(powerdown_all),
|
||||
.reset(wire_rx_digital_only_reset),
|
||||
.rdone(sdone_lego_rx_digitalreset),
|
||||
.sdone(rx_ready)); // RX status indicator for user
|
||||
|
||||
// digital resets have 2 possible sources: full-reset or digital-only
|
||||
assign tx_digitalreset = wire_tx_digitalreset | wire_tx_digital_only_reset;
|
||||
assign rx_digitalreset = wire_rx_digitalreset | wire_rx_digital_only_reset;
|
||||
|
||||
// re-trigger RX digital sequence when main sequence is complete (indicated by sdone_lego_rx_digitalreset)
|
||||
// not manual mode, and lose lock-to-data
|
||||
assign wire_rx_digital_retrigger = ~manual_mode & sdone_lego_rx_digitalreset & ~rx_is_lockedtodata_r;
|
||||
|
||||
// Quad power-down
|
||||
assign gxb_powerdown = powerdown_all;
|
||||
|
||||
|
||||
////////////////////////
|
||||
// general assertions
|
||||
//synopsys translate_off
|
||||
// vlog/vcs/ncverilog: +define+ALTERA_XCVR_ASSERTIONS
|
||||
`ifdef ALTERA_XCVR_ASSERTIONS
|
||||
always @(posedge clock) begin
|
||||
// reset_all starts by triggering CMU PLL powerdown
|
||||
assert property ($rose(reset_all) |=> $rose(pll_powerdown));
|
||||
// While CMU PLL powerdown is asserted, all other resets must be asserted
|
||||
assert property (pll_powerdown |-> (tx_digitalreset & rx_analogreset & rx_digitalreset));
|
||||
// While rx_analogreset is asserted, rx_digitalreset must be asserted
|
||||
assert property (rx_analogreset |-> rx_digitalreset);
|
||||
// When pll_is_locked is asserted, tx_digitalreset must be deasserted
|
||||
assert property ($rose(pll_is_locked_r) |-> ##[0:2] !tx_digitalreset);
|
||||
// During a reset, rx_digitalreset should remain high for t_ltd_auto after rx_is_lockedtodata rising edge
|
||||
assert property ($rose(rx_is_lockedtodata_r) & ~manual_mode|-> rx_digitalreset [*(t_ltd_auto+1)] ##1 !rx_digitalreset);
|
||||
assert property ($rose(rx_is_lockedtodata_r) & manual_mode|->!rx_digitalreset);
|
||||
// reset_tx_digital results in only a brief pulse on tx_digitalreset
|
||||
assert property ($rose(reset_tx_digital) |=> tx_digitalreset [*3] );
|
||||
assert property ($rose(reset_tx_digital) & tx_ready |=> tx_digitalreset [*3] ##1 ~tx_digitalreset ##1 $rose(tx_ready) );
|
||||
// reset_rx_digital results in only a brief pulse on rx_digitalreset
|
||||
assert property ($rose(reset_rx_digital) |=> rx_digitalreset [*3] );
|
||||
assert property ($rose(reset_rx_digital) & rx_ready |=> rx_digitalreset [*3] ##1 ~rx_digitalreset ##1 $rose(rx_ready) );
|
||||
end
|
||||
`endif
|
||||
//synopsys translate_on
|
||||
|
||||
endmodule
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,98 @@
|
|||
# (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
# Your use of Intel Corporation's design tools, logic functions and other
|
||||
# software and tools, and its AMPP partner logic functions, and any output
|
||||
# files from any of the foregoing (including device programming or simulation
|
||||
# files), and any associated documentation or information are expressly subject
|
||||
# to the terms and conditions of the Intel Program License Subscription
|
||||
# Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
# license agreement, including, without limitation, that your use is for the
|
||||
# sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
# Intel or its authorized distributors. Please refer to the applicable
|
||||
# agreement for further details.
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# Description: SDC file for alt_xaui
|
||||
#
|
||||
# Authors: bauyeung
|
||||
#
|
||||
# Copyright (c) Altera Corporation 1997 - 2010
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
#set_time_format -unit ns -decimal_places 3
|
||||
#derive_pll_clocks
|
||||
#derive_clock_uncertainty
|
||||
|
||||
#
|
||||
# input clocks
|
||||
#
|
||||
#create_clock -name {xgmii_tx_clk} \
|
||||
# -period 6.400 -waveform {0.000 3.2} \
|
||||
# [ get_ports {xgmii_tx_clk} ]
|
||||
#create_clock -name {phy_mgmt_clk} \
|
||||
# -period 20.000 -waveform {0.000 10.0} \
|
||||
# [ get_ports {phy_mgmt_clk} ]
|
||||
#create_clock -name {refclk} \
|
||||
# -period 6.400 -waveform {0.000 3.2} \
|
||||
# [ get_ports {pll_ref_clk} ]
|
||||
|
||||
|
||||
proc alt_xcvr_xaui_constraint_ptrs {from_node_list to_node_list} {
|
||||
set_net_delay -from $from_node_list -to $to_node_list -max 6ns
|
||||
set_max_delay -from $from_node_list -to $to_node_list 100
|
||||
set_min_delay -from $from_node_list -to $to_node_list -100
|
||||
}
|
||||
|
||||
set TQ2 [get_global_assignment -name TIMEQUEST2]
|
||||
|
||||
if {$TQ2=="ON"} {
|
||||
|
||||
# Cut path
|
||||
set_false_path -from [get_registers {*a10_xcvr_xaui*hxaui_csr*hxaui_csr_reset0q[1]}] -to [get_registers *sxaui_0*alt_soft_xaui_pcs*tx_reset*]
|
||||
set_false_path -from [get_registers {*a10_xcvr_xaui*hxaui_csr*hxaui_csr_reset0q[1]}] -to [get_registers *sxaui_0*alt_soft_xaui_pcs*rx_reset*]
|
||||
set_false_path -from [get_registers {*a10_xcvr_xaui*hxaui_csr*hxaui_csr_simulation_flag0q}] -to [get_registers *sxaui_0*alt_soft_xaui_pcs*pcs_reset*simulation_flag_f]
|
||||
|
||||
set_false_path -from [get_registers *alt_soft_xaui_pcs|tx_reset_n] -to [get_registers *xaui_tx|reset_tx_clk_n]
|
||||
set_false_path -from [get_registers *alt_soft_xaui_pcs|tx_reset_n] -to [get_registers *xaui_tx|reset_tx_clk_n_meta]
|
||||
|
||||
set_false_path -from [get_registers *sxaui_0*alt_soft_xaui_pcs*rx_reset_n] -to [get_registers *sxaui_0*alt_soft_xaui_pcs*xaui_rx*reset_channel_n_meta]
|
||||
set_false_path -from [get_registers *sxaui_0*alt_soft_xaui_pcs*rx_reset_n] -to [get_registers *sxaui_0*alt_soft_xaui_pcs*xaui_rx*reset_channel_n]
|
||||
set_false_path -from [get_registers *sxaui_0*alt_soft_xaui_pcs*rx_reset_n] -to [get_registers *sxaui_0*alt_soft_xaui_pcs*xaui_rx*reset_sysclk_n_meta]
|
||||
set_false_path -from [get_registers *sxaui_0*alt_soft_xaui_pcs*rx_reset_n] -to [get_registers *sxaui_0*alt_soft_xaui_pcs*xaui_rx*reset_sysclk_n]
|
||||
|
||||
|
||||
# Check for instances
|
||||
set from_path pcs_rate_match
|
||||
set from_reg flag_rd
|
||||
set inst [get_registers -nowarn *$from_path*$from_reg]
|
||||
|
||||
set inst_list [query_collection -list -all $inst]
|
||||
foreach each_inst $inst_list {
|
||||
# Get the path to instance
|
||||
regexp "(.*${from_path}.*|)(${from_reg})" $each_inst reg_path inst_path reg_name
|
||||
|
||||
# Set delay
|
||||
alt_xcvr_xaui_constraint_ptrs [get_registers "${inst_path}*flag_rd"] [get_registers "${inst_path}*sync_flag_rd_wr*din_s1"]
|
||||
alt_xcvr_xaui_constraint_ptrs [get_registers "${inst_path}*flag_wr"] [get_registers "${inst_path}*sync_flag_wr_rd*din_s1"]
|
||||
|
||||
alt_xcvr_xaui_constraint_ptrs [get_registers "${inst_path}*wr_ptr_latched_del[*]"] [get_registers "${inst_path}*wr_ptr_rd[*]"]
|
||||
alt_xcvr_xaui_constraint_ptrs [get_registers "${inst_path}*rd_ptr_latched_del[*]"] [get_registers "${inst_path}*rd_ptr_wr[*]"]
|
||||
|
||||
# Set skew
|
||||
set_max_skew -from [get_registers "${inst_path}flag_rd ${inst_path}rd_ptr_latched_del[*]"] -to [get_registers "${inst_path}*sync_flag_rd_wr*din_s1 ${inst_path}rd_ptr_wr[*]"] 6.4ns
|
||||
set_max_skew -from [get_registers "${inst_path}flag_wr ${inst_path}wr_ptr_latched_del[*]"] -to [get_registers "${inst_path}*sync_flag_wr_rd*din_s1 ${inst_path}wr_ptr_rd[*]"] 6.4ns
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
// Clocked priority encoder with state
|
||||
//
|
||||
// On each clock cycle, updates state to show which request is granted.
|
||||
// Most recent grant holder is always the highest priority.
|
||||
// If current grant holder is not making a request, while others are,
|
||||
// then new grant holder is always the requester with lowest bit number.
|
||||
// If no requests, current grant holder retains grant state
|
||||
|
||||
// $Header$
|
||||
|
||||
`timescale 1 ns / 1 ns
|
||||
|
||||
module alt_xcvr_arbiter #(
|
||||
parameter width = 2
|
||||
) (
|
||||
input wire clock,
|
||||
input wire [width-1:0] req, // req[n] requests for this cycle
|
||||
output reg [width-1:0] grant // grant[n] means requester n is grantee in this cycle
|
||||
);
|
||||
|
||||
wire idle; // idle when no requests
|
||||
wire [width-1:0] keep; // keep[n] means requester n is requesting, and already has the grant
|
||||
// Note: current grantee is always highest priority for next grant
|
||||
wire [width-1:0] take; // take[n] means requester n is requesting, and there are no higher-priority requests
|
||||
|
||||
assign keep = req & grant; // current grantee is always highest priority for next grant
|
||||
assign idle = ~| req; // idle when no requests
|
||||
|
||||
initial begin
|
||||
grant = 0;
|
||||
end
|
||||
|
||||
// grant next state depends on current grant and take priority
|
||||
always @(posedge clock) begin
|
||||
grant <=
|
||||
// synthesis translate_off
|
||||
(grant === {width{1'bx}})? {width{1'b0}} :
|
||||
// synthesis translate_on
|
||||
keep // if current grantee is requesting, gets to keep grant
|
||||
| ({width{idle}} & grant) // if no requests, grant state remains unchanged
|
||||
| take; // take applies only if current grantee is not requesting
|
||||
end
|
||||
|
||||
// 'take' bus encodes priority. Request with lowest bit number wins when current grantee not requesting
|
||||
assign take[0] = req[0]
|
||||
& (~| (keep & ({width{1'b1}} << 1))); // no 'keep' from lower-priority inputs
|
||||
genvar i;
|
||||
generate
|
||||
for (i=1; i < width; i = i + 1) begin : arb
|
||||
assign take[i] = req[i]
|
||||
& (~| (keep & ({width{1'b1}} << (i+1)))) // no 'keep' from lower-priority inputs
|
||||
& (~| (req & {i{1'b1}})); // no 'req' from higher-priority inputs
|
||||
end
|
||||
endgenerate
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,238 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
//
|
||||
// Common control & status register map for transceiver PHY IP
|
||||
// Applies to Stratix V-generation basic PHY components
|
||||
//
|
||||
// $Header$
|
||||
//
|
||||
|
||||
`timescale 1 ps / 1 ps
|
||||
|
||||
module alt_xcvr_csr_common #(
|
||||
parameter lanes = 1,
|
||||
parameter plls = 1,
|
||||
parameter rpc = 0 // reset per channel
|
||||
)
|
||||
(
|
||||
// user data (avalon-MM formatted)
|
||||
input wire clk,
|
||||
input tri0 reset,
|
||||
input wire [7:0] address,
|
||||
input tri0 read,
|
||||
output reg [31:0] readdata = 0,
|
||||
input tri0 write,
|
||||
input wire [31:0] writedata,
|
||||
|
||||
// transceiver status inputs to this CSR
|
||||
input wire [plls - 1 : 0] pll_locked,
|
||||
input wire [lanes - 1 : 0] rx_is_lockedtoref,
|
||||
input wire [lanes - 1 : 0] rx_is_lockedtodata,
|
||||
input wire [lanes - 1 : 0] rx_signaldetect,
|
||||
|
||||
// reset controller outputs
|
||||
input wire reset_controller_tx_ready,
|
||||
input wire reset_controller_rx_ready,
|
||||
input wire reset_controller_pll_powerdown,
|
||||
input wire [(rpc?lanes:1)-1:0]reset_controller_tx_digitalreset,
|
||||
input wire [(rpc?lanes:1)-1:0]reset_controller_rx_analogreset,
|
||||
input wire [(rpc?lanes:1)-1:0]reset_controller_rx_digitalreset,
|
||||
|
||||
// read/write control registers
|
||||
// to reset controller
|
||||
output reg csr_reset_tx_digital = 0,
|
||||
output reg csr_reset_rx_digital = 0,
|
||||
output reg csr_reset_all = 1, // power-up to 1 to trigger auto-init sequence
|
||||
// to PMA and PCS reset inputs
|
||||
output wire csr_pll_powerdown, // reset controller or manual
|
||||
output wire [lanes - 1 : 0] csr_tx_digitalreset, // reset controller or manual
|
||||
output wire [lanes - 1 : 0] csr_rx_analogreset, // reset controller or manual
|
||||
output wire [lanes - 1 : 0] csr_rx_digitalreset, // reset controller or manual
|
||||
// common PMA controls
|
||||
output reg [lanes - 1 : 0] csr_phy_loopback_serial = 0,
|
||||
output reg [lanes - 1 : 0] csr_rx_set_locktoref = 0,
|
||||
output reg [lanes - 1 : 0] csr_rx_set_locktodata = 0
|
||||
);
|
||||
import alt_xcvr_csr_common_h::*;
|
||||
|
||||
localparam sync_stages = 2; // number of sync stages for transceiver status signals
|
||||
localparam sync_stages_str = sync_stages[7:0] + 8'd48; // number of sync stages specified as string (for timing constraints)
|
||||
|
||||
integer stage;
|
||||
|
||||
// Parameter strings for embedded timing constraints
|
||||
localparam CSR_PLLLOCKED_CONSTRAINT = {"-name SDC_STATEMENT \"set regs [get_registers -nowarn *alt_xcvr_csr_common*csr_pll_locked*[",sync_stages_str,"]*]; if {[llength [query_collection -report -all $regs]] > 0} {set_false_path -to $regs}\""};
|
||||
localparam CSR_RXISLOCKED_CONSTRAINT = {"-name SDC_STATEMENT \"set regs [get_registers -nowarn *alt_xcvr_csr_common*csr_rx_is_locked*[",sync_stages_str,"]*]; if {[llength [query_collection -report -all $regs]] > 0} {set_false_path -to $regs}\""};
|
||||
localparam CSR_RXSIGNALDET_CONSTRAINT = {"-name SDC_STATEMENT \"set regs [get_registers -nowarn *alt_xcvr_csr_common*csr_rx_signaldetect*[",sync_stages_str,"]*]; if {[llength [query_collection -report -all $regs]] > 0} {set_false_path -to $regs}\""};
|
||||
localparam SDC_CONSTRAINTS = {CSR_PLLLOCKED_CONSTRAINT,";",CSR_RXISLOCKED_CONSTRAINT,";",CSR_RXSIGNALDET_CONSTRAINT};
|
||||
|
||||
// internal control registers
|
||||
reg [lanes - 1 : 0] csr_interrupt_ch_bitmask = {lanes{1'b1}};
|
||||
// fine reset control. 'OR' with reset controller equivalent signals
|
||||
reg csr_reset_or_pll_powerdown = 0; // fine reset control
|
||||
reg csr_reset_or_reset_tx_digital = 0; // fine reset control
|
||||
reg csr_reset_or_reset_rx_analog = 0; // fine reset control
|
||||
reg csr_reset_or_reset_rx_digital = 0; // fine reset control
|
||||
reg [lanes - 1 : 0] csr_reset_ch_bitmask = {lanes{1'b1}};
|
||||
reg [1:0] csr_reset_tx_digital_r;
|
||||
reg [1:0] csr_reset_rx_digital_r;
|
||||
|
||||
// read-only status registers
|
||||
// These are synchronized forms of transceiver status signals
|
||||
// async inputs go to reg [sync_stages], and come out synchronized at reg [1]
|
||||
(* altera_attribute = SDC_CONSTRAINTS *) // Apply timing constraints (does not matter which node)
|
||||
reg [plls - 1 : 0] csr_pll_locked [sync_stages:1];
|
||||
reg [lanes - 1 : 0] csr_rx_is_lockedtoref [sync_stages:1];
|
||||
reg [lanes - 1 : 0] csr_rx_is_lockedtodata [sync_stages:1];
|
||||
reg [lanes - 1 : 0] csr_rx_signaldetect [sync_stages:1];
|
||||
|
||||
// Internal expansion of reset controller inputs
|
||||
wire [lanes-1:0] w_reset_controller_tx_digitalreset;
|
||||
wire [lanes-1:0] w_reset_controller_rx_analogreset;
|
||||
wire [lanes-1:0] w_reset_controller_rx_digitalreset;
|
||||
// Internal expansion of reset override registers
|
||||
wire [lanes-1:0] w_csr_reset_or_reset_tx_digital; // fine reset control
|
||||
wire [lanes-1:0] w_csr_reset_or_reset_rx_analog; // fine reset control
|
||||
wire [lanes-1:0] w_csr_reset_or_reset_rx_digital; // fine reset control
|
||||
|
||||
// Synchronization registers
|
||||
always @(posedge clk) begin
|
||||
// synchronization registers for status signals from transceivers
|
||||
csr_pll_locked [sync_stages] <= pll_locked; // input from transceiver
|
||||
csr_rx_is_lockedtoref [sync_stages] <= rx_is_lockedtoref;
|
||||
csr_rx_is_lockedtodata[sync_stages] <= rx_is_lockedtodata;
|
||||
csr_rx_signaldetect [sync_stages] <= rx_signaldetect;
|
||||
for (stage=2; stage <= sync_stages; stage = stage + 1) begin
|
||||
// additional sync stages
|
||||
csr_pll_locked [stage-1] <= csr_pll_locked [stage];
|
||||
csr_rx_is_lockedtoref [stage-1] <= csr_rx_is_lockedtoref [stage];
|
||||
csr_rx_is_lockedtodata[stage-1] <= csr_rx_is_lockedtodata [stage];
|
||||
csr_rx_signaldetect [stage-1] <= csr_rx_signaldetect [stage];
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk or posedge reset) begin
|
||||
if (reset == 1) begin
|
||||
readdata <= 0;
|
||||
csr_interrupt_ch_bitmask <= {lanes{1'b1}};
|
||||
|
||||
csr_reset_tx_digital <= 0;
|
||||
csr_reset_rx_digital <= 0;
|
||||
csr_reset_tx_digital_r <= 2'b00;
|
||||
csr_reset_rx_digital_r <= 2'b00;
|
||||
csr_reset_all <= 1; // reset to 1 to trigger auto-init sequence
|
||||
csr_reset_ch_bitmask <= {lanes{1'b1}};
|
||||
csr_reset_or_pll_powerdown <= 0; // fine reset control
|
||||
csr_reset_or_reset_tx_digital <= 0; // fine reset control
|
||||
csr_reset_or_reset_rx_analog <= 0; // fine reset control
|
||||
csr_reset_or_reset_rx_digital <= 0; // fine reset control
|
||||
|
||||
csr_phy_loopback_serial <= 0;
|
||||
csr_rx_set_locktoref <= 0;
|
||||
csr_rx_set_locktodata <= 0;
|
||||
end
|
||||
else begin
|
||||
// decode read & write for each supported address
|
||||
case (address)
|
||||
// interrupt control
|
||||
ADDR_INTERRUPT_CH_BITMASK: begin
|
||||
readdata <= (32'd0 | csr_interrupt_ch_bitmask);
|
||||
if (write) csr_interrupt_ch_bitmask <= writedata[lanes-1:0];
|
||||
end
|
||||
|
||||
// reset control
|
||||
ADDR_RESET_CONTROL: begin
|
||||
// on read, returns two bits: bit0: TX ready, bit1: RX ready
|
||||
readdata <= (32'd0 | {reset_controller_rx_ready, reset_controller_tx_ready});
|
||||
// on write, bit0 is 'reset_tx_digital', bit1 is 'reset_rx_digital', bit2 is 'reset_all'
|
||||
//if (write) begin
|
||||
// reset_all write side-effect: when write a '1', force all reset_ch_bitmask bits to '1'
|
||||
// csr_reset_ch_bitmask <= csr_reset_ch_bitmask | {(lanes){writedata[2]}};
|
||||
//end
|
||||
end
|
||||
ADDR_RESET_CH_BITMASK: begin
|
||||
readdata <= (32'd0 | csr_reset_ch_bitmask);
|
||||
if (write) csr_reset_ch_bitmask <= writedata[lanes-1:0];
|
||||
end
|
||||
|
||||
// loopback control
|
||||
ADDR_PHY_LOOPBACK_SERIAL,
|
||||
ADDR_PMA_LOOPBACK_SERIAL: begin
|
||||
readdata <= (32'd0 | csr_phy_loopback_serial);
|
||||
if (write) csr_phy_loopback_serial <= writedata[lanes-1:0];
|
||||
end
|
||||
|
||||
// PMA control and status
|
||||
ADDR_PMA_RX_SET_LOCKTOREF: begin
|
||||
readdata <= (32'd0 | csr_rx_set_locktoref);
|
||||
if (write) csr_rx_set_locktoref <= writedata[lanes-1:0];
|
||||
end
|
||||
ADDR_PMA_RX_SET_LOCKTODATA: begin
|
||||
readdata <= (32'd0 | csr_rx_set_locktodata);
|
||||
if (write) csr_rx_set_locktodata <= writedata[lanes-1:0];
|
||||
end
|
||||
// PMA status (read-only)
|
||||
ADDR_PMA_PLL_IS_LOCKED: readdata <= (32'd0 | csr_pll_locked[1]);
|
||||
ADDR_PMA_RX_IS_LOCKEDTOREF: readdata <= (32'd0 | csr_rx_is_lockedtoref[1]);
|
||||
ADDR_PMA_RX_IS_LOCKEDTODATA: readdata <= (32'd0 | csr_rx_is_lockedtodata[1]);
|
||||
ADDR_PMA_RX_SIGNALDETECT: readdata <= (32'd0 | csr_rx_signaldetect[1]);
|
||||
|
||||
// Fine reset control - device dependent
|
||||
ADDR_RESET_FINE_CONTROL: begin
|
||||
// bit 0: 'pll_powerdown', 1: 'reset_tx_digital', 2: 'reset_rx_analog', 3: 'reset_rx_digital'
|
||||
|
||||
readdata <= (32'd0 | {csr_reset_or_reset_rx_digital, csr_reset_or_reset_rx_analog,
|
||||
csr_reset_or_reset_tx_digital, csr_reset_or_pll_powerdown});
|
||||
if (write) begin
|
||||
csr_reset_or_pll_powerdown <= writedata[0]; // fine reset control
|
||||
csr_reset_or_reset_tx_digital <= writedata[1]; // fine reset control
|
||||
csr_reset_or_reset_rx_analog <= writedata[2]; // fine reset control
|
||||
csr_reset_or_reset_rx_digital <= writedata[3]; // fine reset control
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
default: readdata <= ~ 32'd0; // use too many LEs?
|
||||
endcase
|
||||
|
||||
// special handling for registers that must auto-clear on cycle after a write
|
||||
// reset control. on write, bit0 is 'reset_tx_digital', bit1 is 'reset_rx_digital', bit2 is 'reset_all'
|
||||
{csr_reset_tx_digital,csr_reset_tx_digital_r} <= ((address == ADDR_RESET_CONTROL) & write & writedata[0])
|
||||
? 3'b111 : {csr_reset_tx_digital_r,1'b0};
|
||||
{csr_reset_rx_digital,csr_reset_rx_digital_r} <= ((address == ADDR_RESET_CONTROL) & write & writedata[1])
|
||||
? 3'b111 : {csr_reset_rx_digital_r,1'b0};
|
||||
csr_reset_all <= (address == ADDR_RESET_CONTROL) & write & writedata[2];
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
// combine reset controller and CSR manual reset control settings
|
||||
assign w_reset_controller_tx_digitalreset = {(rpc?1:lanes){reset_controller_tx_digitalreset}};
|
||||
assign w_reset_controller_rx_analogreset = {(rpc?1:lanes){reset_controller_rx_analogreset}};
|
||||
assign w_reset_controller_rx_digitalreset = {(rpc?1:lanes){reset_controller_rx_digitalreset}};
|
||||
|
||||
assign w_csr_reset_or_reset_tx_digital = {lanes{csr_reset_or_reset_tx_digital}}; // fine reset control
|
||||
assign w_csr_reset_or_reset_rx_analog = {lanes{csr_reset_or_reset_rx_analog}}; // fine reset control
|
||||
assign w_csr_reset_or_reset_rx_digital = {lanes{csr_reset_or_reset_rx_digital}}; // fine reset control
|
||||
|
||||
assign csr_pll_powerdown = reset_controller_pll_powerdown; // cut manual PLL reset path
|
||||
// | csr_reset_or_pll_powerdown;
|
||||
assign csr_tx_digitalreset = csr_reset_ch_bitmask &
|
||||
(w_reset_controller_tx_digitalreset | w_csr_reset_or_reset_tx_digital);
|
||||
assign csr_rx_analogreset = csr_reset_ch_bitmask &
|
||||
(w_reset_controller_rx_analogreset | w_csr_reset_or_reset_rx_analog);
|
||||
assign csr_rx_digitalreset = csr_reset_ch_bitmask &
|
||||
(w_reset_controller_rx_digitalreset | w_csr_reset_or_reset_rx_digital);
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
//
|
||||
// Common control & status register map for transceiver PHY IP
|
||||
// Applies to Stratix V-generation basic PHY components
|
||||
//
|
||||
// $Header$
|
||||
//
|
||||
// PACKAGE DECLARATION
|
||||
|
||||
`timescale 1 ps / 1 ps
|
||||
|
||||
package alt_xcvr_csr_common_h;
|
||||
|
||||
localparam alt_xcvr_csr_addr_width = 8;
|
||||
|
||||
// register bitmap ---------------------------------------------------------
|
||||
// common blocks, interrupt control
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_INTERRUPT_CH_BITMASK = 1;
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_INTERRUPT_ENABLE_BITMASK = 2;
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_INTERRUPT_SOURCE = 3;
|
||||
|
||||
// common blocks, loopback control
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PHY_LOOPBACK_SERIAL = 6;
|
||||
|
||||
// common blocks, reset control
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_RESET_CONTROL_BASE = 64;
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_RESET_CH_BITMASK = ADDR_RESET_CONTROL_BASE + 8'd1;
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_RESET_CONTROL = ADDR_RESET_CONTROL_BASE + 8'd2;
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_RESET_FINE_CONTROL = ADDR_RESET_CONTROL_BASE + 8'd4;
|
||||
|
||||
// common blocks, PMA common control & status
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PMA_COMMON_BASE = 32;
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PMA_PLL_IS_LOCKED = ADDR_PMA_COMMON_BASE + 8'd2;
|
||||
// common blocks, PMA channel control & status
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PMA_CHANNEL_BASE = 96;
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PMA_LOOPBACK_SERIAL = ADDR_PMA_CHANNEL_BASE + 8'd1;
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PMA_RX_SIGNALDETECT = ADDR_PMA_CHANNEL_BASE + 8'd3;
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PMA_RX_SET_LOCKTODATA = ADDR_PMA_CHANNEL_BASE + 8'd4;
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PMA_RX_SET_LOCKTOREF = ADDR_PMA_CHANNEL_BASE + 8'd5;
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PMA_RX_IS_LOCKEDTODATA = ADDR_PMA_CHANNEL_BASE + 8'd6;
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PMA_RX_IS_LOCKEDTOREF = ADDR_PMA_CHANNEL_BASE + 8'd7;
|
||||
|
||||
// external block for PCS control & status
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PCS_BASE = 128; // 128-255
|
||||
|
||||
// First word in every PCS CSR is lane # (or lane group # as appropriate)
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PCS_LANE_GROUP = ADDR_PCS_BASE + 8'd0;
|
||||
|
||||
endpackage
|
||||
|
|
@ -0,0 +1,351 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
//
|
||||
// Common control & status register map for transceiver PHY IP
|
||||
// Applies to Stratix V-generation basic PHY components
|
||||
//
|
||||
// $Header$
|
||||
//
|
||||
|
||||
`timescale 1 ns / 1 ns
|
||||
|
||||
module alt_xcvr_csr_pcs8g #(
|
||||
parameter lanes = 1,
|
||||
parameter words = 2, // for status bits that are per-word, like 8B10B status
|
||||
parameter boundary_width = 5
|
||||
)
|
||||
(
|
||||
// user data (avalon-MM formatted)
|
||||
input wire clk,
|
||||
input tri0 reset,
|
||||
input wire [7:0] address,
|
||||
input tri0 read,
|
||||
output reg [31:0] readdata = 0,
|
||||
input tri0 write,
|
||||
input wire [31:0] writedata,
|
||||
|
||||
input wire rx_clk, // to synchronize rx control outputs
|
||||
input wire tx_clk, // to synchronize tx control outputs
|
||||
|
||||
// transceiver status inputs to this CSR
|
||||
input wire [lanes*words - 1 : 0] rx_patterndetect,
|
||||
input wire [lanes*words - 1 : 0] rx_syncstatus,
|
||||
input wire [lanes*words - 1 : 0] rx_errdetect,
|
||||
input wire [lanes*words - 1 : 0] rx_disperr,
|
||||
input wire [lanes - 1 : 0] rx_phase_comp_fifo_error,
|
||||
input wire [lanes - 1 : 0] tx_phase_comp_fifo_error,
|
||||
input wire [lanes*boundary_width - 1: 0] rx_bitslipboundaryselectout,
|
||||
input wire [lanes - 1 : 0] rlv,
|
||||
input wire [lanes*words - 1 : 0] rx_a1a2sizeout,
|
||||
|
||||
// read/write control outputs
|
||||
// PCS controls
|
||||
output wire [lanes - 1 : 0] csr_tx_invpolarity,
|
||||
output wire [lanes*boundary_width - 1 : 0] csr_tx_bitslipboundaryselect,
|
||||
output wire [lanes - 1 : 0] csr_rx_invpolarity,
|
||||
output wire [lanes - 1 : 0] csr_rx_enapatternalign,
|
||||
output wire [lanes - 1 : 0] csr_rx_bitreversalenable,
|
||||
output wire [lanes - 1 : 0] csr_rx_bytereversalenable,
|
||||
output wire [lanes - 1 : 0] csr_rx_bitslip,
|
||||
output wire [lanes - 1 : 0] csr_rx_a1a2size
|
||||
);
|
||||
import alt_xcvr_csr_common_h::*;
|
||||
import alt_xcvr_csr_pcs8g_h::*;
|
||||
|
||||
localparam sync_stages = 2; // number of sync stages for transceiver status signals
|
||||
localparam sync_stages_str = sync_stages[7:0] + 8'd48; // number of sync stages specified as string (for timing constraints)
|
||||
localparam LANE_REGW = 5;
|
||||
|
||||
// Parameter strings for embedded timing constraints
|
||||
localparam SYNC_RX_CONSTRAINT = {"-name SDC_STATEMENT \"set regs [get_registers -nowarn *alt_xcvr_csr_pcs8g*sync_rx_*[",sync_stages_str,"]*]; if {[llength [query_collection -report -all $regs]] > 0} {set_false_path -to $regs}\""};
|
||||
localparam SYNC_TX_CONSTRAINT = {"-name SDC_STATEMENT \"set regs [get_registers -nowarn *alt_xcvr_csr_pcs8g*sync_tx_*[",sync_stages_str,"]*]; if {[llength [query_collection -report -all $regs]] > 0} {set_false_path -to $regs}\""};
|
||||
localparam CSR_REG_CONSTRAINT = {"-name SDC_STATEMENT \"set regs [get_registers -nowarn *alt_xcvr_csr_pcs8g*csr_indexed_read_only_reg*sreg[",sync_stages_str,"]*]; if {[llength [query_collection -report -all $regs]] > 0} {set_false_path -to $regs}\""};
|
||||
localparam SDC_CONSTRAINTS = {SYNC_RX_CONSTRAINT,";",SYNC_TX_CONSTRAINT,";",CSR_REG_CONSTRAINT};
|
||||
|
||||
// internal registers
|
||||
reg [LANE_REGW-1:0] reg_lane_number = 0; // lane or group number for indirection
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// Read/Write CSR registers with lane indirection
|
||||
////////////////////////////////////////////////////////
|
||||
// Apply false path timing constraints to synchronization registers. (It does not matter as to which node these are applied).
|
||||
(* altera_attribute = SDC_CONSTRAINTS *)
|
||||
reg [lanes - 1 : 0] reg_tx_invpolarity = 0;
|
||||
reg [lanes - 1 : 0] sync_tx_invpolarity [sync_stages:1]; // synchronize to tx_clk
|
||||
wire [lanes - 1 : 0] write_tx_invpolarity; // indexed write group muxed in
|
||||
wire [0 : 0] lane_tx_invpolarity; // selected group indexed for output
|
||||
csr_indexed_write_mux #(.groups(lanes), .grp_size(1), .sel_size(LANE_REGW), .init_value(0))
|
||||
wmux_tx_invpolarity(.in_narrow(writedata[0]),
|
||||
.in_wide(reg_tx_invpolarity), .sel(reg_lane_number),
|
||||
.out_narrow(lane_tx_invpolarity), .out_wide(write_tx_invpolarity));
|
||||
|
||||
reg [lanes*boundary_width - 1 : 0] reg_tx_bitslipboundaryselect = 0;
|
||||
reg [lanes*boundary_width - 1 : 0] sync_tx_bitslipboundaryselect [sync_stages:1]; //synchronize to tx_clk
|
||||
wire [lanes*boundary_width - 1 : 0] write_tx_bitslipboundaryselect; //indexed write group muxed in
|
||||
wire [boundary_width-1:0] lane_tx_bitslipboundaryselect; //selected group indexed for output
|
||||
csr_indexed_write_mux #(.groups(lanes), .grp_size(boundary_width), .sel_size(LANE_REGW), .init_value(0))
|
||||
wmux_tx_bitslipboundaryselect(.in_narrow(writedata[boundary_width:1]),
|
||||
.in_wide(reg_tx_bitslipboundaryselect), .sel(reg_lane_number),
|
||||
.out_narrow(lane_tx_bitslipboundaryselect), .out_wide(write_tx_bitslipboundaryselect));
|
||||
|
||||
reg [lanes - 1 : 0] reg_rx_invpolarity = 0;
|
||||
reg [lanes - 1 : 0] sync_rx_invpolarity [sync_stages:1]; // synchronize to rx_clk
|
||||
wire [lanes - 1 : 0] write_rx_invpolarity; // indexed write group muxed in
|
||||
wire [0 : 0] lane_rx_invpolarity; // selected group indexed for output
|
||||
csr_indexed_write_mux #(.groups(lanes), .grp_size(1), .sel_size(LANE_REGW), .init_value(0))
|
||||
wmux_rx_invpolarity(.in_narrow(writedata[0]),
|
||||
.in_wide(reg_rx_invpolarity), .sel(reg_lane_number),
|
||||
.out_narrow(lane_rx_invpolarity), .out_wide(write_rx_invpolarity));
|
||||
|
||||
reg [lanes - 1 : 0] reg_rx_enapatternalign = 0;
|
||||
reg [lanes - 1 : 0] sync_rx_enapatternalign [sync_stages:1]; // synchronize to rx_clk
|
||||
wire [lanes - 1 : 0] write_rx_enapatternalign; // indexed write group muxed in
|
||||
wire [0 : 0] lane_rx_enapatternalign; // selected group indexed for output
|
||||
csr_indexed_write_mux #(.groups(lanes), .grp_size(1), .sel_size(LANE_REGW), .init_value(0))
|
||||
wmux_rx_enapatternalign(.in_narrow(writedata[0]),
|
||||
.in_wide(reg_rx_enapatternalign), .sel(reg_lane_number),
|
||||
.out_narrow(lane_rx_enapatternalign), .out_wide(write_rx_enapatternalign));
|
||||
|
||||
reg [lanes - 1 : 0] reg_rx_bitreversalenable = 0;
|
||||
reg [lanes - 1 : 0] sync_rx_bitreversalenable [sync_stages:1]; // synchronize to rx_clk
|
||||
wire [lanes - 1 : 0] write_rx_bitreversalenable; // indexed write group muxed in
|
||||
wire [0 : 0] lane_rx_bitreversalenable; // selected group indexed for output
|
||||
csr_indexed_write_mux #(.groups(lanes), .grp_size(1), .sel_size(LANE_REGW), .init_value(0))
|
||||
wmux_rx_bitreversalenable(.in_narrow(writedata[1]),
|
||||
.in_wide(reg_rx_bitreversalenable), .sel(reg_lane_number),
|
||||
.out_narrow(lane_rx_bitreversalenable), .out_wide(write_rx_bitreversalenable));
|
||||
|
||||
reg [lanes - 1 : 0] reg_rx_bytereversalenable = 0;
|
||||
reg [lanes - 1 : 0] sync_rx_bytereversalenable [sync_stages:1]; // synchronize to rx_clk
|
||||
wire [lanes - 1 : 0] write_rx_bytereversalenable; // indexed write group muxed in
|
||||
wire [0 : 0] lane_rx_bytereversalenable; // selected group indexed for output
|
||||
csr_indexed_write_mux #(.groups(lanes), .grp_size(1), .sel_size(LANE_REGW), .init_value(0))
|
||||
wmux_rx_bytereversalenable(.in_narrow(writedata[2]),
|
||||
.in_wide(reg_rx_bytereversalenable), .sel(reg_lane_number),
|
||||
.out_narrow(lane_rx_bytereversalenable), .out_wide(write_rx_bytereversalenable));
|
||||
|
||||
reg [lanes - 1 : 0] reg_rx_bitslip = 0;
|
||||
reg [lanes - 1 : 0] sync_rx_bitslip [sync_stages:1]; // synchronize to rx_clk
|
||||
wire [lanes - 1 : 0] write_rx_bitslip; // indexed write group muxed in
|
||||
wire [0 : 0] lane_rx_bitslip; // selected group indexed for output
|
||||
csr_indexed_write_mux #(.groups(lanes), .grp_size(1), .sel_size(LANE_REGW), .init_value(0))
|
||||
wmux_rx_bitslip(.in_narrow(writedata[3]),
|
||||
.in_wide(reg_rx_bitslip), .sel(reg_lane_number),
|
||||
.out_narrow(lane_rx_bitslip), .out_wide(write_rx_bitslip));
|
||||
|
||||
reg [lanes - 1 : 0] reg_rx_a1a2size = 0;
|
||||
reg [lanes - 1 : 0] sync_rx_a1a2size [sync_stages:1]; // synchronize to rx_clk
|
||||
wire [lanes - 1 : 0] write_rx_a1a2size; // indexed write group muxed in
|
||||
wire [0 : 0] lane_rx_a1a2size; // selected group indexed for output
|
||||
csr_indexed_write_mux #(.groups(lanes), .grp_size(1), .sel_size(LANE_REGW), .init_value(0))
|
||||
wmux_rx_a1a2size(.in_narrow(writedata[3]),
|
||||
.in_wide(reg_rx_a1a2size), .sel(reg_lane_number),
|
||||
.out_narrow(lane_rx_a1a2size), .out_wide(write_rx_a1a2size));
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// Read-only CSR registers with lane indirection
|
||||
////////////////////////////////////////////////////////
|
||||
// read-only status registers are synchronized forms of transceiver status signals
|
||||
// async inputs go to reg [sync_stages], and come out synchronized at reg [1]
|
||||
////////////////////////////////////////////////////////
|
||||
// read selectors (muxes) that index using the indirect lane (group) number
|
||||
wire [words-1 : 0] lane_rx_patterndetect;
|
||||
csr_indexed_read_only_reg #(.groups(lanes), .grp_size(words), .sel_size(LANE_REGW), .sync_stages(sync_stages))
|
||||
mux_rx_patterndetect(.clk(clk), .async_in_wide(rx_patterndetect),
|
||||
.sel(reg_lane_number), .out_narrow(lane_rx_patterndetect));
|
||||
|
||||
wire [words-1 : 0] lane_rx_syncstatus;
|
||||
csr_indexed_read_only_reg #(.groups(lanes), .grp_size(words), .sel_size(LANE_REGW), .sync_stages(sync_stages))
|
||||
mux_rx_syncstatus(.clk(clk), .async_in_wide(rx_syncstatus),
|
||||
.sel(reg_lane_number), .out_narrow(lane_rx_syncstatus));
|
||||
|
||||
wire [words-1 : 0] lane_rx_errdetect;
|
||||
csr_indexed_read_only_reg #(.groups(lanes), .grp_size(words), .sel_size(LANE_REGW), .sync_stages(sync_stages))
|
||||
mux_rx_errdetect(.clk(clk), .async_in_wide(rx_errdetect),
|
||||
.sel(reg_lane_number), .out_narrow(lane_rx_errdetect));
|
||||
|
||||
wire [words-1 : 0] lane_rx_disperr;
|
||||
csr_indexed_read_only_reg #(.groups(lanes), .grp_size(words), .sel_size(LANE_REGW), .sync_stages(sync_stages))
|
||||
mux_rx_disperr(.clk(clk), .async_in_wide(rx_disperr),
|
||||
.sel(reg_lane_number), .out_narrow(lane_rx_disperr));
|
||||
|
||||
wire [words-1 : 0] lane_rx_a1a2sizeout;
|
||||
csr_indexed_read_only_reg #(.groups(lanes), .grp_size(words), .sel_size(LANE_REGW), .sync_stages(sync_stages))
|
||||
mux_rx_a1a2sizeout(.clk(clk), .async_in_wide(rx_a1a2sizeout),
|
||||
.sel(reg_lane_number), .out_narrow(lane_rx_a1a2sizeout));
|
||||
|
||||
wire [0 : 0] lane_rx_phase_comp_fifo_error;
|
||||
csr_indexed_read_only_reg #(.groups(lanes), .grp_size(1), .sel_size(LANE_REGW), .sync_stages(sync_stages))
|
||||
mux_rx_phase_comp_fifo_error(.clk(clk), .async_in_wide(rx_phase_comp_fifo_error),
|
||||
.sel(reg_lane_number), .out_narrow(lane_rx_phase_comp_fifo_error));
|
||||
|
||||
wire [boundary_width-1 : 0] lane_rx_bitslipboundaryselectout;
|
||||
csr_indexed_read_only_reg #(.groups(lanes), .grp_size(boundary_width), .sel_size(LANE_REGW), .sync_stages(sync_stages))
|
||||
mux_rx_bitslipboundaryselectout(.clk(clk), .async_in_wide(rx_bitslipboundaryselectout),
|
||||
.sel(reg_lane_number), .out_narrow(lane_rx_bitslipboundaryselectout));
|
||||
|
||||
wire [0 : 0] lane_tx_phase_comp_fifo_error;
|
||||
csr_indexed_read_only_reg #(.groups(lanes), .grp_size(1), .sel_size(LANE_REGW), .sync_stages(sync_stages))
|
||||
mux_tx_phase_comp_fifo_error(.clk(clk), .async_in_wide(tx_phase_comp_fifo_error),
|
||||
.sel(reg_lane_number), .out_narrow(lane_tx_phase_comp_fifo_error));
|
||||
|
||||
wire [0 : 0] lane_rlv;
|
||||
csr_indexed_read_only_reg #(.groups(lanes), .grp_size(1), .sel_size(LANE_REGW), .sync_stages(sync_stages))
|
||||
mux_rlv(.clk(clk), .async_in_wide(rlv),
|
||||
.sel(reg_lane_number), .out_narrow(lane_rlv));
|
||||
|
||||
|
||||
always @(posedge clk or posedge reset) begin
|
||||
if (reset == 1) begin
|
||||
readdata <= 0;
|
||||
reg_lane_number <= 0;
|
||||
reg_tx_invpolarity <= 0;
|
||||
reg_tx_bitslipboundaryselect <= 0;
|
||||
reg_rx_invpolarity <= 0;
|
||||
reg_rx_enapatternalign <= 0;
|
||||
reg_rx_bitreversalenable <= 0;
|
||||
reg_rx_bytereversalenable <= 0;
|
||||
reg_rx_bitslip <= 0;
|
||||
reg_rx_a1a2size <= 0;
|
||||
|
||||
// no need to clear synchronization registers, since they do not store state
|
||||
end
|
||||
else begin
|
||||
// decode read & write for each supported address
|
||||
case (address)
|
||||
// lane or group number for indirection
|
||||
ADDR_PCS_LANE_GROUP: begin
|
||||
readdata <= (32'd0 | reg_lane_number);
|
||||
if (write) reg_lane_number <= writedata[LANE_REGW-1:0];
|
||||
end
|
||||
|
||||
// offset + 1, read-only RX status bits
|
||||
// bit 0, rx_phase_comp_fifo_error
|
||||
// bit boundary_width:1, rx_bitslipboundaryselectout
|
||||
ADDR_PCS8G_RX_STATUS: begin
|
||||
readdata <= (32'd0 |
|
||||
{lane_rx_bitslipboundaryselectout, //bit boundary_width-1
|
||||
lane_rx_phase_comp_fifo_error}); // bit 0
|
||||
end
|
||||
|
||||
// offset + 2, read-only TX status bits
|
||||
// bit 0, tx_phase_comp_fifo_error
|
||||
ADDR_PCS8G_TX_STATUS: begin
|
||||
readdata <= (32'd0 | lane_tx_phase_comp_fifo_error); // bit 0
|
||||
end
|
||||
|
||||
// offset + 3, read/write TX control bits
|
||||
// bit 0, tx_invpolarity
|
||||
// bit boundary_width:1, tx_bitslipboundaryselect
|
||||
ADDR_PCS8G_TX_CONTROL: begin
|
||||
readdata <= (32'd0 | {lane_tx_bitslipboundaryselect, lane_tx_invpolarity});
|
||||
if (write)
|
||||
begin
|
||||
reg_tx_invpolarity <= write_tx_invpolarity;
|
||||
reg_tx_bitslipboundaryselect <= write_tx_bitslipboundaryselect;
|
||||
end
|
||||
end
|
||||
|
||||
// offset + 4, read/write RX control bits
|
||||
// bit 0, rx_invpolarity
|
||||
ADDR_PCS8G_RX_CONTROL: begin
|
||||
readdata <= (32'd0 | lane_rx_invpolarity);
|
||||
if (write) reg_rx_invpolarity <= write_rx_invpolarity;
|
||||
end
|
||||
|
||||
// offset + 5, read/write RX WA control bits
|
||||
// bit 0, rx_enapatternalign
|
||||
// bit 1, rx_bitreversalenable
|
||||
// bit 2, rx_bytereversalenable
|
||||
// bit 3, rx_bitslip
|
||||
// bit 4, rx_a1a2size
|
||||
ADDR_PCS8G_RX_WA_CONTROL: begin
|
||||
readdata <= (32'd0 | { lane_rx_a1a2size, // bit 4
|
||||
lane_rx_bitslip, // bit 3
|
||||
lane_rx_bytereversalenable, // bit 2
|
||||
lane_rx_bitreversalenable, // bit 1
|
||||
lane_rx_enapatternalign}); // bit 0
|
||||
if (write)
|
||||
begin
|
||||
reg_rx_enapatternalign <= write_rx_enapatternalign;
|
||||
reg_rx_bitreversalenable <= write_rx_bitreversalenable;
|
||||
reg_rx_bytereversalenable <= write_rx_bytereversalenable;
|
||||
reg_rx_bitslip <= write_rx_bitslip;
|
||||
reg_rx_a1a2size <= write_rx_a1a2size;
|
||||
end
|
||||
end
|
||||
|
||||
// offset + 5, read RX WA status bits
|
||||
// bit 3:0, rx_errdetect
|
||||
// bit 7:4, rx_syncstatus
|
||||
// bit 11:8, rx_disperr
|
||||
// bit 15:12, rx_patterndetect
|
||||
// bit 16, rlv
|
||||
// bit 23:20, rx_a1a2sizeout
|
||||
ADDR_PCS8G_RX_WA_STATUS: begin
|
||||
readdata <= (32'd0 | {(4'b0 | lane_rx_a1a2sizeout), // bit 23:20
|
||||
(4'b0 | lane_rlv), // bit 16
|
||||
(4'b0 | lane_rx_patterndetect), // bit 15:12
|
||||
(4'b0 | lane_rx_disperr), // bit 11:8
|
||||
(4'b0 | lane_rx_syncstatus), // bit 7:4
|
||||
(4'b0 | lane_rx_errdetect)}); // bit 3:0
|
||||
end
|
||||
|
||||
default: readdata <= ~ 32'd0; // use too many LEs?
|
||||
endcase
|
||||
end
|
||||
end
|
||||
|
||||
// synchronize TX controls to tx_clk before generating output
|
||||
// sysclk-sync'ed input enters at [sync_stages], and tx_clk-sync'ed output exist at [1]
|
||||
integer stage;
|
||||
always @(posedge tx_clk) begin
|
||||
sync_tx_invpolarity[sync_stages] <= reg_tx_invpolarity;
|
||||
sync_tx_bitslipboundaryselect[sync_stages] <= reg_tx_bitslipboundaryselect;
|
||||
for (stage=2; stage <= sync_stages; stage = stage + 1) begin
|
||||
// additional sync stages
|
||||
sync_tx_invpolarity[stage-1] <= sync_tx_invpolarity[stage];
|
||||
sync_tx_bitslipboundaryselect[stage-1] <= sync_tx_bitslipboundaryselect[stage];
|
||||
end
|
||||
end
|
||||
assign csr_tx_invpolarity = sync_tx_invpolarity[1];
|
||||
assign csr_tx_bitslipboundaryselect = sync_tx_bitslipboundaryselect[1];
|
||||
|
||||
// synchronize RX controls to rx_clk before generating output
|
||||
// sysclk-sync'ed input enters at [sync_stages], and rx_clk-sync'ed output exist at [1]
|
||||
always @(posedge rx_clk) begin
|
||||
sync_rx_invpolarity[sync_stages] <= reg_rx_invpolarity;
|
||||
sync_rx_enapatternalign[sync_stages] <= reg_rx_enapatternalign;
|
||||
sync_rx_bitreversalenable[sync_stages] <= reg_rx_bitreversalenable;
|
||||
sync_rx_bytereversalenable[sync_stages] <= reg_rx_bytereversalenable;
|
||||
sync_rx_bitslip[sync_stages] <= reg_rx_bitslip;
|
||||
sync_rx_a1a2size[sync_stages] <= reg_rx_a1a2size;
|
||||
for (stage=2; stage <= sync_stages; stage = stage + 1) begin
|
||||
// additional sync stages
|
||||
sync_rx_invpolarity[stage-1] <= sync_rx_invpolarity[stage];
|
||||
sync_rx_enapatternalign[stage-1] <= sync_rx_enapatternalign[stage];
|
||||
sync_rx_bitreversalenable[stage-1] <= sync_rx_bitreversalenable[stage];
|
||||
sync_rx_bytereversalenable[stage-1] <= sync_rx_bytereversalenable[stage];
|
||||
sync_rx_bitslip[stage-1] <= sync_rx_bitslip[stage];
|
||||
sync_rx_a1a2size[stage-1] <= sync_rx_a1a2size[stage];
|
||||
end
|
||||
end
|
||||
assign csr_rx_invpolarity = sync_rx_invpolarity[1];
|
||||
assign csr_rx_enapatternalign = sync_rx_enapatternalign[1];
|
||||
assign csr_rx_bitreversalenable = sync_rx_bitreversalenable[1];
|
||||
assign csr_rx_bytereversalenable = sync_rx_bytereversalenable[1];
|
||||
assign csr_rx_bitslip = sync_rx_bitslip[1];
|
||||
assign csr_rx_a1a2size = sync_rx_a1a2size[1];
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
//
|
||||
// Common control & status register map for transceiver PHY IP
|
||||
// Applies to Stratix V-generation basic PHY components
|
||||
//
|
||||
// $Header$
|
||||
//
|
||||
// PACKAGE DECLARATION
|
||||
package alt_xcvr_csr_pcs8g_h;
|
||||
|
||||
import alt_xcvr_csr_common_h::*;
|
||||
|
||||
// 8G PCS, a.k.a. "Standard PCS", control and status bits
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PCS8G_RX_STATUS = ADDR_PCS_BASE + 8'd1;
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PCS8G_TX_STATUS = ADDR_PCS_BASE + 8'd2;
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PCS8G_TX_CONTROL = ADDR_PCS_BASE + 8'd3;
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PCS8G_RX_CONTROL = ADDR_PCS_BASE + 8'd4;
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PCS8G_RX_WA_CONTROL = ADDR_PCS_BASE + 8'd5;
|
||||
localparam [alt_xcvr_csr_addr_width-1:0] ADDR_PCS8G_RX_WA_STATUS = ADDR_PCS_BASE + 8'd6;
|
||||
|
||||
endpackage
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
//
|
||||
// Select a sub-group from a wide register
|
||||
// Useful for indirection indexing
|
||||
//
|
||||
// $Header$
|
||||
//
|
||||
|
||||
`timescale 1 ns / 1 ns
|
||||
|
||||
module csr_mux #(
|
||||
parameter groups = 2,
|
||||
parameter grp_size = 1,
|
||||
parameter sel_size = 1
|
||||
)
|
||||
(
|
||||
input wire [groups*grp_size-1:0] in_wide,
|
||||
input tri0 [sel_size-1:0] sel,
|
||||
output wire [grp_size-1:0] out_narrow
|
||||
);
|
||||
// lpm_mux #(.lpm_size(groups), .lpm_width(grp_size), .lpm_widths(sel_size))
|
||||
// mux (.data(in_wide), .sel(sel), .result(out_narrow));
|
||||
wire [grp_size-1:0] in_groups [groups-1:0];
|
||||
|
||||
// a synthesizable mux, with a parameterized number of inputs
|
||||
genvar i;
|
||||
assign in_groups[0] = in_wide[grp_size-1:0] & {grp_size{sel == 0}};
|
||||
generate for (i=1; i<groups; i = i+1) begin: mux
|
||||
assign in_groups[i] = in_groups[i-1] | in_wide[i*grp_size +: grp_size] & {grp_size{sel == i}};
|
||||
end
|
||||
endgenerate
|
||||
assign out_narrow = in_groups[groups-1];
|
||||
endmodule
|
||||
|
||||
//
|
||||
// write to a sub-group of a wide register
|
||||
// Useful for indirection indexing on write
|
||||
//
|
||||
module csr_indexed_write_mux #(
|
||||
parameter groups = 2,
|
||||
parameter grp_size = 1,
|
||||
parameter sel_size = 1,
|
||||
parameter init_value = 0
|
||||
)
|
||||
(
|
||||
input wire [grp_size-1:0] in_narrow,
|
||||
input tri0 [sel_size-1:0] sel,
|
||||
output wire [grp_size-1:0] out_narrow, // for read back to mgmt interface
|
||||
input wire [groups*grp_size-1:0] in_wide, // full-width control reg state
|
||||
output wire [groups*grp_size-1:0] out_wide // to write to full-width control reg
|
||||
);
|
||||
wire [groups*grp_size-1:0] wire_wide [groups-1:0];
|
||||
|
||||
// in_narrow is output in the group position indicated by .sel() input
|
||||
genvar i;
|
||||
assign wire_wide[0] = (in_wide & {grp_size{sel != 0}}) | (in_narrow & {grp_size{sel == 0}});
|
||||
generate for (i=1; i<groups; i = i+1) begin: mux
|
||||
assign wire_wide[i] = wire_wide[i-1]
|
||||
| (in_wide & {{grp_size{sel != i}}, {(grp_size*i){1'b0}}})
|
||||
| ({in_narrow & {grp_size{sel == i}}, {(grp_size*i){1'b0}}});
|
||||
end
|
||||
endgenerate
|
||||
assign out_wide = wire_wide[groups-1];
|
||||
|
||||
// generate out_narrow as ordinary mux of in_wide
|
||||
csr_mux #(.groups(groups), .grp_size(grp_size), .sel_size(sel_size))
|
||||
o_narrow(.in_wide(in_wide), .sel(sel), .out_narrow(out_narrow));
|
||||
|
||||
endmodule
|
||||
|
||||
//
|
||||
// read from a sub-group of a wide, async status input
|
||||
// Creates synchronization logic to sample in local clock domain
|
||||
// Useful for indirection indexing on read-only status bits
|
||||
//
|
||||
module csr_indexed_read_only_reg #(
|
||||
parameter groups = 2,
|
||||
parameter grp_size = 1,
|
||||
parameter sel_size = 1,
|
||||
parameter sync_stages = 2
|
||||
)
|
||||
(
|
||||
input wire clk,
|
||||
input tri0 [sel_size-1:0] sel,
|
||||
output wire [grp_size-1:0] out_narrow, // for read back to mgmt interface
|
||||
input wire [groups*grp_size-1:0] async_in_wide // full-width async status inputs
|
||||
);
|
||||
localparam sync_stages_str = sync_stages[7:0] + 8'd48; // number of sync stages specified as string (for timing constraints)
|
||||
localparam SYNC_SREG_CONSTRAINT = {"-name SDC_STATEMENT \"set regs [get_registers -nowarn *csr_indexed_read_only_reg*sreg[",sync_stages_str,"]*]; if {[llength [query_collection -report -all $regs]] > 0} {set_false_path -to $regs}\""};
|
||||
localparam SDC_CONSTRAINTS = {SYNC_SREG_CONSTRAINT};
|
||||
|
||||
// read-only status registers are synchronized forms of async status signals
|
||||
// async inputs go to sreg [sync_stages], and come out synchronized at sreg [1]
|
||||
// Apply false path timing constraints to synchronization registers.
|
||||
(* altera_attribute = SDC_CONSTRAINTS *)
|
||||
reg [groups*grp_size-1:0] sreg [sync_stages:1];
|
||||
integer stage;
|
||||
always @(posedge clk) begin
|
||||
sreg[sync_stages] <= async_in_wide;
|
||||
for (stage=2; stage <= sync_stages; stage = stage + 1) begin
|
||||
// additional sync stages
|
||||
sreg[stage-1] <= sreg[stage];
|
||||
end
|
||||
end
|
||||
|
||||
// generate out_narrow as ordinary mux of out_wide
|
||||
csr_mux #(.groups(groups), .grp_size(grp_size), .sel_size(sel_size))
|
||||
o_narrow(.in_wide(sreg[1]), .sel(sel), .out_narrow(out_narrow));
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
// Master-to-slave access fabric
|
||||
//
|
||||
// Combined with external multi-master arbitration, this block gates
|
||||
// master read, write, address, and writedata outputs, and generates
|
||||
// a waitrequest when arbiter indicates access is not granted
|
||||
|
||||
// $Header$
|
||||
|
||||
`timescale 1 ns / 1 ns
|
||||
|
||||
module alt_xcvr_m2s #(
|
||||
parameter width_addr = 3,
|
||||
parameter width_data = 32
|
||||
) (
|
||||
input wire clock,
|
||||
output wire req, // request to arbiter for slave access
|
||||
input wire grant,
|
||||
|
||||
// signals from/to master
|
||||
input wire m_read,
|
||||
input wire m_write,
|
||||
input wire [width_addr-1:0] m_address,
|
||||
input wire [width_data-1:0] m_writedata,
|
||||
output wire [width_data-1:0] m_readdata,
|
||||
output wire m_waitrequest,
|
||||
|
||||
// signals from/to slave
|
||||
output wire s_read,
|
||||
output wire s_write,
|
||||
output wire [width_addr-1:0] s_address,
|
||||
output wire [width_data-1:0] s_writedata,
|
||||
input wire [width_data-1:0] s_readdata,
|
||||
input wire s_waitrequest
|
||||
);
|
||||
|
||||
// If master is requesting access, generate waitreq until granted
|
||||
assign req = m_read | m_write; // master access requests
|
||||
assign m_waitrequest = grant ? s_waitrequest : req;
|
||||
|
||||
// gate outputs to slave with grant signal
|
||||
assign s_read = m_read & grant;
|
||||
assign s_write = m_write & grant;
|
||||
assign s_address = m_address & {width_addr{grant}};
|
||||
assign s_writedata = m_writedata & {width_data{grant}};
|
||||
|
||||
// slave data outputs pass through directly
|
||||
assign m_readdata = s_readdata;
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
// Management interface address decoder for Altera Transceiver PHY
|
||||
//
|
||||
// Addresses common case of 2 modules to be stitched together:
|
||||
// - 'top' PHY channel blocks (includes reset control, CSR, ...)
|
||||
// - dynamic reconfiguration block
|
||||
|
||||
// $Header$
|
||||
|
||||
`timescale 1 ns / 1 ns
|
||||
|
||||
module alt_xcvr_mgmt2dec (
|
||||
|
||||
// user-visible external management interface
|
||||
input wire mgmt_clk_reset,
|
||||
input wire mgmt_clk,
|
||||
|
||||
input wire [8:0] mgmt_address,
|
||||
input wire mgmt_read,
|
||||
output reg [31:0] mgmt_readdata = ~32'd0,
|
||||
output reg mgmt_waitrequest = 0,
|
||||
input wire mgmt_write,
|
||||
|
||||
// internal interface to 'top' csr block
|
||||
output wire [7:0] topcsr_address,
|
||||
output wire topcsr_read,
|
||||
input wire [31:0] topcsr_readdata,
|
||||
input wire topcsr_waitrequest,
|
||||
output wire topcsr_write,
|
||||
|
||||
// internal interface to 'top' csr block
|
||||
output wire [7:0] reconf_address,
|
||||
output wire reconf_read,
|
||||
input wire [31:0] reconf_readdata,
|
||||
input wire reconf_waitrequest,
|
||||
output wire reconf_write
|
||||
);
|
||||
localparam width_swa = 7; // word address width of interface to slaves (2 for top.CSR and 1 for reconfig)
|
||||
localparam dec_count = 2; // count of the total number of sub-components that can act
|
||||
// as slaves to the mgmt interface
|
||||
localparam dec_topcsr = 0; // uses 2 128-word address blocks
|
||||
localparam dec_reconf = 1; // uses 1 128-word address block
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Decoder for multiple slaves of reconfig_mgmt interface
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
wire [dec_count-1:0] r_decode;
|
||||
assign r_decode =
|
||||
(mgmt_address[8:width_swa+1] == dec_topcsr) ? (({dec_count-dec_topcsr{1'b0}} | 1'b1) << dec_topcsr)
|
||||
: (mgmt_address[8:width_swa] == 2'd2) ? (({dec_count-dec_reconf{1'b0}} | 1'b1) << dec_reconf)
|
||||
: {dec_count{1'b0}};
|
||||
|
||||
// reconfig_mgmt output generation is muxing of decoded slave output
|
||||
always @(*) begin
|
||||
if (r_decode[dec_topcsr] == 1'b1) begin
|
||||
mgmt_readdata = topcsr_readdata;
|
||||
mgmt_waitrequest = topcsr_waitrequest;
|
||||
end else if (r_decode[dec_reconf] == 1'b1) begin
|
||||
mgmt_readdata = reconf_readdata;
|
||||
mgmt_waitrequest = reconf_waitrequest;
|
||||
end else begin
|
||||
mgmt_readdata = -1;
|
||||
mgmt_waitrequest = 1'b0;
|
||||
end
|
||||
end
|
||||
|
||||
// internal interface to 'top' csr block
|
||||
assign topcsr_address = mgmt_address[width_swa:0]; // top.csr uses 2 128-word blocks
|
||||
assign topcsr_read = mgmt_read & r_decode[dec_topcsr];
|
||||
assign topcsr_write = mgmt_write & r_decode[dec_topcsr];
|
||||
|
||||
// internal interface to 'top' csr block
|
||||
assign reconf_address = mgmt_address[width_swa-1:0]; // reconfig uses 1 128-word block
|
||||
assign reconf_read = mgmt_read & r_decode[dec_reconf];
|
||||
assign reconf_write = mgmt_write & r_decode[dec_reconf];
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Description: Custom management interface address decoder for Altera
|
||||
// transciever PHY. Addresses common case of 2 modules to be stitched together:
|
||||
// - 'top' PHY channel blocks (includes reset control, CSR, ...)
|
||||
// - dynamic reconfiguration block
|
||||
//
|
||||
// Authors: dunnikri 19-Aug-2010
|
||||
//
|
||||
// Copyright (c) Altera Corporation 1997 - 2010
|
||||
// All rights reserved.
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
`timescale 1 ns / 1 ns
|
||||
|
||||
module alt_xcvr_mgmt2dec_phyreconfig (
|
||||
|
||||
// user-visible external management interface
|
||||
input wire mgmt_clk_reset,
|
||||
input wire mgmt_clk,
|
||||
|
||||
input wire [8:0] mgmt_address,
|
||||
input wire mgmt_read,
|
||||
output reg [31:0] mgmt_readdata = ~32'd0,
|
||||
output reg mgmt_waitrequest = 0,
|
||||
input wire mgmt_write,
|
||||
|
||||
// internal interface to xaui phy block
|
||||
output wire [7:0] sc_phy_address,
|
||||
output wire sc_phy_read,
|
||||
input wire [31:0] sc_phy_readdata,
|
||||
input wire sc_phy_waitrequest,
|
||||
output wire sc_phy_write,
|
||||
|
||||
// internal interface to reconfig block
|
||||
output wire [6:0] sc_reconf_address,
|
||||
output wire sc_reconf_read,
|
||||
input wire [31:0] sc_reconf_readdata,
|
||||
input wire sc_reconf_waitrequest,
|
||||
output wire sc_reconf_write
|
||||
);
|
||||
localparam width_swa = 7; // word address width of interface to slaves (2 for phy and 1 for reconfig)
|
||||
localparam dec_count = 2; // count of the total number of sub-components that can act
|
||||
// as slaves to the mgmt interface
|
||||
localparam dec_sc_phy = 0; //
|
||||
localparam dec_reconf = 1; //
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Decoder for multiple slaves of reconfig_mgmt interface
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
wire [dec_count-1:0] r_decode; //1-hot encoding
|
||||
|
||||
//-----------------------Memory Map Reference-------------------------
|
||||
//--------------------------------------------------------------------
|
||||
//Block | Word Address | Byte Address |
|
||||
//-------------------------------------------------------------------
|
||||
//PHY Common | 0x0 | 0x0 |
|
||||
//PMA Controller | 0x20 | 0x80 |
|
||||
//Reset Controller | 0x40 | 0x100 |
|
||||
//PMA Channel Controller | 0x60 | 0x180 |
|
||||
//PCS | 0x80 | 0x200 |
|
||||
//XCVR Reconfig | 0x100 | 0x400 |
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//Decoding is based on memory map word address
|
||||
assign r_decode =
|
||||
(mgmt_address[8:width_swa+1] == dec_sc_phy) ? (({dec_count-dec_sc_phy{1'b0}} | 1'b1) << dec_sc_phy)
|
||||
: (mgmt_address[8:width_swa] == 2'd2) ? (({dec_count-dec_reconf{1'b0}} | 1'b1) << dec_reconf)
|
||||
: {dec_count{1'b0}};
|
||||
|
||||
// reconfig_mgmt output generation is muxing of decoded slave output
|
||||
always @(*) begin
|
||||
if (r_decode[dec_sc_phy] == 1'b1) begin
|
||||
mgmt_readdata = sc_phy_readdata;
|
||||
mgmt_waitrequest = sc_phy_waitrequest;
|
||||
end else if (r_decode[dec_reconf] == 1'b1) begin
|
||||
mgmt_readdata = sc_reconf_readdata;
|
||||
mgmt_waitrequest = sc_reconf_waitrequest;
|
||||
end else begin
|
||||
mgmt_readdata = -1;
|
||||
mgmt_waitrequest = 1'b0;
|
||||
end
|
||||
end
|
||||
|
||||
// internal interface to 'top' phy block
|
||||
assign sc_phy_address = mgmt_address[width_swa:0];
|
||||
assign sc_phy_read = mgmt_read & r_decode[dec_sc_phy];
|
||||
assign sc_phy_write = mgmt_write & r_decode[dec_sc_phy];
|
||||
|
||||
// internal interface to 'top' reconfig block
|
||||
assign sc_reconf_address = mgmt_address[width_swa-1:0];
|
||||
assign sc_reconf_read = mgmt_read & r_decode[dec_reconf];
|
||||
assign sc_reconf_write = mgmt_write & r_decode[dec_reconf];
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Description: Custom management interface address decoder for Altera
|
||||
// transciever PHY. Addresses common case of 3 modules to be stitched together:
|
||||
// - CSR, Alt_PMA controller, Alt_PMA_Channel controller
|
||||
//
|
||||
// Authors: dunnikri 19-Aug-2010
|
||||
//
|
||||
// Copyright (c) Altera Corporation 1997 - 2010
|
||||
// All rights reserved.
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
`timescale 1 ps / 1 ps
|
||||
|
||||
module alt_xcvr_mgmt2dec_xaui (
|
||||
|
||||
// user-visible external management interface
|
||||
input wire mgmt_clk_reset,
|
||||
input wire mgmt_clk,
|
||||
|
||||
input wire [7:0] mgmt_address,
|
||||
input wire mgmt_read,
|
||||
output reg [31:0] mgmt_readdata = ~32'd0,
|
||||
output reg mgmt_waitrequest = 0,
|
||||
input wire mgmt_write,
|
||||
|
||||
// internal interface to xaui pma channel controller
|
||||
output wire [5:0] sc_pma_ch_controller_address,
|
||||
output wire sc_pma_ch_controller_read,
|
||||
input wire [31:0] sc_pma_ch_controller_readdata,
|
||||
input wire sc_pma_ch_controller_waitrequest,
|
||||
output wire sc_pma_ch_controller_write,
|
||||
|
||||
// internal interface to pma controller block
|
||||
output wire [1:0] sc_pma_controller_address,
|
||||
output wire sc_pma_controller_read,
|
||||
input wire [31:0] sc_pma_controller_readdata,
|
||||
input wire sc_pma_controller_waitrequest,
|
||||
output wire sc_pma_controller_write,
|
||||
|
||||
// internal interface to hxaui csr block
|
||||
output wire [4:0] sc_csr_address,
|
||||
output wire sc_csr_read,
|
||||
input wire [31:0] sc_csr_readdata,
|
||||
input wire sc_csr_waitrequest,
|
||||
output wire sc_csr_write
|
||||
);
|
||||
localparam width_swa = 7; // word address width of interface to slaves (2 for phy and 1 for reconfig)
|
||||
localparam dec_count = 3; // count of the total number of sub-components that can act
|
||||
// as slaves to the mgmt interface
|
||||
|
||||
localparam dec_pma_control = 0;
|
||||
localparam dec_csr = 1;
|
||||
localparam dec_pma_ch_control = 2;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//Block | Word Address | Byte Address |
|
||||
//-------------------------------------------------------------------
|
||||
//PHY Common | 0x0 | 0x0 |
|
||||
//PMA Controller | 0x20 | 0x80 |
|
||||
//Reset Controller | 0x40 | 0x100 |
|
||||
//PMA Channel Controller | 0x60 | 0x180 |
|
||||
//PCS | 0x80 | 0x200 |
|
||||
//XCVR Reconfig | 0x100 | 0x400 |
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Decoder for multiple slaves of reconfig_mgmt interface
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
wire [dec_count-1:0] r_decode; //1-hot encoding
|
||||
|
||||
//PMA Controller - 0x20 (0010 0000)
|
||||
//Reset Controller - 0x40 (0100 0000)
|
||||
//Channel Controller - 0x60 (0110 0000)
|
||||
//PCS - 0x80 (1000 0000)
|
||||
//Consider first 3 MSBs for decoding
|
||||
/*assign r_decode =
|
||||
(mgmt_address[7:5] == 3'd1) ? (({dec_count-dec_pma_control{1'b0}} | 1'b1) << dec_pma_control)
|
||||
: (mgmt_address[7:5] == 3'd4) ? (({dec_count-dec_csr{1'b0}} | 1'b1) << dec_csr)
|
||||
: (mgmt_address[7:5] == 3'd3) ? (({dec_count-dec_pma_ch_control{1'b0}} | 1'b1) << dec_pma_ch_control)
|
||||
: {dec_count{1'b0}};*/
|
||||
|
||||
assign r_decode[0] = (!mgmt_address[7]) & (!mgmt_address[6]) & (mgmt_address[5]);
|
||||
assign r_decode[1] = (mgmt_address[7]) & (!mgmt_address[6]) & (!mgmt_address[5]);
|
||||
assign r_decode[2] = (!mgmt_address[7]) & (mgmt_address[6]);
|
||||
|
||||
|
||||
always @(*) begin
|
||||
if (r_decode[dec_pma_ch_control] == 1'b1) begin
|
||||
mgmt_readdata = sc_pma_ch_controller_readdata;
|
||||
mgmt_waitrequest = sc_pma_ch_controller_waitrequest;
|
||||
end else if (r_decode[dec_pma_control] == 1'b1) begin
|
||||
mgmt_readdata = sc_pma_controller_readdata;
|
||||
mgmt_waitrequest = sc_pma_controller_waitrequest;
|
||||
end else if (r_decode[dec_csr] == 1'b1) begin
|
||||
mgmt_readdata = sc_csr_readdata;
|
||||
mgmt_waitrequest = sc_csr_waitrequest;
|
||||
end else begin
|
||||
mgmt_readdata = -1;
|
||||
mgmt_waitrequest = 1'b0;
|
||||
end
|
||||
end
|
||||
|
||||
// internal interface to alt_pma_ch_control block
|
||||
assign sc_pma_ch_controller_address = mgmt_address[5:0]; //6 bit address
|
||||
assign sc_pma_ch_controller_read = mgmt_read & r_decode[dec_pma_ch_control];
|
||||
assign sc_pma_ch_controller_write = mgmt_write & r_decode[dec_pma_ch_control];
|
||||
|
||||
// internal interface to pma_control block
|
||||
assign sc_pma_controller_address = mgmt_address[1:0]; // 2 bit address
|
||||
assign sc_pma_controller_read = mgmt_read & r_decode[dec_pma_control];
|
||||
assign sc_pma_controller_write = mgmt_write & r_decode[dec_pma_control];
|
||||
|
||||
// internal interface to csr block
|
||||
assign sc_csr_address = mgmt_address[4:0]; // 5 bit address
|
||||
assign sc_csr_read = mgmt_read & r_decode[dec_csr];
|
||||
assign sc_csr_write = mgmt_write & r_decode[dec_csr];
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
|
||||
// File Name: alt_xcvr_reset_counter
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
// A simple counter targeted for a reset controller. The parameters specify the clock domain's
|
||||
// clock frequency and the desired reset period specified in nanoseconds. The caller may specify
|
||||
// the active level of the internal reset flop.
|
||||
//
|
||||
// The async_req input signal is active high. The reset outputs
|
||||
// will remain asserted while async_req is asserted and will not deassert
|
||||
// until the specified reset period has expired.
|
||||
// The sync_req input behaves similar to the async_req but is sampled
|
||||
// synchronously with the clock.
|
||||
// The "reset_or" input does not reset the counter but directly asserts the reset output flop.
|
||||
// The reset outputs will remain asserted so long as "reset_or" is asserted.
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// Special notes:
|
||||
//
|
||||
|
||||
`timescale 1ns / 1ns
|
||||
|
||||
module alt_xcvr_reset_counter #(
|
||||
parameter CLKS_PER_SEC = 25000000, // Clock frequency in Hz
|
||||
parameter RESET_PER_NS = 1000000, // Reset period in ns
|
||||
parameter RESET_COUNT = 0, // Overrides RESET_PER_NS
|
||||
parameter ACTIVE_LEVEL = 1 //
|
||||
) (
|
||||
input clk,
|
||||
input async_req, // asynchronous reset request (restart sequence)
|
||||
input sync_req, // synchronous reset request
|
||||
input reset_or, // auxilliary reset override (assert only)
|
||||
|
||||
output reset, // synchronous reset out
|
||||
output reset_n, // negation of reset
|
||||
output reset_stat // reset status (intended for control logic)
|
||||
);
|
||||
|
||||
// Determine unrounded counter limit based on passed frequency
|
||||
localparam [63:0] INITIAL_COUNT = (CLKS_PER_SEC * RESET_PER_NS) / 1000000000;
|
||||
// Round counter limit up if needed
|
||||
localparam [63:0] ROUND_COUNT = (((INITIAL_COUNT * 1000000000) / CLKS_PER_SEC) < RESET_PER_NS)
|
||||
? (INITIAL_COUNT + 1) : INITIAL_COUNT;
|
||||
// Use given counter limit if provided (RESET_COUNT), otherwise use calculated counter limit
|
||||
localparam MAX_CNT = (RESET_COUNT == 0) ? ROUND_COUNT - 1 : RESET_COUNT - 1;
|
||||
localparam CNT_WIDTH = altera_xcvr_functions::clogb2(MAX_CNT);
|
||||
// 1 bit wide active level
|
||||
localparam LCL_ACTIVE_LEVEL = (ACTIVE_LEVEL == 0) ? 1'b0 : 1'b1;
|
||||
|
||||
// Counter signals
|
||||
reg [CNT_WIDTH-1:0] count = {CNT_WIDTH{1'b0}};
|
||||
wire count_lim;
|
||||
|
||||
// Internal reset signals
|
||||
(* dont_merge *)
|
||||
reg r_reset; // Reset output register
|
||||
reg r_reset_stat; // Reset status register
|
||||
wire reset_cond; // Condition for reset
|
||||
|
||||
// Reset counter
|
||||
//***************************************************************************
|
||||
//**************************** Reset counter ********************************
|
||||
assign count_lim = (count == MAX_CNT);
|
||||
always @(posedge clk or posedge async_req)
|
||||
if(async_req) count <= {CNT_WIDTH{1'b0}};
|
||||
else if(sync_req) count <= {CNT_WIDTH{1'b0}};
|
||||
else if(~count_lim) count <= count + 1'b1;
|
||||
//************************** End Reset counter ******************************
|
||||
//***************************************************************************
|
||||
|
||||
|
||||
//***************************************************************************
|
||||
//********************** Internal reset register ****************************
|
||||
// The condition for a reset (other than asynchrnous reset) are:
|
||||
// 1 - Synchronous reset request
|
||||
// 2 - Timer has not expired.
|
||||
// 3 - Reset override is asserted
|
||||
assign reset_cond = (sync_req | ~count_lim | reset_or);
|
||||
|
||||
// Reset register
|
||||
always @(posedge clk or posedge async_req)
|
||||
if(async_req) r_reset <= LCL_ACTIVE_LEVEL;
|
||||
else r_reset <= ~(reset_cond ^ LCL_ACTIVE_LEVEL);
|
||||
|
||||
// External reset status generation. We create a status of the reset
|
||||
// output simply so we can allow the actual reset output to drive resets
|
||||
// with limited fanout to other logic. This status output is intended
|
||||
// to be used for reset control logic.
|
||||
assign reset_stat = r_reset_stat;
|
||||
always @(posedge clk or posedge async_req)
|
||||
if(async_req) r_reset_stat <= 1'b1;
|
||||
else r_reset_stat <= reset_cond;
|
||||
//******************** End Internal reset register **************************
|
||||
//***************************************************************************
|
||||
|
||||
|
||||
//***************************************************************************
|
||||
//*********************** Reset output generation ***************************
|
||||
// External reset generation
|
||||
generate if (ACTIVE_LEVEL == 0) begin : g_active_low_resets
|
||||
assign reset = ~r_reset;
|
||||
assign reset_n = r_reset;
|
||||
end else begin : g_active_high_resets
|
||||
assign reset = r_reset;
|
||||
assign reset_n = ~r_reset;
|
||||
end
|
||||
endgenerate
|
||||
//********************* End Reset output generation *************************
|
||||
//***************************************************************************
|
||||
|
||||
endmodule
|
||||
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
// Module: alt_xcvr_resync
|
||||
//
|
||||
// Description:
|
||||
// A general purpose resynchronization module.
|
||||
//
|
||||
// Parameters:
|
||||
// SYNC_CHAIN_LENGTH
|
||||
// - Specifies the length of the synchronizer chain for metastability
|
||||
// retiming.
|
||||
// WIDTH
|
||||
// - Specifies the number of bits you want to synchronize. Controls the width of the
|
||||
// d and q ports.
|
||||
// SLOW_CLOCK - USE WITH CAUTION.
|
||||
// - Leaving this setting at its default will create a standard resynch circuit that
|
||||
// merely passes the input data through a chain of flip-flops. This setting assumes
|
||||
// that the input data has a pulse width longer than one clock cycle sufficient to
|
||||
// satisfy setup and hold requirements on at least one clock edge.
|
||||
// - By setting this to 1 (USE CAUTION) you are creating an asynchronous
|
||||
// circuit that will capture the input data regardless of the pulse width and
|
||||
// its relationship to the clock. However it is more difficult to apply static
|
||||
// timing constraints as it ties the data input to the clock input of the flop.
|
||||
// This implementation assumes the data rate is slow enough
|
||||
// INIT_VALUE
|
||||
// - Specifies the initial values of the synchronization registers.
|
||||
//
|
||||
// Apply embedded false path timing constraint
|
||||
(* altera_attribute = "-name SDC_STATEMENT \"set regs [get_registers -nowarn *alt_xcvr_resync*sync_r[0]]; if {[llength [query_collection -report -all $regs]] > 0} {set_false_path -to $regs}\"" *)
|
||||
|
||||
`timescale 1ps/1ps
|
||||
|
||||
module alt_xcvr_resync #(
|
||||
parameter SYNC_CHAIN_LENGTH = 2, // Number of flip-flops for retiming. Must be >1
|
||||
parameter WIDTH = 1, // Number of bits to resync
|
||||
parameter SLOW_CLOCK = 0, // See description above
|
||||
parameter INIT_VALUE = 0
|
||||
) (
|
||||
input wire clk,
|
||||
input wire reset,
|
||||
input wire [WIDTH-1:0] d,
|
||||
output wire [WIDTH-1:0] q
|
||||
);
|
||||
|
||||
localparam INT_LEN = (SYNC_CHAIN_LENGTH > 1) ? SYNC_CHAIN_LENGTH : 2;
|
||||
localparam [INT_LEN-1:0] L_INIT_VALUE = (INIT_VALUE == 1) ? {INT_LEN{1'b1}} : {INT_LEN{1'b0}};
|
||||
|
||||
genvar ig;
|
||||
|
||||
// Generate a synchronizer chain for each bit
|
||||
generate begin
|
||||
for(ig=0;ig<WIDTH;ig=ig+1) begin : resync_chains
|
||||
wire d_in; // Input to sychronization chain.
|
||||
(* altera_attribute = "disable_da_rule=D103" *)
|
||||
reg [INT_LEN-1:0] sync_r = L_INIT_VALUE;
|
||||
|
||||
assign q[ig] = sync_r[INT_LEN-1]; // Output signal
|
||||
|
||||
always @(posedge clk or posedge reset)
|
||||
if(reset)
|
||||
sync_r <= L_INIT_VALUE;
|
||||
else
|
||||
sync_r <= {sync_r[INT_LEN-2:0],d_in};
|
||||
|
||||
// Generate asynchronous capture circuit if specified.
|
||||
if(SLOW_CLOCK == 0) begin
|
||||
assign d_in = d[ig];
|
||||
end else begin
|
||||
wire d_clk;
|
||||
reg d_r = L_INIT_VALUE[0];
|
||||
wire clr_n;
|
||||
|
||||
assign d_clk = d[ig];
|
||||
assign d_in = d_r;
|
||||
assign clr_n = ~q[ig] | d_clk; // Clear when output is logic 1 and input is logic 0
|
||||
|
||||
// Asynchronously latch the input signal.
|
||||
always @(posedge d_clk or negedge clr_n)
|
||||
if(!clr_n) d_r <= 1'b0;
|
||||
else if(d_clk) d_r <= 1'b1;
|
||||
end // SLOW_CLOCK
|
||||
end // for loop
|
||||
end // generate
|
||||
endgenerate
|
||||
|
||||
endmodule
|
||||
Binary file not shown.
|
|
@ -0,0 +1,195 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
// $Id: //acds/main/ip/sopc/components/primitives/altera_std_synchronizer/altera_std_synchronizer.v#8 $
|
||||
// $Revision: #8 $
|
||||
// $Date: 2009/02/18 $
|
||||
// $Author: pscheidt $
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// File: altera_std_synchronizer_nocut.v
|
||||
//
|
||||
// Abstract: Single bit clock domain crossing synchronizer. Exactly the same
|
||||
// as altera_std_synchronizer.v, except that the embedded false
|
||||
// path constraint is removed in this module. If you use this
|
||||
// module, you will have to apply the appropriate timing
|
||||
// constraints.
|
||||
//
|
||||
// We expect to make this a standard Quartus atom eventually.
|
||||
//
|
||||
// Composed of two or more flip flops connected in series.
|
||||
// Random metastable condition is simulated when the
|
||||
// __ALTERA_STD__METASTABLE_SIM macro is defined.
|
||||
// Use +define+__ALTERA_STD__METASTABLE_SIM argument
|
||||
// on the Verilog simulator compiler command line to
|
||||
// enable this mode. In addition, define the macro
|
||||
// __ALTERA_STD__METASTABLE_SIM_VERBOSE to get console output
|
||||
// with every metastable event generated in the synchronizer.
|
||||
//
|
||||
// Copyright (C) Altera Corporation 2009, All Rights Reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
`timescale 1ns / 1ns
|
||||
|
||||
module altera_std_synchronizer (
|
||||
clk,
|
||||
reset_n,
|
||||
din,
|
||||
dout
|
||||
);
|
||||
|
||||
parameter depth = 3; // This value must be >= 2 !
|
||||
parameter rst_value = 0;
|
||||
|
||||
input clk;
|
||||
input reset_n;
|
||||
input din;
|
||||
output dout;
|
||||
|
||||
// QuartusII synthesis directives:
|
||||
// 1. Preserve all registers ie. do not touch them.
|
||||
// 2. Do not merge other flip-flops with synchronizer flip-flops.
|
||||
// QuartusII TimeQuest directives:
|
||||
// 1. Identify all flip-flops in this module as members of the synchronizer
|
||||
// to enable automatic metastability MTBF analysis.
|
||||
|
||||
(* altera_attribute = {"-name ADV_NETLIST_OPT_ALLOWED NEVER_ALLOW; -name SYNCHRONIZER_IDENTIFICATION FORCED; -name DONT_MERGE_REGISTER ON; -name PRESERVE_REGISTER ON "} *) reg din_s1;
|
||||
|
||||
(* altera_attribute = {"-name ADV_NETLIST_OPT_ALLOWED NEVER_ALLOW; -name DONT_MERGE_REGISTER ON; -name PRESERVE_REGISTER ON"} *) reg [depth-2:0] dreg;
|
||||
|
||||
//synthesis translate_off
|
||||
initial begin
|
||||
if (depth <2) begin
|
||||
$display("%m: Error: synchronizer length: %0d less than 2.", depth);
|
||||
end
|
||||
end
|
||||
|
||||
// the first synchronizer register is either a simple D flop for synthesis
|
||||
// and non-metastable simulation or a D flop with a method to inject random
|
||||
// metastable events resulting in random delay of [0,1] cycles
|
||||
|
||||
`ifdef __ALTERA_STD__METASTABLE_SIM
|
||||
|
||||
reg[31:0] RANDOM_SEED = 123456;
|
||||
wire next_din_s1;
|
||||
wire dout;
|
||||
reg din_last;
|
||||
reg random;
|
||||
event metastable_event; // hook for debug monitoring
|
||||
|
||||
initial begin
|
||||
$display("%m: Info: Metastable event injection simulation mode enabled");
|
||||
end
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (reset_n == 0)
|
||||
random <= $random(RANDOM_SEED);
|
||||
else
|
||||
random <= $random;
|
||||
end
|
||||
|
||||
assign next_din_s1 = (din_last ^ din) ? random : din;
|
||||
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (reset_n == 0)
|
||||
din_last <= (rst_value == 0)? 1'b0 : 1'b1;
|
||||
else
|
||||
din_last <= din;
|
||||
end
|
||||
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (reset_n == 0)
|
||||
din_s1 <= (rst_value == 0)? 1'b0 : 1'b1;
|
||||
else
|
||||
din_s1 <= next_din_s1;
|
||||
end
|
||||
|
||||
`else
|
||||
|
||||
//synthesis translate_on
|
||||
generate if (rst_value == 0)
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (reset_n == 0)
|
||||
din_s1 <= 1'b0;
|
||||
else
|
||||
din_s1 <= din;
|
||||
end
|
||||
endgenerate
|
||||
|
||||
generate if (rst_value == 1)
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (reset_n == 0)
|
||||
din_s1 <= 1'b1;
|
||||
else
|
||||
din_s1 <= din;
|
||||
end
|
||||
endgenerate
|
||||
//synthesis translate_off
|
||||
|
||||
`endif
|
||||
|
||||
`ifdef __ALTERA_STD__METASTABLE_SIM_VERBOSE
|
||||
always @(*) begin
|
||||
if (reset_n && (din_last != din) && (random != din)) begin
|
||||
$display("%m: Verbose Info: metastable event @ time %t", $time);
|
||||
->metastable_event;
|
||||
end
|
||||
end
|
||||
`endif
|
||||
|
||||
//synthesis translate_on
|
||||
|
||||
// the remaining synchronizer registers form a simple shift register
|
||||
// of length depth-1
|
||||
generate if (rst_value == 0)
|
||||
if (depth < 3) begin
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (reset_n == 0)
|
||||
dreg <= {depth-1{1'b0}};
|
||||
else
|
||||
dreg <= din_s1;
|
||||
end
|
||||
end else begin
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (reset_n == 0)
|
||||
dreg <= {depth-1{1'b0}};
|
||||
else
|
||||
dreg <= {dreg[depth-3:0], din_s1};
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
|
||||
generate if (rst_value == 1)
|
||||
if (depth < 3) begin
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (reset_n == 0)
|
||||
dreg <= {depth-1{1'b1}};
|
||||
else
|
||||
dreg <= din_s1;
|
||||
end
|
||||
end else begin
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (reset_n == 0)
|
||||
dreg <= {depth-1{1'b1}};
|
||||
else
|
||||
dreg <= {dreg[depth-3:0], din_s1};
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
|
||||
assign dout = dreg[depth-2];
|
||||
|
||||
endmodule
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
// $Id: //acds/main/ip/sopc/components/primitives/altera_std_synchronizer/altera_std_synchronizer.v#8 $
|
||||
// $Revision: #8 $
|
||||
// $Date: 2009/02/18 $
|
||||
// $Author: pscheidt $
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// File: altera_std_synchronizer_nocut.v
|
||||
//
|
||||
// Abstract: Single bit clock domain crossing synchronizer. Exactly the same
|
||||
// as altera_std_synchronizer.v, except that the embedded false
|
||||
// path constraint is removed in this module. If you use this
|
||||
// module, you will have to apply the appropriate timing
|
||||
// constraints.
|
||||
//
|
||||
// We expect to make this a standard Quartus atom eventually.
|
||||
//
|
||||
// Composed of two or more flip flops connected in series.
|
||||
// Random metastable condition is simulated when the
|
||||
// __ALTERA_STD__METASTABLE_SIM macro is defined.
|
||||
// Use +define+__ALTERA_STD__METASTABLE_SIM argument
|
||||
// on the Verilog simulator compiler command line to
|
||||
// enable this mode. In addition, define the macro
|
||||
// __ALTERA_STD__METASTABLE_SIM_VERBOSE to get console output
|
||||
// with every metastable event generated in the synchronizer.
|
||||
//
|
||||
// Copyright (C) Altera Corporation 2009, All Rights Reserved
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
`timescale 1ns / 1ns
|
||||
|
||||
module altera_std_synchronizer_nocut (
|
||||
clk,
|
||||
reset_n,
|
||||
din,
|
||||
dout
|
||||
);
|
||||
|
||||
parameter depth = 3; // This value must be >= 2 !
|
||||
parameter rst_value = 0;
|
||||
|
||||
input clk;
|
||||
input reset_n;
|
||||
input din;
|
||||
output dout;
|
||||
|
||||
// QuartusII synthesis directives:
|
||||
// 1. Preserve all registers ie. do not touch them.
|
||||
// 2. Do not merge other flip-flops with synchronizer flip-flops.
|
||||
// QuartusII TimeQuest directives:
|
||||
// 1. Identify all flip-flops in this module as members of the synchronizer
|
||||
// to enable automatic metastability MTBF analysis.
|
||||
|
||||
(* altera_attribute = {"-name ADV_NETLIST_OPT_ALLOWED NEVER_ALLOW; -name SYNCHRONIZER_IDENTIFICATION FORCED; -name DONT_MERGE_REGISTER ON; -name PRESERVE_REGISTER ON "} *) reg din_s1;
|
||||
|
||||
(* altera_attribute = {"-name ADV_NETLIST_OPT_ALLOWED NEVER_ALLOW; -name DONT_MERGE_REGISTER ON; -name PRESERVE_REGISTER ON"} *) reg [depth-2:0] dreg;
|
||||
|
||||
//synthesis translate_off
|
||||
initial begin
|
||||
if (depth <2) begin
|
||||
$display("%m: Error: synchronizer length: %0d less than 2.", depth);
|
||||
end
|
||||
end
|
||||
|
||||
// the first synchronizer register is either a simple D flop for synthesis
|
||||
// and non-metastable simulation or a D flop with a method to inject random
|
||||
// metastable events resulting in random delay of [0,1] cycles
|
||||
|
||||
`ifdef __ALTERA_STD__METASTABLE_SIM
|
||||
|
||||
reg[31:0] RANDOM_SEED = 123456;
|
||||
wire next_din_s1;
|
||||
wire dout;
|
||||
reg din_last;
|
||||
reg random;
|
||||
event metastable_event; // hook for debug monitoring
|
||||
|
||||
initial begin
|
||||
$display("%m: Info: Metastable event injection simulation mode enabled");
|
||||
end
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (reset_n == 0)
|
||||
random <= $random(RANDOM_SEED);
|
||||
else
|
||||
random <= $random;
|
||||
end
|
||||
|
||||
assign next_din_s1 = (din_last ^ din) ? random : din;
|
||||
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (reset_n == 0)
|
||||
din_last <= (rst_value == 0)? 1'b0 : 1'b1;
|
||||
else
|
||||
din_last <= din;
|
||||
end
|
||||
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (reset_n == 0)
|
||||
din_s1 <= (rst_value == 0)? 1'b0 : 1'b1;
|
||||
else
|
||||
din_s1 <= next_din_s1;
|
||||
end
|
||||
|
||||
`else
|
||||
|
||||
//synthesis translate_on
|
||||
generate if (rst_value == 0)
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (reset_n == 0)
|
||||
din_s1 <= 1'b0;
|
||||
else
|
||||
din_s1 <= din;
|
||||
end
|
||||
endgenerate
|
||||
|
||||
generate if (rst_value == 1)
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (reset_n == 0)
|
||||
din_s1 <= 1'b1;
|
||||
else
|
||||
din_s1 <= din;
|
||||
end
|
||||
endgenerate
|
||||
//synthesis translate_off
|
||||
|
||||
`endif
|
||||
|
||||
`ifdef __ALTERA_STD__METASTABLE_SIM_VERBOSE
|
||||
always @(*) begin
|
||||
if (reset_n && (din_last != din) && (random != din)) begin
|
||||
$display("%m: Verbose Info: metastable event @ time %t", $time);
|
||||
->metastable_event;
|
||||
end
|
||||
end
|
||||
`endif
|
||||
|
||||
//synthesis translate_on
|
||||
|
||||
// the remaining synchronizer registers form a simple shift register
|
||||
// of length depth-1
|
||||
generate if (rst_value == 0)
|
||||
if (depth < 3) begin
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (reset_n == 0)
|
||||
dreg <= {depth-1{1'b0}};
|
||||
else
|
||||
dreg <= din_s1;
|
||||
end
|
||||
end else begin
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (reset_n == 0)
|
||||
dreg <= {depth-1{1'b0}};
|
||||
else
|
||||
dreg <= {dreg[depth-3:0], din_s1};
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
|
||||
generate if (rst_value == 1)
|
||||
if (depth < 3) begin
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (reset_n == 0)
|
||||
dreg <= {depth-1{1'b1}};
|
||||
else
|
||||
dreg <= din_s1;
|
||||
end
|
||||
end else begin
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (reset_n == 0)
|
||||
dreg <= {depth-1{1'b1}};
|
||||
else
|
||||
dreg <= {dreg[depth-3:0], din_s1};
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
|
||||
assign dout = dreg[depth-2];
|
||||
|
||||
endmodule
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
`timescale 1 ps / 1 ps
|
||||
module altera_wait_generate
|
||||
//#(
|
||||
//This code only works when wait_cycle =1, if need other case, you need to modify this code.
|
||||
//please set wait_cycle default value as 1 to keep old design works.
|
||||
// parameter wait_cycle =1
|
||||
// )
|
||||
(
|
||||
input wire rst,
|
||||
input wire clk,
|
||||
input wire launch_signal,
|
||||
output wire wait_req
|
||||
);
|
||||
reg launch_reg = 0;
|
||||
reg wait_reg = 0;
|
||||
always @ (posedge clk, posedge rst) begin
|
||||
if(rst) launch_reg <= 1'b0;
|
||||
else launch_reg <= launch_signal;
|
||||
end
|
||||
always @ (posedge clk, posedge rst) begin
|
||||
if(rst) wait_reg <= 1'b0;
|
||||
else wait_reg <= launch_signal & launch_reg & (! wait_reg & !wait_req);
|
||||
end
|
||||
|
||||
|
||||
// waitrequest should be asserted during reset - note that in the reconfig
|
||||
// controller, reset is locally synchronized. If you are using this module
|
||||
// outside the reconfig controller, you may want to ensure that the reset
|
||||
// signal is synchronized to prevent glitches, as waitrequest is not
|
||||
// necessarily a registered output.
|
||||
wire reset_sync;
|
||||
alt_xcvr_resync #(.INIT_VALUE (1)) rst_sync (.clk(clk),.reset(rst),.d(1'b0),.q(reset_sync));
|
||||
|
||||
assign wait_req = reset_sync | (launch_signal & ~launch_reg) | (wait_reg & launch_signal ) ;
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,906 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
//
|
||||
// Common functions for transceiver PHY IP
|
||||
//
|
||||
// $Header$
|
||||
//
|
||||
// PACKAGE DECLARATION
|
||||
package altera_xcvr_functions;
|
||||
localparam integer MAX_CHARS = 86; // To accomodate LONG parameter lists.
|
||||
localparam integer MAX_STRS = 16;
|
||||
localparam integer MAX_XCVR_CHANNELS = 64;
|
||||
|
||||
|
||||
// Reconfiguration bundle widths per family
|
||||
localparam integer W_S5_RECONFIG_BUNDLE_TO_XCVR = 70;
|
||||
localparam integer W_S5_RECONFIG_BUNDLE_FROM_XCVR = 46;
|
||||
localparam integer W_A5_RECONFIG_BUNDLE_TO_XCVR = 70;
|
||||
localparam integer W_A5_RECONFIG_BUNDLE_FROM_XCVR = 46;
|
||||
localparam integer W_S4_RECONFIG_BUNDLE_TO_XCVR = 4;
|
||||
localparam integer W_S4_RECONFIG_BUNDLE_FROM_XCVR = 17;
|
||||
localparam integer W_C4_RECONFIG_BUNDLE_TO_XCVR = 4;
|
||||
localparam integer W_C4_RECONFIG_BUNDLE_FROM_XCVR = 17;
|
||||
|
||||
// Reconfiguration bundle widths per family
|
||||
localparam integer W_S5_RECONFIG_BUNDLE_TO_GXB = W_S5_RECONFIG_BUNDLE_TO_XCVR;
|
||||
localparam integer W_S5_RECONFIG_BUNDLE_FROM_GXB = W_S5_RECONFIG_BUNDLE_FROM_XCVR;
|
||||
localparam integer W_A5_RECONFIG_BUNDLE_TO_GXB = W_A5_RECONFIG_BUNDLE_TO_XCVR;
|
||||
localparam integer W_A5_RECONFIG_BUNDLE_FROM_GXB = W_A5_RECONFIG_BUNDLE_FROM_XCVR;
|
||||
localparam integer W_S4_RECONFIG_BUNDLE_TO_GXB = W_S4_RECONFIG_BUNDLE_TO_XCVR;
|
||||
localparam integer W_S4_RECONFIG_BUNDLE_FROM_GXB = W_S4_RECONFIG_BUNDLE_FROM_XCVR;
|
||||
localparam integer W_C4_RECONFIG_BUNDLE_TO_GXB = W_C4_RECONFIG_BUNDLE_TO_XCVR;
|
||||
localparam integer W_C4_RECONFIG_BUNDLE_FROM_GXB = W_C4_RECONFIG_BUNDLE_FROM_XCVR;
|
||||
|
||||
// convert frequency string into integer Hz. Fractional Hz are truncated
|
||||
// Must remain a constant function - can't use string.atoi().
|
||||
function time str2hz (
|
||||
input [8*MAX_CHARS:1] s
|
||||
);
|
||||
|
||||
integer i;
|
||||
integer c; // temp char storage for frequency conversion
|
||||
integer unit_tens; // assume already Hz
|
||||
integer is_numeric;
|
||||
integer saw_dot;
|
||||
|
||||
reg [8:1] c_dot; // = ".";
|
||||
reg [8:1] c_space; // = " ";
|
||||
reg [8:1] c_a; // = 8'h61; //"a";
|
||||
reg [8:1] c_z; // = 8'h7a; //"z";
|
||||
reg [8*4:1] s_unit;
|
||||
reg [8*MAX_CHARS:1] s_shift;
|
||||
|
||||
begin
|
||||
// frequency ratio calculations
|
||||
str2hz = 0;
|
||||
unit_tens = 0; // assume already Hz
|
||||
is_numeric = 1;
|
||||
saw_dot = 0;
|
||||
s_unit = "";
|
||||
|
||||
// Modelsim optimizer bug forces us to initialize these non-statically
|
||||
c_dot = ".";
|
||||
c_space = " ";
|
||||
c_a = "a";
|
||||
c_z = "z";
|
||||
for (i=(MAX_CHARS-1); i>=0; i=i-1) begin
|
||||
s_shift = (s >> (i*8));
|
||||
c = s_shift[8:1] & 8'hff;
|
||||
if (c > 0) begin
|
||||
//$display("[%d] => '%1s',", i, c);
|
||||
if (c >= 8'h30 && c <= 8'h39 && is_numeric) begin
|
||||
str2hz = (str2hz * 10) + (c & 8'h0f);
|
||||
if (saw_dot) unit_tens = unit_tens - 1; // count digits after decimal point
|
||||
end else if (c == c_dot) saw_dot = 1;
|
||||
else if (c != c_space) begin
|
||||
is_numeric = 0; // stop accepting new numeric digits in value
|
||||
// if it's a-z, convert to upper case A-Z
|
||||
if (c >= c_a && c <= c_z) c = (c & 8'h5f); // convert a-z (lower) to A-Z (upper)
|
||||
s_unit = (s_unit << 8) | c;
|
||||
end
|
||||
end
|
||||
end
|
||||
//$display("numeric = %d x 10**(%2d), unit = '%0s'", str2hz, unit_tens, s_unit);
|
||||
|
||||
// account for frequency unit
|
||||
if (s_unit == "GHZ" || s_unit == "GBPS") unit_tens = unit_tens + 9; // 10**9
|
||||
else if (s_unit == "MHZ" || s_unit == "MBPS") unit_tens = unit_tens + 6; // 10**6
|
||||
else if (s_unit == "KHZ" || s_unit == "KBPS") unit_tens = unit_tens + 3; // 10**3
|
||||
else if (s_unit != "HZ" && s_unit != "BPS") begin
|
||||
$display("Invalid frequency unit '%0s', assuming %d x 10**(%2d) 'Hz'", s_unit, str2hz, unit_tens);
|
||||
end
|
||||
//$display("numeric in Hz = %d x 10**(%2d)", str2hz, unit_tens);
|
||||
|
||||
// align numeric to Hz
|
||||
if (unit_tens < 0) begin
|
||||
//str2hz = str2hz / (10**(-unit_tens));
|
||||
for (i=0; i>unit_tens; i=i-1) begin
|
||||
str2hz = str2hz / 10;
|
||||
end
|
||||
end else begin
|
||||
//str2hz = str2hz * (10**unit_tens);
|
||||
for (i=0; i<unit_tens; i=i+1) begin
|
||||
str2hz = str2hz * 10;
|
||||
end
|
||||
end
|
||||
//$display("%d Hz", str2hz);
|
||||
end
|
||||
endfunction
|
||||
|
||||
// convert integer Hz to a frequency string
|
||||
// integer Hz as type time, and the frequency string will use MHz units
|
||||
// Must remain a constant function - can't use $sformat or string.itoa().
|
||||
function [MAX_CHARS*8-1:0] hz2str (
|
||||
input time hz
|
||||
);
|
||||
integer pos;
|
||||
integer f_unit; // 10**f_unit is offset from Hz for larger unit
|
||||
time hz_mod_10;
|
||||
begin
|
||||
hz2str = "0.000000 MHz"; // minimum string value
|
||||
f_unit = 6; // MHz offsets Hz value by 6 decimal digits
|
||||
|
||||
// convert time back to string with frequency units
|
||||
// char positions 3 to 0 are used by " MHz", so start with digits at pos 4
|
||||
for (pos = 4; pos < MAX_CHARS && hz > 0; pos = pos + 1) begin
|
||||
if (f_unit == 0) begin
|
||||
hz2str[pos*8 +: 8] = 8'h2e; // add "." character
|
||||
pos = pos + 1;
|
||||
end
|
||||
f_unit = f_unit - 1;
|
||||
hz_mod_10 = (hz % 10);
|
||||
hz2str[pos*8 +: 8] = hz_mod_10[7:0] | 8'h30;
|
||||
hz = hz / 10;
|
||||
//$display("hz2str() => so far '%s', pos (%d), f_unit(%d) ", hz2str, pos, f_unit);
|
||||
end
|
||||
//$display("hz2str() returns '%s'", hz2str);
|
||||
end
|
||||
endfunction
|
||||
|
||||
// Convert a string to an integer
|
||||
// Uses pre-existing str2hz function
|
||||
function integer str2int(
|
||||
input [MAX_CHARS*8-1:0] instring
|
||||
);
|
||||
time temp;
|
||||
temp = str2hz(instring); // str2hz assume Hertz as default unit. Don't need to add 'Hz' to input.
|
||||
str2int = temp[31:0];
|
||||
endfunction
|
||||
|
||||
|
||||
// Convert an integer to a string
|
||||
function [MAX_CHARS*8-1:0] int2str(
|
||||
input integer in_int
|
||||
);
|
||||
integer i;
|
||||
integer this_char;
|
||||
i = 0;
|
||||
int2str = "";
|
||||
do
|
||||
begin
|
||||
this_char = (in_int % 10) + 48;
|
||||
int2str[i*8+:8] = this_char[7:0];
|
||||
i=i+1;
|
||||
in_int = in_int / 10;
|
||||
end
|
||||
while(in_int > 0);
|
||||
endfunction
|
||||
|
||||
// function to convert at most 40-bit long string to binary
|
||||
function [39 : 0] m_str_to_bin;
|
||||
input [40*8 : 1] s;
|
||||
reg [40*8 : 1] reg_s;
|
||||
reg [40:1] res;
|
||||
|
||||
integer m;
|
||||
begin
|
||||
|
||||
reg_s = s;
|
||||
for (m = 40; m > 0; m = m-1 )
|
||||
begin
|
||||
res[m] = reg_s[313];
|
||||
reg_s = reg_s << 8;
|
||||
end
|
||||
|
||||
m_str_to_bin = res;
|
||||
end
|
||||
endfunction
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
// Convert the argument string to a 64-bit binary value
|
||||
// @hex_str The string to be converted specified as an ASCII hexadecimal string
|
||||
function [63:0] m_hex_to_bin (
|
||||
input [8*MAX_CHARS-1:0] hex_str
|
||||
);
|
||||
integer i;
|
||||
|
||||
reg [63:0] out; // = 64'h0000_0000_0000_0000;
|
||||
reg [7:0] this_char;
|
||||
|
||||
begin
|
||||
|
||||
out = 64'h0000_0000_0000_0000;
|
||||
|
||||
for(i=0; i<16; i=i+1) begin
|
||||
this_char = hex_str[i*8+:8];
|
||||
if(this_char >= 48 && this_char <= 57)
|
||||
out[i*4+:4] = this_char - 48;
|
||||
else if(this_char >= 65 && this_char <= 70)
|
||||
out[i*4+:4] = this_char - 55;
|
||||
else if(this_char >= 97 && this_char <= 102)
|
||||
out[i*4+:4] = this_char - 87;
|
||||
else begin
|
||||
out[i*4+:4] = 0;
|
||||
end
|
||||
end
|
||||
end
|
||||
m_hex_to_bin = out;
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Verify that the string value is contained in the legal set.
|
||||
//
|
||||
// The 'set' can consist of a single string with no delimiters, e.g. "individual",
|
||||
// or multiple values, separated by commas, and surrounded by parens, e.g. "(one,two,three,four,five)"
|
||||
//
|
||||
// Returns 1 if the value is in the set, and 0 otherwise
|
||||
function integer is_in_legal_set(
|
||||
input [MAX_CHARS*8-1:0] value,
|
||||
input [MAX_STRS*MAX_CHARS*8-1:0] set
|
||||
);
|
||||
if (value == "<auto_any>")
|
||||
is_in_legal_set = 1;
|
||||
else if (value == "<auto_single>")
|
||||
is_in_legal_set = (set[7:0] == 8'h29) ? 0 : 1; // 8'h29 is closing parenthesis char
|
||||
else if (value == set)
|
||||
is_in_legal_set = 1; // value matches single value in set
|
||||
else begin
|
||||
// check value against each in set
|
||||
integer close_pos; // end of string marker can be comma or closing paren
|
||||
integer open_pos; // open paren is start of set, if appropriate
|
||||
reg [MAX_STRS*MAX_CHARS*8-1:0] legalstr;
|
||||
|
||||
is_in_legal_set = 0;
|
||||
open_pos = MAX_STRS*MAX_CHARS-1;
|
||||
// Remove closing parenthesis if exists
|
||||
if(set[7:0] == 8'h29) begin
|
||||
set = (set >> 8);
|
||||
set[(MAX_STRS*MAX_CHARS*8-1)-:8] = 8'h00;
|
||||
end
|
||||
// look for first non-null and non open paren character
|
||||
while (open_pos > 0 && (set[open_pos*8 +: 8] == 8'h00 || set[open_pos*8 +: 8] == 8'h28)) // look for first non-null
|
||||
open_pos = open_pos - 1;
|
||||
|
||||
while (is_in_legal_set == 0 && open_pos >= 0) begin
|
||||
close_pos = open_pos;
|
||||
while (close_pos > 0
|
||||
&& set[close_pos*8 +: 8] != 8'h2c) // look for comma (8'h2c)
|
||||
close_pos = close_pos - 1;
|
||||
if (close_pos >= 0) begin
|
||||
close_pos = close_pos == 0 ? 0 : close_pos + 1;
|
||||
legalstr = ((set & ((1'b1 << open_pos*8+8)-1)) >> close_pos*8);
|
||||
if (value == legalstr)
|
||||
is_in_legal_set = 1;
|
||||
end
|
||||
open_pos = close_pos-2; // prepare to look for next legal string
|
||||
end
|
||||
end
|
||||
//$display("is_in_legal_set(): returns %d", is_in_legal_set);
|
||||
endfunction
|
||||
|
||||
|
||||
// Accepts a string list of comma seperated numbers and returns a binary
|
||||
// field where each bit indicates whether the index corresponding to that bit
|
||||
// was found in the legal set.
|
||||
//
|
||||
// @param count - The number of integer indexes to check for in the set
|
||||
// or the highest integer minus 1.
|
||||
// @param set - The list containing the integer values to search for
|
||||
// @return - A bitfield where each bit indicates whether the corresponding
|
||||
// integer was found in the legal set.
|
||||
function [MAX_XCVR_CHANNELS-1:0] map_numerical_is_in_legal_set(
|
||||
input integer count,
|
||||
input [MAX_STRS*MAX_CHARS*8-1:0] set
|
||||
);
|
||||
integer index;
|
||||
reg [MAX_XCVR_CHANNELS-1:0] retval;
|
||||
|
||||
// Validate count parameter
|
||||
if(count > MAX_XCVR_CHANNELS)
|
||||
$display("Error: [map_numerical_is_in_legal_set]: Invalid value for count: %0d",count);
|
||||
|
||||
map_numerical_is_in_legal_set = {MAX_XCVR_CHANNELS{1'b0}};
|
||||
retval = {MAX_XCVR_CHANNELS{1'b0}};
|
||||
for(index = 0; index < count; index = index + 1) begin
|
||||
if(is_in_legal_set(int2str(index),set))
|
||||
retval = retval | (({MAX_XCVR_CHANNELS{1'b0}} | 1'b1) << index);
|
||||
end
|
||||
map_numerical_is_in_legal_set = retval;
|
||||
endfunction
|
||||
|
||||
|
||||
// Accepts a string list of comma seperated numbers and returns a binary
|
||||
// field where each byte contains the corresponding number found in the
|
||||
// list.
|
||||
//
|
||||
// @param count - The number of elements in the list.
|
||||
// @param set - The list containing the integer values.
|
||||
// @return - A bitfield where each byte contains the corresponding number found
|
||||
// at that location in the list.
|
||||
function [MAX_XCVR_CHANNELS*8-1:0] map_numerical_legal_set(
|
||||
input integer count,
|
||||
input [MAX_STRS*MAX_CHARS*8-1:0] set
|
||||
);
|
||||
integer index;
|
||||
reg [MAX_XCVR_CHANNELS-1:0] retval;
|
||||
reg [MAX_CHARS*8-1:0] str_val;
|
||||
reg [7:0] int_val;
|
||||
|
||||
// Validate count parameter
|
||||
if(count > MAX_XCVR_CHANNELS || count > 256)
|
||||
$display("Error: [map_numerical_legal_set]: Invalid value for count: %0d",count);
|
||||
|
||||
map_numerical_legal_set = {MAX_XCVR_CHANNELS{8'd0}};
|
||||
retval = {MAX_XCVR_CHANNELS{8'd0}};
|
||||
for(index = 0; index < count; index = index + 1) begin
|
||||
str_val = get_value_at_index(index,set);
|
||||
if(str_val != "NA") begin
|
||||
int_val = str2int(str_val);
|
||||
if(int_val > 255)
|
||||
$display("Error: [map_numerical_legal_set]: Invalid string contains non-numerical item or value:%0d",int_val);
|
||||
else begin
|
||||
retval = retval | ( ( {MAX_XCVR_CHANNELS{8'd0}} | int_val ) << (index * 8));
|
||||
end
|
||||
end
|
||||
end
|
||||
map_numerical_legal_set = retval;
|
||||
endfunction
|
||||
|
||||
|
||||
// Accepts a comma separated list of string values and returns the element
|
||||
// found at the specified index. If the index is invalid, "NA" is returned
|
||||
//
|
||||
// @param index - The index of the value to return within "set"
|
||||
// @param set - A comma separated list of string values. The entire list may
|
||||
// be surrounded by parenthesis("(item0,item1,item2)")
|
||||
function [MAX_CHARS*8-1:0] get_value_at_index(
|
||||
input integer index,
|
||||
input [MAX_STRS*MAX_CHARS*8-1:0] set
|
||||
);
|
||||
// check value against each in set
|
||||
integer close_pos; // end of string marker can be comma or closing paren
|
||||
integer open_pos; // open paren is start of set, if appropriate
|
||||
reg [MAX_STRS*MAX_CHARS*8-1:0] legalstr;
|
||||
integer cur_index;
|
||||
|
||||
get_value_at_index = "";
|
||||
legalstr = "NA";
|
||||
cur_index = 0;
|
||||
open_pos = MAX_STRS*MAX_CHARS-1;
|
||||
// Remove closing parenthesis if exists
|
||||
if(set[7:0] == 8'h29) begin
|
||||
set = (set >> 8);
|
||||
set[(MAX_STRS*MAX_CHARS*8-1)-:8] = 8'h00;
|
||||
end
|
||||
// Find the start of the string
|
||||
while (open_pos >= 1 && (set[open_pos*8 +: 8] == 8'h00 || set[open_pos*8 +: 8] == 8'h28)) // look for first non-null
|
||||
open_pos = open_pos - 1;
|
||||
|
||||
// Iterate through list until the string is found or we've reached the end of the list
|
||||
while (legalstr == "NA" && open_pos >= 0 && cur_index <= index) begin
|
||||
close_pos = open_pos;
|
||||
// Move the close iterator to the end of the current value (or end of string)
|
||||
while (close_pos > 0
|
||||
&& set[close_pos*8 +: 8] != 8'h2c) // look for comma (8'h2c)
|
||||
close_pos = close_pos - 1;
|
||||
if (close_pos >= 0) begin
|
||||
close_pos = close_pos == 0 ? 0 : close_pos + 1;
|
||||
if(index == cur_index) begin
|
||||
legalstr = ((set & ((1'b1 << open_pos*8+8)-1)) >> close_pos*8);
|
||||
end
|
||||
open_pos = close_pos-2; // prepare to look for next legal string
|
||||
end
|
||||
cur_index = cur_index + 1;
|
||||
end
|
||||
|
||||
cur_index = 0;
|
||||
while(legalstr[cur_index*8+:8] != 0) begin
|
||||
get_value_at_index[cur_index*8+:8] = legalstr[cur_index*8+:8];
|
||||
cur_index = cur_index + 1;
|
||||
end
|
||||
|
||||
//$display("is_in_legal_set(): returns %d", is_in_legal_set);
|
||||
endfunction
|
||||
|
||||
// The goal was to return one of the values, does not matter which one.
|
||||
// ~45 times faster than get_value_at_index( 0, set );
|
||||
function [MAX_CHARS*8-1:0] get_first_enum_value( input [MAX_STRS*MAX_CHARS*8-1:0] set );
|
||||
|
||||
int start_pos, cur_idx;
|
||||
bit [7:0] cur_set_char;
|
||||
|
||||
// Ensure null-terminating the string.
|
||||
// MODIFIED: Work around for a QuestaSim vopt bug: set[(MAX_STRS*MAX_CHARS*8-8) +: 8 ] = 8'h00;
|
||||
set [ ( MAX_STRS * MAX_CHARS * 8 -1) : ( MAX_STRS * MAX_CHARS * 8 - 8) ] = 8 'h00 ;
|
||||
|
||||
start_pos = set[7:0] == 8'h29 ? 8 : 0;
|
||||
cur_idx = 0;
|
||||
|
||||
get_first_enum_value = "";
|
||||
|
||||
forever
|
||||
begin
|
||||
cur_set_char = set[ cur_idx + start_pos +: 8 ];
|
||||
|
||||
// comma, par or 0
|
||||
if ( cur_set_char == 8'h2c || cur_set_char == 8'h28 || cur_set_char == 8'h00 )
|
||||
break;
|
||||
|
||||
get_first_enum_value[ cur_idx +: 8 ] = cur_set_char;
|
||||
cur_idx = cur_idx + 8;
|
||||
end
|
||||
|
||||
// get_first_enum_value = get_value_at_index( 0, set );
|
||||
|
||||
endfunction
|
||||
|
||||
// This functions is ~12 times faster than is_in_legal_set
|
||||
function integer is_enum_in_legal_set( input [MAX_CHARS*8-1:0] value, input [MAX_STRS*MAX_CHARS*8-1:0] set );
|
||||
|
||||
if ( value == "<auto_any>" )
|
||||
return 1;
|
||||
else if (value == "<auto_single>")
|
||||
return (set[7:0] == 8'h29) ? 0 : 1; // 8'h29 is closing parenthesis char
|
||||
else if (value == set)
|
||||
return 1; // value matches single value in set
|
||||
else
|
||||
begin
|
||||
// ')'
|
||||
int set_pos;
|
||||
set_pos = 0;
|
||||
if ( set[7:0] == 8'h29 )
|
||||
set_pos = 8;
|
||||
|
||||
// Ensure null-terminating the string.
|
||||
set[(MAX_STRS*MAX_CHARS*8-8) +: 8 ] = 8'h00;
|
||||
|
||||
forever
|
||||
begin
|
||||
int cur_cmp_len;
|
||||
cur_cmp_len = 0;
|
||||
|
||||
// $display( "set_pos ", set_pos/8 );
|
||||
|
||||
forever
|
||||
begin
|
||||
|
||||
int cur_val_char, cur_set_char;
|
||||
cur_val_char = value[ cur_cmp_len +: 8 ];
|
||||
cur_set_char = set[ set_pos +: 8 ];
|
||||
|
||||
// $display( "comparing ", set_pos/8, cur_cmp_len/8, " " , value[ cur_cmp_len +: 8 ], " ", set[ set_pos +: 8 ] );
|
||||
|
||||
if ( cur_val_char == 0 )
|
||||
// The end of value reached, check whether set has comma, par or 0
|
||||
if ( cur_set_char == 8'h2c || cur_set_char == 8'h28 || cur_set_char == 8'h00 )
|
||||
return 1;
|
||||
|
||||
if ( cur_val_char != cur_set_char )
|
||||
break;
|
||||
|
||||
cur_cmp_len = cur_cmp_len + 8;
|
||||
set_pos = set_pos + 8;
|
||||
end
|
||||
|
||||
forever
|
||||
begin
|
||||
int cur_set_char;
|
||||
cur_set_char = set[ set_pos +: 8 ];
|
||||
|
||||
// $display( "skipping ", set_pos/8 );
|
||||
|
||||
// ','
|
||||
if ( cur_set_char == 8'h2c )
|
||||
begin
|
||||
set_pos = set_pos + 8;
|
||||
break;
|
||||
end
|
||||
|
||||
if ( cur_set_char == 8'h00 )
|
||||
return 0;
|
||||
|
||||
set_pos = set_pos + 8;
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
endfunction
|
||||
|
||||
// The first parameter is just a number, NOT a string
|
||||
function integer is_numeric_in_legal_set( input [MAX_CHARS*8-1:0] value, input [MAX_STRS*MAX_CHARS*8-1:0] set );
|
||||
is_numeric_in_legal_set = 1;
|
||||
endfunction
|
||||
|
||||
// AP stubs --- end
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Returns ceil_log2() value
|
||||
localparam integer MAX_PRECISION = 32; // VCS requires this declaration outside the function
|
||||
function integer ceil_log2;
|
||||
input [MAX_PRECISION-1:0] input_num;
|
||||
integer i;
|
||||
reg [MAX_PRECISION-1:0] try_result;
|
||||
begin
|
||||
i = 0;
|
||||
try_result = 1;
|
||||
while ((try_result << i) < input_num && i < MAX_PRECISION)
|
||||
i = i + 1;
|
||||
ceil_log2 = i;
|
||||
end
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Return the number of bits required to represent an integer
|
||||
// E.g. 0->1; 1->1; 2->2; 3->2 ... 31->5; 32->6
|
||||
//
|
||||
function integer clogb2;
|
||||
input [MAX_PRECISION-1:0] input_num;
|
||||
begin
|
||||
for (clogb2=0; input_num>0 && clogb2<MAX_PRECISION; clogb2=clogb2+1)
|
||||
input_num = input_num >> 1;
|
||||
if(clogb2 == 0)
|
||||
clogb2 = 1;
|
||||
end
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Return current device family string for display purposes
|
||||
`ifndef XCVR_DEV_FAM
|
||||
`ifdef ALTERA_RESERVED_QIS_FAMILY
|
||||
`define XCVR_DEV_FAM `ALTERA_RESERVED_QIS_FAMILY // synthesis: use QIS-defined value
|
||||
`else
|
||||
`define XCVR_DEV_FAM device_family // simulation: use passed-in value
|
||||
`endif
|
||||
`endif
|
||||
function [MAX_CHARS*8-1:0] current_device_family (
|
||||
input [MAX_CHARS*8-1:0] device_family
|
||||
);
|
||||
current_device_family = `XCVR_DEV_FAM;
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Match device family against standard family name strings
|
||||
//
|
||||
// Returns 1 if the names feature is present in the given device family
|
||||
function integer has_s4_style_hssi (
|
||||
input [MAX_CHARS*8-1:0] device_family
|
||||
);
|
||||
has_s4_style_hssi = ( (`XCVR_DEV_FAM == "Stratix IV")
|
||||
|| (`XCVR_DEV_FAM == "Arria II")
|
||||
|| (`XCVR_DEV_FAM == "Cyclone IV GX") // not exact, but close enough
|
||||
|| (`XCVR_DEV_FAM == "Arria II GX")
|
||||
|| (`XCVR_DEV_FAM == "Arria II GZ")
|
||||
|| (`XCVR_DEV_FAM == "HardCopy IV")
|
||||
) ? 1 : 0;
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Match device family against standard family name strings
|
||||
//
|
||||
// Returns 1 if the names feature is present in the given device family
|
||||
function integer has_s5_style_hssi (
|
||||
input [MAX_CHARS*8-1:0] device_family
|
||||
);
|
||||
has_s5_style_hssi = ( (`XCVR_DEV_FAM == "Stratix V") || (`XCVR_DEV_FAM == "Arria V GZ")
|
||||
) ? 1 : 0;
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Match device family against standard family name strings
|
||||
//
|
||||
// Returns 1 if the names feature is present in the given device family
|
||||
function integer has_a5_style_hssi (
|
||||
input [MAX_CHARS*8-1:0] device_family
|
||||
);
|
||||
has_a5_style_hssi = ( (`XCVR_DEV_FAM == "Arria V")
|
||||
) ? 1 : 0;
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Match device family against standard family name strings
|
||||
//
|
||||
// Returns 1 if the names feature is present in the given device family
|
||||
function integer has_c5_style_hssi (
|
||||
input [MAX_CHARS*8-1:0] device_family
|
||||
);
|
||||
has_c5_style_hssi = ( (`XCVR_DEV_FAM == "Cyclone V")
|
||||
) ? 1 : 0;
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Match device family against standard family name strings
|
||||
//
|
||||
// Returns 1 if the names feature is present in the given device family
|
||||
function integer has_c4_style_hssi (
|
||||
input [MAX_CHARS*8-1:0] device_family
|
||||
);
|
||||
has_c4_style_hssi = ( (`XCVR_DEV_FAM == "Cyclone IV GX")
|
||||
) ? 1 : 0;
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Get reconfig_to_gxb bundle width for specified device family
|
||||
//
|
||||
// Returns 0 if the device_family argument is invalid, otherwise
|
||||
// it returns the width of the reconfig_to_gxb bundle for that family
|
||||
function integer get_reconfig_to_gxb_width (
|
||||
input [MAX_CHARS*8-1:0] device_family
|
||||
);
|
||||
if (has_s5_style_hssi(device_family) || has_a5_style_hssi(device_family) || has_c5_style_hssi(device_family))
|
||||
get_reconfig_to_gxb_width = W_S5_RECONFIG_BUNDLE_TO_XCVR;
|
||||
else if (has_s4_style_hssi(device_family))
|
||||
get_reconfig_to_gxb_width = W_S4_RECONFIG_BUNDLE_TO_XCVR;
|
||||
else if (has_c4_style_hssi(device_family))
|
||||
get_reconfig_to_gxb_width = W_C4_RECONFIG_BUNDLE_TO_XCVR;
|
||||
else
|
||||
get_reconfig_to_gxb_width = 0;
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Get reconfig_from_gxb bundle width for specified device family
|
||||
//
|
||||
// Returns 0 if the device_family argument is invalid, otherwise
|
||||
// it returns the width of the reconfig_from_gxb bundle for that family
|
||||
function integer get_reconfig_from_gxb_width (
|
||||
input [MAX_CHARS*8-1:0] device_family
|
||||
);
|
||||
if (has_s5_style_hssi(device_family) || has_a5_style_hssi(device_family) || has_c5_style_hssi(device_family))
|
||||
get_reconfig_from_gxb_width = W_S5_RECONFIG_BUNDLE_FROM_XCVR;
|
||||
else if (has_s4_style_hssi(device_family))
|
||||
get_reconfig_from_gxb_width = W_S4_RECONFIG_BUNDLE_FROM_XCVR;
|
||||
else if (has_c4_style_hssi(device_family))
|
||||
get_reconfig_from_gxb_width = W_C4_RECONFIG_BUNDLE_FROM_XCVR;
|
||||
else
|
||||
get_reconfig_from_gxb_width = 0;
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Get reconfig_to_xcvr total port width for specified device family
|
||||
//
|
||||
// Returns 0 if the device_family argument is invalid, otherwise
|
||||
// it returns the width of the reconfig_to_xcvr port for that family
|
||||
function integer get_reconfig_to_width (
|
||||
input [MAX_CHARS*8-1:0] device_family,
|
||||
input integer reconfig_interfaces
|
||||
);
|
||||
if (has_s5_style_hssi(device_family) || has_a5_style_hssi(device_family) || has_c5_style_hssi(device_family))
|
||||
get_reconfig_to_width = get_s5_reconfig_to_width(reconfig_interfaces);
|
||||
else if (has_s4_style_hssi(device_family))
|
||||
get_reconfig_to_width = W_S4_RECONFIG_BUNDLE_TO_XCVR;
|
||||
else if (has_c4_style_hssi(device_family))
|
||||
get_reconfig_to_width = W_C4_RECONFIG_BUNDLE_TO_XCVR;
|
||||
else
|
||||
get_reconfig_to_width = 0;
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Get reconfig_to_xcvr total port width for Stratix V device family
|
||||
//
|
||||
function integer get_s5_reconfig_to_width (
|
||||
input integer reconfig_interfaces
|
||||
);
|
||||
get_s5_reconfig_to_width = reconfig_interfaces * get_reconfig_to_gxb_width("Stratix V");
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Get reconfig_from_xcvr total port width for specified device family
|
||||
//
|
||||
// Returns 0 if the device_family argument is invalid, otherwise
|
||||
// it returns the width of the reconfig_from_xcvr port for that family
|
||||
function integer get_reconfig_from_width (
|
||||
input [MAX_CHARS*8-1:0] device_family,
|
||||
input integer reconfig_interfaces
|
||||
);
|
||||
if (has_s5_style_hssi(device_family) || has_a5_style_hssi(device_family) || has_c5_style_hssi(device_family))
|
||||
get_reconfig_from_width = reconfig_interfaces * get_reconfig_from_gxb_width(device_family);
|
||||
else if (has_s4_style_hssi(device_family))
|
||||
get_reconfig_from_width = reconfig_interfaces * get_reconfig_from_gxb_width(device_family);
|
||||
else if (has_c4_style_hssi(device_family))
|
||||
get_reconfig_from_width = reconfig_interfaces * get_reconfig_from_gxb_width(device_family);
|
||||
else
|
||||
get_reconfig_from_width = 0;
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Get reconfig_from_xcvr total port width for Stratix V device family
|
||||
//
|
||||
function integer get_s5_reconfig_from_width (
|
||||
input integer reconfig_interfaces
|
||||
);
|
||||
get_s5_reconfig_from_width = reconfig_interfaces * get_reconfig_from_gxb_width("Stratix V");
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Get number of reconfig interfaces for Custom PHY
|
||||
// NOTE - !!Has since been used by other PHY IP!!
|
||||
//
|
||||
// @param device_family - Desired device family
|
||||
// @param operation_mode - "Duplex","Rx","Tx" or "duplex", "rx_only", "tx_only" in 10gbaser
|
||||
// @param lanes - Number of channels
|
||||
// @param plls - Number of TX plls (per channel)
|
||||
// @param bonded_group_size - Size of bonded group (1 or lanes)
|
||||
// @param data_path_type - Abuse of function by overloading for ATT support
|
||||
// - Carry on the abuse
|
||||
//
|
||||
// @return 0 if the device_family argument is invalid, otherwise
|
||||
// it returns the width of the reconfig_from_xcvr port for that family
|
||||
function integer get_custom_reconfig_interfaces(
|
||||
input [MAX_CHARS*8-1:0] device_family,
|
||||
input [MAX_CHARS*8-1:0] operation_mode,
|
||||
input integer lanes,
|
||||
input integer plls,
|
||||
input integer bonded_group_size,
|
||||
input [MAX_CHARS*8-1:0] data_path_type = "",
|
||||
input [MAX_CHARS*8-1:0] bonded_mode = "xN"
|
||||
);
|
||||
integer reconfig_interfaces;
|
||||
reconfig_interfaces = 0;
|
||||
if (has_s5_style_hssi(device_family) || has_a5_style_hssi(device_family) || has_c5_style_hssi(device_family)) begin
|
||||
// ATT specific calculations
|
||||
if( data_path_type == "ATT" ) begin
|
||||
if((operation_mode == "RX_ONLY") || (operation_mode == "rx_only") || (operation_mode == "Rx") || (operation_mode == "RX") || (operation_mode == "rx")) begin
|
||||
reconfig_interfaces = lanes;
|
||||
end else if((operation_mode == "TX_ONLY") || (operation_mode == "tx_only") || (operation_mode == "Tx") || (operation_mode == "TX") || (operation_mode == "tx")) begin
|
||||
reconfig_interfaces = 2*lanes;
|
||||
end else begin
|
||||
reconfig_interfaces = 3*lanes;
|
||||
end
|
||||
end else begin
|
||||
// Custom PHY calculations
|
||||
if((operation_mode == "RX") || (operation_mode == "Rx") || (operation_mode == "rx_only"))
|
||||
reconfig_interfaces = lanes;
|
||||
else begin
|
||||
bonded_group_size = (bonded_mode == "fb_compensation") ? 1 :
|
||||
(bonded_mode == "non_bonded") ? 1 : bonded_group_size;
|
||||
reconfig_interfaces = lanes+(plls*(lanes/bonded_group_size));
|
||||
end
|
||||
end
|
||||
end
|
||||
get_custom_reconfig_interfaces = reconfig_interfaces;
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Get reconfig_to_xcvr total port width for Custom PHY
|
||||
//
|
||||
// @param device_family - Desired device family
|
||||
// @param operation_mode - "Duplex","Rx","Tx" or "duplex", "rx_only", "tx_only" in 10gbaser
|
||||
// @param lanes - Number of transceiver channels
|
||||
// @param plls - Number of plls per bonded group
|
||||
// @param bonded_group_size - Size of bonded group (1 or lanes)
|
||||
// @param data_path_type - Abuse of function to support ATT
|
||||
//
|
||||
// @return - 0 if the device_family argument is invalid, otherwise
|
||||
// it returns the width of the reconfig_from_xcvr port for that family
|
||||
function integer get_custom_reconfig_to_width(
|
||||
input [MAX_CHARS*8-1:0] device_family,
|
||||
input [MAX_CHARS*8-1:0] operation_mode,
|
||||
input integer lanes,
|
||||
input integer plls,
|
||||
input integer bonded_group_size,
|
||||
input [MAX_CHARS*8-1:0] data_path_type = "",
|
||||
input [MAX_CHARS*8-1:0] bonded_mode = "xN"
|
||||
);
|
||||
integer reconfig_interfaces;
|
||||
reconfig_interfaces = get_custom_reconfig_interfaces(device_family,operation_mode,lanes,plls,bonded_group_size, data_path_type, bonded_mode );
|
||||
get_custom_reconfig_to_width = get_s5_reconfig_to_width(reconfig_interfaces);
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Get reconfig_from_xcvr total port width for Custom PHY
|
||||
//
|
||||
// @param device_family - Desired device family
|
||||
// @param operation_mode - "Duplex","Rx","Tx" or "duplex", "rx_only", "tx_only" in 10gbaser
|
||||
// @param lanes - Number of transceiver channels
|
||||
// @param plls - Number of plls per bonded group
|
||||
// @param bonded_group_size - Size of bonded group (1 or lanes)
|
||||
// @param data_path_type - Abuse of function to support ATT
|
||||
//
|
||||
// @return - 0 if the device_family argument is invalid, otherwise
|
||||
// it returns the width of the reconfig_from_xcvr port for that family
|
||||
function integer get_custom_reconfig_from_width(
|
||||
input [MAX_CHARS*8-1:0] device_family,
|
||||
input [MAX_CHARS*8-1:0] operation_mode,
|
||||
input integer lanes,
|
||||
input integer plls,
|
||||
input integer bonded_group_size,
|
||||
input [MAX_CHARS*8-1:0] data_path_type = "",
|
||||
input [MAX_CHARS*8-1:0] bonded_mode = "xN"
|
||||
);
|
||||
integer reconfig_interfaces;
|
||||
reconfig_interfaces = get_custom_reconfig_interfaces(device_family,operation_mode,lanes,plls,bonded_group_size, data_path_type, bonded_mode);
|
||||
get_custom_reconfig_from_width = get_s5_reconfig_from_width(reconfig_interfaces);
|
||||
endfunction
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Start Interlaken Specific functions for calculating reconfig interfaces
|
||||
// and reconfig_to_gxb, reconfig_from_gxb widths
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Get number of reconfig interfaces for Interlaken PHY
|
||||
//
|
||||
// @param device_family - Desired device family
|
||||
// @param operation_mode - "Duplex","Rx","Tx" or "duplex", "rx_only", "tx_only" in 10gbaser
|
||||
// Returns 0 if the device_family argument is invalid, otherwise
|
||||
// it returns the width of the reconfig_from_xcvr port for that family
|
||||
function integer get_interlaken_reconfig_interfaces(
|
||||
input [MAX_CHARS*8-1:0] device_family,
|
||||
input [MAX_CHARS*8-1:0] operation_mode,
|
||||
input integer bonded_group_size,
|
||||
input integer lanes
|
||||
);
|
||||
integer reconfig_interfaces;
|
||||
integer xslices;
|
||||
integer xremain;
|
||||
integer totalplls;
|
||||
|
||||
reconfig_interfaces = 0;
|
||||
if (has_s5_style_hssi(device_family) || has_a5_style_hssi(device_family) || has_c5_style_hssi(device_family)) begin
|
||||
if((operation_mode == "RX") || (operation_mode == "Rx") || (operation_mode == "rx_only"))
|
||||
reconfig_interfaces = lanes;
|
||||
else begin
|
||||
xslices = lanes/bonded_group_size;
|
||||
xremain = lanes % bonded_group_size;
|
||||
|
||||
if (xremain >0)
|
||||
totalplls = xslices +1;
|
||||
else
|
||||
totalplls = xslices;
|
||||
reconfig_interfaces = lanes+totalplls;
|
||||
end // else: !if((operation_mode == "RX") || (operation_mode == "Rx") || (operation_mode == "rx_only"))
|
||||
end // if (has_s5_style_hssi(device_family))
|
||||
get_interlaken_reconfig_interfaces = reconfig_interfaces;
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Get reconfig_to_xcvr total port width for Interlaken PHY
|
||||
//
|
||||
// @param device_family - Desired device family
|
||||
// @param operation_mode - "Duplex","Rx","Tx" or "duplex", "rx_only", "tx_only" in 10gbaser
|
||||
// @param lanes - Number of transceiver channels
|
||||
// Returns 0 if the device_family argument is invalid, otherwise
|
||||
// it returns the width of the reconfig_from_xcvr port for that family
|
||||
function integer get_interlaken_reconfig_to_width(
|
||||
input [MAX_CHARS*8-1:0] device_family,
|
||||
input [MAX_CHARS*8-1:0] operation_mode,
|
||||
input integer bonded_group_size,
|
||||
input integer lanes
|
||||
);
|
||||
integer reconfig_interfaces;
|
||||
reconfig_interfaces = get_interlaken_reconfig_interfaces(device_family,operation_mode,bonded_group_size,lanes);
|
||||
get_interlaken_reconfig_to_width = get_s5_reconfig_to_width(reconfig_interfaces);
|
||||
endfunction
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Get reconfig_from_xcvr total port width for Custom PHY
|
||||
//
|
||||
// @param device_family - Desired device family
|
||||
// @param operation_mode - "Duplex","Rx","Tx" or "duplex", "rx_only", "tx_only" in 10gbaser
|
||||
// Returns 0 if the device_family argument is invalid, otherwise
|
||||
// it returns the width of the reconfig_from_xcvr port for that family
|
||||
function integer get_interlaken_reconfig_from_width(
|
||||
input [MAX_CHARS*8-1:0] device_family,
|
||||
input [MAX_CHARS*8-1:0] operation_mode,
|
||||
input integer bonded_group_size,
|
||||
input integer lanes
|
||||
);
|
||||
integer reconfig_interfaces;
|
||||
reconfig_interfaces = get_interlaken_reconfig_interfaces(device_family,operation_mode,bonded_group_size,lanes);
|
||||
get_interlaken_reconfig_from_width = get_s5_reconfig_from_width(reconfig_interfaces);
|
||||
endfunction
|
||||
|
||||
// End Interlaken specific functions
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
endpackage
|
||||
|
|
@ -0,0 +1,441 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
|
||||
// File Name: altera_xcvr_reset_control.sv
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
// A configurable reset controller intended to drive resets for HSSI transceiver PLLs and CHANNELS.
|
||||
// The reset controller makes use of individual reset counters to control reset timing for the various reset
|
||||
// outputs.
|
||||
//
|
||||
// Features:
|
||||
// - Optional TX,RX,PLL reset control.
|
||||
// - Optional synchronization of the reset input
|
||||
// - Optional hysteresis for the pll_locked status inputs
|
||||
// - Reset control per channel or shared. (E.g. separate rx_digitalreset control for each channel
|
||||
// or one control for all channels)
|
||||
// - Configurable reset timings
|
||||
// - Optional automatic or manual reset control mode
|
||||
// (For TX, tx_digitalreset can automatically be restarted on loss of pll_locked)
|
||||
// (For RX, rx_digitalreset can automatically be restarted on loss of rx_is_lockedtodata)
|
||||
|
||||
`timescale 1ns / 1ns
|
||||
`ifndef ALTERA_RESERVED_QIS_FAMILY_ARRIA10
|
||||
(* altera_attribute = "-name MERGE_TX_PLL_DRIVEN_BY_REGISTERS_WITH_SAME_CLEAR ON -to \"alt_xcvr_reset_counter:g_pll.counter_pll_powerdown|r_reset\" " *)
|
||||
`endif
|
||||
//altera message_off 10036
|
||||
module altera_xcvr_reset_control
|
||||
#(
|
||||
// General Options
|
||||
parameter CHANNELS = 1, // Number of CHANNELS
|
||||
parameter PLLS = 1, // Number of TX PLLs. For pll_powerdown and pll_locked
|
||||
parameter SYS_CLK_IN_MHZ = 250, // Clock frequency in MHz. Required for reset timers
|
||||
parameter SYNCHRONIZE_RESET = 1, // (0,1) Synchronize the reset input
|
||||
parameter REDUCED_SIM_TIME = 1, // (0,1) 1=Reduced reset timings for simulation
|
||||
// PLL options
|
||||
parameter TX_PLL_ENABLE = 0, // (0,1) Enable TX PLL reset
|
||||
parameter T_PLL_POWERDOWN = 1000, // pll_powerdown period in ns
|
||||
parameter SYNCHRONIZE_PLL_RESET = 0,// (0,1) Use synchronized reset input for PLL powerdown
|
||||
// !NOTE! Will prevent PLL merging across reset controllers
|
||||
// !NOTE! Requires SYNCHRONIZE_RESET == 1
|
||||
// TX options
|
||||
parameter TX_ENABLE = 0, // (0,1) Enable TX resets
|
||||
parameter TX_PER_CHANNEL = 0, // (0,1) 1=separate TX reset per channel
|
||||
parameter T_TX_ANALOGRESET = 0, // tx_analogreset period (after reset removal)
|
||||
parameter T_TX_DIGITALRESET = 20, // tx_digitalreset period (after pll_powerdown)
|
||||
parameter T_PLL_LOCK_HYST = 0, // Amount of hysteresis to add to pll_locked status signal
|
||||
// RX options
|
||||
parameter RX_ENABLE = 0, // (0,1) Enable RX resets
|
||||
parameter RX_PER_CHANNEL = 0, // (0,1) 1=separate RX reset per channel
|
||||
parameter T_RX_ANALOGRESET = 40, // rx_analogreset period
|
||||
parameter T_RX_DIGITALRESET = 4000, // rx_digitalreset period (after rx_is_lockedtodata)
|
||||
// CAL BUSY option
|
||||
parameter EN_PLL_CAL_BUSY = 0
|
||||
) (
|
||||
// User inputs and outputs
|
||||
input wire clock, // System clock
|
||||
input wire reset, // Asynchronous reset
|
||||
|
||||
// Reset signals
|
||||
output wire [PLLS-1:0] pll_powerdown, // reset TX PLL (to PHY/PLL)
|
||||
output wire [CHANNELS-1:0] tx_analogreset, // reset TX PMA (to PHY)
|
||||
output wire [CHANNELS-1:0] tx_digitalreset, // reset TX PCS (to PHY)
|
||||
output wire [CHANNELS-1:0] rx_analogreset, // reset RX PMA (to PHY)
|
||||
output wire [CHANNELS-1:0] rx_digitalreset, // reset RX PCS (to PHY)
|
||||
// Status output
|
||||
output wire [CHANNELS-1:0] tx_ready, // TX is not in reset
|
||||
output wire [CHANNELS-1:0] rx_ready, // RX is not in reset
|
||||
|
||||
// Digital reset override inputs (must by synchronous with clock)
|
||||
input wire [CHANNELS-1:0] tx_digitalreset_or, // reset request for tx_digitalreset
|
||||
input wire [CHANNELS-1:0] rx_digitalreset_or, // reset request for rx_digitalreset
|
||||
|
||||
// TX control inputs
|
||||
input wire [PLLS-1:0] pll_locked, // TX PLL lock status (from PHY/PLL)
|
||||
input wire [pll_select_width(PLLS,TX_PER_CHANNEL,CHANNELS)-1:0] pll_select, // Select TX PLL locked signal
|
||||
input wire [CHANNELS-1:0] tx_cal_busy, // TX channel calibration status (from PHY/Reconfig)
|
||||
input wire [PLLS-1:0] pll_cal_busy, // TX PLL calibration status (from PLL)
|
||||
input wire [CHANNELS-1:0] tx_manual, // 0 = Automatically restart tx_digitalreset
|
||||
// when pll_locked deasserts.
|
||||
// 1 = Do nothing when pll_locked deasserts
|
||||
// RX control inputs
|
||||
input wire [CHANNELS-1:0] rx_is_lockedtodata, // RX CDR PLL locked-to-data status (from PHY)
|
||||
input wire [CHANNELS-1:0] rx_cal_busy, // RX channel calibration status (from PHY/Reconfig)
|
||||
input wire [CHANNELS-1:0] rx_manual // 0 = Automatically restart rx_digitalreset
|
||||
// when rx_is_lockedtodata deasserts
|
||||
// 1 = Do nothing when rx_is_lockedtodata deasserts
|
||||
);
|
||||
|
||||
// Faster reset time for simulation if indicated
|
||||
localparam SYNTH_CLK_IN_HZ = SYS_CLK_IN_MHZ * 1000000;
|
||||
localparam SIM_CLK_IN_HZ = (REDUCED_SIM_TIME == 1)
|
||||
? 2 * 1000000 : SYNTH_CLK_IN_HZ;
|
||||
`ifdef ALTERA_RESERVED_QIS
|
||||
localparam SYS_CLK_IN_HZ = SYNTH_CLK_IN_HZ;
|
||||
`else
|
||||
localparam SYS_CLK_IN_HZ = SIM_CLK_IN_HZ;
|
||||
`endif
|
||||
|
||||
// Calculate delays
|
||||
wire reset_sync; // Synchronized reset input
|
||||
wire stat_pll_powerdown; // PLL powerdown status
|
||||
|
||||
genvar ig;
|
||||
|
||||
//**************************************************************************
|
||||
//************************ Synchronize Reset Input *************************
|
||||
generate if(SYNCHRONIZE_RESET == 1) begin: g_reset_sync
|
||||
// Synchronize reset input
|
||||
alt_xcvr_resync #(
|
||||
.SYNC_CHAIN_LENGTH(2), // Number of flip-flops for retiming
|
||||
.WIDTH (1), // Number of bits to resync
|
||||
.INIT_VALUE (1'b1)
|
||||
) alt_xcvr_resync_reset (
|
||||
.clk (clock ),
|
||||
.reset (reset ),
|
||||
.d (1'b0 ),
|
||||
.q (reset_sync )
|
||||
);
|
||||
end else begin: g_no_reset_sync
|
||||
assign reset_sync = reset;
|
||||
end
|
||||
endgenerate
|
||||
//************************ Synchronize Reset Input *************************
|
||||
//**************************************************************************
|
||||
|
||||
|
||||
//***************************************************************************
|
||||
//*************************** TX PLL Reset Logic ****************************
|
||||
generate if(TX_PLL_ENABLE) begin: g_pll
|
||||
wire lcl_pll_powerdown;
|
||||
wire reset_pll;
|
||||
assign pll_powerdown = {PLLS{lcl_pll_powerdown}};
|
||||
if(SYNCHRONIZE_PLL_RESET == 1) begin : g_sync_pll_reset
|
||||
assign reset_pll = reset_sync;
|
||||
end else begin : g_no_sync_pll_reset
|
||||
assign reset_pll = reset;
|
||||
end
|
||||
// pll_powerdown
|
||||
alt_xcvr_reset_counter #(
|
||||
.CLKS_PER_SEC (SYS_CLK_IN_HZ ), // Clock frequency in Hz
|
||||
.RESET_PER_NS (T_PLL_POWERDOWN ), // Reset period in ns
|
||||
.ACTIVE_LEVEL (0 )
|
||||
) counter_pll_powerdown (
|
||||
.clk (clock ),
|
||||
.async_req (reset_pll ), // asynchronous reset request
|
||||
.sync_req (1'b0 ), // synchronous reset request
|
||||
.reset_or (1'b0 ),
|
||||
.reset (lcl_pll_powerdown ), // synchronous reset out
|
||||
.reset_n (/*unused*/ ),
|
||||
.reset_stat (stat_pll_powerdown )
|
||||
);
|
||||
end else begin : g_no_pll
|
||||
assign pll_powerdown = {PLLS{1'b0}};
|
||||
assign stat_pll_powerdown = 1'b0;
|
||||
end
|
||||
endgenerate
|
||||
//************************* End TX PLL Reset Logic **************************
|
||||
//***************************************************************************
|
||||
|
||||
|
||||
//***************************************************************************
|
||||
//***************************** TX Reset Logic ******************************
|
||||
generate if(TX_ENABLE) begin: g_tx
|
||||
localparam PLL_SEL_WIDTH = altera_xcvr_functions::clogb2(PLLS-1);
|
||||
|
||||
for (ig=0;ig<CHANNELS;ig=ig+1) begin : g_tx
|
||||
if(ig == 0 || TX_PER_CHANNEL == 1) begin : g_tx
|
||||
wire lcl_tx_cal_busy;
|
||||
wire lcl_tx_manual;
|
||||
wire lcl_tx_digitalreset_or; // tx_digitalreset_or for this channel
|
||||
wire lcl_pll_locked; // pll_locked[lcl_pll_select]
|
||||
wire lcl_pll_cal_busy; // pll_cal_busy[lcl_pll_select]
|
||||
wire [PLL_SEL_WIDTH-1:0] lcl_pll_select;
|
||||
// Synchronized signals
|
||||
wire tx_cal_busy_sync; // tx_cal_busy after synchronization
|
||||
wire pll_cal_busy_sync;// pll_cal_busy after synchronization
|
||||
wire tx_manual_sync; // Synchronous reset trigger for TX resets
|
||||
wire pll_locked_sync; // pll_locked after synchronization
|
||||
wire pll_locked_hyst; // pll_locked after hysteresis
|
||||
reg pll_locked_latch; // One shot latched pll_locked
|
||||
wire tx_or_pll_cal_busy_sync; //output of OR between synchronized tx_cal_busy and pll_cal_busy
|
||||
// Reset status signals
|
||||
wire stat_tx_analogreset;
|
||||
wire stat_tx_digitalreset;
|
||||
|
||||
// Control signal for this channel. With separate reset control per channel, each channel
|
||||
// listens to its own control signal. Otherwise the control signals for all channels are
|
||||
// combined for the shared reset control.
|
||||
assign lcl_tx_cal_busy = TX_PER_CHANNEL ? tx_cal_busy[ig] : |tx_cal_busy;
|
||||
assign lcl_tx_manual = TX_PER_CHANNEL ? tx_manual [ig] : |tx_manual;
|
||||
assign lcl_tx_digitalreset_or= TX_PER_CHANNEL ? tx_digitalreset_or [ig] : |tx_digitalreset_or;
|
||||
assign lcl_pll_locked = pll_locked[lcl_pll_select];
|
||||
if(EN_PLL_CAL_BUSY==1) begin : cal_busy
|
||||
assign lcl_pll_cal_busy = pll_cal_busy[lcl_pll_select];
|
||||
end else begin : no_cal_busy
|
||||
assign lcl_pll_cal_busy = 1'b0;
|
||||
end
|
||||
|
||||
assign lcl_pll_select = TX_PER_CHANNEL ? pll_select[ig*PLL_SEL_WIDTH+:PLL_SEL_WIDTH]
|
||||
: (PLLS > 1) ? pll_select
|
||||
: 1'b0;
|
||||
|
||||
assign tx_or_pll_cal_busy_sync = tx_cal_busy_sync | pll_cal_busy_sync;
|
||||
|
||||
// Synchonize TX inputs
|
||||
alt_xcvr_resync #(
|
||||
.SYNC_CHAIN_LENGTH(2), // Number of flip-flops for retiming
|
||||
.WIDTH (4),
|
||||
.INIT_VALUE (0)
|
||||
) resync_tx_cal_busy (
|
||||
.clk (clock ),
|
||||
.reset (reset_sync ),
|
||||
.d ({lcl_tx_cal_busy ,lcl_pll_cal_busy ,lcl_tx_manual ,lcl_pll_locked }),
|
||||
.q ({tx_cal_busy_sync,pll_cal_busy_sync,tx_manual_sync,pll_locked_sync})
|
||||
);
|
||||
|
||||
// Add hysteresis to pll_locked if needed
|
||||
// Reset counter works fine for hysteresis
|
||||
if(T_PLL_LOCK_HYST != 0) begin : g_pll_locked_hyst
|
||||
alt_xcvr_reset_counter #(
|
||||
.CLKS_PER_SEC (SYS_CLK_IN_HZ ), // Clock frequency in Hz
|
||||
.RESET_PER_NS (T_PLL_LOCK_HYST) // Reset period in ns
|
||||
) counter_pll_locked_hyst (
|
||||
.clk (clock ),
|
||||
.async_req (reset_sync ), // asynchronous reset request
|
||||
.sync_req (~pll_locked_sync ), // synchronous reset request
|
||||
.reset_or (1'b0 ),
|
||||
.reset (/*unused*/ ), // synchronous reset out
|
||||
.reset_n (pll_locked_hyst ),
|
||||
.reset_stat (/*unused*/ )
|
||||
);
|
||||
end else begin : g_no_pll_locked_hyst
|
||||
// No hysteresis added; use synchronized pll_locked directly.
|
||||
assign pll_locked_hyst = pll_locked_sync;
|
||||
end
|
||||
|
||||
// Add one-shot latch to pll_locked for initial reset sequence
|
||||
always @(posedge clock or posedge reset_sync)
|
||||
if(reset_sync) pll_locked_latch <= 1'b0;
|
||||
else if(pll_locked_hyst & ~tx_cal_busy_sync)
|
||||
pll_locked_latch <= 1'b1;
|
||||
|
||||
// tx_analogreset
|
||||
if(T_TX_ANALOGRESET == 0) begin
|
||||
// Tie tx_analogreset to pll_powerdown if used, otherwise tie to reset input (which may be synchronized)
|
||||
assign tx_analogreset[ig] = TX_PLL_ENABLE ? pll_powerdown[0] : reset_sync;
|
||||
assign stat_tx_analogreset = stat_pll_powerdown;
|
||||
end else begin
|
||||
// Assert rx_analogreset during RX calibration and for "T_RX_ANALOGRESET" ns thereafter
|
||||
alt_xcvr_reset_counter #(
|
||||
.CLKS_PER_SEC (SYS_CLK_IN_HZ ), // Clock frequency in Hz
|
||||
.RESET_PER_NS (T_TX_ANALOGRESET ) // Reset period in ns
|
||||
) counter_tx_analogreset (
|
||||
.clk (clock ),
|
||||
.async_req (reset_sync ), // asynchronous reset request
|
||||
.sync_req (tx_or_pll_cal_busy_sync), // synchronous reset request
|
||||
.reset_or (1'b0 ), // auxilliary reset override
|
||||
.reset (tx_analogreset [ig] ), // synchronous reset out
|
||||
.reset_n (/*unused*/ ),
|
||||
.reset_stat (stat_tx_analogreset )
|
||||
);
|
||||
end
|
||||
|
||||
// tx_digitalreset
|
||||
// Assert tx_digitalreset while any of the following
|
||||
// 1 - pll_powerdown is asserted.
|
||||
// 2 - TX calibration is in progress
|
||||
// 3 - PLL has not reached initial lock (pll_locked_latch)
|
||||
// 4 - PLL is not locked AND TX reset is NOT under manual control
|
||||
// 5 - Reset override
|
||||
alt_xcvr_reset_counter #(
|
||||
.CLKS_PER_SEC (SYS_CLK_IN_HZ ), // Clock frequency in Hz
|
||||
.RESET_PER_NS (T_TX_DIGITALRESET ) // Reset period in ns
|
||||
) counter_tx_digitalreset (
|
||||
.clk (clock ),
|
||||
.async_req (reset_sync ), // asynchronous reset request
|
||||
.sync_req (stat_tx_analogreset | tx_cal_busy_sync | ~pll_locked_latch | (~pll_locked_hyst&~tx_manual_sync)), // synchronous reset request
|
||||
.reset_or (lcl_tx_digitalreset_or ), // auxilliary reset override
|
||||
.reset (tx_digitalreset[ig] ), // synchronous reset out
|
||||
.reset_n (/*unused*/ ),
|
||||
.reset_stat (stat_tx_digitalreset )
|
||||
);
|
||||
|
||||
// tx_ready
|
||||
alt_xcvr_reset_counter #(
|
||||
.RESET_COUNT(3)
|
||||
) counter_tx_ready (
|
||||
.clk (clock ),
|
||||
.async_req (reset_sync ), // asynchronous reset request
|
||||
.sync_req (stat_tx_digitalreset ), // synchronous reset request
|
||||
.reset_or (1'b0 ), // auxilliary reset override
|
||||
.reset (/*unused*/ ), // synchronous reset out
|
||||
.reset_n (tx_ready [ig] ),
|
||||
.reset_stat (/*unused*/ ) // reset status
|
||||
);
|
||||
end else begin : g_fanout_tx
|
||||
assign tx_analogreset [ig] = tx_analogreset [0];
|
||||
assign tx_digitalreset [ig] = tx_digitalreset [0];
|
||||
assign tx_ready [ig] = tx_ready [0];
|
||||
end
|
||||
end
|
||||
end else begin : g_no_tx
|
||||
assign tx_analogreset = {CHANNELS{1'b0}};
|
||||
assign tx_digitalreset = {CHANNELS{1'b0}};
|
||||
assign tx_ready = {CHANNELS{1'b0}};
|
||||
end
|
||||
endgenerate
|
||||
//*************************** End TX Reset Logic ****************************
|
||||
//***************************************************************************
|
||||
|
||||
|
||||
//***************************************************************************
|
||||
//***************************** RX Reset Logic ******************************
|
||||
generate if (RX_ENABLE) begin : g_rx
|
||||
for (ig=0;ig<CHANNELS;ig=ig+1) begin : g_rx
|
||||
if(ig == 0 || RX_PER_CHANNEL == 1) begin : g_rx
|
||||
wire lcl_rx_cal_busy; // rx_cal_busy for this channel
|
||||
wire lcl_rx_manual; // rx_manual for this channel
|
||||
wire lcl_rx_is_lockedtodata; // rx_is_lockedtodata for this channel
|
||||
wire lcl_rx_digitalreset_or; // rx_digitalreset_or for this channel
|
||||
// Synchronized signals
|
||||
wire rx_cal_busy_sync; // rx_cal_busy after synchronization
|
||||
wire rx_manual_sync; // rx_manual after synchronization
|
||||
wire rx_is_lockedtodata_sync; // rx_is_lockedtodata after synchronization
|
||||
// Reset status signals
|
||||
wire stat_rx_analogreset;
|
||||
wire stat_rx_digitalreset;
|
||||
|
||||
// Control signal for this channel. With separate reset control per channel, each channel
|
||||
// listens to its own control signal. Otherwise the control signals for all channels are
|
||||
// combined for the shared reset control.
|
||||
assign lcl_rx_manual = RX_PER_CHANNEL ? rx_manual [ig] : |rx_manual;
|
||||
assign lcl_rx_cal_busy = RX_PER_CHANNEL ? rx_cal_busy [ig] : |rx_cal_busy;
|
||||
assign lcl_rx_is_lockedtodata = RX_PER_CHANNEL ? rx_is_lockedtodata [ig] : &rx_is_lockedtodata;
|
||||
assign lcl_rx_digitalreset_or = RX_PER_CHANNEL ? rx_digitalreset_or [ig] : |rx_digitalreset_or;
|
||||
|
||||
// Synchonize RX inputs
|
||||
alt_xcvr_resync #(
|
||||
.SYNC_CHAIN_LENGTH(2), // Number of flip-flops for retiming
|
||||
.WIDTH (3),
|
||||
.INIT_VALUE (3'b100)
|
||||
) resync_rx_cal_busy (
|
||||
.clk (clock ),
|
||||
.reset (reset_sync ),
|
||||
.d ({lcl_rx_cal_busy, lcl_rx_is_lockedtodata ,lcl_rx_manual }),
|
||||
.q ({rx_cal_busy_sync,rx_is_lockedtodata_sync,rx_manual_sync})
|
||||
);
|
||||
|
||||
// rx_analogreset
|
||||
// Assert rx_analogreset during RX calibration and for "T_RX_ANALOGRESET" ns thereafter
|
||||
alt_xcvr_reset_counter #(
|
||||
.CLKS_PER_SEC (SYS_CLK_IN_HZ ), // Clock frequency in Hz
|
||||
.RESET_PER_NS (T_RX_ANALOGRESET ) // Reset period in ns
|
||||
) counter_rx_analogreset (
|
||||
.clk (clock ),
|
||||
.async_req (reset_sync ), // asynchronous reset request
|
||||
.sync_req (rx_cal_busy_sync ), // synchronous reset request
|
||||
.reset_or (1'b0 ), // auxilliary reset override
|
||||
.reset (rx_analogreset [ig]), // synchronous reset out
|
||||
.reset_n (/*unused*/ ),
|
||||
.reset_stat (stat_rx_analogreset)
|
||||
);
|
||||
|
||||
// rx_digitalreset
|
||||
// Assert rx_digitalreset while any of the following:
|
||||
// 1 - RX calibration is in progress
|
||||
// 2 - rx_analogreset is asserted
|
||||
// 3 - RX is not locked to data AND RX reset is NOT under manual control
|
||||
// (meaning user wants us to respond to loss of RX data lock)
|
||||
alt_xcvr_reset_counter #(
|
||||
.CLKS_PER_SEC (SYS_CLK_IN_HZ ), // Clock frequency in Hz
|
||||
.RESET_PER_NS (T_RX_DIGITALRESET ) // Reset period in ns
|
||||
) counter_rx_digitalreset (
|
||||
.clk (clock ),
|
||||
.async_req (reset_sync ), // asynchronous reset request
|
||||
.sync_req (rx_cal_busy_sync|stat_rx_analogreset|(~rx_is_lockedtodata_sync&~rx_manual_sync)), // synchronous reset request
|
||||
.reset_or (lcl_rx_digitalreset_or ), // auxilliary reset override
|
||||
.reset (rx_digitalreset[ig] ), // synchronous reset out
|
||||
.reset_n (/*unused*/ ),
|
||||
.reset_stat (stat_rx_digitalreset )
|
||||
);
|
||||
|
||||
// rx_ready
|
||||
alt_xcvr_reset_counter #(
|
||||
.RESET_COUNT(3)
|
||||
) counter_rx_ready (
|
||||
.clk (clock ),
|
||||
.async_req (reset_sync ), // asynchronous reset request
|
||||
.sync_req (stat_rx_digitalreset ), // synchronous reset request
|
||||
.reset_or (1'b0 ), // auxilliary reset override
|
||||
.reset (/*unused*/ ), // synchronous reset out
|
||||
.reset_n (rx_ready[ig] ),
|
||||
.reset_stat (/*unused*/ )
|
||||
);
|
||||
|
||||
end else begin : g_fanout_rx
|
||||
assign rx_analogreset [ig] = rx_analogreset [0];
|
||||
assign rx_digitalreset [ig] = rx_digitalreset [0];
|
||||
assign rx_ready [ig] = rx_ready [0];
|
||||
end
|
||||
end
|
||||
end else begin : g_no_rx
|
||||
assign rx_analogreset = {CHANNELS{1'b0}};
|
||||
assign rx_digitalreset = {CHANNELS{1'b0}};
|
||||
assign rx_ready = {CHANNELS{1'b0}};
|
||||
end
|
||||
endgenerate
|
||||
//*************************** End RX Reset Logic ****************************
|
||||
//***************************************************************************
|
||||
|
||||
// pll_select_width
|
||||
// Internal function to calculate the width of pll_select port.
|
||||
// @param PLLS - Number of TX PLLs
|
||||
// @param TX_PER_CHANNEL - Separate TX reset controller per channel
|
||||
// @param CHANNELS - The number of TX CHANNELS
|
||||
//
|
||||
// @return - The width of the pll_select port
|
||||
function integer pll_select_width;
|
||||
input integer PLLS;
|
||||
input integer TX_PER_CHANNEL;
|
||||
input integer CHANNELS;
|
||||
begin
|
||||
pll_select_width = altera_xcvr_functions::clogb2(PLLS-1);
|
||||
if(TX_PER_CHANNEL) pll_select_width = pll_select_width * CHANNELS;
|
||||
end
|
||||
endfunction
|
||||
|
||||
endmodule
|
||||
|
||||
|
|
@ -0,0 +1,747 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Description: alt_xaui static verilog top level
|
||||
//
|
||||
// Authors: bauyeung 7-Sep-2010
|
||||
// Modified: ishimony 13-Dec-2010
|
||||
// Modified: hhleong 11-May-2012
|
||||
//
|
||||
// Copyright (c) Altera Corporation 1997 - 2012
|
||||
// All rights reserved.
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// have separate generate statements for each component
|
||||
|
||||
`timescale 1 ps / 1 ps
|
||||
import altera_xcvr_functions::*;
|
||||
|
||||
module altera_xcvr_xaui #(
|
||||
parameter device_family = "Stratix IV", // default Stratix IV
|
||||
parameter starting_channel_number = 0, // only applies to SIV
|
||||
parameter interface_type = "Hard XAUI",
|
||||
parameter data_rate = "3125 Mbps",
|
||||
parameter xaui_pll_type = "CMU",
|
||||
parameter BASE_DATA_RATE = "3125 Mbps",
|
||||
parameter en_synce_support = 0, //expose CDR ref-clk in this mode
|
||||
parameter use_control_and_status_ports = 0,
|
||||
parameter external_pma_ctrl_reconf = 0,
|
||||
parameter recovered_clk_out = 0,
|
||||
parameter number_of_interfaces = 1,
|
||||
parameter reconfig_interfaces = 1,
|
||||
parameter use_rx_rate_match = 0,
|
||||
parameter tx_termination = "OCT_150_OHMS",
|
||||
parameter tx_vod_selection = 2,
|
||||
parameter tx_preemp_pretap = 0,
|
||||
parameter tx_preemp_pretap_inv = "false",
|
||||
parameter tx_preemp_tap_1 = 0,
|
||||
parameter tx_preemp_tap_2 = 0,
|
||||
parameter tx_preemp_tap_2_inv = "false",
|
||||
parameter rx_common_mode = "0.82v",
|
||||
parameter rx_termination = "OCT_150_OHMS",
|
||||
parameter rx_eq_dc_gain = 1,
|
||||
parameter rx_eq_ctrl = 16,
|
||||
parameter mgmt_clk_in_mhz = 250,
|
||||
|
||||
// Only for AV
|
||||
parameter pll_external_enable = 1,
|
||||
|
||||
// Only for A10
|
||||
parameter en_dual_fifo = 0,
|
||||
|
||||
// Only for SV
|
||||
parameter enable_rx_coreclkin = 0,
|
||||
|
||||
parameter disable_embedded_sdc = 0
|
||||
|
||||
|
||||
) (
|
||||
input wire pll_ref_clk,
|
||||
input wire cdr_ref_clk, // used only in SyncE mode
|
||||
input wire xgmii_tx_clk,
|
||||
output wire xgmii_rx_clk,
|
||||
output wire tx_clk312_5, // dxaui: pma tx out clock, 312.5Mhz
|
||||
input wire phy_mgmt_clk,
|
||||
input wire phy_mgmt_clk_reset,
|
||||
input wire [8:0] phy_mgmt_address,
|
||||
output wire phy_mgmt_waitrequest,
|
||||
input wire phy_mgmt_read,
|
||||
output wire [31:0] phy_mgmt_readdata,
|
||||
input wire phy_mgmt_write,
|
||||
input wire [31:0] phy_mgmt_writedata,
|
||||
input wire [71:0] xgmii_tx_dc,
|
||||
output wire [71:0] xgmii_rx_dc,
|
||||
output wire [3:0] xaui_tx_serial_data,
|
||||
input wire [3:0] xaui_rx_serial_data,
|
||||
output wire rx_ready,
|
||||
output wire tx_ready,
|
||||
output wire [3:0] rx_recovered_clk, // rx recovered clock from cdr
|
||||
|
||||
// only used if use_control_and_status_ports is set
|
||||
input tri0 rx_analogreset,
|
||||
input tri0 rx_digitalreset,
|
||||
input tri0 tx_digitalreset,
|
||||
output tri0 rx_channelaligned,
|
||||
input tri0 [3:0] rx_invpolarity,
|
||||
input tri0 [3:0] rx_set_locktodata,
|
||||
input tri0 [3:0] rx_set_locktoref,
|
||||
input tri0 [3:0] rx_seriallpbken,
|
||||
input tri0 [3:0] tx_invpolarity,
|
||||
output tri0 [3:0] rx_is_lockedtodata,
|
||||
output tri0 [3:0] rx_phase_comp_fifo_error,
|
||||
output tri0 [3:0] rx_is_lockedtoref,
|
||||
output tri0 [3:0] rx_rlv,
|
||||
output tri0 [3:0] rx_rmfifoempty,
|
||||
output tri0 [3:0] rx_rmfifofull,
|
||||
output tri0 [3:0] tx_phase_comp_fifo_error,
|
||||
output tri0 [7:0] rx_disperr,
|
||||
output tri0 [7:0] rx_errdetect,
|
||||
output tri0 [7:0] rx_patterndetect,
|
||||
output tri0 [7:0] rx_rmfifodatadeleted,
|
||||
output tri0 [7:0] rx_rmfifodatainserted,
|
||||
output tri0 [7:0] rx_runningdisp,
|
||||
output tri0 [7:0] rx_syncstatus,
|
||||
|
||||
|
||||
// only used if external_pma_ctrl_reconf is set
|
||||
output tri0 [(device_family == "Arria 10")? 1 : altera_xcvr_functions::get_reconfig_from_width(device_family,reconfig_interfaces)-1:0] reconfig_from_xcvr,
|
||||
input tri0 [(device_family == "Arria 10")? 1 : altera_xcvr_functions::get_reconfig_to_width(device_family,reconfig_interfaces)-1:0] reconfig_to_xcvr,
|
||||
output tri0 pll_locked,
|
||||
input tri0 cal_blk_powerdown,
|
||||
input tri0 gxb_powerdown,
|
||||
input tri0 pll_powerdown,
|
||||
// need to add all possible port/param combinations
|
||||
// these should be set to tri0/1 where possible, so unused ports don't need to be terminated by the user
|
||||
|
||||
// only used for A10
|
||||
input [5:0] tx_bonding_clocks,
|
||||
input xgmii_rx_inclk,
|
||||
|
||||
// only for AV and A10
|
||||
input pll_locked_i,
|
||||
output pll_powerdown_o,
|
||||
input pll_cal_busy_i,
|
||||
|
||||
// only used for AV
|
||||
input tri0 [3 : 0] ext_pll_clk,
|
||||
|
||||
// Dynamic reconfiguration AV-MM interface, only for A10
|
||||
input reconfig_clk,
|
||||
input reconfig_reset,
|
||||
input reconfig_write,
|
||||
input reconfig_read,
|
||||
input [11:0] reconfig_address,
|
||||
input [31:0] reconfig_writedata,
|
||||
output [31:0] reconfig_readdata,
|
||||
output reconfig_waitrequest,
|
||||
|
||||
// only for SV
|
||||
input rx_coreclkin
|
||||
|
||||
);
|
||||
|
||||
import altera_xcvr_functions::*;
|
||||
|
||||
localparam reconfig_out_width = altera_xcvr_functions::get_reconfig_from_width(device_family,reconfig_interfaces);
|
||||
localparam reconfig_in_width = altera_xcvr_functions::get_reconfig_to_width(device_family,reconfig_interfaces);
|
||||
|
||||
wire [reconfig_out_width -1:0] l_reconfig_from_xcvr; // local reconfig_from_xcvr
|
||||
wire [reconfig_in_width -1:0] l_reconfig_to_xcvr; // local reconfig_to_xcvr
|
||||
|
||||
wire [7:0] sc_phy_address; // mgmt.address
|
||||
wire sc_phy_waitrequest; // .waitrequest
|
||||
wire sc_phy_read; // .read
|
||||
wire [31:0] sc_phy_readdata; // .readdata
|
||||
wire sc_phy_write; // .write
|
||||
|
||||
wire [6:0] sc_reconf_address; // mgmt.address
|
||||
wire sc_reconf_waitrequest; // .waitrequest
|
||||
wire sc_reconf_read; // .read
|
||||
wire [31:0] sc_reconf_readdata; // .readdata
|
||||
wire sc_reconf_write; // .write
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Custom decoder for multiple slaves of phy-reconfig interface
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// should be consistent across all device families
|
||||
alt_xcvr_mgmt2dec_phyreconfig mgmtdec_phyreconfig (
|
||||
.mgmt_clk_reset (phy_mgmt_clk_reset),
|
||||
.mgmt_clk (phy_mgmt_clk),
|
||||
|
||||
.mgmt_address (phy_mgmt_address),
|
||||
.mgmt_read (phy_mgmt_read),
|
||||
.mgmt_write (phy_mgmt_write),
|
||||
.mgmt_readdata (phy_mgmt_readdata),
|
||||
.mgmt_waitrequest (phy_mgmt_waitrequest),
|
||||
|
||||
// internal interface to 'top' phy block
|
||||
.sc_phy_readdata (sc_phy_readdata),
|
||||
.sc_phy_waitrequest (sc_phy_waitrequest),
|
||||
.sc_phy_address (sc_phy_address),
|
||||
.sc_phy_read (sc_phy_read),
|
||||
.sc_phy_write (sc_phy_write),
|
||||
|
||||
// internal interface to 'top' reconfig block
|
||||
.sc_reconf_readdata (sc_reconf_readdata),
|
||||
.sc_reconf_waitrequest (sc_reconf_waitrequest),
|
||||
.sc_reconf_address (sc_reconf_address),
|
||||
.sc_reconf_read (sc_reconf_read),
|
||||
.sc_reconf_write (sc_reconf_write)
|
||||
);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// alt_xcvr_reconfig
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// add generate statement for this
|
||||
// need to account for external pma reconfig
|
||||
generate
|
||||
if (external_pma_ctrl_reconf == 1) begin
|
||||
assign l_reconfig_to_xcvr = reconfig_to_xcvr;
|
||||
assign reconfig_from_xcvr = l_reconfig_from_xcvr;
|
||||
assign sc_reconf_readdata = 32'd0;
|
||||
assign sc_reconf_waitrequest = 1'b0;
|
||||
end else if ((interface_type == "Hard XAUI") && ((device_family == "Stratix IV") || (device_family == "HardCopy IV") || (device_family == "Arria II GX") || (device_family == "Arria II GX") || (device_family == "Arria II GZ"))) begin
|
||||
alt_xcvr_reconfig_siv #(
|
||||
.number_of_reconfig_interfaces (1)
|
||||
) alt_xcvr_reconfig_0 (
|
||||
.mgmt_clk_clk (phy_mgmt_clk),
|
||||
.mgmt_rst_reset (phy_mgmt_clk_reset),
|
||||
.reconfig_mgmt_address (sc_reconf_address),
|
||||
.reconfig_mgmt_waitrequest (sc_reconf_waitrequest),
|
||||
.reconfig_mgmt_read (sc_reconf_read),
|
||||
.reconfig_mgmt_readdata (sc_reconf_readdata),
|
||||
.reconfig_mgmt_write (sc_reconf_write),
|
||||
.reconfig_mgmt_writedata (phy_mgmt_writedata),
|
||||
.reconfig_togxb (l_reconfig_to_xcvr),
|
||||
.reconfig_fromgxb (l_reconfig_from_xcvr[16:0])
|
||||
);
|
||||
end else if ((interface_type == "Soft XAUI") && ((device_family == "Stratix IV") || (device_family == "HardCopy IV"))) begin // Arria II GX/GZ don't support soft xaui
|
||||
alt_xcvr_reconfig_siv #(
|
||||
.number_of_reconfig_interfaces (4)
|
||||
) alt_xcvr_reconfig_0 (
|
||||
.mgmt_clk_clk (phy_mgmt_clk),
|
||||
.mgmt_rst_reset (phy_mgmt_clk_reset),
|
||||
.reconfig_mgmt_address (sc_reconf_address),
|
||||
.reconfig_mgmt_waitrequest (sc_reconf_waitrequest),
|
||||
.reconfig_mgmt_read (sc_reconf_read),
|
||||
.reconfig_mgmt_readdata (sc_reconf_readdata),
|
||||
.reconfig_mgmt_write (sc_reconf_write),
|
||||
.reconfig_mgmt_writedata (phy_mgmt_writedata),
|
||||
.reconfig_togxb (l_reconfig_to_xcvr),
|
||||
.reconfig_fromgxb (l_reconfig_from_xcvr)
|
||||
);
|
||||
end else if ((interface_type == "DDR XAUI") && (device_family == "Stratix IV")) begin
|
||||
// stub for now - nothing here
|
||||
end else if ((device_family == "Stratix V") || (device_family == "Arria V GZ")) begin
|
||||
// stub for now - nothing here
|
||||
assign l_reconfig_to_xcvr = reconfig_to_xcvr;
|
||||
assign reconfig_from_xcvr = l_reconfig_from_xcvr;
|
||||
assign sc_reconf_readdata = 32'd0;
|
||||
assign sc_reconf_waitrequest = 1'b0;
|
||||
end else if (device_family == "Cyclone IV GX") begin
|
||||
alt_xcvr_reconfig_civ #(
|
||||
.number_of_reconfig_interfaces (1)
|
||||
) alt_xcvr_reconfig_0 (
|
||||
.reconfig_mgmt_clk_clk (phy_mgmt_clk),
|
||||
.reconfig_mgmt_rst_reset (phy_mgmt_clk_reset),
|
||||
.reconfig_mgmt_address (sc_reconf_address),
|
||||
.reconfig_mgmt_waitrequest (sc_reconf_waitrequest),
|
||||
.reconfig_mgmt_read (sc_reconf_read),
|
||||
.reconfig_mgmt_readdata (sc_reconf_readdata),
|
||||
.reconfig_mgmt_write (sc_reconf_write),
|
||||
.reconfig_mgmt_writedata (phy_mgmt_writedata),
|
||||
.reconfig_togxb (l_reconfig_to_xcvr),
|
||||
.reconfig_fromgxb (l_reconfig_from_xcvr[16:0])
|
||||
);
|
||||
end else if (device_family == "Arria 10") begin
|
||||
assign sc_reconf_readdata = 32'd0;
|
||||
assign sc_reconf_waitrequest = 1'b0;
|
||||
end
|
||||
endgenerate
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// alt_xaui_phy - Integrates hxaui (i/f to hxaui_alt_c3gxb), csr, pma
|
||||
// controller and pma channel controller
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
generate
|
||||
if ((device_family == "Stratix V") || (device_family == "Arria V GZ")) begin
|
||||
sv_xcvr_xaui #(
|
||||
.device_family (device_family),
|
||||
.starting_channel_number (starting_channel_number),
|
||||
.interface_type (interface_type),
|
||||
.reconfig_interfaces (reconfig_interfaces),
|
||||
.sys_clk_in_mhz (mgmt_clk_in_mhz),
|
||||
.data_rate (data_rate),
|
||||
.xaui_pll_type (xaui_pll_type),
|
||||
.BASE_DATA_RATE (BASE_DATA_RATE),
|
||||
.en_synce_support (en_synce_support), //expose CDR ref-clk in this mode
|
||||
.use_control_and_status_ports (use_control_and_status_ports),
|
||||
.tx_termination (tx_termination),
|
||||
.rx_termination (rx_termination),
|
||||
.tx_preemp_pretap (tx_preemp_pretap),
|
||||
.tx_preemp_pretap_inv (tx_preemp_pretap_inv),
|
||||
.tx_preemp_tap_1 (tx_preemp_tap_1),
|
||||
.tx_preemp_tap_2 (tx_preemp_tap_2),
|
||||
.tx_preemp_tap_2_inv (tx_preemp_tap_2_inv),
|
||||
.tx_vod_selection (tx_vod_selection),
|
||||
.rx_eq_dc_gain (rx_eq_dc_gain),
|
||||
.rx_eq_ctrl (rx_eq_ctrl),
|
||||
.rx_common_mode (rx_common_mode),
|
||||
.bonded_group_size (4), /// allowed values 1=> non-bonded 4=> bonded
|
||||
.bonded_mode ("xN"), /// allowed values "xN" and "fb_compensation"
|
||||
.enable_rx_coreclkin (enable_rx_coreclkin)
|
||||
) alt_xaui_phy (
|
||||
.pll_ref_clk (pll_ref_clk), // refclk.clk
|
||||
.cdr_ref_clk (cdr_ref_clk), // used only in SyncE mode
|
||||
.xgmii_tx_clk (xgmii_tx_clk), // xgmii_tx_clk.clk
|
||||
.xgmii_rx_clk (xgmii_rx_clk), // xgmii_rx_clk.clk
|
||||
.phy_mgmt_clk (phy_mgmt_clk), // mgmt_clk.clk
|
||||
.phy_mgmt_clk_reset (phy_mgmt_clk_reset), // mgmt_clk_rst.reset_n
|
||||
.phy_mgmt_address (sc_phy_address), // phy_mgmt.address
|
||||
.phy_mgmt_waitrequest (sc_phy_waitrequest), // .waitrequest
|
||||
.phy_mgmt_read (sc_phy_read), // .read
|
||||
.phy_mgmt_readdata (sc_phy_readdata), // .readdata
|
||||
.phy_mgmt_write (sc_phy_write), // .write
|
||||
.phy_mgmt_writedata (phy_mgmt_writedata), // .writedata
|
||||
.xgmii_tx_dc (xgmii_tx_dc), // xgmii_tx_dc.data
|
||||
.xgmii_rx_dc (xgmii_rx_dc), // xgmii_rx_dc.data
|
||||
.xaui_tx_serial_data (xaui_tx_serial_data), // xaui_tx_serial.export
|
||||
.xaui_rx_serial_data (xaui_rx_serial_data), // xaui_rx_serial.export
|
||||
.rx_digitalreset (rx_digitalreset), // rx_digitalreset.data
|
||||
.tx_digitalreset (tx_digitalreset), // tx_digitalreset.data
|
||||
.rx_channelaligned (rx_channelaligned), // rx_channelaligned.data
|
||||
.rx_syncstatus (rx_syncstatus), // rx_syncstatus.data
|
||||
.rx_disperr (rx_disperr), // rx_disperr.data
|
||||
.rx_errdetect (rx_errdetect), // rx_errdetect.data
|
||||
.rx_ready (rx_ready), // rx_pma_ready.data
|
||||
.tx_ready (tx_ready), // tx_pma_ready.data
|
||||
.reconfig_to_xcvr (l_reconfig_to_xcvr),
|
||||
.reconfig_from_xcvr (l_reconfig_from_xcvr),
|
||||
.rx_recovered_clk (rx_recovered_clk),
|
||||
.rx_coreclkin (rx_coreclkin)
|
||||
);
|
||||
assign tx_clk312_5 = 1'b0 ;
|
||||
end else if (device_family == "Arria V") begin
|
||||
av_xcvr_xaui #(
|
||||
.device_family (device_family),
|
||||
.starting_channel_number (starting_channel_number),
|
||||
.interface_type (interface_type),
|
||||
.reconfig_interfaces (reconfig_interfaces),
|
||||
.mgmt_clk_in_mhz (mgmt_clk_in_mhz),
|
||||
.data_rate (data_rate),
|
||||
.xaui_pll_type (xaui_pll_type),
|
||||
//.base_data_rate ("3125 Mbps"),
|
||||
.en_synce_support (en_synce_support), //expose CDR ref-clk in this mode
|
||||
.use_control_and_status_ports (use_control_and_status_ports),
|
||||
.tx_termination (tx_termination),
|
||||
.rx_termination (rx_termination),
|
||||
.tx_preemp_pretap (tx_preemp_pretap),
|
||||
.tx_preemp_pretap_inv (tx_preemp_pretap_inv),
|
||||
.tx_preemp_tap_1 (tx_preemp_tap_1),
|
||||
.tx_preemp_tap_2 (tx_preemp_tap_2),
|
||||
.tx_preemp_tap_2_inv (tx_preemp_tap_2_inv),
|
||||
.tx_vod_selection (tx_vod_selection),
|
||||
.rx_eq_dc_gain (rx_eq_dc_gain),
|
||||
.rx_eq_ctrl (rx_eq_ctrl),
|
||||
.rx_common_mode (rx_common_mode),
|
||||
.bonded_group_size (4), /// allowed values 1=> non-bonded 4=> bonded
|
||||
.bonded_mode ("xN"), /// allowed values "xN" and "fb_compensation"
|
||||
.pll_external_enable (pll_external_enable)
|
||||
) alt_xaui_phy (
|
||||
.pll_ref_clk (pll_ref_clk), // refclk.clk
|
||||
.cdr_ref_clk (cdr_ref_clk), // used only in SyncE mode
|
||||
.xgmii_tx_clk (xgmii_tx_clk), // xgmii_tx_clk.clk
|
||||
.xgmii_rx_clk (xgmii_rx_clk), // xgmii_rx_clk.clk
|
||||
.phy_mgmt_clk (phy_mgmt_clk), // mgmt_clk.clk
|
||||
.phy_mgmt_clk_reset (phy_mgmt_clk_reset), // mgmt_clk_rst.reset_n
|
||||
.phy_mgmt_address (sc_phy_address), // phy_mgmt.address
|
||||
.phy_mgmt_waitrequest (sc_phy_waitrequest), // .waitrequest
|
||||
.phy_mgmt_read (sc_phy_read), // .read
|
||||
.phy_mgmt_readdata (sc_phy_readdata), // .readdata
|
||||
.phy_mgmt_write (sc_phy_write), // .write
|
||||
.phy_mgmt_writedata (phy_mgmt_writedata), // .writedata
|
||||
.xgmii_tx_dc (xgmii_tx_dc), // xgmii_tx_dc.data
|
||||
.xgmii_rx_dc (xgmii_rx_dc), // xgmii_rx_dc.data
|
||||
.xaui_tx_serial_data (xaui_tx_serial_data), // xaui_tx_serial.export
|
||||
.xaui_rx_serial_data (xaui_rx_serial_data), // xaui_rx_serial.export
|
||||
.rx_digitalreset (rx_digitalreset), // rx_digitalreset.data
|
||||
.tx_digitalreset (tx_digitalreset), // tx_digitalreset.data
|
||||
.rx_channelaligned (rx_channelaligned), // rx_channelaligned.data
|
||||
.rx_syncstatus (rx_syncstatus), // rx_syncstatus.data
|
||||
.rx_disperr (rx_disperr), // rx_disperr.data
|
||||
.rx_errdetect (rx_errdetect), // rx_errdetect.data
|
||||
.rx_ready (rx_ready), // rx_pma_ready.data
|
||||
.tx_ready (tx_ready), // tx_pma_ready.data
|
||||
.reconfig_to_xcvr (reconfig_to_xcvr),
|
||||
.reconfig_from_xcvr (reconfig_from_xcvr),
|
||||
.pll_locked_i (pll_locked_i),
|
||||
.ext_pll_clk (ext_pll_clk),
|
||||
.rx_recovered_clk (rx_recovered_clk)
|
||||
);
|
||||
assign tx_clk312_5 = 1'b0 ;
|
||||
end else if (device_family == "Cyclone V") begin
|
||||
cv_xcvr_xaui #(
|
||||
.device_family (device_family),
|
||||
.starting_channel_number (starting_channel_number),
|
||||
.interface_type (interface_type),
|
||||
.reconfig_interfaces (reconfig_interfaces),
|
||||
.mgmt_clk_in_mhz (mgmt_clk_in_mhz),
|
||||
.data_rate (data_rate),
|
||||
.xaui_pll_type (xaui_pll_type),
|
||||
//.base_data_rate ("3125 Mbps"),
|
||||
.en_synce_support (en_synce_support), //expose CDR ref-clk in this mode
|
||||
.use_control_and_status_ports (use_control_and_status_ports),
|
||||
.tx_termination (tx_termination),
|
||||
.rx_termination (rx_termination),
|
||||
.tx_preemp_pretap (tx_preemp_pretap),
|
||||
.tx_preemp_pretap_inv (tx_preemp_pretap_inv),
|
||||
.tx_preemp_tap_1 (tx_preemp_tap_1),
|
||||
.tx_preemp_tap_2 (tx_preemp_tap_2),
|
||||
.tx_preemp_tap_2_inv (tx_preemp_tap_2_inv),
|
||||
.tx_vod_selection (tx_vod_selection),
|
||||
.rx_eq_dc_gain (rx_eq_dc_gain),
|
||||
.rx_eq_ctrl (rx_eq_ctrl),
|
||||
.rx_common_mode (rx_common_mode),
|
||||
.bonded_group_size (4), /// allowed values 1=> non-bonded 4=> bonded
|
||||
.bonded_mode ("xN") /// allowed values "xN" and "fb_compensation"
|
||||
) alt_xaui_phy (
|
||||
.pll_ref_clk (pll_ref_clk), // refclk.clk
|
||||
.cdr_ref_clk (cdr_ref_clk), // used only in SyncE mode
|
||||
.xgmii_tx_clk (xgmii_tx_clk), // xgmii_tx_clk.clk
|
||||
.xgmii_rx_clk (xgmii_rx_clk), // xgmii_rx_clk.clk
|
||||
.phy_mgmt_clk (phy_mgmt_clk), // mgmt_clk.clk
|
||||
.phy_mgmt_clk_reset (phy_mgmt_clk_reset), // mgmt_clk_rst.reset_n
|
||||
.phy_mgmt_address (sc_phy_address), // phy_mgmt.address
|
||||
.phy_mgmt_waitrequest (sc_phy_waitrequest), // .waitrequest
|
||||
.phy_mgmt_read (sc_phy_read), // .read
|
||||
.phy_mgmt_readdata (sc_phy_readdata), // .readdata
|
||||
.phy_mgmt_write (sc_phy_write), // .write
|
||||
.phy_mgmt_writedata (phy_mgmt_writedata), // .writedata
|
||||
.xgmii_tx_dc (xgmii_tx_dc), // xgmii_tx_dc.data
|
||||
.xgmii_rx_dc (xgmii_rx_dc), // xgmii_rx_dc.data
|
||||
.xaui_tx_serial_data (xaui_tx_serial_data), // xaui_tx_serial.export
|
||||
.xaui_rx_serial_data (xaui_rx_serial_data), // xaui_rx_serial.export
|
||||
.rx_digitalreset (rx_digitalreset), // rx_digitalreset.data
|
||||
.tx_digitalreset (tx_digitalreset), // tx_digitalreset.data
|
||||
.rx_channelaligned (rx_channelaligned), // rx_channelaligned.data
|
||||
.rx_syncstatus (rx_syncstatus), // rx_syncstatus.data
|
||||
.rx_disperr (rx_disperr), // rx_disperr.data
|
||||
.rx_errdetect (rx_errdetect), // rx_errdetect.data
|
||||
.rx_ready (rx_ready), // rx_pma_ready.data
|
||||
.tx_ready (tx_ready), // tx_pma_ready.data
|
||||
.reconfig_to_xcvr (reconfig_to_xcvr),
|
||||
.reconfig_from_xcvr (reconfig_from_xcvr),
|
||||
.rx_recovered_clk (rx_recovered_clk)
|
||||
);
|
||||
assign tx_clk312_5 = 1'b0 ;
|
||||
end else if ((interface_type == "DDR XAUI") && (device_family == "Stratix IV")) begin
|
||||
dxaui_siv #(
|
||||
.device_family (device_family),
|
||||
.starting_channel_number (starting_channel_number),
|
||||
.interface_type (interface_type),
|
||||
.number_of_interfaces (1),
|
||||
.reconfig_interfaces (reconfig_interfaces),
|
||||
.sys_clk_in_mhz (mgmt_clk_in_mhz),
|
||||
.xaui_pll_type (xaui_pll_type),
|
||||
.use_control_and_status_ports (use_control_and_status_ports),
|
||||
.external_pma_ctrl_reconf (external_pma_ctrl_reconf),
|
||||
.tx_termination (tx_termination),
|
||||
.tx_vod_selection (tx_vod_selection),
|
||||
.tx_preemp_pretap (tx_preemp_pretap),
|
||||
.tx_preemp_pretap_inv (tx_preemp_pretap_inv),
|
||||
.tx_preemp_tap_1 (tx_preemp_tap_1),
|
||||
.tx_preemp_tap_2 (tx_preemp_tap_2),
|
||||
.tx_preemp_tap_2_inv (tx_preemp_tap_2_inv),
|
||||
.rx_common_mode (rx_common_mode),
|
||||
.rx_termination (rx_termination),
|
||||
.rx_eq_dc_gain (rx_eq_dc_gain),
|
||||
.rx_eq_ctrl (rx_eq_ctrl),
|
||||
.use_rx_rate_match (use_rx_rate_match)
|
||||
) dxaui_siv (
|
||||
.pll_ref_clk (pll_ref_clk), // i
|
||||
.xgmii_tx_clk (xgmii_tx_clk), // i
|
||||
.xgmii_rx_clk (xgmii_rx_clk), // o
|
||||
.tx_clk312_5 (tx_clk312_5), // o
|
||||
.phy_mgmt_clk (phy_mgmt_clk), // i
|
||||
.phy_mgmt_clk_reset (phy_mgmt_clk_reset), // i
|
||||
.phy_mgmt_address (sc_phy_address), // i
|
||||
.phy_mgmt_waitrequest (sc_phy_waitrequest), // o
|
||||
.phy_mgmt_read (sc_phy_read), // i
|
||||
.phy_mgmt_readdata (sc_phy_readdata), // o
|
||||
.phy_mgmt_write (sc_phy_write), // i
|
||||
.phy_mgmt_writedata (phy_mgmt_writedata), // i
|
||||
.xgmii_tx_dc (xgmii_tx_dc), // i
|
||||
.xgmii_rx_dc (xgmii_rx_dc), // o
|
||||
.xaui_tx_serial_data (xaui_tx_serial_data), // o
|
||||
.xaui_rx_serial_data (xaui_rx_serial_data), // i
|
||||
.rx_ready (rx_ready), // o
|
||||
.tx_ready (tx_ready), // o
|
||||
.rx_recovered_clk (rx_recovered_clk), // o
|
||||
.reconfig_from_xcvr (l_reconfig_from_xcvr), // o
|
||||
.reconfig_to_xcvr (l_reconfig_to_xcvr), // i
|
||||
.rx_analogreset (rx_analogreset), // i
|
||||
.rx_digitalreset (rx_digitalreset), // i
|
||||
.tx_digitalreset (tx_digitalreset), // i
|
||||
.rx_channelaligned (rx_channelaligned), // o
|
||||
.rx_invpolarity (rx_invpolarity), // i
|
||||
.rx_set_locktodata (rx_set_locktodata), // i
|
||||
.rx_set_locktoref (rx_set_locktoref), // i
|
||||
.rx_seriallpbken (rx_seriallpbken), // i
|
||||
.tx_invpolarity (tx_invpolarity), // i
|
||||
.rx_is_lockedtodata (rx_is_lockedtodata), // o
|
||||
.rx_phase_comp_fifo_error (rx_phase_comp_fifo_error), // o
|
||||
.rx_is_lockedtoref (rx_is_lockedtoref), // o
|
||||
.rx_rlv (rx_rlv), // o
|
||||
.rx_rmfifoempty (rx_rmfifoempty), // o
|
||||
.rx_rmfifofull (rx_rmfifofull), // o
|
||||
.tx_phase_comp_fifo_error (tx_phase_comp_fifo_error), // o
|
||||
.rx_disperr (rx_disperr), // o
|
||||
.rx_errdetect (rx_errdetect), // o
|
||||
.rx_patterndetect (rx_patterndetect), // o
|
||||
.rx_rmfifodatadeleted (rx_rmfifodatadeleted), // o
|
||||
.rx_rmfifodatainserted (rx_rmfifodatainserted), // o
|
||||
.rx_runningdisp (rx_runningdisp), // o
|
||||
.rx_syncstatus (rx_syncstatus), // o
|
||||
.pll_locked (pll_locked), // o
|
||||
.cal_blk_powerdown (cal_blk_powerdown), // i
|
||||
.gxb_powerdown (gxb_powerdown), // i
|
||||
.pll_powerdown (pll_powerdown) // i
|
||||
); // module dxaui_siv
|
||||
end else if ((device_family == "Stratix IV") || (device_family == "HardCopy IV") ||(device_family == "Arria II GX") || (device_family == "Arria II GZ")) begin
|
||||
siv_xcvr_xaui #(
|
||||
.device_family (device_family),
|
||||
.starting_channel_number (starting_channel_number),
|
||||
.interface_type (interface_type),
|
||||
.number_of_interfaces (1),
|
||||
.reconfig_interfaces (reconfig_interfaces),
|
||||
.sys_clk_in_mhz (mgmt_clk_in_mhz),
|
||||
.xaui_pll_type (xaui_pll_type),
|
||||
.use_control_and_status_ports (use_control_and_status_ports),
|
||||
.external_pma_ctrl_reconf (external_pma_ctrl_reconf),
|
||||
.tx_termination (tx_termination),
|
||||
.rx_termination (rx_termination),
|
||||
.tx_preemp_pretap (tx_preemp_pretap),
|
||||
.tx_preemp_pretap_inv (tx_preemp_pretap_inv),
|
||||
.tx_preemp_tap_1 (tx_preemp_tap_1),
|
||||
.tx_preemp_tap_2 (tx_preemp_tap_2),
|
||||
.tx_preemp_tap_2_inv (tx_preemp_tap_2_inv),
|
||||
.tx_vod_selection (tx_vod_selection),
|
||||
.rx_eq_dc_gain (rx_eq_dc_gain),
|
||||
.rx_eq_ctrl (rx_eq_ctrl),
|
||||
.rx_common_mode (rx_common_mode)
|
||||
) xaui_phy (
|
||||
.pll_ref_clk (pll_ref_clk),
|
||||
.xgmii_rx_clk (xgmii_rx_clk),
|
||||
.xgmii_tx_clk (xgmii_tx_clk),
|
||||
.phy_mgmt_clk (phy_mgmt_clk),
|
||||
.phy_mgmt_clk_reset (phy_mgmt_clk_reset),
|
||||
.phy_mgmt_address (sc_phy_address),
|
||||
.phy_mgmt_read (sc_phy_read),
|
||||
.phy_mgmt_readdata (sc_phy_readdata),
|
||||
.phy_mgmt_waitrequest (sc_phy_waitrequest),
|
||||
.phy_mgmt_write (sc_phy_write),
|
||||
.phy_mgmt_writedata (phy_mgmt_writedata),
|
||||
.xaui_rx_serial_data (xaui_rx_serial_data),
|
||||
.xaui_tx_serial_data (xaui_tx_serial_data),
|
||||
.xgmii_rx_dc (xgmii_rx_dc),
|
||||
.xgmii_tx_dc (xgmii_tx_dc),
|
||||
.rx_ready (rx_ready),
|
||||
.tx_ready (tx_ready),
|
||||
.rx_recovered_clk (rx_recovered_clk), //o
|
||||
.reconfig_from_xcvr (l_reconfig_from_xcvr),
|
||||
.reconfig_to_xcvr (l_reconfig_to_xcvr),
|
||||
|
||||
// optional control and status ports - will be terminated by tri0 if unconnected
|
||||
.rx_analogreset (rx_analogreset), // input wire
|
||||
.rx_digitalreset (rx_digitalreset), // input wire [3:0]
|
||||
.tx_digitalreset (tx_digitalreset), // input wire [3:0]
|
||||
.rx_channelaligned (rx_channelaligned), // output wire
|
||||
.rx_invpolarity (rx_invpolarity), // input wire [3:0]
|
||||
.rx_set_locktodata (rx_set_locktodata), // input wire [3:0]
|
||||
.rx_set_locktoref (rx_set_locktoref), // input wire [3:0]
|
||||
.rx_seriallpbken (rx_seriallpbken), // input wire [3:0]
|
||||
.tx_invpolarity (tx_invpolarity), // input wire [3:0]
|
||||
.rx_is_lockedtodata (rx_is_lockedtodata), // output wire [3:0]
|
||||
.rx_phase_comp_fifo_error (rx_phase_comp_fifo_error), // output wire [3:0]
|
||||
.rx_is_lockedtoref (rx_is_lockedtoref), // output wire [3:0]
|
||||
.rx_rlv (rx_rlv), // output wire [3:0]
|
||||
.rx_rmfifoempty (rx_rmfifoempty), // output wire [3:0]
|
||||
.rx_rmfifofull (rx_rmfifofull), // output wire [3:0]
|
||||
.tx_phase_comp_fifo_error (tx_phase_comp_fifo_error), // output wire [3:0]
|
||||
.rx_disperr (rx_disperr), // output wire [7:0]
|
||||
.rx_errdetect (rx_errdetect), // output wire [7:0]
|
||||
.rx_patterndetect (rx_patterndetect), // output wire [7:0]
|
||||
.rx_rmfifodatadeleted (rx_rmfifodatadeleted), // output wire [7:0]
|
||||
.rx_rmfifodatainserted (rx_rmfifodatainserted), // output wire [7:0]
|
||||
.rx_runningdisp (rx_runningdisp), // output wire [7:0]
|
||||
.rx_syncstatus (rx_syncstatus), // output wire [7:0]
|
||||
|
||||
// external_pma_ctrl_reconf
|
||||
.pll_locked (pll_locked), // output wire
|
||||
.cal_blk_powerdown (cal_blk_powerdown), // input wire
|
||||
.gxb_powerdown (gxb_powerdown), // input wire
|
||||
.pll_powerdown (pll_powerdown) // input wire
|
||||
);
|
||||
assign tx_clk312_5 = 1'b0 ;
|
||||
end else if (device_family == "Cyclone IV GX") begin
|
||||
// need to add the extra optional ports for c&s and ext_pma
|
||||
civ_xcvr_xaui #(
|
||||
.device_family (device_family),
|
||||
.starting_channel_number (starting_channel_number),
|
||||
.interface_type (interface_type),
|
||||
.number_of_interfaces (1),
|
||||
.sys_clk_in_mhz (mgmt_clk_in_mhz),
|
||||
.xaui_pll_type (xaui_pll_type),
|
||||
.use_control_and_status_ports (use_control_and_status_ports),
|
||||
.external_pma_ctrl_reconf (external_pma_ctrl_reconf),
|
||||
.tx_termination (tx_termination),
|
||||
.rx_termination (rx_termination),
|
||||
.tx_preemp_pretap (tx_preemp_pretap),
|
||||
.tx_preemp_pretap_inv (tx_preemp_pretap_inv),
|
||||
.tx_preemp_tap_1 (tx_preemp_tap_1),
|
||||
.tx_preemp_tap_2 (tx_preemp_tap_2),
|
||||
.tx_preemp_tap_2_inv (tx_preemp_tap_2_inv),
|
||||
.tx_vod_selection (tx_vod_selection),
|
||||
.rx_eq_dc_gain (rx_eq_dc_gain),
|
||||
.rx_eq_ctrl (rx_eq_ctrl),
|
||||
.rx_common_mode (rx_common_mode)
|
||||
) xaui_phy (
|
||||
.pll_ref_clk (pll_ref_clk),
|
||||
.xgmii_rx_clk (xgmii_rx_clk),
|
||||
.xgmii_tx_clk (xgmii_tx_clk),
|
||||
.phy_mgmt_clk (phy_mgmt_clk),
|
||||
.phy_mgmt_clk_reset (phy_mgmt_clk_reset),
|
||||
.phy_mgmt_address (sc_phy_address),
|
||||
.phy_mgmt_read (sc_phy_read),
|
||||
.phy_mgmt_readdata (sc_phy_readdata),
|
||||
.phy_mgmt_waitrequest (sc_phy_waitrequest),
|
||||
.phy_mgmt_write (sc_phy_write),
|
||||
.phy_mgmt_writedata (phy_mgmt_writedata),
|
||||
.xaui_rx_serial_data (xaui_rx_serial_data),
|
||||
.xaui_tx_serial_data (xaui_tx_serial_data),
|
||||
.xgmii_rx_dc (xgmii_rx_dc),
|
||||
.xgmii_tx_dc (xgmii_tx_dc),
|
||||
.rx_ready (rx_ready),
|
||||
.tx_ready (tx_ready),
|
||||
.rx_recovered_clk (rx_recovered_clk), //o
|
||||
.reconfig_from_xcvr (l_reconfig_from_xcvr[16:0]),
|
||||
.reconfig_to_xcvr (l_reconfig_to_xcvr),
|
||||
|
||||
// optional control and status ports - will be terminated by tri0 if unconnected
|
||||
.rx_analogreset (rx_analogreset), // input wire
|
||||
.rx_digitalreset (rx_digitalreset), // input wire [3:0]
|
||||
.tx_digitalreset (tx_digitalreset), // input wire [3:0]
|
||||
.rx_channelaligned (rx_channelaligned), // output wire
|
||||
.rx_invpolarity (rx_invpolarity), // input wire [3:0]
|
||||
.rx_set_locktodata (rx_set_locktodata), // input wire [3:0]
|
||||
.rx_set_locktoref (rx_set_locktoref), // input wire [3:0]
|
||||
.rx_seriallpbken (rx_seriallpbken), // input wire [3:0]
|
||||
.tx_invpolarity (tx_invpolarity), // input wire [3:0]
|
||||
.rx_is_lockedtodata (rx_is_lockedtodata), // output wire [3:0]
|
||||
.rx_phase_comp_fifo_error (rx_phase_comp_fifo_error), // output wire [3:0]
|
||||
.rx_is_lockedtoref (rx_is_lockedtoref), // output wire [3:0]
|
||||
.rx_rlv (rx_rlv), // output wire [3:0]
|
||||
.rx_rmfifoempty (rx_rmfifoempty), // output wire [3:0]
|
||||
.rx_rmfifofull (rx_rmfifofull), // output wire [3:0]
|
||||
.tx_phase_comp_fifo_error (tx_phase_comp_fifo_error), // output wire [3:0]
|
||||
.rx_disperr (rx_disperr), // output wire [7:0]
|
||||
.rx_errdetect (rx_errdetect), // output wire [7:0]
|
||||
.rx_patterndetect (rx_patterndetect), // output wire [7:0]
|
||||
.rx_rmfifodatadeleted (rx_rmfifodatadeleted), // output wire [7:0]
|
||||
.rx_rmfifodatainserted (rx_rmfifodatainserted), // output wire [7:0]
|
||||
.rx_runningdisp (rx_runningdisp), // output wire [7:0]
|
||||
.rx_syncstatus (rx_syncstatus), // output wire [7:0]
|
||||
|
||||
// external_pma_ctrl_reconf
|
||||
.pll_locked (pll_locked), // output wire
|
||||
.cal_blk_powerdown (cal_blk_powerdown), // input wire
|
||||
.gxb_powerdown (gxb_powerdown), // input wire
|
||||
.pll_powerdown (pll_powerdown) // input wire
|
||||
);
|
||||
assign tx_clk312_5 = 1'b0 ;
|
||||
end
|
||||
else if (device_family == "Arria 10") begin
|
||||
a10_xcvr_xaui #(
|
||||
.device_family (device_family),
|
||||
.interface_type (interface_type),
|
||||
.mgmt_clk_in_mhz (mgmt_clk_in_mhz),
|
||||
.data_rate (data_rate),
|
||||
.en_synce_support (en_synce_support), //expose CDR ref-clk in this mode
|
||||
.use_control_and_status_ports (use_control_and_status_ports),
|
||||
.tx_termination (tx_termination),
|
||||
.rx_termination (rx_termination),
|
||||
.tx_preemp_pretap (tx_preemp_pretap),
|
||||
.tx_preemp_pretap_inv (tx_preemp_pretap_inv),
|
||||
.tx_preemp_tap_1 (tx_preemp_tap_1),
|
||||
.tx_preemp_tap_2 (tx_preemp_tap_2),
|
||||
.tx_preemp_tap_2_inv (tx_preemp_tap_2_inv),
|
||||
.tx_vod_selection (tx_vod_selection),
|
||||
.rx_eq_dc_gain (rx_eq_dc_gain),
|
||||
.rx_eq_ctrl (rx_eq_ctrl),
|
||||
.rx_common_mode (rx_common_mode),
|
||||
.bonded_group_size (4), /// allowed values 1=> non-bonded 4=> bonded
|
||||
.bonded_mode ("xN"), /// allowed values "xN" and "fb_compensation"
|
||||
.en_dual_fifo (en_dual_fifo),
|
||||
.disable_embedded_sdc (disable_embedded_sdc)
|
||||
) alt_xaui_phy (
|
||||
.pll_ref_clk (pll_ref_clk), // refclk.clk
|
||||
.cdr_ref_clk (cdr_ref_clk), // used only in SyncE mode
|
||||
.xgmii_tx_clk (xgmii_tx_clk), // xgmii_tx_clk.clk
|
||||
.xgmii_rx_clk (xgmii_rx_clk), // xgmii_rx_clk.clk
|
||||
.xgmii_rx_inclk (xgmii_rx_inclk),
|
||||
.phy_mgmt_clk (phy_mgmt_clk), // mgmt_clk.clk
|
||||
.phy_mgmt_clk_reset (phy_mgmt_clk_reset), // mgmt_clk_rst.reset_n
|
||||
.phy_mgmt_address (sc_phy_address), // phy_mgmt.address
|
||||
.phy_mgmt_waitrequest (sc_phy_waitrequest), // .waitrequest
|
||||
.phy_mgmt_read (sc_phy_read), // .read
|
||||
.phy_mgmt_readdata (sc_phy_readdata), // .readdata
|
||||
.phy_mgmt_write (sc_phy_write), // .write
|
||||
.phy_mgmt_writedata (phy_mgmt_writedata), // .writedata
|
||||
.xgmii_tx_dc (xgmii_tx_dc), // xgmii_tx_dc.data
|
||||
.xgmii_rx_dc (xgmii_rx_dc), // xgmii_rx_dc.data
|
||||
.xaui_tx_serial_data (xaui_tx_serial_data), // xaui_tx_serial.export
|
||||
.xaui_rx_serial_data (xaui_rx_serial_data), // xaui_rx_serial.export
|
||||
.rx_digitalreset (rx_digitalreset), // rx_digitalreset.data
|
||||
.tx_digitalreset (tx_digitalreset), // tx_digitalreset.data
|
||||
.rx_channelaligned (rx_channelaligned), // rx_channelaligned.data
|
||||
.rx_syncstatus (rx_syncstatus), // rx_syncstatus.data
|
||||
.rx_disperr (rx_disperr), // rx_disperr.data
|
||||
.rx_errdetect (rx_errdetect), // rx_errdetect.data
|
||||
.rx_ready (rx_ready), // rx_pma_ready.data
|
||||
.tx_ready (tx_ready), // tx_pma_ready.data
|
||||
.rx_recovered_clk (rx_recovered_clk),
|
||||
.tx_bonding_clocks (tx_bonding_clocks),
|
||||
.pll_powerdown (pll_powerdown_o),
|
||||
.pll_locked (pll_locked_i),
|
||||
.pll_cal_busy (pll_cal_busy_i),
|
||||
.reconfig_clk (reconfig_clk), // reconfig_clk.clk
|
||||
.reconfig_reset (reconfig_reset), // reconfig_reset.reset
|
||||
.reconfig_write (reconfig_write), // reconfig_avmm.write
|
||||
.reconfig_read (reconfig_read), // .read
|
||||
.reconfig_address (reconfig_address), // .address
|
||||
.reconfig_writedata (reconfig_writedata), // .writedata
|
||||
.reconfig_readdata (reconfig_readdata),
|
||||
.reconfig_waitrequest (reconfig_waitrequest)
|
||||
);
|
||||
assign tx_clk312_5 = 1'b0 ;
|
||||
end
|
||||
endgenerate
|
||||
|
||||
endmodule
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,735 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
// Verilog RBC parameter resolution wrapper for arriav_hssi_8g_tx_pcs
|
||||
//
|
||||
|
||||
`timescale 1 ns / 1 ps
|
||||
|
||||
module av_hssi_8g_tx_pcs_rbc #(
|
||||
// unconstrained parameters
|
||||
parameter prot_mode = "<auto_single>", // basic, cpri, cpri_rx_tx, disabled_prot_mode, gige, pipe_g1, pipe_g2, srio_2p1, test, xaui
|
||||
parameter sup_mode = "<auto_single>", // engineering_mode, user_mode
|
||||
|
||||
// extra unconstrained parameters found in atom map
|
||||
parameter avmm_group_channel_index = 0, // 0..2
|
||||
parameter channel_number = 0, // 0..65
|
||||
parameter cid_pattern_len = 8'b0, // 8
|
||||
parameter use_default_base_address = "true", // false, true
|
||||
parameter user_base_address = 0, // 0..2047
|
||||
|
||||
// constrained parameters
|
||||
parameter test_mode = "<auto_single>", // bist, dont_care_test, prbs
|
||||
parameter hip_mode = "<auto_single>", // dis_hip, en_hip
|
||||
parameter pma_dw = "<auto_single>", // eight_bit, sixteen_bit, ten_bit, twenty_bit
|
||||
parameter pcs_bypass = "<auto_single>", // dis_pcs_bypass, en_pcs_bypass
|
||||
parameter phase_compensation_fifo = "<auto_single>", // low_latency, normal_latency, pld_ctrl_low_latency, pld_ctrl_normal_latency, register_fifo
|
||||
parameter tx_compliance_controlled_disparity = "<auto_single>", // dis_txcompliance, en_txcompliance_pipe2p0
|
||||
parameter force_kchar = "<auto_single>", // dis_force_kchar, en_force_kchar
|
||||
parameter force_echar = "<auto_single>", // dis_force_echar, en_force_echar
|
||||
parameter byte_serializer = "<auto_single>", // dis_bs, en_bs_by_2
|
||||
parameter data_selection_8b10b_encoder_input = "<auto_single>", // gige_idle_conversion, normal_data_path, xaui_sm
|
||||
parameter eightb_tenb_disp_ctrl = "<auto_single>", // dis_disp_ctrl, en_disp_ctrl, en_ib_disp_ctrl
|
||||
parameter eightb_tenb_encoder = "<auto_single>", // dis_8b10b, en_8b10b_ibm, en_8b10b_sgx
|
||||
parameter prbs_gen = "<auto_single>", // dis_prbs, prbs_10, prbs_15, prbs_23_dw, prbs_23_sw, prbs_31, prbs_7_dw, prbs_7_sw, prbs_8, prbs_hf_dw, prbs_hf_sw, prbs_lf_dw, prbs_lf_sw, prbs_mf_dw, prbs_mf_sw
|
||||
parameter cid_pattern = "<auto_single>", // cid_pattern_0, cid_pattern_1
|
||||
parameter bist_gen = "<auto_single>", // cjpat, crpat, dis_bist, incremental
|
||||
parameter bit_reversal = "<auto_single>", // dis_bit_reversal, en_bit_reversal
|
||||
parameter symbol_swap = "<auto_single>", // dis_symbol_swap, en_symbol_swap
|
||||
parameter polarity_inversion = "<auto_single>", // dis_polinv, enable_polinv
|
||||
parameter tx_bitslip = "<auto_single>", // dis_tx_bitslip, en_tx_bitslip
|
||||
parameter ctrl_plane_bonding_consumption = "<auto_single>", // bundled_master, bundled_slave_above, bundled_slave_below, individual
|
||||
parameter agg_block_sel = "<auto_single>", // other_smrt_pack, same_smrt_pack
|
||||
parameter ctrl_plane_bonding_distribution = "<auto_single>", // master_chnl_distr, not_master_chnl_distr
|
||||
parameter ctrl_plane_bonding_compensation = "<auto_single>", // dis_compensation, en_compensation
|
||||
parameter bypass_pipeline_reg = "<auto_single>", // dis_bypass_pipeline, en_bypass_pipeline
|
||||
parameter clock_gate_bs_enc = "<auto_single>", // dis_bs_enc_clk_gating, en_bs_enc_clk_gating
|
||||
parameter clock_gate_prbs = "<auto_single>", // dis_prbs_clk_gating, en_prbs_clk_gating
|
||||
parameter clock_gate_bist = "<auto_single>", // dis_bist_clk_gating, en_bist_clk_gating
|
||||
parameter clock_gate_sw_fifowr = "<auto_single>", // dis_sw_fifowr_clk_gating, en_sw_fifowr_clk_gating
|
||||
parameter clock_gate_dw_fifowr = "<auto_single>", // dis_dw_fifowr_clk_gating, en_dw_fifowr_clk_gating
|
||||
parameter clock_gate_fiford = "<auto_single>", // dis_fiford_clk_gating, en_fiford_clk_gating
|
||||
parameter revloop_back_rm = "<auto_single>", // dis_rev_loopback_rx_rm, en_rev_loopback_rx_rm
|
||||
parameter phfifo_write_clk_sel = "<auto_single>", // pld_tx_clk, tx_clk
|
||||
parameter refclk_b_clk_sel = "<auto_single>", // refclk_dig, tx_pma_clock
|
||||
parameter dynamic_clk_switch = "<auto_single>", // dis_dyn_clk_switch, en_dyn_clk_switch
|
||||
parameter auto_speed_nego_gen2 = "<auto_single>", // dis_asn_g2, en_asn_g2_freq_scal
|
||||
parameter txclk_freerun = "<auto_single>", // dis_freerun_tx, en_freerun_tx
|
||||
parameter pcfifo_urst = "<auto_single>", // dis_pcfifourst, en_pcfifourst
|
||||
parameter txpcs_urst = "<auto_single>" // dis_txpcs_urst, en_txpcs_urst
|
||||
) (
|
||||
// ports
|
||||
output wire aggtxpcsrst,
|
||||
input wire [10:0] avmmaddress,
|
||||
input wire [1:0] avmmbyteen,
|
||||
input wire avmmclk,
|
||||
input wire avmmread,
|
||||
output wire [15:0] avmmreaddata,
|
||||
input wire avmmrstn,
|
||||
input wire avmmwrite,
|
||||
input wire [15:0] avmmwritedata,
|
||||
input wire [4:0] bitslipboundaryselect,
|
||||
output wire blockselect,
|
||||
output wire clkout,
|
||||
input wire coreclk,
|
||||
input wire [43:0] datain,
|
||||
output wire [19:0] dataout,
|
||||
input wire detectrxloopin,
|
||||
output wire detectrxloopout,
|
||||
input wire dispcbyte,
|
||||
output wire dynclkswitchn,
|
||||
input wire [2:0] elecidleinfersel,
|
||||
input wire enrevparallellpbk,
|
||||
input wire [1:0] fifoselectinchnldown,
|
||||
input wire [1:0] fifoselectinchnlup,
|
||||
output wire [1:0] fifoselectoutchnldown,
|
||||
output wire [1:0] fifoselectoutchnlup,
|
||||
output wire [2:0] grayelecidleinferselout,
|
||||
input wire hrdrst,
|
||||
input wire invpol,
|
||||
output wire observablebyteserdesclock,
|
||||
output wire [19:0] parallelfdbkout,
|
||||
output wire phfifooverflow,
|
||||
input wire phfiforddisable,
|
||||
input wire phfiforeset,
|
||||
output wire phfifotxdeemph,
|
||||
output wire [2:0] phfifotxmargin,
|
||||
output wire phfifotxswing,
|
||||
output wire phfifounderflow,
|
||||
input wire phfifowrenable,
|
||||
input wire pipeenrevparallellpbkin,
|
||||
output wire pipeenrevparallellpbkout,
|
||||
output wire [1:0] pipepowerdownout,
|
||||
input wire pipetxdeemph,
|
||||
input wire [2:0] pipetxmargin,
|
||||
input wire pipetxswing,
|
||||
input wire polinvrxin,
|
||||
output wire polinvrxout,
|
||||
input wire [1:0] powerdn,
|
||||
input wire prbscidenable,
|
||||
input wire rateswitch,
|
||||
input wire rdenableinchnldown,
|
||||
input wire rdenableinchnlup,
|
||||
output wire rdenableoutchnldown,
|
||||
output wire rdenableoutchnlup,
|
||||
output wire rdenablesync,
|
||||
output wire refclkb,
|
||||
output wire refclkbreset,
|
||||
input wire refclkdig,
|
||||
input wire resetpcptrs,
|
||||
input wire resetpcptrsinchnldown,
|
||||
input wire resetpcptrsinchnlup,
|
||||
input wire [19:0] revparallellpbkdata,
|
||||
input wire rxpolarityin,
|
||||
output wire rxpolarityout,
|
||||
input wire scanmode,
|
||||
output wire syncdatain,
|
||||
input wire [3:0] txblkstart,
|
||||
output wire [3:0] txblkstartout,
|
||||
output wire txcomplianceout,
|
||||
output wire [19:0] txctrlplanetestbus,
|
||||
output wire [3:0] txdatakouttogen3,
|
||||
output wire [31:0] txdataouttogen3,
|
||||
input wire [3:0] txdatavalid,
|
||||
output wire [3:0] txdatavalidouttogen3,
|
||||
output wire [1:0] txdivsync,
|
||||
input wire [1:0] txdivsyncinchnldown,
|
||||
input wire [1:0] txdivsyncinchnlup,
|
||||
output wire [1:0] txdivsyncoutchnldown,
|
||||
output wire [1:0] txdivsyncoutchnlup,
|
||||
output wire txelecidleout,
|
||||
input wire txpcsreset,
|
||||
output wire txpipeclk,
|
||||
output wire txpipeelectidle,
|
||||
output wire txpipesoftreset,
|
||||
input wire txpmalocalclk,
|
||||
input wire [1:0] txsynchdr,
|
||||
output wire [1:0] txsynchdrout,
|
||||
output wire [19:0] txtestbus,
|
||||
input wire wrenableinchnldown,
|
||||
input wire wrenableinchnlup,
|
||||
output wire wrenableoutchnldown,
|
||||
output wire wrenableoutchnlup,
|
||||
input wire xgmctrl,
|
||||
output wire xgmctrlenable,
|
||||
input wire xgmctrltoporbottom,
|
||||
input wire [7:0] xgmdatain,
|
||||
input wire [7:0] xgmdataintoporbottom,
|
||||
output wire [7:0] xgmdataout
|
||||
);
|
||||
import altera_xcvr_functions::*;
|
||||
|
||||
// prot_mode external parameter (no RBC)
|
||||
localparam rbc_all_prot_mode = "(basic,cpri,cpri_rx_tx,disabled_prot_mode,gige,pipe_g1,pipe_g2,srio_2p1,test,xaui)";
|
||||
localparam rbc_any_prot_mode = "basic";
|
||||
localparam fnl_prot_mode = (prot_mode == "<auto_any>" || prot_mode == "<auto_single>") ? rbc_any_prot_mode : prot_mode;
|
||||
|
||||
// sup_mode external parameter (no RBC)
|
||||
localparam rbc_all_sup_mode = "(engineering_mode,user_mode)";
|
||||
localparam rbc_any_sup_mode = "user_mode";
|
||||
localparam fnl_sup_mode = (sup_mode == "<auto_any>" || sup_mode == "<auto_single>") ? rbc_any_sup_mode : sup_mode;
|
||||
|
||||
// use_default_base_address external parameter (no RBC)
|
||||
localparam rbc_all_use_default_base_address = "(false,true)";
|
||||
localparam rbc_any_use_default_base_address = "true";
|
||||
localparam fnl_use_default_base_address = (use_default_base_address == "<auto_any>" || use_default_base_address == "<auto_single>") ? rbc_any_use_default_base_address : use_default_base_address;
|
||||
|
||||
// test_mode, RBC-validated
|
||||
localparam rbc_all_test_mode = (fnl_prot_mode != "test") ? ("dont_care_test") : "(prbs,bist)";
|
||||
localparam rbc_any_test_mode = (fnl_prot_mode != "test") ? ("dont_care_test") : "prbs";
|
||||
localparam fnl_test_mode = (test_mode == "<auto_any>" || test_mode == "<auto_single>") ? rbc_any_test_mode : test_mode;
|
||||
|
||||
// hip_mode, RBC-validated
|
||||
localparam rbc_all_hip_mode = (fnl_prot_mode == "pipe_g1" || fnl_prot_mode == "pipe_g2" ) ? ("(dis_hip,en_hip)") : "dis_hip";
|
||||
localparam rbc_any_hip_mode = (fnl_prot_mode == "pipe_g1" || fnl_prot_mode == "pipe_g2" ) ? ("dis_hip") : "dis_hip";
|
||||
localparam fnl_hip_mode = (hip_mode == "<auto_any>" || hip_mode == "<auto_single>") ? rbc_any_hip_mode : hip_mode;
|
||||
|
||||
// pma_dw, RBC-validated
|
||||
localparam rbc_all_pma_dw = ( fnl_prot_mode == "srio_2p1" ) ? ("twenty_bit")
|
||||
: ( (fnl_prot_mode == "basic") || (fnl_test_mode == "prbs") ) ? ("(eight_bit,ten_bit,sixteen_bit,twenty_bit)")
|
||||
: ( (fnl_test_mode == "bist" ) || ( fnl_prot_mode == "cpri") || (fnl_prot_mode == "cpri_rx_tx")) ? ("(ten_bit,twenty_bit)") : "ten_bit";
|
||||
localparam rbc_any_pma_dw = ( fnl_prot_mode == "srio_2p1" ) ? ("twenty_bit")
|
||||
: ( (fnl_prot_mode == "basic") || (fnl_test_mode == "prbs") ) ? ("eight_bit")
|
||||
: ( (fnl_test_mode == "bist" ) || ( fnl_prot_mode == "cpri") || (fnl_prot_mode == "cpri_rx_tx")) ? ("ten_bit") : "ten_bit";
|
||||
localparam fnl_pma_dw = (pma_dw == "<auto_any>" || pma_dw == "<auto_single>") ? rbc_any_pma_dw : pma_dw;
|
||||
|
||||
// pcs_bypass, RBC-validated
|
||||
localparam rbc_all_pcs_bypass = ((fnl_prot_mode == "basic") || (fnl_prot_mode == "cpri_rx_tx")) ? ("(dis_pcs_bypass,en_pcs_bypass)") : "dis_pcs_bypass";
|
||||
localparam rbc_any_pcs_bypass = ((fnl_prot_mode == "basic") || (fnl_prot_mode == "cpri_rx_tx")) ? ("dis_pcs_bypass") : "dis_pcs_bypass";
|
||||
localparam fnl_pcs_bypass = (pcs_bypass == "<auto_any>" || pcs_bypass == "<auto_single>") ? rbc_any_pcs_bypass : pcs_bypass;
|
||||
|
||||
// phase_compensation_fifo, RBC-validated
|
||||
localparam rbc_all_phase_compensation_fifo = (fnl_prot_mode == "cpri" || fnl_prot_mode == "cpri_rx_tx" || fnl_hip_mode == "en_hip" ) ? ("register_fifo")
|
||||
: ( (fnl_prot_mode == "basic") || (fnl_prot_mode == "gige") ) ? ("(low_latency,register_fifo)") : "low_latency";
|
||||
localparam rbc_any_phase_compensation_fifo = (fnl_prot_mode == "cpri" || fnl_prot_mode == "cpri_rx_tx" || fnl_hip_mode == "en_hip" ) ? ("register_fifo")
|
||||
: ( (fnl_prot_mode == "basic") || (fnl_prot_mode == "gige") ) ? ("low_latency") : "low_latency";
|
||||
localparam fnl_phase_compensation_fifo = (phase_compensation_fifo == "<auto_any>" || phase_compensation_fifo == "<auto_single>") ? rbc_any_phase_compensation_fifo : phase_compensation_fifo;
|
||||
|
||||
// tx_compliance_controlled_disparity, RBC-validated
|
||||
localparam rbc_all_tx_compliance_controlled_disparity = ((fnl_prot_mode == "pipe_g1") || (fnl_prot_mode == "pipe_g2")) ? ("en_txcompliance_pipe2p0") : "dis_txcompliance";
|
||||
localparam rbc_any_tx_compliance_controlled_disparity = ((fnl_prot_mode == "pipe_g1") || (fnl_prot_mode == "pipe_g2")) ? ("en_txcompliance_pipe2p0") : "dis_txcompliance";
|
||||
localparam fnl_tx_compliance_controlled_disparity = (tx_compliance_controlled_disparity == "<auto_any>" || tx_compliance_controlled_disparity == "<auto_single>") ? rbc_any_tx_compliance_controlled_disparity : tx_compliance_controlled_disparity;
|
||||
|
||||
// force_kchar, RBC-validated
|
||||
localparam rbc_all_force_kchar = "dis_force_kchar";
|
||||
localparam rbc_any_force_kchar = "dis_force_kchar";
|
||||
localparam fnl_force_kchar = (force_kchar == "<auto_any>" || force_kchar == "<auto_single>") ? rbc_any_force_kchar : force_kchar;
|
||||
|
||||
// force_echar, RBC-validated
|
||||
localparam rbc_all_force_echar = "dis_force_echar";
|
||||
localparam rbc_any_force_echar = "dis_force_echar";
|
||||
localparam fnl_force_echar = (force_echar == "<auto_any>" || force_echar == "<auto_single>") ? rbc_any_force_echar : force_echar;
|
||||
|
||||
// byte_serializer, RBC-validated
|
||||
localparam rbc_all_byte_serializer = ( (fnl_test_mode == "prbs") || (fnl_test_mode == "bist" && fnl_pma_dw == "twenty_bit") || (fnl_prot_mode == "disabled_prot_mode") || (fnl_hip_mode == "en_hip") ) ? ("dis_bs")
|
||||
: ( (fnl_prot_mode == "xaui") || (fnl_test_mode == "bist" && fnl_pma_dw == "ten_bit" ) || ( fnl_prot_mode == "pipe_g2" ) ) ? ("en_bs_by_2") : "(dis_bs,en_bs_by_2)";
|
||||
localparam rbc_any_byte_serializer = ( (fnl_test_mode == "prbs") || (fnl_test_mode == "bist" && fnl_pma_dw == "twenty_bit") || (fnl_prot_mode == "disabled_prot_mode") || (fnl_hip_mode == "en_hip") ) ? ("dis_bs")
|
||||
: ( (fnl_prot_mode == "xaui") || (fnl_test_mode == "bist" && fnl_pma_dw == "ten_bit" ) || ( fnl_prot_mode == "pipe_g2" ) ) ? ("en_bs_by_2") : "dis_bs";
|
||||
localparam fnl_byte_serializer = (byte_serializer == "<auto_any>" || byte_serializer == "<auto_single>") ? rbc_any_byte_serializer : byte_serializer;
|
||||
|
||||
// data_selection_8b10b_encoder_input, RBC-validated
|
||||
localparam rbc_all_data_selection_8b10b_encoder_input = (fnl_prot_mode == "gige") ? ("gige_idle_conversion")
|
||||
: (fnl_prot_mode == "xaui") ? ("xaui_sm") : "normal_data_path";
|
||||
localparam rbc_any_data_selection_8b10b_encoder_input = (fnl_prot_mode == "gige") ? ("gige_idle_conversion")
|
||||
: (fnl_prot_mode == "xaui") ? ("xaui_sm") : "normal_data_path";
|
||||
localparam fnl_data_selection_8b10b_encoder_input = (data_selection_8b10b_encoder_input == "<auto_any>" || data_selection_8b10b_encoder_input == "<auto_single>") ? rbc_any_data_selection_8b10b_encoder_input : data_selection_8b10b_encoder_input;
|
||||
|
||||
// eightb_tenb_disp_ctrl, RBC-validated
|
||||
localparam rbc_all_eightb_tenb_disp_ctrl = ( fnl_prot_mode == "basic") ? ("(dis_disp_ctrl,en_disp_ctrl)")
|
||||
: (fnl_prot_mode == "pipe_g1" || fnl_prot_mode == "pipe_g2" ) ? ("en_disp_ctrl") : "dis_disp_ctrl";
|
||||
localparam rbc_any_eightb_tenb_disp_ctrl = ( fnl_prot_mode == "basic") ? ("dis_disp_ctrl")
|
||||
: (fnl_prot_mode == "pipe_g1" || fnl_prot_mode == "pipe_g2" ) ? ("en_disp_ctrl") : "dis_disp_ctrl";
|
||||
localparam fnl_eightb_tenb_disp_ctrl = (eightb_tenb_disp_ctrl == "<auto_any>" || eightb_tenb_disp_ctrl == "<auto_single>") ? rbc_any_eightb_tenb_disp_ctrl : eightb_tenb_disp_ctrl;
|
||||
|
||||
// eightb_tenb_encoder, RBC-validated
|
||||
localparam rbc_all_eightb_tenb_encoder = ( (fnl_pma_dw == "eight_bit") || (fnl_pma_dw == "sixteen_bit") || (fnl_pcs_bypass == "en_pcs_bypass") || (fnl_test_mode == "prbs") ) ? ("dis_8b10b")
|
||||
: (((fnl_prot_mode == "basic" ) && (fnl_pcs_bypass == "dis_pcs_bypass") && (fnl_sup_mode == "user_mode")) || fnl_prot_mode == "cpri" || fnl_prot_mode == "cpri_rx_tx" ) ? ("(dis_8b10b,en_8b10b_ibm)")
|
||||
: ( (fnl_prot_mode == "basic" ) && (fnl_pcs_bypass == "dis_pcs_bypass") && (fnl_sup_mode == "engineering_mode") ) ? ("(dis_8b10b,en_8b10b_ibm,en_8b10b_sgx)") : "en_8b10b_ibm";
|
||||
localparam rbc_any_eightb_tenb_encoder = ( (fnl_pma_dw == "eight_bit") || (fnl_pma_dw == "sixteen_bit") || (fnl_pcs_bypass == "en_pcs_bypass") || (fnl_test_mode == "prbs") ) ? ("dis_8b10b")
|
||||
: (((fnl_prot_mode == "basic" ) && (fnl_pcs_bypass == "dis_pcs_bypass") && (fnl_sup_mode == "user_mode")) || fnl_prot_mode == "cpri" || fnl_prot_mode == "cpri_rx_tx" ) ? ("dis_8b10b")
|
||||
: ( (fnl_prot_mode == "basic" ) && (fnl_pcs_bypass == "dis_pcs_bypass") && (fnl_sup_mode == "engineering_mode") ) ? ("dis_8b10b") : "en_8b10b_ibm";
|
||||
localparam fnl_eightb_tenb_encoder = (eightb_tenb_encoder == "<auto_any>" || eightb_tenb_encoder == "<auto_single>") ? rbc_any_eightb_tenb_encoder : eightb_tenb_encoder;
|
||||
|
||||
// prbs_gen, RBC-validated
|
||||
localparam rbc_all_prbs_gen = ( fnl_test_mode == "prbs") ?
|
||||
(
|
||||
(fnl_pma_dw == "eight_bit") ? ("(prbs_7_sw,prbs_8,prbs_23_sw,prbs_hf_sw,prbs_15,prbs_31)")
|
||||
: (fnl_pma_dw == "ten_bit") ? ("(prbs_10,prbs_hf_sw,prbs_lf_sw,prbs_15,prbs_31)")
|
||||
: (fnl_pma_dw == "sixteen_bit") ? ("(prbs_7_dw,prbs_23_dw,prbs_hf_dw,prbs_15,prbs_31)") : "(prbs_7_dw,prbs_23_dw,prbs_hf_dw,prbs_lf_dw,prbs_15,prbs_31)"
|
||||
) : "dis_prbs";
|
||||
localparam rbc_any_prbs_gen = ( fnl_test_mode == "prbs") ?
|
||||
(
|
||||
(fnl_pma_dw == "eight_bit") ? ("prbs_7_sw")
|
||||
: (fnl_pma_dw == "ten_bit") ? ("prbs_10")
|
||||
: (fnl_pma_dw == "sixteen_bit") ? ("prbs_7_dw") : "prbs_7_dw"
|
||||
) : "dis_prbs";
|
||||
localparam fnl_prbs_gen = (prbs_gen == "<auto_any>" || prbs_gen == "<auto_single>") ? rbc_any_prbs_gen : prbs_gen;
|
||||
|
||||
// cid_pattern, RBC-validated
|
||||
localparam rbc_all_cid_pattern = (fnl_prbs_gen == "prbs_8" ) ? ("(cid_pattern_0,cid_pattern_1)") : "cid_pattern_0";
|
||||
localparam rbc_any_cid_pattern = (fnl_prbs_gen == "prbs_8" ) ? ("cid_pattern_0") : "cid_pattern_0";
|
||||
localparam fnl_cid_pattern = (cid_pattern == "<auto_any>" || cid_pattern == "<auto_single>") ? rbc_any_cid_pattern : cid_pattern;
|
||||
|
||||
// bist_gen, RBC-validated
|
||||
localparam rbc_all_bist_gen = ( (fnl_test_mode == "bist") && (fnl_sup_mode == "user_mode") ) ? ("incremental")
|
||||
: ( (fnl_test_mode == "bist") && (fnl_sup_mode == "engineering_mode") ) ? ("(cjpat,crpat)") : "dis_bist";
|
||||
localparam rbc_any_bist_gen = ( (fnl_test_mode == "bist") && (fnl_sup_mode == "user_mode") ) ? ("incremental")
|
||||
: ( (fnl_test_mode == "bist") && (fnl_sup_mode == "engineering_mode") ) ? ("cjpat") : "dis_bist";
|
||||
localparam fnl_bist_gen = (bist_gen == "<auto_any>" || bist_gen == "<auto_single>") ? rbc_any_bist_gen : bist_gen;
|
||||
|
||||
// bit_reversal, RBC-validated
|
||||
localparam rbc_all_bit_reversal = (fnl_prot_mode == "pipe_g1" || fnl_prot_mode == "pipe_g2" || fnl_prot_mode == "cpri" || fnl_prot_mode == "cpri_rx_tx" || fnl_prot_mode == "gige" || fnl_prot_mode == "xaui" || fnl_prot_mode == "srio_2p1" || fnl_prot_mode == "test" ) ? ("dis_bit_reversal")
|
||||
: (fnl_prot_mode == "basic") ? ("(dis_bit_reversal,en_bit_reversal)") : "dis_bit_reversal";
|
||||
localparam rbc_any_bit_reversal = (fnl_prot_mode == "pipe_g1" || fnl_prot_mode == "pipe_g2" || fnl_prot_mode == "cpri" || fnl_prot_mode == "cpri_rx_tx" || fnl_prot_mode == "gige" || fnl_prot_mode == "xaui" || fnl_prot_mode == "srio_2p1" || fnl_prot_mode == "test" ) ? ("dis_bit_reversal")
|
||||
: (fnl_prot_mode == "basic") ? ("dis_bit_reversal") : "dis_bit_reversal";
|
||||
localparam fnl_bit_reversal = (bit_reversal == "<auto_any>" || bit_reversal == "<auto_single>") ? rbc_any_bit_reversal : bit_reversal;
|
||||
|
||||
// symbol_swap, RBC-validated
|
||||
localparam rbc_all_symbol_swap = ((fnl_prot_mode == "basic") && (fnl_pma_dw == "sixteen_bit" || fnl_pma_dw == "twenty_bit")) ? ("(dis_symbol_swap,en_symbol_swap)") : "dis_symbol_swap";
|
||||
localparam rbc_any_symbol_swap = ((fnl_prot_mode == "basic") && (fnl_pma_dw == "sixteen_bit" || fnl_pma_dw == "twenty_bit")) ? ("dis_symbol_swap") : "dis_symbol_swap";
|
||||
localparam fnl_symbol_swap = (symbol_swap == "<auto_any>" || symbol_swap == "<auto_single>") ? rbc_any_symbol_swap : symbol_swap;
|
||||
|
||||
// polarity_inversion, RBC-validated
|
||||
localparam rbc_all_polarity_inversion = (fnl_prot_mode == "disabled_prot_mode") ? ("dis_polinv")
|
||||
: (fnl_prot_mode == "test") ?
|
||||
(
|
||||
( (fnl_test_mode == "prbs") && (fnl_prbs_gen == "prbs_31")) ? ("(dis_polinv,enable_polinv)") : "dis_polinv"
|
||||
) : "(dis_polinv,enable_polinv)";
|
||||
localparam rbc_any_polarity_inversion = (fnl_prot_mode == "disabled_prot_mode") ? ("dis_polinv")
|
||||
: (fnl_prot_mode == "test") ?
|
||||
(
|
||||
( (fnl_test_mode == "prbs") && (fnl_prbs_gen == "prbs_31")) ? ("dis_polinv") : "dis_polinv"
|
||||
) : "dis_polinv";
|
||||
localparam fnl_polarity_inversion = (polarity_inversion == "<auto_any>" || polarity_inversion == "<auto_single>") ? rbc_any_polarity_inversion : polarity_inversion;
|
||||
|
||||
// tx_bitslip, RBC-validated
|
||||
localparam rbc_all_tx_bitslip = (fnl_prot_mode == "cpri_rx_tx") ? ("en_tx_bitslip")
|
||||
: (fnl_prot_mode == "pipe_g1" || fnl_prot_mode == "pipe_g2" || fnl_prot_mode == "gige" || fnl_prot_mode == "xaui" || fnl_prot_mode == "test") ? ("dis_tx_bitslip")
|
||||
: ( (fnl_prot_mode == "basic") || (fnl_prot_mode == "srio_2p1") || (fnl_prot_mode == "cpri") ) ? ("(en_tx_bitslip,dis_tx_bitslip)") : "dis_tx_bitslip";
|
||||
localparam rbc_any_tx_bitslip = (fnl_prot_mode == "cpri_rx_tx") ? ("en_tx_bitslip")
|
||||
: (fnl_prot_mode == "pipe_g1" || fnl_prot_mode == "pipe_g2" || fnl_prot_mode == "gige" || fnl_prot_mode == "xaui" || fnl_prot_mode == "test") ? ("dis_tx_bitslip")
|
||||
: ( (fnl_prot_mode == "basic") || (fnl_prot_mode == "srio_2p1") || (fnl_prot_mode == "cpri") ) ? ("dis_tx_bitslip") : "dis_tx_bitslip";
|
||||
localparam fnl_tx_bitslip = (tx_bitslip == "<auto_any>" || tx_bitslip == "<auto_single>") ? rbc_any_tx_bitslip : tx_bitslip;
|
||||
|
||||
// ctrl_plane_bonding_consumption, RBC-validated
|
||||
localparam rbc_all_ctrl_plane_bonding_consumption = ( (fnl_prot_mode == "test") || (fnl_prot_mode == "gige") || (fnl_prot_mode == "disabled_prot_mode") ) ? ("individual")
|
||||
: (fnl_prot_mode == "xaui") ? ("(bundled_master,bundled_slave_below,bundled_slave_above)") : "(individual,bundled_master,bundled_slave_below,bundled_slave_above)";
|
||||
localparam rbc_any_ctrl_plane_bonding_consumption = ( (fnl_prot_mode == "test") || (fnl_prot_mode == "gige") || (fnl_prot_mode == "disabled_prot_mode") ) ? ("individual")
|
||||
: (fnl_prot_mode == "xaui") ? ("bundled_master") : "individual";
|
||||
localparam fnl_ctrl_plane_bonding_consumption = (ctrl_plane_bonding_consumption == "<auto_any>" || ctrl_plane_bonding_consumption == "<auto_single>") ? rbc_any_ctrl_plane_bonding_consumption : ctrl_plane_bonding_consumption;
|
||||
|
||||
// agg_block_sel, RBC-validated
|
||||
localparam rbc_all_agg_block_sel = ( (fnl_prot_mode == "xaui") || ( (fnl_prot_mode == "srio_2p1") && (fnl_ctrl_plane_bonding_consumption != "individual")) ) ? ("(same_smrt_pack,other_smrt_pack)") : "same_smrt_pack";
|
||||
localparam rbc_any_agg_block_sel = ( (fnl_prot_mode == "xaui") || ( (fnl_prot_mode == "srio_2p1") && (fnl_ctrl_plane_bonding_consumption != "individual")) ) ? ("same_smrt_pack") : "same_smrt_pack";
|
||||
localparam fnl_agg_block_sel = (agg_block_sel == "<auto_any>" || agg_block_sel == "<auto_single>") ? rbc_any_agg_block_sel : agg_block_sel;
|
||||
|
||||
// ctrl_plane_bonding_distribution, RBC-validated
|
||||
localparam rbc_all_ctrl_plane_bonding_distribution = (fnl_ctrl_plane_bonding_consumption == "bundled_master") ? ("master_chnl_distr") : "not_master_chnl_distr";
|
||||
localparam rbc_any_ctrl_plane_bonding_distribution = (fnl_ctrl_plane_bonding_consumption == "bundled_master") ? ("master_chnl_distr") : "not_master_chnl_distr";
|
||||
localparam fnl_ctrl_plane_bonding_distribution = (ctrl_plane_bonding_distribution == "<auto_any>" || ctrl_plane_bonding_distribution == "<auto_single>") ? rbc_any_ctrl_plane_bonding_distribution : ctrl_plane_bonding_distribution;
|
||||
|
||||
// ctrl_plane_bonding_compensation, RBC-validated
|
||||
localparam rbc_all_ctrl_plane_bonding_compensation = "dis_compensation";
|
||||
localparam rbc_any_ctrl_plane_bonding_compensation = "dis_compensation";
|
||||
localparam fnl_ctrl_plane_bonding_compensation = (ctrl_plane_bonding_compensation == "<auto_any>" || ctrl_plane_bonding_compensation == "<auto_single>") ? rbc_any_ctrl_plane_bonding_compensation : ctrl_plane_bonding_compensation;
|
||||
|
||||
// bypass_pipeline_reg, RBC-validated
|
||||
localparam rbc_all_bypass_pipeline_reg = "dis_bypass_pipeline";
|
||||
localparam rbc_any_bypass_pipeline_reg = "dis_bypass_pipeline";
|
||||
localparam fnl_bypass_pipeline_reg = (bypass_pipeline_reg == "<auto_any>" || bypass_pipeline_reg == "<auto_single>") ? rbc_any_bypass_pipeline_reg : bypass_pipeline_reg;
|
||||
|
||||
// clock_gate_bs_enc, RBC-validated
|
||||
localparam rbc_all_clock_gate_bs_enc = (fnl_prot_mode == "disabled_prot_mode") ? ("en_bs_enc_clk_gating") : "dis_bs_enc_clk_gating";
|
||||
localparam rbc_any_clock_gate_bs_enc = (fnl_prot_mode == "disabled_prot_mode") ? ("en_bs_enc_clk_gating") : "dis_bs_enc_clk_gating";
|
||||
localparam fnl_clock_gate_bs_enc = (clock_gate_bs_enc == "<auto_any>" || clock_gate_bs_enc == "<auto_single>") ? rbc_any_clock_gate_bs_enc : clock_gate_bs_enc;
|
||||
|
||||
// clock_gate_prbs, RBC-validated
|
||||
localparam rbc_all_clock_gate_prbs = (fnl_test_mode != "prbs" ) ? ("en_prbs_clk_gating") : "dis_prbs_clk_gating";
|
||||
localparam rbc_any_clock_gate_prbs = (fnl_test_mode != "prbs" ) ? ("en_prbs_clk_gating") : "dis_prbs_clk_gating";
|
||||
localparam fnl_clock_gate_prbs = (clock_gate_prbs == "<auto_any>" || clock_gate_prbs == "<auto_single>") ? rbc_any_clock_gate_prbs : clock_gate_prbs;
|
||||
|
||||
// clock_gate_bist, RBC-validated
|
||||
localparam rbc_all_clock_gate_bist = (fnl_test_mode != "bist" ) ? ("en_bist_clk_gating") : "dis_bist_clk_gating";
|
||||
localparam rbc_any_clock_gate_bist = (fnl_test_mode != "bist" ) ? ("en_bist_clk_gating") : "dis_bist_clk_gating";
|
||||
localparam fnl_clock_gate_bist = (clock_gate_bist == "<auto_any>" || clock_gate_bist == "<auto_single>") ? rbc_any_clock_gate_bist : clock_gate_bist;
|
||||
|
||||
// clock_gate_sw_fifowr, RBC-validated
|
||||
localparam rbc_all_clock_gate_sw_fifowr = ( (fnl_prot_mode == "disabled_prot_mode") ||((fnl_phase_compensation_fifo == "register_fifo") && (fnl_hip_mode == "dis_hip")) ) ? ("en_sw_fifowr_clk_gating") : "dis_sw_fifowr_clk_gating";
|
||||
localparam rbc_any_clock_gate_sw_fifowr = ( (fnl_prot_mode == "disabled_prot_mode") ||((fnl_phase_compensation_fifo == "register_fifo") && (fnl_hip_mode == "dis_hip")) ) ? ("en_sw_fifowr_clk_gating") : "dis_sw_fifowr_clk_gating";
|
||||
localparam fnl_clock_gate_sw_fifowr = (clock_gate_sw_fifowr == "<auto_any>" || clock_gate_sw_fifowr == "<auto_single>") ? rbc_any_clock_gate_sw_fifowr : clock_gate_sw_fifowr;
|
||||
|
||||
// clock_gate_dw_fifowr, RBC-validated
|
||||
localparam rbc_all_clock_gate_dw_fifowr = ( (fnl_prot_mode == "disabled_prot_mode") || (fnl_phase_compensation_fifo == "register_fifo") || (fnl_pma_dw == "ten_bit") || (fnl_pma_dw == "eight_bit") ) ? ("en_dw_fifowr_clk_gating") : "dis_dw_fifowr_clk_gating";
|
||||
localparam rbc_any_clock_gate_dw_fifowr = ( (fnl_prot_mode == "disabled_prot_mode") || (fnl_phase_compensation_fifo == "register_fifo") || (fnl_pma_dw == "ten_bit") || (fnl_pma_dw == "eight_bit") ) ? ("en_dw_fifowr_clk_gating") : "dis_dw_fifowr_clk_gating";
|
||||
localparam fnl_clock_gate_dw_fifowr = (clock_gate_dw_fifowr == "<auto_any>" || clock_gate_dw_fifowr == "<auto_single>") ? rbc_any_clock_gate_dw_fifowr : clock_gate_dw_fifowr;
|
||||
|
||||
// clock_gate_fiford, RBC-validated
|
||||
localparam rbc_all_clock_gate_fiford = (fnl_prot_mode == "disabled_prot_mode") ? ("en_fiford_clk_gating") : "dis_fiford_clk_gating";
|
||||
localparam rbc_any_clock_gate_fiford = (fnl_prot_mode == "disabled_prot_mode") ? ("en_fiford_clk_gating") : "dis_fiford_clk_gating";
|
||||
localparam fnl_clock_gate_fiford = (clock_gate_fiford == "<auto_any>" || clock_gate_fiford == "<auto_single>") ? rbc_any_clock_gate_fiford : clock_gate_fiford;
|
||||
|
||||
// revloop_back_rm, RBC-validated
|
||||
localparam rbc_all_revloop_back_rm = ((fnl_prot_mode == "pipe_g1") || (fnl_prot_mode == "pipe_g2")) ? ("en_rev_loopback_rx_rm") : "dis_rev_loopback_rx_rm";
|
||||
localparam rbc_any_revloop_back_rm = ((fnl_prot_mode == "pipe_g1") || (fnl_prot_mode == "pipe_g2")) ? ("en_rev_loopback_rx_rm") : "dis_rev_loopback_rx_rm";
|
||||
localparam fnl_revloop_back_rm = (revloop_back_rm == "<auto_any>" || revloop_back_rm == "<auto_single>") ? rbc_any_revloop_back_rm : revloop_back_rm;
|
||||
|
||||
// phfifo_write_clk_sel, RBC-validated
|
||||
localparam rbc_all_phfifo_write_clk_sel = ((fnl_prot_mode == "test") || (fnl_phase_compensation_fifo == "register_fifo") ) ? ("tx_clk") : "pld_tx_clk";
|
||||
localparam rbc_any_phfifo_write_clk_sel = ((fnl_prot_mode == "test") || (fnl_phase_compensation_fifo == "register_fifo") ) ? ("tx_clk") : "pld_tx_clk";
|
||||
localparam fnl_phfifo_write_clk_sel = (phfifo_write_clk_sel == "<auto_any>" || phfifo_write_clk_sel == "<auto_single>") ? rbc_any_phfifo_write_clk_sel : phfifo_write_clk_sel;
|
||||
|
||||
// refclk_b_clk_sel, RBC-validated
|
||||
localparam rbc_all_refclk_b_clk_sel = (fnl_sup_mode == "engineering_mode") ? ("(refclk_dig,tx_pma_clock)") : "tx_pma_clock";
|
||||
localparam rbc_any_refclk_b_clk_sel = (fnl_sup_mode == "engineering_mode") ? ("tx_pma_clock") : "tx_pma_clock";
|
||||
localparam fnl_refclk_b_clk_sel = (refclk_b_clk_sel == "<auto_any>" || refclk_b_clk_sel == "<auto_single>") ? rbc_any_refclk_b_clk_sel : refclk_b_clk_sel;
|
||||
|
||||
// dynamic_clk_switch, RBC-validated
|
||||
localparam rbc_all_dynamic_clk_switch = "dis_dyn_clk_switch";
|
||||
localparam rbc_any_dynamic_clk_switch = "dis_dyn_clk_switch";
|
||||
localparam fnl_dynamic_clk_switch = (dynamic_clk_switch == "<auto_any>" || dynamic_clk_switch == "<auto_single>") ? rbc_any_dynamic_clk_switch : dynamic_clk_switch;
|
||||
|
||||
// auto_speed_nego_gen2, RBC-validated
|
||||
localparam rbc_all_auto_speed_nego_gen2 = ( (fnl_prot_mode == "pipe_g2" ) && ( (fnl_ctrl_plane_bonding_consumption == "individual") || (fnl_ctrl_plane_bonding_consumption == "bundled_master")) ) ? ("en_asn_g2_freq_scal") : "dis_asn_g2";
|
||||
localparam rbc_any_auto_speed_nego_gen2 = ( (fnl_prot_mode == "pipe_g2" ) && ( (fnl_ctrl_plane_bonding_consumption == "individual") || (fnl_ctrl_plane_bonding_consumption == "bundled_master")) ) ? ("en_asn_g2_freq_scal") : "dis_asn_g2";
|
||||
localparam fnl_auto_speed_nego_gen2 = (auto_speed_nego_gen2 == "<auto_any>" || auto_speed_nego_gen2 == "<auto_single>") ? rbc_any_auto_speed_nego_gen2 : auto_speed_nego_gen2;
|
||||
|
||||
// txclk_freerun, RBC-validated
|
||||
localparam rbc_all_txclk_freerun = "en_freerun_tx";
|
||||
localparam rbc_any_txclk_freerun = "en_freerun_tx";
|
||||
localparam fnl_txclk_freerun = (txclk_freerun == "<auto_any>" || txclk_freerun == "<auto_single>") ? rbc_any_txclk_freerun : txclk_freerun;
|
||||
|
||||
// pcfifo_urst, RBC-validated
|
||||
localparam rbc_all_pcfifo_urst = "dis_pcfifourst";
|
||||
localparam rbc_any_pcfifo_urst = "dis_pcfifourst";
|
||||
localparam fnl_pcfifo_urst = (pcfifo_urst == "<auto_any>" || pcfifo_urst == "<auto_single>") ? rbc_any_pcfifo_urst : pcfifo_urst;
|
||||
|
||||
// txpcs_urst, RBC-validated
|
||||
localparam rbc_all_txpcs_urst = "en_txpcs_urst";
|
||||
localparam rbc_any_txpcs_urst = "en_txpcs_urst";
|
||||
localparam fnl_txpcs_urst = (txpcs_urst == "<auto_any>" || txpcs_urst == "<auto_single>") ? rbc_any_txpcs_urst : txpcs_urst;
|
||||
|
||||
// Validate input parameters against known values or RBC values
|
||||
initial begin
|
||||
//$display("prot_mode = orig: '%s', any:'%s', all:'%s', final: '%s'", prot_mode, rbc_any_prot_mode, rbc_all_prot_mode, fnl_prot_mode);
|
||||
if (!is_in_legal_set(prot_mode, rbc_all_prot_mode)) begin
|
||||
$display("Critical Warning: parameter 'prot_mode' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", prot_mode, rbc_all_prot_mode, fnl_prot_mode);
|
||||
end
|
||||
//$display("sup_mode = orig: '%s', any:'%s', all:'%s', final: '%s'", sup_mode, rbc_any_sup_mode, rbc_all_sup_mode, fnl_sup_mode);
|
||||
if (!is_in_legal_set(sup_mode, rbc_all_sup_mode)) begin
|
||||
$display("Critical Warning: parameter 'sup_mode' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", sup_mode, rbc_all_sup_mode, fnl_sup_mode);
|
||||
end
|
||||
//$display("use_default_base_address = orig: '%s', any:'%s', all:'%s', final: '%s'", use_default_base_address, rbc_any_use_default_base_address, rbc_all_use_default_base_address, fnl_use_default_base_address);
|
||||
if (!is_in_legal_set(use_default_base_address, rbc_all_use_default_base_address)) begin
|
||||
$display("Critical Warning: parameter 'use_default_base_address' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", use_default_base_address, rbc_all_use_default_base_address, fnl_use_default_base_address);
|
||||
end
|
||||
//$display("test_mode = orig: '%s', any:'%s', all:'%s', final: '%s'", test_mode, rbc_any_test_mode, rbc_all_test_mode, fnl_test_mode);
|
||||
if (!is_in_legal_set(test_mode, rbc_all_test_mode)) begin
|
||||
$display("Critical Warning: parameter 'test_mode' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", test_mode, rbc_all_test_mode, fnl_test_mode);
|
||||
end
|
||||
//$display("hip_mode = orig: '%s', any:'%s', all:'%s', final: '%s'", hip_mode, rbc_any_hip_mode, rbc_all_hip_mode, fnl_hip_mode);
|
||||
if (!is_in_legal_set(hip_mode, rbc_all_hip_mode)) begin
|
||||
$display("Critical Warning: parameter 'hip_mode' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", hip_mode, rbc_all_hip_mode, fnl_hip_mode);
|
||||
end
|
||||
//$display("pma_dw = orig: '%s', any:'%s', all:'%s', final: '%s'", pma_dw, rbc_any_pma_dw, rbc_all_pma_dw, fnl_pma_dw);
|
||||
if (!is_in_legal_set(pma_dw, rbc_all_pma_dw)) begin
|
||||
$display("Critical Warning: parameter 'pma_dw' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pma_dw, rbc_all_pma_dw, fnl_pma_dw);
|
||||
end
|
||||
//$display("pcs_bypass = orig: '%s', any:'%s', all:'%s', final: '%s'", pcs_bypass, rbc_any_pcs_bypass, rbc_all_pcs_bypass, fnl_pcs_bypass);
|
||||
if (!is_in_legal_set(pcs_bypass, rbc_all_pcs_bypass)) begin
|
||||
$display("Critical Warning: parameter 'pcs_bypass' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pcs_bypass, rbc_all_pcs_bypass, fnl_pcs_bypass);
|
||||
end
|
||||
//$display("phase_compensation_fifo = orig: '%s', any:'%s', all:'%s', final: '%s'", phase_compensation_fifo, rbc_any_phase_compensation_fifo, rbc_all_phase_compensation_fifo, fnl_phase_compensation_fifo);
|
||||
if (!is_in_legal_set(phase_compensation_fifo, rbc_all_phase_compensation_fifo)) begin
|
||||
$display("Critical Warning: parameter 'phase_compensation_fifo' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", phase_compensation_fifo, rbc_all_phase_compensation_fifo, fnl_phase_compensation_fifo);
|
||||
end
|
||||
//$display("tx_compliance_controlled_disparity = orig: '%s', any:'%s', all:'%s', final: '%s'", tx_compliance_controlled_disparity, rbc_any_tx_compliance_controlled_disparity, rbc_all_tx_compliance_controlled_disparity, fnl_tx_compliance_controlled_disparity);
|
||||
if (!is_in_legal_set(tx_compliance_controlled_disparity, rbc_all_tx_compliance_controlled_disparity)) begin
|
||||
$display("Critical Warning: parameter 'tx_compliance_controlled_disparity' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", tx_compliance_controlled_disparity, rbc_all_tx_compliance_controlled_disparity, fnl_tx_compliance_controlled_disparity);
|
||||
end
|
||||
//$display("force_kchar = orig: '%s', any:'%s', all:'%s', final: '%s'", force_kchar, rbc_any_force_kchar, rbc_all_force_kchar, fnl_force_kchar);
|
||||
if (!is_in_legal_set(force_kchar, rbc_all_force_kchar)) begin
|
||||
$display("Critical Warning: parameter 'force_kchar' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", force_kchar, rbc_all_force_kchar, fnl_force_kchar);
|
||||
end
|
||||
//$display("force_echar = orig: '%s', any:'%s', all:'%s', final: '%s'", force_echar, rbc_any_force_echar, rbc_all_force_echar, fnl_force_echar);
|
||||
if (!is_in_legal_set(force_echar, rbc_all_force_echar)) begin
|
||||
$display("Critical Warning: parameter 'force_echar' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", force_echar, rbc_all_force_echar, fnl_force_echar);
|
||||
end
|
||||
//$display("byte_serializer = orig: '%s', any:'%s', all:'%s', final: '%s'", byte_serializer, rbc_any_byte_serializer, rbc_all_byte_serializer, fnl_byte_serializer);
|
||||
if (!is_in_legal_set(byte_serializer, rbc_all_byte_serializer)) begin
|
||||
$display("Critical Warning: parameter 'byte_serializer' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", byte_serializer, rbc_all_byte_serializer, fnl_byte_serializer);
|
||||
end
|
||||
//$display("data_selection_8b10b_encoder_input = orig: '%s', any:'%s', all:'%s', final: '%s'", data_selection_8b10b_encoder_input, rbc_any_data_selection_8b10b_encoder_input, rbc_all_data_selection_8b10b_encoder_input, fnl_data_selection_8b10b_encoder_input);
|
||||
if (!is_in_legal_set(data_selection_8b10b_encoder_input, rbc_all_data_selection_8b10b_encoder_input)) begin
|
||||
$display("Critical Warning: parameter 'data_selection_8b10b_encoder_input' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", data_selection_8b10b_encoder_input, rbc_all_data_selection_8b10b_encoder_input, fnl_data_selection_8b10b_encoder_input);
|
||||
end
|
||||
//$display("eightb_tenb_disp_ctrl = orig: '%s', any:'%s', all:'%s', final: '%s'", eightb_tenb_disp_ctrl, rbc_any_eightb_tenb_disp_ctrl, rbc_all_eightb_tenb_disp_ctrl, fnl_eightb_tenb_disp_ctrl);
|
||||
if (!is_in_legal_set(eightb_tenb_disp_ctrl, rbc_all_eightb_tenb_disp_ctrl)) begin
|
||||
$display("Critical Warning: parameter 'eightb_tenb_disp_ctrl' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", eightb_tenb_disp_ctrl, rbc_all_eightb_tenb_disp_ctrl, fnl_eightb_tenb_disp_ctrl);
|
||||
end
|
||||
//$display("eightb_tenb_encoder = orig: '%s', any:'%s', all:'%s', final: '%s'", eightb_tenb_encoder, rbc_any_eightb_tenb_encoder, rbc_all_eightb_tenb_encoder, fnl_eightb_tenb_encoder);
|
||||
if (!is_in_legal_set(eightb_tenb_encoder, rbc_all_eightb_tenb_encoder)) begin
|
||||
$display("Critical Warning: parameter 'eightb_tenb_encoder' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", eightb_tenb_encoder, rbc_all_eightb_tenb_encoder, fnl_eightb_tenb_encoder);
|
||||
end
|
||||
//$display("prbs_gen = orig: '%s', any:'%s', all:'%s', final: '%s'", prbs_gen, rbc_any_prbs_gen, rbc_all_prbs_gen, fnl_prbs_gen);
|
||||
if (!is_in_legal_set(prbs_gen, rbc_all_prbs_gen)) begin
|
||||
$display("Critical Warning: parameter 'prbs_gen' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", prbs_gen, rbc_all_prbs_gen, fnl_prbs_gen);
|
||||
end
|
||||
//$display("cid_pattern = orig: '%s', any:'%s', all:'%s', final: '%s'", cid_pattern, rbc_any_cid_pattern, rbc_all_cid_pattern, fnl_cid_pattern);
|
||||
if (!is_in_legal_set(cid_pattern, rbc_all_cid_pattern)) begin
|
||||
$display("Critical Warning: parameter 'cid_pattern' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", cid_pattern, rbc_all_cid_pattern, fnl_cid_pattern);
|
||||
end
|
||||
//$display("bist_gen = orig: '%s', any:'%s', all:'%s', final: '%s'", bist_gen, rbc_any_bist_gen, rbc_all_bist_gen, fnl_bist_gen);
|
||||
if (!is_in_legal_set(bist_gen, rbc_all_bist_gen)) begin
|
||||
$display("Critical Warning: parameter 'bist_gen' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", bist_gen, rbc_all_bist_gen, fnl_bist_gen);
|
||||
end
|
||||
//$display("bit_reversal = orig: '%s', any:'%s', all:'%s', final: '%s'", bit_reversal, rbc_any_bit_reversal, rbc_all_bit_reversal, fnl_bit_reversal);
|
||||
if (!is_in_legal_set(bit_reversal, rbc_all_bit_reversal)) begin
|
||||
$display("Critical Warning: parameter 'bit_reversal' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", bit_reversal, rbc_all_bit_reversal, fnl_bit_reversal);
|
||||
end
|
||||
//$display("symbol_swap = orig: '%s', any:'%s', all:'%s', final: '%s'", symbol_swap, rbc_any_symbol_swap, rbc_all_symbol_swap, fnl_symbol_swap);
|
||||
if (!is_in_legal_set(symbol_swap, rbc_all_symbol_swap)) begin
|
||||
$display("Critical Warning: parameter 'symbol_swap' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", symbol_swap, rbc_all_symbol_swap, fnl_symbol_swap);
|
||||
end
|
||||
//$display("polarity_inversion = orig: '%s', any:'%s', all:'%s', final: '%s'", polarity_inversion, rbc_any_polarity_inversion, rbc_all_polarity_inversion, fnl_polarity_inversion);
|
||||
if (!is_in_legal_set(polarity_inversion, rbc_all_polarity_inversion)) begin
|
||||
$display("Critical Warning: parameter 'polarity_inversion' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", polarity_inversion, rbc_all_polarity_inversion, fnl_polarity_inversion);
|
||||
end
|
||||
//$display("tx_bitslip = orig: '%s', any:'%s', all:'%s', final: '%s'", tx_bitslip, rbc_any_tx_bitslip, rbc_all_tx_bitslip, fnl_tx_bitslip);
|
||||
if (!is_in_legal_set(tx_bitslip, rbc_all_tx_bitslip)) begin
|
||||
$display("Critical Warning: parameter 'tx_bitslip' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", tx_bitslip, rbc_all_tx_bitslip, fnl_tx_bitslip);
|
||||
end
|
||||
//$display("ctrl_plane_bonding_consumption = orig: '%s', any:'%s', all:'%s', final: '%s'", ctrl_plane_bonding_consumption, rbc_any_ctrl_plane_bonding_consumption, rbc_all_ctrl_plane_bonding_consumption, fnl_ctrl_plane_bonding_consumption);
|
||||
if (!is_in_legal_set(ctrl_plane_bonding_consumption, rbc_all_ctrl_plane_bonding_consumption)) begin
|
||||
$display("Critical Warning: parameter 'ctrl_plane_bonding_consumption' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", ctrl_plane_bonding_consumption, rbc_all_ctrl_plane_bonding_consumption, fnl_ctrl_plane_bonding_consumption);
|
||||
end
|
||||
//$display("agg_block_sel = orig: '%s', any:'%s', all:'%s', final: '%s'", agg_block_sel, rbc_any_agg_block_sel, rbc_all_agg_block_sel, fnl_agg_block_sel);
|
||||
if (!is_in_legal_set(agg_block_sel, rbc_all_agg_block_sel)) begin
|
||||
$display("Critical Warning: parameter 'agg_block_sel' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", agg_block_sel, rbc_all_agg_block_sel, fnl_agg_block_sel);
|
||||
end
|
||||
//$display("ctrl_plane_bonding_distribution = orig: '%s', any:'%s', all:'%s', final: '%s'", ctrl_plane_bonding_distribution, rbc_any_ctrl_plane_bonding_distribution, rbc_all_ctrl_plane_bonding_distribution, fnl_ctrl_plane_bonding_distribution);
|
||||
if (!is_in_legal_set(ctrl_plane_bonding_distribution, rbc_all_ctrl_plane_bonding_distribution)) begin
|
||||
$display("Critical Warning: parameter 'ctrl_plane_bonding_distribution' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", ctrl_plane_bonding_distribution, rbc_all_ctrl_plane_bonding_distribution, fnl_ctrl_plane_bonding_distribution);
|
||||
end
|
||||
//$display("ctrl_plane_bonding_compensation = orig: '%s', any:'%s', all:'%s', final: '%s'", ctrl_plane_bonding_compensation, rbc_any_ctrl_plane_bonding_compensation, rbc_all_ctrl_plane_bonding_compensation, fnl_ctrl_plane_bonding_compensation);
|
||||
if (!is_in_legal_set(ctrl_plane_bonding_compensation, rbc_all_ctrl_plane_bonding_compensation)) begin
|
||||
$display("Critical Warning: parameter 'ctrl_plane_bonding_compensation' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", ctrl_plane_bonding_compensation, rbc_all_ctrl_plane_bonding_compensation, fnl_ctrl_plane_bonding_compensation);
|
||||
end
|
||||
//$display("bypass_pipeline_reg = orig: '%s', any:'%s', all:'%s', final: '%s'", bypass_pipeline_reg, rbc_any_bypass_pipeline_reg, rbc_all_bypass_pipeline_reg, fnl_bypass_pipeline_reg);
|
||||
if (!is_in_legal_set(bypass_pipeline_reg, rbc_all_bypass_pipeline_reg)) begin
|
||||
$display("Critical Warning: parameter 'bypass_pipeline_reg' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", bypass_pipeline_reg, rbc_all_bypass_pipeline_reg, fnl_bypass_pipeline_reg);
|
||||
end
|
||||
//$display("clock_gate_bs_enc = orig: '%s', any:'%s', all:'%s', final: '%s'", clock_gate_bs_enc, rbc_any_clock_gate_bs_enc, rbc_all_clock_gate_bs_enc, fnl_clock_gate_bs_enc);
|
||||
if (!is_in_legal_set(clock_gate_bs_enc, rbc_all_clock_gate_bs_enc)) begin
|
||||
$display("Critical Warning: parameter 'clock_gate_bs_enc' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", clock_gate_bs_enc, rbc_all_clock_gate_bs_enc, fnl_clock_gate_bs_enc);
|
||||
end
|
||||
//$display("clock_gate_prbs = orig: '%s', any:'%s', all:'%s', final: '%s'", clock_gate_prbs, rbc_any_clock_gate_prbs, rbc_all_clock_gate_prbs, fnl_clock_gate_prbs);
|
||||
if (!is_in_legal_set(clock_gate_prbs, rbc_all_clock_gate_prbs)) begin
|
||||
$display("Critical Warning: parameter 'clock_gate_prbs' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", clock_gate_prbs, rbc_all_clock_gate_prbs, fnl_clock_gate_prbs);
|
||||
end
|
||||
//$display("clock_gate_bist = orig: '%s', any:'%s', all:'%s', final: '%s'", clock_gate_bist, rbc_any_clock_gate_bist, rbc_all_clock_gate_bist, fnl_clock_gate_bist);
|
||||
if (!is_in_legal_set(clock_gate_bist, rbc_all_clock_gate_bist)) begin
|
||||
$display("Critical Warning: parameter 'clock_gate_bist' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", clock_gate_bist, rbc_all_clock_gate_bist, fnl_clock_gate_bist);
|
||||
end
|
||||
//$display("clock_gate_sw_fifowr = orig: '%s', any:'%s', all:'%s', final: '%s'", clock_gate_sw_fifowr, rbc_any_clock_gate_sw_fifowr, rbc_all_clock_gate_sw_fifowr, fnl_clock_gate_sw_fifowr);
|
||||
if (!is_in_legal_set(clock_gate_sw_fifowr, rbc_all_clock_gate_sw_fifowr)) begin
|
||||
$display("Critical Warning: parameter 'clock_gate_sw_fifowr' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", clock_gate_sw_fifowr, rbc_all_clock_gate_sw_fifowr, fnl_clock_gate_sw_fifowr);
|
||||
end
|
||||
//$display("clock_gate_dw_fifowr = orig: '%s', any:'%s', all:'%s', final: '%s'", clock_gate_dw_fifowr, rbc_any_clock_gate_dw_fifowr, rbc_all_clock_gate_dw_fifowr, fnl_clock_gate_dw_fifowr);
|
||||
if (!is_in_legal_set(clock_gate_dw_fifowr, rbc_all_clock_gate_dw_fifowr)) begin
|
||||
$display("Critical Warning: parameter 'clock_gate_dw_fifowr' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", clock_gate_dw_fifowr, rbc_all_clock_gate_dw_fifowr, fnl_clock_gate_dw_fifowr);
|
||||
end
|
||||
//$display("clock_gate_fiford = orig: '%s', any:'%s', all:'%s', final: '%s'", clock_gate_fiford, rbc_any_clock_gate_fiford, rbc_all_clock_gate_fiford, fnl_clock_gate_fiford);
|
||||
if (!is_in_legal_set(clock_gate_fiford, rbc_all_clock_gate_fiford)) begin
|
||||
$display("Critical Warning: parameter 'clock_gate_fiford' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", clock_gate_fiford, rbc_all_clock_gate_fiford, fnl_clock_gate_fiford);
|
||||
end
|
||||
//$display("revloop_back_rm = orig: '%s', any:'%s', all:'%s', final: '%s'", revloop_back_rm, rbc_any_revloop_back_rm, rbc_all_revloop_back_rm, fnl_revloop_back_rm);
|
||||
if (!is_in_legal_set(revloop_back_rm, rbc_all_revloop_back_rm)) begin
|
||||
$display("Critical Warning: parameter 'revloop_back_rm' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", revloop_back_rm, rbc_all_revloop_back_rm, fnl_revloop_back_rm);
|
||||
end
|
||||
//$display("phfifo_write_clk_sel = orig: '%s', any:'%s', all:'%s', final: '%s'", phfifo_write_clk_sel, rbc_any_phfifo_write_clk_sel, rbc_all_phfifo_write_clk_sel, fnl_phfifo_write_clk_sel);
|
||||
if (!is_in_legal_set(phfifo_write_clk_sel, rbc_all_phfifo_write_clk_sel)) begin
|
||||
$display("Critical Warning: parameter 'phfifo_write_clk_sel' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", phfifo_write_clk_sel, rbc_all_phfifo_write_clk_sel, fnl_phfifo_write_clk_sel);
|
||||
end
|
||||
//$display("refclk_b_clk_sel = orig: '%s', any:'%s', all:'%s', final: '%s'", refclk_b_clk_sel, rbc_any_refclk_b_clk_sel, rbc_all_refclk_b_clk_sel, fnl_refclk_b_clk_sel);
|
||||
if (!is_in_legal_set(refclk_b_clk_sel, rbc_all_refclk_b_clk_sel)) begin
|
||||
$display("Critical Warning: parameter 'refclk_b_clk_sel' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", refclk_b_clk_sel, rbc_all_refclk_b_clk_sel, fnl_refclk_b_clk_sel);
|
||||
end
|
||||
//$display("dynamic_clk_switch = orig: '%s', any:'%s', all:'%s', final: '%s'", dynamic_clk_switch, rbc_any_dynamic_clk_switch, rbc_all_dynamic_clk_switch, fnl_dynamic_clk_switch);
|
||||
if (!is_in_legal_set(dynamic_clk_switch, rbc_all_dynamic_clk_switch)) begin
|
||||
$display("Critical Warning: parameter 'dynamic_clk_switch' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", dynamic_clk_switch, rbc_all_dynamic_clk_switch, fnl_dynamic_clk_switch);
|
||||
end
|
||||
//$display("auto_speed_nego_gen2 = orig: '%s', any:'%s', all:'%s', final: '%s'", auto_speed_nego_gen2, rbc_any_auto_speed_nego_gen2, rbc_all_auto_speed_nego_gen2, fnl_auto_speed_nego_gen2);
|
||||
if (!is_in_legal_set(auto_speed_nego_gen2, rbc_all_auto_speed_nego_gen2)) begin
|
||||
$display("Critical Warning: parameter 'auto_speed_nego_gen2' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", auto_speed_nego_gen2, rbc_all_auto_speed_nego_gen2, fnl_auto_speed_nego_gen2);
|
||||
end
|
||||
//$display("txclk_freerun = orig: '%s', any:'%s', all:'%s', final: '%s'", txclk_freerun, rbc_any_txclk_freerun, rbc_all_txclk_freerun, fnl_txclk_freerun);
|
||||
if (!is_in_legal_set(txclk_freerun, rbc_all_txclk_freerun)) begin
|
||||
$display("Critical Warning: parameter 'txclk_freerun' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", txclk_freerun, rbc_all_txclk_freerun, fnl_txclk_freerun);
|
||||
end
|
||||
//$display("pcfifo_urst = orig: '%s', any:'%s', all:'%s', final: '%s'", pcfifo_urst, rbc_any_pcfifo_urst, rbc_all_pcfifo_urst, fnl_pcfifo_urst);
|
||||
if (!is_in_legal_set(pcfifo_urst, rbc_all_pcfifo_urst)) begin
|
||||
$display("Critical Warning: parameter 'pcfifo_urst' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pcfifo_urst, rbc_all_pcfifo_urst, fnl_pcfifo_urst);
|
||||
end
|
||||
//$display("txpcs_urst = orig: '%s', any:'%s', all:'%s', final: '%s'", txpcs_urst, rbc_any_txpcs_urst, rbc_all_txpcs_urst, fnl_txpcs_urst);
|
||||
if (!is_in_legal_set(txpcs_urst, rbc_all_txpcs_urst)) begin
|
||||
$display("Critical Warning: parameter 'txpcs_urst' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", txpcs_urst, rbc_all_txpcs_urst, fnl_txpcs_urst);
|
||||
end
|
||||
end
|
||||
|
||||
arriav_hssi_8g_tx_pcs #(
|
||||
.prot_mode(fnl_prot_mode),
|
||||
.sup_mode(fnl_sup_mode),
|
||||
.avmm_group_channel_index(avmm_group_channel_index),
|
||||
.channel_number(channel_number),
|
||||
.cid_pattern_len(cid_pattern_len),
|
||||
.use_default_base_address(fnl_use_default_base_address),
|
||||
.user_base_address(user_base_address),
|
||||
.test_mode(fnl_test_mode),
|
||||
.hip_mode(fnl_hip_mode),
|
||||
.pma_dw(fnl_pma_dw),
|
||||
.pcs_bypass(fnl_pcs_bypass),
|
||||
.phase_compensation_fifo(fnl_phase_compensation_fifo),
|
||||
.tx_compliance_controlled_disparity(fnl_tx_compliance_controlled_disparity),
|
||||
.force_kchar(fnl_force_kchar),
|
||||
.force_echar(fnl_force_echar),
|
||||
.byte_serializer(fnl_byte_serializer),
|
||||
.data_selection_8b10b_encoder_input(fnl_data_selection_8b10b_encoder_input),
|
||||
.eightb_tenb_disp_ctrl(fnl_eightb_tenb_disp_ctrl),
|
||||
.eightb_tenb_encoder(fnl_eightb_tenb_encoder),
|
||||
.prbs_gen(fnl_prbs_gen),
|
||||
.cid_pattern(fnl_cid_pattern),
|
||||
.bist_gen(fnl_bist_gen),
|
||||
.bit_reversal(fnl_bit_reversal),
|
||||
.symbol_swap(fnl_symbol_swap),
|
||||
.polarity_inversion(fnl_polarity_inversion),
|
||||
.tx_bitslip(fnl_tx_bitslip),
|
||||
.ctrl_plane_bonding_consumption(fnl_ctrl_plane_bonding_consumption),
|
||||
.agg_block_sel(fnl_agg_block_sel),
|
||||
.ctrl_plane_bonding_distribution(fnl_ctrl_plane_bonding_distribution),
|
||||
.ctrl_plane_bonding_compensation(fnl_ctrl_plane_bonding_compensation),
|
||||
.bypass_pipeline_reg(fnl_bypass_pipeline_reg),
|
||||
.clock_gate_bs_enc(fnl_clock_gate_bs_enc),
|
||||
.clock_gate_prbs(fnl_clock_gate_prbs),
|
||||
.clock_gate_bist(fnl_clock_gate_bist),
|
||||
.clock_gate_sw_fifowr(fnl_clock_gate_sw_fifowr),
|
||||
.clock_gate_dw_fifowr(fnl_clock_gate_dw_fifowr),
|
||||
.clock_gate_fiford(fnl_clock_gate_fiford),
|
||||
.revloop_back_rm(fnl_revloop_back_rm),
|
||||
.phfifo_write_clk_sel(fnl_phfifo_write_clk_sel),
|
||||
.refclk_b_clk_sel(fnl_refclk_b_clk_sel),
|
||||
.dynamic_clk_switch(fnl_dynamic_clk_switch),
|
||||
.auto_speed_nego_gen2(fnl_auto_speed_nego_gen2),
|
||||
.txclk_freerun(fnl_txclk_freerun),
|
||||
.pcfifo_urst(fnl_pcfifo_urst),
|
||||
.txpcs_urst(fnl_txpcs_urst)
|
||||
) wys (
|
||||
// ports
|
||||
.aggtxpcsrst(aggtxpcsrst),
|
||||
.avmmaddress(avmmaddress),
|
||||
.avmmbyteen(avmmbyteen),
|
||||
.avmmclk(avmmclk),
|
||||
.avmmread(avmmread),
|
||||
.avmmreaddata(avmmreaddata),
|
||||
.avmmrstn(avmmrstn),
|
||||
.avmmwrite(avmmwrite),
|
||||
.avmmwritedata(avmmwritedata),
|
||||
.bitslipboundaryselect(bitslipboundaryselect),
|
||||
.blockselect(blockselect),
|
||||
.clkout(clkout),
|
||||
.coreclk(coreclk),
|
||||
.datain(datain),
|
||||
.dataout(dataout),
|
||||
.detectrxloopin(detectrxloopin),
|
||||
.detectrxloopout(detectrxloopout),
|
||||
.dispcbyte(dispcbyte),
|
||||
.dynclkswitchn(dynclkswitchn),
|
||||
.elecidleinfersel(elecidleinfersel),
|
||||
.enrevparallellpbk(enrevparallellpbk),
|
||||
.fifoselectinchnldown(fifoselectinchnldown),
|
||||
.fifoselectinchnlup(fifoselectinchnlup),
|
||||
.fifoselectoutchnldown(fifoselectoutchnldown),
|
||||
.fifoselectoutchnlup(fifoselectoutchnlup),
|
||||
.grayelecidleinferselout(grayelecidleinferselout),
|
||||
.hrdrst(hrdrst),
|
||||
.invpol(invpol),
|
||||
.observablebyteserdesclock(observablebyteserdesclock),
|
||||
.parallelfdbkout(parallelfdbkout),
|
||||
.phfifooverflow(phfifooverflow),
|
||||
.phfiforddisable(phfiforddisable),
|
||||
.phfiforeset(phfiforeset),
|
||||
.phfifotxdeemph(phfifotxdeemph),
|
||||
.phfifotxmargin(phfifotxmargin),
|
||||
.phfifotxswing(phfifotxswing),
|
||||
.phfifounderflow(phfifounderflow),
|
||||
.phfifowrenable(phfifowrenable),
|
||||
.pipeenrevparallellpbkin(pipeenrevparallellpbkin),
|
||||
.pipeenrevparallellpbkout(pipeenrevparallellpbkout),
|
||||
.pipepowerdownout(pipepowerdownout),
|
||||
.pipetxdeemph(pipetxdeemph),
|
||||
.pipetxmargin(pipetxmargin),
|
||||
.pipetxswing(pipetxswing),
|
||||
.polinvrxin(polinvrxin),
|
||||
.polinvrxout(polinvrxout),
|
||||
.powerdn(powerdn),
|
||||
.prbscidenable(prbscidenable),
|
||||
.rateswitch(rateswitch),
|
||||
.rdenableinchnldown(rdenableinchnldown),
|
||||
.rdenableinchnlup(rdenableinchnlup),
|
||||
.rdenableoutchnldown(rdenableoutchnldown),
|
||||
.rdenableoutchnlup(rdenableoutchnlup),
|
||||
.rdenablesync(rdenablesync),
|
||||
.refclkb(refclkb),
|
||||
.refclkbreset(refclkbreset),
|
||||
.refclkdig(refclkdig),
|
||||
.resetpcptrs(resetpcptrs),
|
||||
.resetpcptrsinchnldown(resetpcptrsinchnldown),
|
||||
.resetpcptrsinchnlup(resetpcptrsinchnlup),
|
||||
.revparallellpbkdata(revparallellpbkdata),
|
||||
.rxpolarityin(rxpolarityin),
|
||||
.rxpolarityout(rxpolarityout),
|
||||
.scanmode(scanmode),
|
||||
.syncdatain(syncdatain),
|
||||
.txblkstart(txblkstart),
|
||||
.txblkstartout(txblkstartout),
|
||||
.txcomplianceout(txcomplianceout),
|
||||
.txctrlplanetestbus(txctrlplanetestbus),
|
||||
.txdatakouttogen3(txdatakouttogen3),
|
||||
.txdataouttogen3(txdataouttogen3),
|
||||
.txdatavalid(txdatavalid),
|
||||
.txdatavalidouttogen3(txdatavalidouttogen3),
|
||||
.txdivsync(txdivsync),
|
||||
.txdivsyncinchnldown(txdivsyncinchnldown),
|
||||
.txdivsyncinchnlup(txdivsyncinchnlup),
|
||||
.txdivsyncoutchnldown(txdivsyncoutchnldown),
|
||||
.txdivsyncoutchnlup(txdivsyncoutchnlup),
|
||||
.txelecidleout(txelecidleout),
|
||||
.txpcsreset(txpcsreset),
|
||||
.txpipeclk(txpipeclk),
|
||||
.txpipeelectidle(txpipeelectidle),
|
||||
.txpipesoftreset(txpipesoftreset),
|
||||
.txpmalocalclk(txpmalocalclk),
|
||||
.txsynchdr(txsynchdr),
|
||||
.txsynchdrout(txsynchdrout),
|
||||
.txtestbus(txtestbus),
|
||||
.wrenableinchnldown(wrenableinchnldown),
|
||||
.wrenableinchnlup(wrenableinchnlup),
|
||||
.wrenableoutchnldown(wrenableoutchnldown),
|
||||
.wrenableoutchnlup(wrenableoutchnlup),
|
||||
.xgmctrl(xgmctrl),
|
||||
.xgmctrlenable(xgmctrlenable),
|
||||
.xgmctrltoporbottom(xgmctrltoporbottom),
|
||||
.xgmdatain(xgmdatain),
|
||||
.xgmdataintoporbottom(xgmdataintoporbottom),
|
||||
.xgmdataout(xgmdataout)
|
||||
);
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,525 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
// Verilog RBC parameter resolution wrapper for arriav_hssi_common_pcs_pma_interface
|
||||
//
|
||||
|
||||
`timescale 1 ns / 1 ps
|
||||
|
||||
module av_hssi_common_pcs_pma_interface_rbc #(
|
||||
// unconstrained parameters
|
||||
parameter func_mode = "<auto_single>", // disable, eightg_only_hip, eightg_only_pld, hrdrstctrl_cmu, pma_direct
|
||||
parameter prot_mode = "<auto_single>", // disabled_prot_mode, other_protocols, pipe_g1, pipe_g2
|
||||
parameter sup_mode = "<auto_single>", // engineering_mode, user_mode
|
||||
|
||||
// extra unconstrained parameters found in atom map
|
||||
parameter avmm_group_channel_index = 0, // 0..2
|
||||
parameter pma_if_dft_en = "dft_dis", // dft_dis
|
||||
parameter pma_if_dft_val = "dft_0", // dft_0
|
||||
parameter use_default_base_address = "true", // false, true
|
||||
parameter user_base_address = 0, // 0..2047
|
||||
|
||||
// constrained parameters
|
||||
parameter pipe_if_g3pcs = "<auto_single>", // pipe_if_8gpcs
|
||||
parameter selectpcs = "<auto_single>", // eight_g_pcs
|
||||
parameter force_freqdet = "<auto_single>", // force0_freqdet_en, force1_freqdet_en, force_freqdet_dis
|
||||
parameter ppmsel = "<auto_single>", // ppm_other, ppmsel_100, ppmsel_1000, ppmsel_125, ppmsel_200, ppmsel_250, ppmsel_300, ppmsel_500, ppmsel_62p5, ppmsel_default
|
||||
parameter auto_speed_ena = "<auto_single>", // dis_auto_speed_ena, en_auto_speed_ena
|
||||
parameter ppm_cnt_rst = "<auto_single>", // ppm_cnt_rst_dis, ppm_cnt_rst_en
|
||||
parameter ppm_gen1_2_cnt = "<auto_single>", // cnt_32k, cnt_64k
|
||||
parameter ppm_post_eidle_delay = "<auto_single>", // cnt_200_cycles, cnt_400_cycles
|
||||
parameter ppm_deassert_early = "<auto_single>" // deassert_early_dis, deassert_early_en
|
||||
) (
|
||||
// ports
|
||||
output wire [1:0] aggaligndetsync,
|
||||
input wire aggalignstatus,
|
||||
output wire aggalignstatussync,
|
||||
input wire aggalignstatussync0,
|
||||
input wire aggalignstatussync0toporbot,
|
||||
input wire aggalignstatustoporbot,
|
||||
input wire aggcgcomprddall,
|
||||
input wire aggcgcomprddalltoporbot,
|
||||
output wire [1:0] aggcgcomprddout,
|
||||
input wire aggcgcompwrall,
|
||||
input wire aggcgcompwralltoporbot,
|
||||
output wire [1:0] aggcgcompwrout,
|
||||
output wire aggdecctl,
|
||||
output wire [7:0] aggdecdata,
|
||||
output wire aggdecdatavalid,
|
||||
input wire aggdelcondmet0,
|
||||
input wire aggdelcondmet0toporbot,
|
||||
output wire aggdelcondmetout,
|
||||
input wire aggendskwqd,
|
||||
input wire aggendskwqdtoporbot,
|
||||
input wire aggendskwrdptrs,
|
||||
input wire aggendskwrdptrstoporbot,
|
||||
input wire aggfifoovr0,
|
||||
input wire aggfifoovr0toporbot,
|
||||
output wire aggfifoovrout,
|
||||
input wire aggfifordincomp0,
|
||||
input wire aggfifordincomp0toporbot,
|
||||
output wire aggfifordoutcomp,
|
||||
input wire aggfiforstrdqd,
|
||||
input wire aggfiforstrdqdtoporbot,
|
||||
input wire agginsertincomplete0,
|
||||
input wire agginsertincomplete0toporbot,
|
||||
output wire agginsertincompleteout,
|
||||
input wire agglatencycomp0,
|
||||
input wire agglatencycomp0toporbot,
|
||||
output wire agglatencycompout,
|
||||
input wire aggrcvdclkagg,
|
||||
input wire aggrcvdclkaggtoporbot,
|
||||
output wire [1:0] aggrdalign,
|
||||
output wire aggrdenablesync,
|
||||
output wire aggrefclkdig,
|
||||
output wire [1:0] aggrunningdisp,
|
||||
input wire aggrxcontrolrs,
|
||||
input wire aggrxcontrolrstoporbot,
|
||||
input wire [7:0] aggrxdatars,
|
||||
input wire [7:0] aggrxdatarstoporbot,
|
||||
output wire aggrxpcsrst,
|
||||
output wire aggscanmoden,
|
||||
output wire aggscanshiftn,
|
||||
output wire aggsyncstatus,
|
||||
input wire [15:0] aggtestbus,
|
||||
input wire aggtestsotopldin,
|
||||
output wire aggtestsotopldout,
|
||||
output wire aggtxctltc,
|
||||
input wire aggtxctlts,
|
||||
input wire aggtxctltstoporbot,
|
||||
output wire [7:0] aggtxdatatc,
|
||||
input wire [7:0] aggtxdatats,
|
||||
input wire [7:0] aggtxdatatstoporbot,
|
||||
output wire aggtxpcsrst,
|
||||
output wire asynchdatain,
|
||||
input wire [10:0] avmmaddress,
|
||||
input wire [1:0] avmmbyteen,
|
||||
input wire avmmclk,
|
||||
input wire avmmread,
|
||||
output wire [15:0] avmmreaddata,
|
||||
input wire avmmrstn,
|
||||
input wire avmmwrite,
|
||||
input wire [15:0] avmmwritedata,
|
||||
output wire blockselect,
|
||||
input wire clklow,
|
||||
input wire fref,
|
||||
output wire freqlock,
|
||||
input wire hardreset,
|
||||
input wire pcs8gearlyeios,
|
||||
input wire pcs8geidleexit,
|
||||
output wire pcs8ggen2ngen1,
|
||||
input wire pcs8gltrpma,
|
||||
input wire pcs8gpcieswitch,
|
||||
input wire [17:0] pcs8gpmacurrentcoeff,
|
||||
output wire pcs8gpmarxfound,
|
||||
output wire pcs8gpowerstatetransitiondone,
|
||||
output wire pcs8grxdetectvalid,
|
||||
input wire pcs8gtxdetectrx,
|
||||
input wire pcs8gtxelecidle,
|
||||
input wire [1:0] pcsaggaligndetsync,
|
||||
output wire pcsaggalignstatus,
|
||||
input wire pcsaggalignstatussync,
|
||||
output wire pcsaggalignstatussync0,
|
||||
output wire pcsaggalignstatussync0toporbot,
|
||||
output wire pcsaggalignstatustoporbot,
|
||||
output wire pcsaggcgcomprddall,
|
||||
output wire pcsaggcgcomprddalltoporbot,
|
||||
input wire [1:0] pcsaggcgcomprddout,
|
||||
output wire pcsaggcgcompwrall,
|
||||
output wire pcsaggcgcompwralltoporbot,
|
||||
input wire [1:0] pcsaggcgcompwrout,
|
||||
input wire pcsaggdecctl,
|
||||
input wire [7:0] pcsaggdecdata,
|
||||
input wire pcsaggdecdatavalid,
|
||||
output wire pcsaggdelcondmet0,
|
||||
output wire pcsaggdelcondmet0toporbot,
|
||||
input wire pcsaggdelcondmetout,
|
||||
output wire pcsaggendskwqd,
|
||||
output wire pcsaggendskwqdtoporbot,
|
||||
output wire pcsaggendskwrdptrs,
|
||||
output wire pcsaggendskwrdptrstoporbot,
|
||||
output wire pcsaggfifoovr0,
|
||||
output wire pcsaggfifoovr0toporbot,
|
||||
input wire pcsaggfifoovrout,
|
||||
output wire pcsaggfifordincomp0,
|
||||
output wire pcsaggfifordincomp0toporbot,
|
||||
input wire pcsaggfifordoutcomp,
|
||||
output wire pcsaggfiforstrdqd,
|
||||
output wire pcsaggfiforstrdqdtoporbot,
|
||||
output wire pcsagginsertincomplete0,
|
||||
output wire pcsagginsertincomplete0toporbot,
|
||||
input wire pcsagginsertincompleteout,
|
||||
output wire pcsagglatencycomp0,
|
||||
output wire pcsagglatencycomp0toporbot,
|
||||
input wire pcsagglatencycompout,
|
||||
output wire pcsaggrcvdclkagg,
|
||||
output wire pcsaggrcvdclkaggtoporbot,
|
||||
input wire [1:0] pcsaggrdalign,
|
||||
input wire pcsaggrdenablesync,
|
||||
input wire pcsaggrefclkdig,
|
||||
input wire [1:0] pcsaggrunningdisp,
|
||||
output wire pcsaggrxcontrolrs,
|
||||
output wire pcsaggrxcontrolrstoporbot,
|
||||
output wire [7:0] pcsaggrxdatars,
|
||||
output wire [7:0] pcsaggrxdatarstoporbot,
|
||||
input wire pcsaggrxpcsrst,
|
||||
input wire pcsaggscanmoden,
|
||||
input wire pcsaggscanshiftn,
|
||||
input wire pcsaggsyncstatus,
|
||||
output wire [15:0] pcsaggtestbus,
|
||||
input wire pcsaggtxctltc,
|
||||
output wire pcsaggtxctlts,
|
||||
output wire pcsaggtxctltstoporbot,
|
||||
input wire [7:0] pcsaggtxdatatc,
|
||||
output wire [7:0] pcsaggtxdatats,
|
||||
output wire [7:0] pcsaggtxdatatstoporbot,
|
||||
input wire pcsaggtxpcsrst,
|
||||
input wire pcsrefclkdig,
|
||||
input wire pcsscanmoden,
|
||||
input wire pcsscanshiftn,
|
||||
output wire pldhclkout,
|
||||
input wire pldnfrzdrv,
|
||||
input wire pldpartialreconfig,
|
||||
input wire pldtestsitoaggin,
|
||||
output wire pldtestsitoaggout,
|
||||
output wire pmaclklowout,
|
||||
output wire [17:0] pmacurrentcoeff,
|
||||
output wire pmaearlyeios,
|
||||
output wire pmafrefout,
|
||||
input wire pmahclk,
|
||||
output wire [9:0] pmaiftestbus,
|
||||
output wire pmaltr,
|
||||
output wire pmanfrzdrv,
|
||||
output wire pmapartialreconfig,
|
||||
input wire [1:0] pmapcieswdone,
|
||||
output wire [1:0] pmapcieswitch,
|
||||
input wire pmarxdetectvalid,
|
||||
input wire pmarxfound,
|
||||
input wire pmarxpmarstb,
|
||||
output wire pmatxdetectrx,
|
||||
output wire pmatxelecidle,
|
||||
input wire resetppmcntrs
|
||||
);
|
||||
import altera_xcvr_functions::*;
|
||||
|
||||
// func_mode external parameter (no RBC)
|
||||
localparam rbc_all_func_mode = "(disable,eightg_only_hip,eightg_only_pld,hrdrstctrl_cmu,pma_direct)";
|
||||
localparam rbc_any_func_mode = "disable";
|
||||
localparam fnl_func_mode = (func_mode == "<auto_any>" || func_mode == "<auto_single>") ? rbc_any_func_mode : func_mode;
|
||||
|
||||
// prot_mode external parameter (no RBC)
|
||||
localparam rbc_all_prot_mode = "(disabled_prot_mode,other_protocols,pipe_g1,pipe_g2)";
|
||||
localparam rbc_any_prot_mode = "disabled_prot_mode";
|
||||
localparam fnl_prot_mode = (prot_mode == "<auto_any>" || prot_mode == "<auto_single>") ? rbc_any_prot_mode : prot_mode;
|
||||
|
||||
// sup_mode external parameter (no RBC)
|
||||
localparam rbc_all_sup_mode = "(engineering_mode,user_mode)";
|
||||
localparam rbc_any_sup_mode = "user_mode";
|
||||
localparam fnl_sup_mode = (sup_mode == "<auto_any>" || sup_mode == "<auto_single>") ? rbc_any_sup_mode : sup_mode;
|
||||
|
||||
// use_default_base_address external parameter (no RBC)
|
||||
localparam rbc_all_use_default_base_address = "(false,true)";
|
||||
localparam rbc_any_use_default_base_address = "true";
|
||||
localparam fnl_use_default_base_address = (use_default_base_address == "<auto_any>" || use_default_base_address == "<auto_single>") ? rbc_any_use_default_base_address : use_default_base_address;
|
||||
|
||||
// pipe_if_g3pcs, RBC-validated
|
||||
localparam rbc_all_pipe_if_g3pcs = "pipe_if_8gpcs";
|
||||
localparam rbc_any_pipe_if_g3pcs = "pipe_if_8gpcs";
|
||||
localparam fnl_pipe_if_g3pcs = (pipe_if_g3pcs == "<auto_any>" || pipe_if_g3pcs == "<auto_single>") ? rbc_any_pipe_if_g3pcs : pipe_if_g3pcs;
|
||||
|
||||
// selectpcs, RBC-validated
|
||||
localparam rbc_all_selectpcs = "eight_g_pcs";
|
||||
localparam rbc_any_selectpcs = "eight_g_pcs";
|
||||
localparam fnl_selectpcs = (selectpcs == "<auto_any>" || selectpcs == "<auto_single>") ? rbc_any_selectpcs : selectpcs;
|
||||
|
||||
// force_freqdet, RBC-validated
|
||||
localparam rbc_all_force_freqdet = ( (fnl_prot_mode == "disabled_prot_mode") || (fnl_prot_mode == "pipe_g1") || (fnl_prot_mode == "pipe_g2") || (fnl_func_mode == "hrdrstctrl_cmu")) ? ("force_freqdet_dis") : "(force0_freqdet_en,force1_freqdet_en,force_freqdet_dis)";
|
||||
localparam rbc_any_force_freqdet = ( (fnl_prot_mode == "disabled_prot_mode") || (fnl_prot_mode == "pipe_g1") || (fnl_prot_mode == "pipe_g2") || (fnl_func_mode == "hrdrstctrl_cmu")) ? ("force_freqdet_dis") : "force_freqdet_dis";
|
||||
localparam fnl_force_freqdet = (force_freqdet == "<auto_any>" || force_freqdet == "<auto_single>") ? rbc_any_force_freqdet : force_freqdet;
|
||||
|
||||
// ppmsel, RBC-validated
|
||||
localparam rbc_all_ppmsel = ( (fnl_force_freqdet != "force_freqdet_dis") || (fnl_prot_mode == "disabled_prot_mode") || (fnl_func_mode == "hrdrstctrl_cmu")) ? ("ppmsel_default") : "(ppm_other,ppmsel_100,ppmsel_1000,ppmsel_125,ppmsel_200,ppmsel_250,ppmsel_300,ppmsel_500,ppmsel_62p5,ppmsel_default)";
|
||||
localparam rbc_any_ppmsel = ( (fnl_force_freqdet != "force_freqdet_dis") || (fnl_prot_mode == "disabled_prot_mode") || (fnl_func_mode == "hrdrstctrl_cmu")) ? ("ppmsel_default") : "ppmsel_default";
|
||||
localparam fnl_ppmsel = (ppmsel == "<auto_any>" || ppmsel == "<auto_single>") ? rbc_any_ppmsel : ppmsel;
|
||||
|
||||
// auto_speed_ena, RBC-validated
|
||||
localparam rbc_all_auto_speed_ena = (fnl_prot_mode == "pipe_g2") ? ("en_auto_speed_ena") : "dis_auto_speed_ena";
|
||||
localparam rbc_any_auto_speed_ena = (fnl_prot_mode == "pipe_g2") ? ("en_auto_speed_ena") : "dis_auto_speed_ena";
|
||||
localparam fnl_auto_speed_ena = (auto_speed_ena == "<auto_any>" || auto_speed_ena == "<auto_single>") ? rbc_any_auto_speed_ena : auto_speed_ena;
|
||||
|
||||
// ppm_cnt_rst, RBC-validated
|
||||
localparam rbc_all_ppm_cnt_rst = "ppm_cnt_rst_dis";
|
||||
localparam rbc_any_ppm_cnt_rst = "ppm_cnt_rst_dis";
|
||||
localparam fnl_ppm_cnt_rst = (ppm_cnt_rst == "<auto_any>" || ppm_cnt_rst == "<auto_single>") ? rbc_any_ppm_cnt_rst : ppm_cnt_rst;
|
||||
|
||||
// ppm_gen1_2_cnt, RBC-validated
|
||||
localparam rbc_all_ppm_gen1_2_cnt = ((fnl_sup_mode == "engineering_mode") && ((fnl_prot_mode == "pipe_g2") || (fnl_prot_mode == "pipe_g1"))) ? ("(cnt_32k,cnt_64k)") : "cnt_32k";
|
||||
localparam rbc_any_ppm_gen1_2_cnt = ((fnl_sup_mode == "engineering_mode") && ((fnl_prot_mode == "pipe_g2") || (fnl_prot_mode == "pipe_g1"))) ? ("cnt_32k") : "cnt_32k";
|
||||
localparam fnl_ppm_gen1_2_cnt = (ppm_gen1_2_cnt == "<auto_any>" || ppm_gen1_2_cnt == "<auto_single>") ? rbc_any_ppm_gen1_2_cnt : ppm_gen1_2_cnt;
|
||||
|
||||
// ppm_post_eidle_delay, RBC-validated
|
||||
localparam rbc_all_ppm_post_eidle_delay = (fnl_prot_mode == "pipe_g1" || fnl_prot_mode == "pipe_g2") ? ("(cnt_200_cycles,cnt_400_cycles)") : "cnt_200_cycles";
|
||||
localparam rbc_any_ppm_post_eidle_delay = (fnl_prot_mode == "pipe_g1" || fnl_prot_mode == "pipe_g2") ? ("cnt_200_cycles") : "cnt_200_cycles";
|
||||
localparam fnl_ppm_post_eidle_delay = (ppm_post_eidle_delay == "<auto_any>" || ppm_post_eidle_delay == "<auto_single>") ? rbc_any_ppm_post_eidle_delay : ppm_post_eidle_delay;
|
||||
|
||||
// ppm_deassert_early, RBC-validated
|
||||
localparam rbc_all_ppm_deassert_early = "deassert_early_dis";
|
||||
localparam rbc_any_ppm_deassert_early = "deassert_early_dis";
|
||||
localparam fnl_ppm_deassert_early = (ppm_deassert_early == "<auto_any>" || ppm_deassert_early == "<auto_single>") ? rbc_any_ppm_deassert_early : ppm_deassert_early;
|
||||
|
||||
// Validate input parameters against known values or RBC values
|
||||
initial begin
|
||||
//$display("func_mode = orig: '%s', any:'%s', all:'%s', final: '%s'", func_mode, rbc_any_func_mode, rbc_all_func_mode, fnl_func_mode);
|
||||
if (!is_in_legal_set(func_mode, rbc_all_func_mode)) begin
|
||||
$display("Critical Warning: parameter 'func_mode' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", func_mode, rbc_all_func_mode, fnl_func_mode);
|
||||
end
|
||||
//$display("prot_mode = orig: '%s', any:'%s', all:'%s', final: '%s'", prot_mode, rbc_any_prot_mode, rbc_all_prot_mode, fnl_prot_mode);
|
||||
if (!is_in_legal_set(prot_mode, rbc_all_prot_mode)) begin
|
||||
$display("Critical Warning: parameter 'prot_mode' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", prot_mode, rbc_all_prot_mode, fnl_prot_mode);
|
||||
end
|
||||
//$display("sup_mode = orig: '%s', any:'%s', all:'%s', final: '%s'", sup_mode, rbc_any_sup_mode, rbc_all_sup_mode, fnl_sup_mode);
|
||||
if (!is_in_legal_set(sup_mode, rbc_all_sup_mode)) begin
|
||||
$display("Critical Warning: parameter 'sup_mode' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", sup_mode, rbc_all_sup_mode, fnl_sup_mode);
|
||||
end
|
||||
//$display("use_default_base_address = orig: '%s', any:'%s', all:'%s', final: '%s'", use_default_base_address, rbc_any_use_default_base_address, rbc_all_use_default_base_address, fnl_use_default_base_address);
|
||||
if (!is_in_legal_set(use_default_base_address, rbc_all_use_default_base_address)) begin
|
||||
$display("Critical Warning: parameter 'use_default_base_address' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", use_default_base_address, rbc_all_use_default_base_address, fnl_use_default_base_address);
|
||||
end
|
||||
//$display("pipe_if_g3pcs = orig: '%s', any:'%s', all:'%s', final: '%s'", pipe_if_g3pcs, rbc_any_pipe_if_g3pcs, rbc_all_pipe_if_g3pcs, fnl_pipe_if_g3pcs);
|
||||
if (!is_in_legal_set(pipe_if_g3pcs, rbc_all_pipe_if_g3pcs)) begin
|
||||
$display("Critical Warning: parameter 'pipe_if_g3pcs' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pipe_if_g3pcs, rbc_all_pipe_if_g3pcs, fnl_pipe_if_g3pcs);
|
||||
end
|
||||
//$display("selectpcs = orig: '%s', any:'%s', all:'%s', final: '%s'", selectpcs, rbc_any_selectpcs, rbc_all_selectpcs, fnl_selectpcs);
|
||||
if (!is_in_legal_set(selectpcs, rbc_all_selectpcs)) begin
|
||||
$display("Critical Warning: parameter 'selectpcs' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", selectpcs, rbc_all_selectpcs, fnl_selectpcs);
|
||||
end
|
||||
//$display("force_freqdet = orig: '%s', any:'%s', all:'%s', final: '%s'", force_freqdet, rbc_any_force_freqdet, rbc_all_force_freqdet, fnl_force_freqdet);
|
||||
if (!is_in_legal_set(force_freqdet, rbc_all_force_freqdet)) begin
|
||||
$display("Critical Warning: parameter 'force_freqdet' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", force_freqdet, rbc_all_force_freqdet, fnl_force_freqdet);
|
||||
end
|
||||
//$display("ppmsel = orig: '%s', any:'%s', all:'%s', final: '%s'", ppmsel, rbc_any_ppmsel, rbc_all_ppmsel, fnl_ppmsel);
|
||||
if (!is_in_legal_set(ppmsel, rbc_all_ppmsel)) begin
|
||||
$display("Critical Warning: parameter 'ppmsel' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", ppmsel, rbc_all_ppmsel, fnl_ppmsel);
|
||||
end
|
||||
//$display("auto_speed_ena = orig: '%s', any:'%s', all:'%s', final: '%s'", auto_speed_ena, rbc_any_auto_speed_ena, rbc_all_auto_speed_ena, fnl_auto_speed_ena);
|
||||
if (!is_in_legal_set(auto_speed_ena, rbc_all_auto_speed_ena)) begin
|
||||
$display("Critical Warning: parameter 'auto_speed_ena' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", auto_speed_ena, rbc_all_auto_speed_ena, fnl_auto_speed_ena);
|
||||
end
|
||||
//$display("ppm_cnt_rst = orig: '%s', any:'%s', all:'%s', final: '%s'", ppm_cnt_rst, rbc_any_ppm_cnt_rst, rbc_all_ppm_cnt_rst, fnl_ppm_cnt_rst);
|
||||
if (!is_in_legal_set(ppm_cnt_rst, rbc_all_ppm_cnt_rst)) begin
|
||||
$display("Critical Warning: parameter 'ppm_cnt_rst' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", ppm_cnt_rst, rbc_all_ppm_cnt_rst, fnl_ppm_cnt_rst);
|
||||
end
|
||||
//$display("ppm_gen1_2_cnt = orig: '%s', any:'%s', all:'%s', final: '%s'", ppm_gen1_2_cnt, rbc_any_ppm_gen1_2_cnt, rbc_all_ppm_gen1_2_cnt, fnl_ppm_gen1_2_cnt);
|
||||
if (!is_in_legal_set(ppm_gen1_2_cnt, rbc_all_ppm_gen1_2_cnt)) begin
|
||||
$display("Critical Warning: parameter 'ppm_gen1_2_cnt' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", ppm_gen1_2_cnt, rbc_all_ppm_gen1_2_cnt, fnl_ppm_gen1_2_cnt);
|
||||
end
|
||||
//$display("ppm_post_eidle_delay = orig: '%s', any:'%s', all:'%s', final: '%s'", ppm_post_eidle_delay, rbc_any_ppm_post_eidle_delay, rbc_all_ppm_post_eidle_delay, fnl_ppm_post_eidle_delay);
|
||||
if (!is_in_legal_set(ppm_post_eidle_delay, rbc_all_ppm_post_eidle_delay)) begin
|
||||
$display("Critical Warning: parameter 'ppm_post_eidle_delay' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", ppm_post_eidle_delay, rbc_all_ppm_post_eidle_delay, fnl_ppm_post_eidle_delay);
|
||||
end
|
||||
//$display("ppm_deassert_early = orig: '%s', any:'%s', all:'%s', final: '%s'", ppm_deassert_early, rbc_any_ppm_deassert_early, rbc_all_ppm_deassert_early, fnl_ppm_deassert_early);
|
||||
if (!is_in_legal_set(ppm_deassert_early, rbc_all_ppm_deassert_early)) begin
|
||||
$display("Critical Warning: parameter 'ppm_deassert_early' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", ppm_deassert_early, rbc_all_ppm_deassert_early, fnl_ppm_deassert_early);
|
||||
end
|
||||
end
|
||||
|
||||
arriav_hssi_common_pcs_pma_interface #(
|
||||
.func_mode(fnl_func_mode),
|
||||
.prot_mode(fnl_prot_mode),
|
||||
.sup_mode(fnl_sup_mode),
|
||||
.avmm_group_channel_index(avmm_group_channel_index),
|
||||
.pma_if_dft_en(pma_if_dft_en),
|
||||
.pma_if_dft_val(pma_if_dft_val),
|
||||
.use_default_base_address(fnl_use_default_base_address),
|
||||
.user_base_address(user_base_address),
|
||||
.pipe_if_g3pcs(fnl_pipe_if_g3pcs),
|
||||
.selectpcs(fnl_selectpcs),
|
||||
.force_freqdet(fnl_force_freqdet),
|
||||
.ppmsel(fnl_ppmsel),
|
||||
.auto_speed_ena(fnl_auto_speed_ena),
|
||||
.ppm_cnt_rst(fnl_ppm_cnt_rst),
|
||||
.ppm_gen1_2_cnt(fnl_ppm_gen1_2_cnt),
|
||||
.ppm_post_eidle_delay(fnl_ppm_post_eidle_delay),
|
||||
.ppm_deassert_early(fnl_ppm_deassert_early)
|
||||
) wys (
|
||||
// ports
|
||||
.aggaligndetsync(aggaligndetsync),
|
||||
.aggalignstatus(aggalignstatus),
|
||||
.aggalignstatussync(aggalignstatussync),
|
||||
.aggalignstatussync0(aggalignstatussync0),
|
||||
.aggalignstatussync0toporbot(aggalignstatussync0toporbot),
|
||||
.aggalignstatustoporbot(aggalignstatustoporbot),
|
||||
.aggcgcomprddall(aggcgcomprddall),
|
||||
.aggcgcomprddalltoporbot(aggcgcomprddalltoporbot),
|
||||
.aggcgcomprddout(aggcgcomprddout),
|
||||
.aggcgcompwrall(aggcgcompwrall),
|
||||
.aggcgcompwralltoporbot(aggcgcompwralltoporbot),
|
||||
.aggcgcompwrout(aggcgcompwrout),
|
||||
.aggdecctl(aggdecctl),
|
||||
.aggdecdata(aggdecdata),
|
||||
.aggdecdatavalid(aggdecdatavalid),
|
||||
.aggdelcondmet0(aggdelcondmet0),
|
||||
.aggdelcondmet0toporbot(aggdelcondmet0toporbot),
|
||||
.aggdelcondmetout(aggdelcondmetout),
|
||||
.aggendskwqd(aggendskwqd),
|
||||
.aggendskwqdtoporbot(aggendskwqdtoporbot),
|
||||
.aggendskwrdptrs(aggendskwrdptrs),
|
||||
.aggendskwrdptrstoporbot(aggendskwrdptrstoporbot),
|
||||
.aggfifoovr0(aggfifoovr0),
|
||||
.aggfifoovr0toporbot(aggfifoovr0toporbot),
|
||||
.aggfifoovrout(aggfifoovrout),
|
||||
.aggfifordincomp0(aggfifordincomp0),
|
||||
.aggfifordincomp0toporbot(aggfifordincomp0toporbot),
|
||||
.aggfifordoutcomp(aggfifordoutcomp),
|
||||
.aggfiforstrdqd(aggfiforstrdqd),
|
||||
.aggfiforstrdqdtoporbot(aggfiforstrdqdtoporbot),
|
||||
.agginsertincomplete0(agginsertincomplete0),
|
||||
.agginsertincomplete0toporbot(agginsertincomplete0toporbot),
|
||||
.agginsertincompleteout(agginsertincompleteout),
|
||||
.agglatencycomp0(agglatencycomp0),
|
||||
.agglatencycomp0toporbot(agglatencycomp0toporbot),
|
||||
.agglatencycompout(agglatencycompout),
|
||||
.aggrcvdclkagg(aggrcvdclkagg),
|
||||
.aggrcvdclkaggtoporbot(aggrcvdclkaggtoporbot),
|
||||
.aggrdalign(aggrdalign),
|
||||
.aggrdenablesync(aggrdenablesync),
|
||||
.aggrefclkdig(aggrefclkdig),
|
||||
.aggrunningdisp(aggrunningdisp),
|
||||
.aggrxcontrolrs(aggrxcontrolrs),
|
||||
.aggrxcontrolrstoporbot(aggrxcontrolrstoporbot),
|
||||
.aggrxdatars(aggrxdatars),
|
||||
.aggrxdatarstoporbot(aggrxdatarstoporbot),
|
||||
.aggrxpcsrst(aggrxpcsrst),
|
||||
.aggscanmoden(aggscanmoden),
|
||||
.aggscanshiftn(aggscanshiftn),
|
||||
.aggsyncstatus(aggsyncstatus),
|
||||
.aggtestbus(aggtestbus),
|
||||
.aggtestsotopldin(aggtestsotopldin),
|
||||
.aggtestsotopldout(aggtestsotopldout),
|
||||
.aggtxctltc(aggtxctltc),
|
||||
.aggtxctlts(aggtxctlts),
|
||||
.aggtxctltstoporbot(aggtxctltstoporbot),
|
||||
.aggtxdatatc(aggtxdatatc),
|
||||
.aggtxdatats(aggtxdatats),
|
||||
.aggtxdatatstoporbot(aggtxdatatstoporbot),
|
||||
.aggtxpcsrst(aggtxpcsrst),
|
||||
.asynchdatain(asynchdatain),
|
||||
.avmmaddress(avmmaddress),
|
||||
.avmmbyteen(avmmbyteen),
|
||||
.avmmclk(avmmclk),
|
||||
.avmmread(avmmread),
|
||||
.avmmreaddata(avmmreaddata),
|
||||
.avmmrstn(avmmrstn),
|
||||
.avmmwrite(avmmwrite),
|
||||
.avmmwritedata(avmmwritedata),
|
||||
.blockselect(blockselect),
|
||||
.clklow(clklow),
|
||||
.fref(fref),
|
||||
.freqlock(freqlock),
|
||||
.hardreset(hardreset),
|
||||
.pcs8gearlyeios(pcs8gearlyeios),
|
||||
.pcs8geidleexit(pcs8geidleexit),
|
||||
.pcs8ggen2ngen1(pcs8ggen2ngen1),
|
||||
.pcs8gltrpma(pcs8gltrpma),
|
||||
.pcs8gpcieswitch(pcs8gpcieswitch),
|
||||
.pcs8gpmacurrentcoeff(pcs8gpmacurrentcoeff),
|
||||
.pcs8gpmarxfound(pcs8gpmarxfound),
|
||||
.pcs8gpowerstatetransitiondone(pcs8gpowerstatetransitiondone),
|
||||
.pcs8grxdetectvalid(pcs8grxdetectvalid),
|
||||
.pcs8gtxdetectrx(pcs8gtxdetectrx),
|
||||
.pcs8gtxelecidle(pcs8gtxelecidle),
|
||||
.pcsaggaligndetsync(pcsaggaligndetsync),
|
||||
.pcsaggalignstatus(pcsaggalignstatus),
|
||||
.pcsaggalignstatussync(pcsaggalignstatussync),
|
||||
.pcsaggalignstatussync0(pcsaggalignstatussync0),
|
||||
.pcsaggalignstatussync0toporbot(pcsaggalignstatussync0toporbot),
|
||||
.pcsaggalignstatustoporbot(pcsaggalignstatustoporbot),
|
||||
.pcsaggcgcomprddall(pcsaggcgcomprddall),
|
||||
.pcsaggcgcomprddalltoporbot(pcsaggcgcomprddalltoporbot),
|
||||
.pcsaggcgcomprddout(pcsaggcgcomprddout),
|
||||
.pcsaggcgcompwrall(pcsaggcgcompwrall),
|
||||
.pcsaggcgcompwralltoporbot(pcsaggcgcompwralltoporbot),
|
||||
.pcsaggcgcompwrout(pcsaggcgcompwrout),
|
||||
.pcsaggdecctl(pcsaggdecctl),
|
||||
.pcsaggdecdata(pcsaggdecdata),
|
||||
.pcsaggdecdatavalid(pcsaggdecdatavalid),
|
||||
.pcsaggdelcondmet0(pcsaggdelcondmet0),
|
||||
.pcsaggdelcondmet0toporbot(pcsaggdelcondmet0toporbot),
|
||||
.pcsaggdelcondmetout(pcsaggdelcondmetout),
|
||||
.pcsaggendskwqd(pcsaggendskwqd),
|
||||
.pcsaggendskwqdtoporbot(pcsaggendskwqdtoporbot),
|
||||
.pcsaggendskwrdptrs(pcsaggendskwrdptrs),
|
||||
.pcsaggendskwrdptrstoporbot(pcsaggendskwrdptrstoporbot),
|
||||
.pcsaggfifoovr0(pcsaggfifoovr0),
|
||||
.pcsaggfifoovr0toporbot(pcsaggfifoovr0toporbot),
|
||||
.pcsaggfifoovrout(pcsaggfifoovrout),
|
||||
.pcsaggfifordincomp0(pcsaggfifordincomp0),
|
||||
.pcsaggfifordincomp0toporbot(pcsaggfifordincomp0toporbot),
|
||||
.pcsaggfifordoutcomp(pcsaggfifordoutcomp),
|
||||
.pcsaggfiforstrdqd(pcsaggfiforstrdqd),
|
||||
.pcsaggfiforstrdqdtoporbot(pcsaggfiforstrdqdtoporbot),
|
||||
.pcsagginsertincomplete0(pcsagginsertincomplete0),
|
||||
.pcsagginsertincomplete0toporbot(pcsagginsertincomplete0toporbot),
|
||||
.pcsagginsertincompleteout(pcsagginsertincompleteout),
|
||||
.pcsagglatencycomp0(pcsagglatencycomp0),
|
||||
.pcsagglatencycomp0toporbot(pcsagglatencycomp0toporbot),
|
||||
.pcsagglatencycompout(pcsagglatencycompout),
|
||||
.pcsaggrcvdclkagg(pcsaggrcvdclkagg),
|
||||
.pcsaggrcvdclkaggtoporbot(pcsaggrcvdclkaggtoporbot),
|
||||
.pcsaggrdalign(pcsaggrdalign),
|
||||
.pcsaggrdenablesync(pcsaggrdenablesync),
|
||||
.pcsaggrefclkdig(pcsaggrefclkdig),
|
||||
.pcsaggrunningdisp(pcsaggrunningdisp),
|
||||
.pcsaggrxcontrolrs(pcsaggrxcontrolrs),
|
||||
.pcsaggrxcontrolrstoporbot(pcsaggrxcontrolrstoporbot),
|
||||
.pcsaggrxdatars(pcsaggrxdatars),
|
||||
.pcsaggrxdatarstoporbot(pcsaggrxdatarstoporbot),
|
||||
.pcsaggrxpcsrst(pcsaggrxpcsrst),
|
||||
.pcsaggscanmoden(pcsaggscanmoden),
|
||||
.pcsaggscanshiftn(pcsaggscanshiftn),
|
||||
.pcsaggsyncstatus(pcsaggsyncstatus),
|
||||
.pcsaggtestbus(pcsaggtestbus),
|
||||
.pcsaggtxctltc(pcsaggtxctltc),
|
||||
.pcsaggtxctlts(pcsaggtxctlts),
|
||||
.pcsaggtxctltstoporbot(pcsaggtxctltstoporbot),
|
||||
.pcsaggtxdatatc(pcsaggtxdatatc),
|
||||
.pcsaggtxdatats(pcsaggtxdatats),
|
||||
.pcsaggtxdatatstoporbot(pcsaggtxdatatstoporbot),
|
||||
.pcsaggtxpcsrst(pcsaggtxpcsrst),
|
||||
.pcsrefclkdig(pcsrefclkdig),
|
||||
.pcsscanmoden(pcsscanmoden),
|
||||
.pcsscanshiftn(pcsscanshiftn),
|
||||
.pldhclkout(pldhclkout),
|
||||
.pldnfrzdrv(pldnfrzdrv),
|
||||
.pldpartialreconfig(pldpartialreconfig),
|
||||
.pldtestsitoaggin(pldtestsitoaggin),
|
||||
.pldtestsitoaggout(pldtestsitoaggout),
|
||||
.pmaclklowout(pmaclklowout),
|
||||
.pmacurrentcoeff(pmacurrentcoeff),
|
||||
.pmaearlyeios(pmaearlyeios),
|
||||
.pmafrefout(pmafrefout),
|
||||
.pmahclk(pmahclk),
|
||||
.pmaiftestbus(pmaiftestbus),
|
||||
.pmaltr(pmaltr),
|
||||
.pmanfrzdrv(pmanfrzdrv),
|
||||
.pmapartialreconfig(pmapartialreconfig),
|
||||
.pmapcieswdone(pmapcieswdone),
|
||||
.pmapcieswitch(pmapcieswitch),
|
||||
.pmarxdetectvalid(pmarxdetectvalid),
|
||||
.pmarxfound(pmarxfound),
|
||||
.pmarxpmarstb(pmarxpmarstb),
|
||||
.pmatxdetectrx(pmatxdetectrx),
|
||||
.pmatxelecidle(pmatxelecidle),
|
||||
.resetppmcntrs(resetppmcntrs)
|
||||
);
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,421 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
// Verilog RBC parameter resolution wrapper for arriav_hssi_common_pld_pcs_interface
|
||||
//
|
||||
|
||||
`timescale 1 ns / 1 ps
|
||||
|
||||
module av_hssi_common_pld_pcs_interface_rbc #(
|
||||
// unconstrained parameters
|
||||
|
||||
// extra unconstrained parameters found in atom map
|
||||
parameter avmm_group_channel_index = 0, // 0..2
|
||||
parameter hip_enable = "hip_disable", // hip_disable, hip_enable
|
||||
parameter hrdrstctrl_en_cfg = "hrst_dis_cfg", // hrst_dis_cfg, hrst_en_cfg
|
||||
parameter hrdrstctrl_en_cfgusr = "hrst_dis_cfgusr", // hrst_dis_cfgusr, hrst_en_cfgusr
|
||||
parameter pld_side_data_source = "pld", // hip, pld
|
||||
parameter pld_side_reserved_source0 = "pld_res0", // hip_res0, pld_res0
|
||||
parameter pld_side_reserved_source1 = "pld_res1", // hip_res1, pld_res1
|
||||
parameter pld_side_reserved_source10 = "pld_res10", // hip_res10, pld_res10
|
||||
parameter pld_side_reserved_source11 = "pld_res11", // hip_res11, pld_res11
|
||||
parameter pld_side_reserved_source2 = "pld_res2", // hip_res2, pld_res2
|
||||
parameter pld_side_reserved_source3 = "pld_res3", // hip_res3, pld_res3
|
||||
parameter pld_side_reserved_source4 = "pld_res4", // hip_res4, pld_res4
|
||||
parameter pld_side_reserved_source5 = "pld_res5", // hip_res5, pld_res5
|
||||
parameter pld_side_reserved_source6 = "pld_res6", // hip_res6, pld_res6
|
||||
parameter pld_side_reserved_source7 = "pld_res7", // hip_res7, pld_res7
|
||||
parameter pld_side_reserved_source8 = "pld_res8", // hip_res8, pld_res8
|
||||
parameter pld_side_reserved_source9 = "pld_res9", // hip_res9, pld_res9
|
||||
parameter testbus_sel = "eight_g_pcs", // eight_g_pcs, pma_if
|
||||
parameter use_default_base_address = "true", // false, true
|
||||
parameter user_base_address = 0, // 0..2047
|
||||
parameter usrmode_sel4rst = "usermode" // last_frz, usermode
|
||||
|
||||
// constrained parameters
|
||||
) (
|
||||
// ports
|
||||
output wire asynchdatain,
|
||||
input wire [10:0] avmmaddress,
|
||||
input wire [1:0] avmmbyteen,
|
||||
input wire avmmclk,
|
||||
input wire avmmread,
|
||||
output wire [15:0] avmmreaddata,
|
||||
input wire avmmrstn,
|
||||
input wire avmmwrite,
|
||||
input wire [15:0] avmmwritedata,
|
||||
output wire blockselect,
|
||||
output wire [2:0] emsipcomclkout,
|
||||
input wire [37:0] emsipcomin,
|
||||
output wire [26:0] emsipcomout,
|
||||
output wire emsipenablediocsrrdydly,
|
||||
input wire [19:0] pcs8gchnltestbusout,
|
||||
output wire [2:0] pcs8geidleinfersel,
|
||||
output wire pcs8ghardreset,
|
||||
output wire pcs8gltr,
|
||||
input wire pcs8gphystatus,
|
||||
output wire [3:0] pcs8gpldextrain,
|
||||
input wire [2:0] pcs8gpldextraout,
|
||||
output wire [1:0] pcs8gpowerdown,
|
||||
output wire pcs8gprbsciden,
|
||||
output wire pcs8grate,
|
||||
output wire pcs8grefclkdig,
|
||||
output wire pcs8grefclkdig2,
|
||||
input wire pcs8grxelecidle,
|
||||
output wire pcs8grxpolarity,
|
||||
input wire [2:0] pcs8grxstatus,
|
||||
input wire pcs8grxvalid,
|
||||
output wire pcs8gscanmoden,
|
||||
output wire pcs8gscanshift,
|
||||
output wire [5:0] pcs8gtestsi,
|
||||
input wire [5:0] pcs8gtestso,
|
||||
output wire pcs8gtxdeemph,
|
||||
output wire pcs8gtxdetectrxloopback,
|
||||
output wire pcs8gtxelecidle,
|
||||
output wire [2:0] pcs8gtxmargin,
|
||||
output wire pcs8gtxswing,
|
||||
output wire pcsaggrefclkdig,
|
||||
output wire pcsaggscanmoden,
|
||||
output wire pcsaggscanshift,
|
||||
output wire pcsaggtestsi,
|
||||
input wire pcsaggtestso,
|
||||
output wire pcspcspmaifrefclkdig,
|
||||
output wire pcspcspmaifscanmoden,
|
||||
output wire pcspcspmaifscanshiftn,
|
||||
output wire pcspmaifhardreset,
|
||||
input wire [9:0] pcspmaiftestbusout,
|
||||
output wire pcspmaiftestsi,
|
||||
input wire pcspmaiftestso,
|
||||
output wire pld8gphystatus,
|
||||
input wire [1:0] pld8gpowerdown,
|
||||
input wire pld8gprbsciden,
|
||||
input wire pld8grefclkdig,
|
||||
input wire pld8grefclkdig2,
|
||||
output wire pld8grxelecidle,
|
||||
input wire pld8grxpolarity,
|
||||
output wire [2:0] pld8grxstatus,
|
||||
output wire pld8grxvalid,
|
||||
input wire pld8gtxdeemph,
|
||||
input wire pld8gtxdetectrxloopback,
|
||||
input wire pld8gtxelecidle,
|
||||
input wire [2:0] pld8gtxmargin,
|
||||
input wire pld8gtxswing,
|
||||
input wire pldaggrefclkdig,
|
||||
output wire pldclklow,
|
||||
input wire [2:0] pldeidleinfersel,
|
||||
output wire pldfref,
|
||||
input wire pldhclkin,
|
||||
input wire pldltr,
|
||||
output wire pldnfrzdrv,
|
||||
input wire pldpartialreconfigin,
|
||||
output wire pldpartialreconfigout,
|
||||
input wire pldpcspmaifrefclkdig,
|
||||
input wire pldrate,
|
||||
input wire [11:0] pldreservedin,
|
||||
output wire [10:0] pldreservedout,
|
||||
input wire pldscanmoden,
|
||||
input wire pldscanshiftn,
|
||||
output wire [19:0] pldtestdata,
|
||||
input wire pmaclklow,
|
||||
input wire pmafref,
|
||||
output wire rstsel,
|
||||
output wire usrrstsel
|
||||
);
|
||||
import altera_xcvr_functions::*;
|
||||
|
||||
// hip_enable external parameter (no RBC)
|
||||
localparam rbc_all_hip_enable = "(hip_disable,hip_enable)";
|
||||
localparam rbc_any_hip_enable = "hip_disable";
|
||||
localparam fnl_hip_enable = (hip_enable == "<auto_any>" || hip_enable == "<auto_single>") ? rbc_any_hip_enable : hip_enable;
|
||||
|
||||
// hrdrstctrl_en_cfg external parameter (no RBC)
|
||||
localparam rbc_all_hrdrstctrl_en_cfg = "(hrst_dis_cfg,hrst_en_cfg)";
|
||||
localparam rbc_any_hrdrstctrl_en_cfg = "hrst_dis_cfg";
|
||||
localparam fnl_hrdrstctrl_en_cfg = (hrdrstctrl_en_cfg == "<auto_any>" || hrdrstctrl_en_cfg == "<auto_single>") ? rbc_any_hrdrstctrl_en_cfg : hrdrstctrl_en_cfg;
|
||||
|
||||
// hrdrstctrl_en_cfgusr external parameter (no RBC)
|
||||
localparam rbc_all_hrdrstctrl_en_cfgusr = "(hrst_dis_cfgusr,hrst_en_cfgusr)";
|
||||
localparam rbc_any_hrdrstctrl_en_cfgusr = "hrst_dis_cfgusr";
|
||||
localparam fnl_hrdrstctrl_en_cfgusr = (hrdrstctrl_en_cfgusr == "<auto_any>" || hrdrstctrl_en_cfgusr == "<auto_single>") ? rbc_any_hrdrstctrl_en_cfgusr : hrdrstctrl_en_cfgusr;
|
||||
|
||||
// pld_side_data_source external parameter (no RBC)
|
||||
localparam rbc_all_pld_side_data_source = "(hip,pld)";
|
||||
localparam rbc_any_pld_side_data_source = "pld";
|
||||
localparam fnl_pld_side_data_source = (pld_side_data_source == "<auto_any>" || pld_side_data_source == "<auto_single>") ? rbc_any_pld_side_data_source : pld_side_data_source;
|
||||
|
||||
// pld_side_reserved_source0 external parameter (no RBC)
|
||||
localparam rbc_all_pld_side_reserved_source0 = "(hip_res0,pld_res0)";
|
||||
localparam rbc_any_pld_side_reserved_source0 = "pld_res0";
|
||||
localparam fnl_pld_side_reserved_source0 = (pld_side_reserved_source0 == "<auto_any>" || pld_side_reserved_source0 == "<auto_single>") ? rbc_any_pld_side_reserved_source0 : pld_side_reserved_source0;
|
||||
|
||||
// pld_side_reserved_source1 external parameter (no RBC)
|
||||
localparam rbc_all_pld_side_reserved_source1 = "(hip_res1,pld_res1)";
|
||||
localparam rbc_any_pld_side_reserved_source1 = "pld_res1";
|
||||
localparam fnl_pld_side_reserved_source1 = (pld_side_reserved_source1 == "<auto_any>" || pld_side_reserved_source1 == "<auto_single>") ? rbc_any_pld_side_reserved_source1 : pld_side_reserved_source1;
|
||||
|
||||
// pld_side_reserved_source10 external parameter (no RBC)
|
||||
localparam rbc_all_pld_side_reserved_source10 = "(hip_res10,pld_res10)";
|
||||
localparam rbc_any_pld_side_reserved_source10 = "pld_res10";
|
||||
localparam fnl_pld_side_reserved_source10 = (pld_side_reserved_source10 == "<auto_any>" || pld_side_reserved_source10 == "<auto_single>") ? rbc_any_pld_side_reserved_source10 : pld_side_reserved_source10;
|
||||
|
||||
// pld_side_reserved_source11 external parameter (no RBC)
|
||||
localparam rbc_all_pld_side_reserved_source11 = "(hip_res11,pld_res11)";
|
||||
localparam rbc_any_pld_side_reserved_source11 = "pld_res11";
|
||||
localparam fnl_pld_side_reserved_source11 = (pld_side_reserved_source11 == "<auto_any>" || pld_side_reserved_source11 == "<auto_single>") ? rbc_any_pld_side_reserved_source11 : pld_side_reserved_source11;
|
||||
|
||||
// pld_side_reserved_source2 external parameter (no RBC)
|
||||
localparam rbc_all_pld_side_reserved_source2 = "(hip_res2,pld_res2)";
|
||||
localparam rbc_any_pld_side_reserved_source2 = "pld_res2";
|
||||
localparam fnl_pld_side_reserved_source2 = (pld_side_reserved_source2 == "<auto_any>" || pld_side_reserved_source2 == "<auto_single>") ? rbc_any_pld_side_reserved_source2 : pld_side_reserved_source2;
|
||||
|
||||
// pld_side_reserved_source3 external parameter (no RBC)
|
||||
localparam rbc_all_pld_side_reserved_source3 = "(hip_res3,pld_res3)";
|
||||
localparam rbc_any_pld_side_reserved_source3 = "pld_res3";
|
||||
localparam fnl_pld_side_reserved_source3 = (pld_side_reserved_source3 == "<auto_any>" || pld_side_reserved_source3 == "<auto_single>") ? rbc_any_pld_side_reserved_source3 : pld_side_reserved_source3;
|
||||
|
||||
// pld_side_reserved_source4 external parameter (no RBC)
|
||||
localparam rbc_all_pld_side_reserved_source4 = "(hip_res4,pld_res4)";
|
||||
localparam rbc_any_pld_side_reserved_source4 = "pld_res4";
|
||||
localparam fnl_pld_side_reserved_source4 = (pld_side_reserved_source4 == "<auto_any>" || pld_side_reserved_source4 == "<auto_single>") ? rbc_any_pld_side_reserved_source4 : pld_side_reserved_source4;
|
||||
|
||||
// pld_side_reserved_source5 external parameter (no RBC)
|
||||
localparam rbc_all_pld_side_reserved_source5 = "(hip_res5,pld_res5)";
|
||||
localparam rbc_any_pld_side_reserved_source5 = "pld_res5";
|
||||
localparam fnl_pld_side_reserved_source5 = (pld_side_reserved_source5 == "<auto_any>" || pld_side_reserved_source5 == "<auto_single>") ? rbc_any_pld_side_reserved_source5 : pld_side_reserved_source5;
|
||||
|
||||
// pld_side_reserved_source6 external parameter (no RBC)
|
||||
localparam rbc_all_pld_side_reserved_source6 = "(hip_res6,pld_res6)";
|
||||
localparam rbc_any_pld_side_reserved_source6 = "pld_res6";
|
||||
localparam fnl_pld_side_reserved_source6 = (pld_side_reserved_source6 == "<auto_any>" || pld_side_reserved_source6 == "<auto_single>") ? rbc_any_pld_side_reserved_source6 : pld_side_reserved_source6;
|
||||
|
||||
// pld_side_reserved_source7 external parameter (no RBC)
|
||||
localparam rbc_all_pld_side_reserved_source7 = "(hip_res7,pld_res7)";
|
||||
localparam rbc_any_pld_side_reserved_source7 = "pld_res7";
|
||||
localparam fnl_pld_side_reserved_source7 = (pld_side_reserved_source7 == "<auto_any>" || pld_side_reserved_source7 == "<auto_single>") ? rbc_any_pld_side_reserved_source7 : pld_side_reserved_source7;
|
||||
|
||||
// pld_side_reserved_source8 external parameter (no RBC)
|
||||
localparam rbc_all_pld_side_reserved_source8 = "(hip_res8,pld_res8)";
|
||||
localparam rbc_any_pld_side_reserved_source8 = "pld_res8";
|
||||
localparam fnl_pld_side_reserved_source8 = (pld_side_reserved_source8 == "<auto_any>" || pld_side_reserved_source8 == "<auto_single>") ? rbc_any_pld_side_reserved_source8 : pld_side_reserved_source8;
|
||||
|
||||
// pld_side_reserved_source9 external parameter (no RBC)
|
||||
localparam rbc_all_pld_side_reserved_source9 = "(hip_res9,pld_res9)";
|
||||
localparam rbc_any_pld_side_reserved_source9 = "pld_res9";
|
||||
localparam fnl_pld_side_reserved_source9 = (pld_side_reserved_source9 == "<auto_any>" || pld_side_reserved_source9 == "<auto_single>") ? rbc_any_pld_side_reserved_source9 : pld_side_reserved_source9;
|
||||
|
||||
// testbus_sel external parameter (no RBC)
|
||||
localparam rbc_all_testbus_sel = "(eight_g_pcs,pma_if)";
|
||||
localparam rbc_any_testbus_sel = "eight_g_pcs";
|
||||
localparam fnl_testbus_sel = (testbus_sel == "<auto_any>" || testbus_sel == "<auto_single>") ? rbc_any_testbus_sel : testbus_sel;
|
||||
|
||||
// use_default_base_address external parameter (no RBC)
|
||||
localparam rbc_all_use_default_base_address = "(false,true)";
|
||||
localparam rbc_any_use_default_base_address = "true";
|
||||
localparam fnl_use_default_base_address = (use_default_base_address == "<auto_any>" || use_default_base_address == "<auto_single>") ? rbc_any_use_default_base_address : use_default_base_address;
|
||||
|
||||
// usrmode_sel4rst external parameter (no RBC)
|
||||
localparam rbc_all_usrmode_sel4rst = "(last_frz,usermode)";
|
||||
localparam rbc_any_usrmode_sel4rst = "usermode";
|
||||
localparam fnl_usrmode_sel4rst = (usrmode_sel4rst == "<auto_any>" || usrmode_sel4rst == "<auto_single>") ? rbc_any_usrmode_sel4rst : usrmode_sel4rst;
|
||||
|
||||
// Validate input parameters against known values or RBC values
|
||||
initial begin
|
||||
//$display("hip_enable = orig: '%s', any:'%s', all:'%s', final: '%s'", hip_enable, rbc_any_hip_enable, rbc_all_hip_enable, fnl_hip_enable);
|
||||
if (!is_in_legal_set(hip_enable, rbc_all_hip_enable)) begin
|
||||
$display("Critical Warning: parameter 'hip_enable' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", hip_enable, rbc_all_hip_enable, fnl_hip_enable);
|
||||
end
|
||||
//$display("hrdrstctrl_en_cfg = orig: '%s', any:'%s', all:'%s', final: '%s'", hrdrstctrl_en_cfg, rbc_any_hrdrstctrl_en_cfg, rbc_all_hrdrstctrl_en_cfg, fnl_hrdrstctrl_en_cfg);
|
||||
if (!is_in_legal_set(hrdrstctrl_en_cfg, rbc_all_hrdrstctrl_en_cfg)) begin
|
||||
$display("Critical Warning: parameter 'hrdrstctrl_en_cfg' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", hrdrstctrl_en_cfg, rbc_all_hrdrstctrl_en_cfg, fnl_hrdrstctrl_en_cfg);
|
||||
end
|
||||
//$display("hrdrstctrl_en_cfgusr = orig: '%s', any:'%s', all:'%s', final: '%s'", hrdrstctrl_en_cfgusr, rbc_any_hrdrstctrl_en_cfgusr, rbc_all_hrdrstctrl_en_cfgusr, fnl_hrdrstctrl_en_cfgusr);
|
||||
if (!is_in_legal_set(hrdrstctrl_en_cfgusr, rbc_all_hrdrstctrl_en_cfgusr)) begin
|
||||
$display("Critical Warning: parameter 'hrdrstctrl_en_cfgusr' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", hrdrstctrl_en_cfgusr, rbc_all_hrdrstctrl_en_cfgusr, fnl_hrdrstctrl_en_cfgusr);
|
||||
end
|
||||
//$display("pld_side_data_source = orig: '%s', any:'%s', all:'%s', final: '%s'", pld_side_data_source, rbc_any_pld_side_data_source, rbc_all_pld_side_data_source, fnl_pld_side_data_source);
|
||||
if (!is_in_legal_set(pld_side_data_source, rbc_all_pld_side_data_source)) begin
|
||||
$display("Critical Warning: parameter 'pld_side_data_source' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pld_side_data_source, rbc_all_pld_side_data_source, fnl_pld_side_data_source);
|
||||
end
|
||||
//$display("pld_side_reserved_source0 = orig: '%s', any:'%s', all:'%s', final: '%s'", pld_side_reserved_source0, rbc_any_pld_side_reserved_source0, rbc_all_pld_side_reserved_source0, fnl_pld_side_reserved_source0);
|
||||
if (!is_in_legal_set(pld_side_reserved_source0, rbc_all_pld_side_reserved_source0)) begin
|
||||
$display("Critical Warning: parameter 'pld_side_reserved_source0' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pld_side_reserved_source0, rbc_all_pld_side_reserved_source0, fnl_pld_side_reserved_source0);
|
||||
end
|
||||
//$display("pld_side_reserved_source1 = orig: '%s', any:'%s', all:'%s', final: '%s'", pld_side_reserved_source1, rbc_any_pld_side_reserved_source1, rbc_all_pld_side_reserved_source1, fnl_pld_side_reserved_source1);
|
||||
if (!is_in_legal_set(pld_side_reserved_source1, rbc_all_pld_side_reserved_source1)) begin
|
||||
$display("Critical Warning: parameter 'pld_side_reserved_source1' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pld_side_reserved_source1, rbc_all_pld_side_reserved_source1, fnl_pld_side_reserved_source1);
|
||||
end
|
||||
//$display("pld_side_reserved_source10 = orig: '%s', any:'%s', all:'%s', final: '%s'", pld_side_reserved_source10, rbc_any_pld_side_reserved_source10, rbc_all_pld_side_reserved_source10, fnl_pld_side_reserved_source10);
|
||||
if (!is_in_legal_set(pld_side_reserved_source10, rbc_all_pld_side_reserved_source10)) begin
|
||||
$display("Critical Warning: parameter 'pld_side_reserved_source10' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pld_side_reserved_source10, rbc_all_pld_side_reserved_source10, fnl_pld_side_reserved_source10);
|
||||
end
|
||||
//$display("pld_side_reserved_source11 = orig: '%s', any:'%s', all:'%s', final: '%s'", pld_side_reserved_source11, rbc_any_pld_side_reserved_source11, rbc_all_pld_side_reserved_source11, fnl_pld_side_reserved_source11);
|
||||
if (!is_in_legal_set(pld_side_reserved_source11, rbc_all_pld_side_reserved_source11)) begin
|
||||
$display("Critical Warning: parameter 'pld_side_reserved_source11' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pld_side_reserved_source11, rbc_all_pld_side_reserved_source11, fnl_pld_side_reserved_source11);
|
||||
end
|
||||
//$display("pld_side_reserved_source2 = orig: '%s', any:'%s', all:'%s', final: '%s'", pld_side_reserved_source2, rbc_any_pld_side_reserved_source2, rbc_all_pld_side_reserved_source2, fnl_pld_side_reserved_source2);
|
||||
if (!is_in_legal_set(pld_side_reserved_source2, rbc_all_pld_side_reserved_source2)) begin
|
||||
$display("Critical Warning: parameter 'pld_side_reserved_source2' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pld_side_reserved_source2, rbc_all_pld_side_reserved_source2, fnl_pld_side_reserved_source2);
|
||||
end
|
||||
//$display("pld_side_reserved_source3 = orig: '%s', any:'%s', all:'%s', final: '%s'", pld_side_reserved_source3, rbc_any_pld_side_reserved_source3, rbc_all_pld_side_reserved_source3, fnl_pld_side_reserved_source3);
|
||||
if (!is_in_legal_set(pld_side_reserved_source3, rbc_all_pld_side_reserved_source3)) begin
|
||||
$display("Critical Warning: parameter 'pld_side_reserved_source3' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pld_side_reserved_source3, rbc_all_pld_side_reserved_source3, fnl_pld_side_reserved_source3);
|
||||
end
|
||||
//$display("pld_side_reserved_source4 = orig: '%s', any:'%s', all:'%s', final: '%s'", pld_side_reserved_source4, rbc_any_pld_side_reserved_source4, rbc_all_pld_side_reserved_source4, fnl_pld_side_reserved_source4);
|
||||
if (!is_in_legal_set(pld_side_reserved_source4, rbc_all_pld_side_reserved_source4)) begin
|
||||
$display("Critical Warning: parameter 'pld_side_reserved_source4' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pld_side_reserved_source4, rbc_all_pld_side_reserved_source4, fnl_pld_side_reserved_source4);
|
||||
end
|
||||
//$display("pld_side_reserved_source5 = orig: '%s', any:'%s', all:'%s', final: '%s'", pld_side_reserved_source5, rbc_any_pld_side_reserved_source5, rbc_all_pld_side_reserved_source5, fnl_pld_side_reserved_source5);
|
||||
if (!is_in_legal_set(pld_side_reserved_source5, rbc_all_pld_side_reserved_source5)) begin
|
||||
$display("Critical Warning: parameter 'pld_side_reserved_source5' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pld_side_reserved_source5, rbc_all_pld_side_reserved_source5, fnl_pld_side_reserved_source5);
|
||||
end
|
||||
//$display("pld_side_reserved_source6 = orig: '%s', any:'%s', all:'%s', final: '%s'", pld_side_reserved_source6, rbc_any_pld_side_reserved_source6, rbc_all_pld_side_reserved_source6, fnl_pld_side_reserved_source6);
|
||||
if (!is_in_legal_set(pld_side_reserved_source6, rbc_all_pld_side_reserved_source6)) begin
|
||||
$display("Critical Warning: parameter 'pld_side_reserved_source6' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pld_side_reserved_source6, rbc_all_pld_side_reserved_source6, fnl_pld_side_reserved_source6);
|
||||
end
|
||||
//$display("pld_side_reserved_source7 = orig: '%s', any:'%s', all:'%s', final: '%s'", pld_side_reserved_source7, rbc_any_pld_side_reserved_source7, rbc_all_pld_side_reserved_source7, fnl_pld_side_reserved_source7);
|
||||
if (!is_in_legal_set(pld_side_reserved_source7, rbc_all_pld_side_reserved_source7)) begin
|
||||
$display("Critical Warning: parameter 'pld_side_reserved_source7' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pld_side_reserved_source7, rbc_all_pld_side_reserved_source7, fnl_pld_side_reserved_source7);
|
||||
end
|
||||
//$display("pld_side_reserved_source8 = orig: '%s', any:'%s', all:'%s', final: '%s'", pld_side_reserved_source8, rbc_any_pld_side_reserved_source8, rbc_all_pld_side_reserved_source8, fnl_pld_side_reserved_source8);
|
||||
if (!is_in_legal_set(pld_side_reserved_source8, rbc_all_pld_side_reserved_source8)) begin
|
||||
$display("Critical Warning: parameter 'pld_side_reserved_source8' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pld_side_reserved_source8, rbc_all_pld_side_reserved_source8, fnl_pld_side_reserved_source8);
|
||||
end
|
||||
//$display("pld_side_reserved_source9 = orig: '%s', any:'%s', all:'%s', final: '%s'", pld_side_reserved_source9, rbc_any_pld_side_reserved_source9, rbc_all_pld_side_reserved_source9, fnl_pld_side_reserved_source9);
|
||||
if (!is_in_legal_set(pld_side_reserved_source9, rbc_all_pld_side_reserved_source9)) begin
|
||||
$display("Critical Warning: parameter 'pld_side_reserved_source9' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pld_side_reserved_source9, rbc_all_pld_side_reserved_source9, fnl_pld_side_reserved_source9);
|
||||
end
|
||||
//$display("testbus_sel = orig: '%s', any:'%s', all:'%s', final: '%s'", testbus_sel, rbc_any_testbus_sel, rbc_all_testbus_sel, fnl_testbus_sel);
|
||||
if (!is_in_legal_set(testbus_sel, rbc_all_testbus_sel)) begin
|
||||
$display("Critical Warning: parameter 'testbus_sel' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", testbus_sel, rbc_all_testbus_sel, fnl_testbus_sel);
|
||||
end
|
||||
//$display("use_default_base_address = orig: '%s', any:'%s', all:'%s', final: '%s'", use_default_base_address, rbc_any_use_default_base_address, rbc_all_use_default_base_address, fnl_use_default_base_address);
|
||||
if (!is_in_legal_set(use_default_base_address, rbc_all_use_default_base_address)) begin
|
||||
$display("Critical Warning: parameter 'use_default_base_address' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", use_default_base_address, rbc_all_use_default_base_address, fnl_use_default_base_address);
|
||||
end
|
||||
//$display("usrmode_sel4rst = orig: '%s', any:'%s', all:'%s', final: '%s'", usrmode_sel4rst, rbc_any_usrmode_sel4rst, rbc_all_usrmode_sel4rst, fnl_usrmode_sel4rst);
|
||||
if (!is_in_legal_set(usrmode_sel4rst, rbc_all_usrmode_sel4rst)) begin
|
||||
$display("Critical Warning: parameter 'usrmode_sel4rst' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", usrmode_sel4rst, rbc_all_usrmode_sel4rst, fnl_usrmode_sel4rst);
|
||||
end
|
||||
end
|
||||
|
||||
arriav_hssi_common_pld_pcs_interface #(
|
||||
.avmm_group_channel_index(avmm_group_channel_index),
|
||||
.hip_enable(fnl_hip_enable),
|
||||
.hrdrstctrl_en_cfg(fnl_hrdrstctrl_en_cfg),
|
||||
.hrdrstctrl_en_cfgusr(fnl_hrdrstctrl_en_cfgusr),
|
||||
.pld_side_data_source(fnl_pld_side_data_source),
|
||||
.pld_side_reserved_source0(fnl_pld_side_reserved_source0),
|
||||
.pld_side_reserved_source1(fnl_pld_side_reserved_source1),
|
||||
.pld_side_reserved_source10(fnl_pld_side_reserved_source10),
|
||||
.pld_side_reserved_source11(fnl_pld_side_reserved_source11),
|
||||
.pld_side_reserved_source2(fnl_pld_side_reserved_source2),
|
||||
.pld_side_reserved_source3(fnl_pld_side_reserved_source3),
|
||||
.pld_side_reserved_source4(fnl_pld_side_reserved_source4),
|
||||
.pld_side_reserved_source5(fnl_pld_side_reserved_source5),
|
||||
.pld_side_reserved_source6(fnl_pld_side_reserved_source6),
|
||||
.pld_side_reserved_source7(fnl_pld_side_reserved_source7),
|
||||
.pld_side_reserved_source8(fnl_pld_side_reserved_source8),
|
||||
.pld_side_reserved_source9(fnl_pld_side_reserved_source9),
|
||||
.testbus_sel(fnl_testbus_sel),
|
||||
.use_default_base_address(fnl_use_default_base_address),
|
||||
.user_base_address(user_base_address),
|
||||
.usrmode_sel4rst(fnl_usrmode_sel4rst)
|
||||
) wys (
|
||||
// ports
|
||||
.asynchdatain(asynchdatain),
|
||||
.avmmaddress(avmmaddress),
|
||||
.avmmbyteen(avmmbyteen),
|
||||
.avmmclk(avmmclk),
|
||||
.avmmread(avmmread),
|
||||
.avmmreaddata(avmmreaddata),
|
||||
.avmmrstn(avmmrstn),
|
||||
.avmmwrite(avmmwrite),
|
||||
.avmmwritedata(avmmwritedata),
|
||||
.blockselect(blockselect),
|
||||
.emsipcomclkout(emsipcomclkout),
|
||||
.emsipcomin(emsipcomin),
|
||||
.emsipcomout(emsipcomout),
|
||||
.emsipenablediocsrrdydly(emsipenablediocsrrdydly),
|
||||
.pcs8gchnltestbusout(pcs8gchnltestbusout),
|
||||
.pcs8geidleinfersel(pcs8geidleinfersel),
|
||||
.pcs8ghardreset(pcs8ghardreset),
|
||||
.pcs8gltr(pcs8gltr),
|
||||
.pcs8gphystatus(pcs8gphystatus),
|
||||
.pcs8gpldextrain(pcs8gpldextrain),
|
||||
.pcs8gpldextraout(pcs8gpldextraout),
|
||||
.pcs8gpowerdown(pcs8gpowerdown),
|
||||
.pcs8gprbsciden(pcs8gprbsciden),
|
||||
.pcs8grate(pcs8grate),
|
||||
.pcs8grefclkdig(pcs8grefclkdig),
|
||||
.pcs8grefclkdig2(pcs8grefclkdig2),
|
||||
.pcs8grxelecidle(pcs8grxelecidle),
|
||||
.pcs8grxpolarity(pcs8grxpolarity),
|
||||
.pcs8grxstatus(pcs8grxstatus),
|
||||
.pcs8grxvalid(pcs8grxvalid),
|
||||
.pcs8gscanmoden(pcs8gscanmoden),
|
||||
.pcs8gscanshift(pcs8gscanshift),
|
||||
.pcs8gtestsi(pcs8gtestsi),
|
||||
.pcs8gtestso(pcs8gtestso),
|
||||
.pcs8gtxdeemph(pcs8gtxdeemph),
|
||||
.pcs8gtxdetectrxloopback(pcs8gtxdetectrxloopback),
|
||||
.pcs8gtxelecidle(pcs8gtxelecidle),
|
||||
.pcs8gtxmargin(pcs8gtxmargin),
|
||||
.pcs8gtxswing(pcs8gtxswing),
|
||||
.pcsaggrefclkdig(pcsaggrefclkdig),
|
||||
.pcsaggscanmoden(pcsaggscanmoden),
|
||||
.pcsaggscanshift(pcsaggscanshift),
|
||||
.pcsaggtestsi(pcsaggtestsi),
|
||||
.pcsaggtestso(pcsaggtestso),
|
||||
.pcspcspmaifrefclkdig(pcspcspmaifrefclkdig),
|
||||
.pcspcspmaifscanmoden(pcspcspmaifscanmoden),
|
||||
.pcspcspmaifscanshiftn(pcspcspmaifscanshiftn),
|
||||
.pcspmaifhardreset(pcspmaifhardreset),
|
||||
.pcspmaiftestbusout(pcspmaiftestbusout),
|
||||
.pcspmaiftestsi(pcspmaiftestsi),
|
||||
.pcspmaiftestso(pcspmaiftestso),
|
||||
.pld8gphystatus(pld8gphystatus),
|
||||
.pld8gpowerdown(pld8gpowerdown),
|
||||
.pld8gprbsciden(pld8gprbsciden),
|
||||
.pld8grefclkdig(pld8grefclkdig),
|
||||
.pld8grefclkdig2(pld8grefclkdig2),
|
||||
.pld8grxelecidle(pld8grxelecidle),
|
||||
.pld8grxpolarity(pld8grxpolarity),
|
||||
.pld8grxstatus(pld8grxstatus),
|
||||
.pld8grxvalid(pld8grxvalid),
|
||||
.pld8gtxdeemph(pld8gtxdeemph),
|
||||
.pld8gtxdetectrxloopback(pld8gtxdetectrxloopback),
|
||||
.pld8gtxelecidle(pld8gtxelecidle),
|
||||
.pld8gtxmargin(pld8gtxmargin),
|
||||
.pld8gtxswing(pld8gtxswing),
|
||||
.pldaggrefclkdig(pldaggrefclkdig),
|
||||
.pldclklow(pldclklow),
|
||||
.pldeidleinfersel(pldeidleinfersel),
|
||||
.pldfref(pldfref),
|
||||
.pldhclkin(pldhclkin),
|
||||
.pldltr(pldltr),
|
||||
.pldnfrzdrv(pldnfrzdrv),
|
||||
.pldpartialreconfigin(pldpartialreconfigin),
|
||||
.pldpartialreconfigout(pldpartialreconfigout),
|
||||
.pldpcspmaifrefclkdig(pldpcspmaifrefclkdig),
|
||||
.pldrate(pldrate),
|
||||
.pldreservedin(pldreservedin),
|
||||
.pldreservedout(pldreservedout),
|
||||
.pldscanmoden(pldscanmoden),
|
||||
.pldscanshiftn(pldscanshiftn),
|
||||
.pldtestdata(pldtestdata),
|
||||
.pmaclklow(pmaclklow),
|
||||
.pmafref(pmafref),
|
||||
.rstsel(rstsel),
|
||||
.usrrstsel(usrrstsel)
|
||||
);
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,321 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
// Verilog RBC parameter resolution wrapper for arriav_hssi_pipe_gen1_2
|
||||
//
|
||||
|
||||
`timescale 1 ns / 1 ps
|
||||
|
||||
module av_hssi_pipe_gen1_2_rbc #(
|
||||
// unconstrained parameters
|
||||
parameter prot_mode = "<auto_single>", // basic, disabled_prot_mode, pipe_g1, pipe_g2, srio_2p1
|
||||
|
||||
// extra unconstrained parameters found in atom map
|
||||
parameter avmm_group_channel_index = 0, // 0..2
|
||||
parameter ctrl_plane_bonding_consumption = "individual", // bundled_master, bundled_slave_above, bundled_slave_below, individual
|
||||
parameter elec_idle_delay_val = 3'b0, // 3
|
||||
parameter elecidle_delay = "elec_idle_delay", // elec_idle_delay
|
||||
parameter phy_status_delay = "phystatus_delay", // phystatus_delay
|
||||
parameter phystatus_delay_val = 3'b0, // 3
|
||||
parameter rpre_emph_a_val = 6'b0, // 6
|
||||
parameter rpre_emph_b_val = 6'b0, // 6
|
||||
parameter rpre_emph_c_val = 6'b0, // 6
|
||||
parameter rpre_emph_d_val = 6'b0, // 6
|
||||
parameter rpre_emph_e_val = 6'b0, // 6
|
||||
parameter rpre_emph_settings = 6'b0, // 6
|
||||
parameter rvod_sel_a_val = 6'b0, // 6
|
||||
parameter rvod_sel_b_val = 6'b0, // 6
|
||||
parameter rvod_sel_c_val = 6'b0, // 6
|
||||
parameter rvod_sel_d_val = 6'b0, // 6
|
||||
parameter rvod_sel_e_val = 6'b0, // 6
|
||||
parameter rvod_sel_settings = 6'b0, // 6
|
||||
parameter sup_mode = "user_mode", // engineering_mode, user_mode
|
||||
parameter use_default_base_address = "true", // false, true
|
||||
parameter user_base_address = 0, // 0..2047
|
||||
|
||||
// constrained parameters
|
||||
parameter hip_mode = "<auto_single>", // dis_hip, en_hip
|
||||
parameter tx_pipe_enable = "<auto_single>", // dis_pipe_tx, en_pipe_tx
|
||||
parameter rx_pipe_enable = "<auto_single>", // dis_pipe_rx, en_pipe_rx
|
||||
parameter pipe_byte_de_serializer_en = "<auto_single>", // dis_bds, dont_care_bds, en_bds_by_2
|
||||
parameter txswing = "<auto_single>", // dis_txswing, en_txswing
|
||||
parameter rxdetect_bypass = "<auto_single>", // dis_rxdetect_bypass, en_rxdetect_bypass
|
||||
parameter error_replace_pad = "<auto_single>", // replace_edb, replace_pad
|
||||
parameter ind_error_reporting = "<auto_single>", // dis_ind_error_reporting, en_ind_error_reporting
|
||||
parameter phystatus_rst_toggle = "<auto_single>" // dis_phystatus_rst_toggle, en_phystatus_rst_toggle
|
||||
) (
|
||||
// ports
|
||||
input wire [10:0] avmmaddress,
|
||||
input wire [1:0] avmmbyteen,
|
||||
input wire avmmclk,
|
||||
input wire avmmread,
|
||||
output wire [15:0] avmmreaddata,
|
||||
input wire avmmrstn,
|
||||
input wire avmmwrite,
|
||||
input wire [15:0] avmmwritedata,
|
||||
output wire blockselect,
|
||||
output wire [17:0] currentcoeff,
|
||||
input wire pcieswitch,
|
||||
output wire phystatus,
|
||||
input wire piperxclk,
|
||||
input wire pipetxclk,
|
||||
input wire polinvrx,
|
||||
output wire polinvrxint,
|
||||
input wire [1:0] powerdown,
|
||||
input wire powerstatetransitiondone,
|
||||
input wire powerstatetransitiondoneena,
|
||||
input wire refclkb,
|
||||
input wire refclkbreset,
|
||||
input wire revloopback,
|
||||
output wire revloopbk,
|
||||
input wire revloopbkpcsgen3,
|
||||
input wire [63:0] rxd,
|
||||
output wire [63:0] rxdch,
|
||||
input wire rxdetectvalid,
|
||||
output wire rxelecidle,
|
||||
input wire rxelectricalidle,
|
||||
output wire rxelectricalidleout,
|
||||
input wire rxfound,
|
||||
input wire rxpipereset,
|
||||
input wire rxpolarity,
|
||||
output wire [2:0] rxstatus,
|
||||
output wire rxvalid,
|
||||
input wire sigdetni,
|
||||
input wire speedchange,
|
||||
input wire speedchangechnldown,
|
||||
input wire speedchangechnlup,
|
||||
output wire speedchangeout,
|
||||
output wire [43:0] txd,
|
||||
input wire [43:0] txdch,
|
||||
input wire txdeemph,
|
||||
output wire txdetectrx,
|
||||
input wire txdetectrxloopback,
|
||||
input wire txelecidlecomp,
|
||||
input wire txelecidlein,
|
||||
output wire txelecidleout,
|
||||
input wire [2:0] txmargin,
|
||||
input wire txpipereset,
|
||||
input wire txswingport
|
||||
);
|
||||
import altera_xcvr_functions::*;
|
||||
|
||||
// prot_mode external parameter (no RBC)
|
||||
localparam rbc_all_prot_mode = "(basic,disabled_prot_mode,pipe_g1,pipe_g2,srio_2p1)";
|
||||
localparam rbc_any_prot_mode = "pipe_g1";
|
||||
localparam fnl_prot_mode = (prot_mode == "<auto_any>" || prot_mode == "<auto_single>") ? rbc_any_prot_mode : prot_mode;
|
||||
|
||||
// ctrl_plane_bonding_consumption external parameter (no RBC)
|
||||
localparam rbc_all_ctrl_plane_bonding_consumption = "(bundled_master,bundled_slave_above,bundled_slave_below,individual)";
|
||||
localparam rbc_any_ctrl_plane_bonding_consumption = "individual";
|
||||
localparam fnl_ctrl_plane_bonding_consumption = (ctrl_plane_bonding_consumption == "<auto_any>" || ctrl_plane_bonding_consumption == "<auto_single>") ? rbc_any_ctrl_plane_bonding_consumption : ctrl_plane_bonding_consumption;
|
||||
|
||||
// sup_mode external parameter (no RBC)
|
||||
localparam rbc_all_sup_mode = "(engineering_mode,user_mode)";
|
||||
localparam rbc_any_sup_mode = "user_mode";
|
||||
localparam fnl_sup_mode = (sup_mode == "<auto_any>" || sup_mode == "<auto_single>") ? rbc_any_sup_mode : sup_mode;
|
||||
|
||||
// use_default_base_address external parameter (no RBC)
|
||||
localparam rbc_all_use_default_base_address = "(false,true)";
|
||||
localparam rbc_any_use_default_base_address = "true";
|
||||
localparam fnl_use_default_base_address = (use_default_base_address == "<auto_any>" || use_default_base_address == "<auto_single>") ? rbc_any_use_default_base_address : use_default_base_address;
|
||||
|
||||
// hip_mode, RBC-validated
|
||||
localparam rbc_all_hip_mode = ((fnl_prot_mode == "pipe_g1") || (fnl_prot_mode == "pipe_g2")) ? ("(dis_hip,en_hip)") : "dis_hip";
|
||||
localparam rbc_any_hip_mode = ((fnl_prot_mode == "pipe_g1") || (fnl_prot_mode == "pipe_g2")) ? ("dis_hip") : "dis_hip";
|
||||
localparam fnl_hip_mode = (hip_mode == "<auto_any>" || hip_mode == "<auto_single>") ? rbc_any_hip_mode : hip_mode;
|
||||
|
||||
// tx_pipe_enable, RBC-validated
|
||||
localparam rbc_all_tx_pipe_enable = ( (fnl_prot_mode == "pipe_g1") || (fnl_prot_mode == "pipe_g2") ) ? ("en_pipe_tx") : "dis_pipe_tx";
|
||||
localparam rbc_any_tx_pipe_enable = ( (fnl_prot_mode == "pipe_g1") || (fnl_prot_mode == "pipe_g2") ) ? ("en_pipe_tx") : "dis_pipe_tx";
|
||||
localparam fnl_tx_pipe_enable = (tx_pipe_enable == "<auto_any>" || tx_pipe_enable == "<auto_single>") ? rbc_any_tx_pipe_enable : tx_pipe_enable;
|
||||
|
||||
// rx_pipe_enable, RBC-validated
|
||||
localparam rbc_all_rx_pipe_enable = ( (fnl_prot_mode == "pipe_g1") || (fnl_prot_mode == "pipe_g2") ) ? ("en_pipe_rx") : "dis_pipe_rx";
|
||||
localparam rbc_any_rx_pipe_enable = ( (fnl_prot_mode == "pipe_g1") || (fnl_prot_mode == "pipe_g2") ) ? ("en_pipe_rx") : "dis_pipe_rx";
|
||||
localparam fnl_rx_pipe_enable = (rx_pipe_enable == "<auto_any>" || rx_pipe_enable == "<auto_single>") ? rbc_any_rx_pipe_enable : rx_pipe_enable;
|
||||
|
||||
// pipe_byte_de_serializer_en, RBC-validated
|
||||
localparam rbc_all_pipe_byte_de_serializer_en = ((fnl_rx_pipe_enable == "en_pipe_rx") && (fnl_hip_mode != "en_hip")) ? ("(dis_bds,en_bds_by_2)")
|
||||
: ((fnl_rx_pipe_enable == "en_pipe_rx") && (fnl_hip_mode == "en_hip")) ? ("dis_bds") : "dont_care_bds";
|
||||
localparam rbc_any_pipe_byte_de_serializer_en = ((fnl_rx_pipe_enable == "en_pipe_rx") && (fnl_hip_mode != "en_hip")) ? ("dis_bds")
|
||||
: ((fnl_rx_pipe_enable == "en_pipe_rx") && (fnl_hip_mode == "en_hip")) ? ("dis_bds") : "dont_care_bds";
|
||||
localparam fnl_pipe_byte_de_serializer_en = (pipe_byte_de_serializer_en == "<auto_any>" || pipe_byte_de_serializer_en == "<auto_single>") ? rbc_any_pipe_byte_de_serializer_en : pipe_byte_de_serializer_en;
|
||||
|
||||
// txswing, RBC-validated
|
||||
localparam rbc_all_txswing = (fnl_rx_pipe_enable == "en_pipe_rx") ? ("(en_txswing,dis_txswing)") : "dis_txswing";
|
||||
localparam rbc_any_txswing = (fnl_rx_pipe_enable == "en_pipe_rx") ? ("dis_txswing") : "dis_txswing";
|
||||
localparam fnl_txswing = (txswing == "<auto_any>" || txswing == "<auto_single>") ? rbc_any_txswing : txswing;
|
||||
|
||||
// rxdetect_bypass, RBC-validated
|
||||
localparam rbc_all_rxdetect_bypass = (fnl_rx_pipe_enable == "en_pipe_rx") ? ("(dis_rxdetect_bypass,en_rxdetect_bypass)") : "dis_rxdetect_bypass";
|
||||
localparam rbc_any_rxdetect_bypass = (fnl_rx_pipe_enable == "en_pipe_rx") ? ("dis_rxdetect_bypass") : "dis_rxdetect_bypass";
|
||||
localparam fnl_rxdetect_bypass = (rxdetect_bypass == "<auto_any>" || rxdetect_bypass == "<auto_single>") ? rbc_any_rxdetect_bypass : rxdetect_bypass;
|
||||
|
||||
// error_replace_pad, RBC-validated
|
||||
localparam rbc_all_error_replace_pad = "replace_edb";
|
||||
localparam rbc_any_error_replace_pad = "replace_edb";
|
||||
localparam fnl_error_replace_pad = (error_replace_pad == "<auto_any>" || error_replace_pad == "<auto_single>") ? rbc_any_error_replace_pad : error_replace_pad;
|
||||
|
||||
// ind_error_reporting, RBC-validated
|
||||
localparam rbc_all_ind_error_reporting = (fnl_rx_pipe_enable == "en_pipe_rx") ? ("(en_ind_error_reporting,dis_ind_error_reporting)") : "dis_ind_error_reporting";
|
||||
localparam rbc_any_ind_error_reporting = (fnl_rx_pipe_enable == "en_pipe_rx") ? ("dis_ind_error_reporting") : "dis_ind_error_reporting";
|
||||
localparam fnl_ind_error_reporting = (ind_error_reporting == "<auto_any>" || ind_error_reporting == "<auto_single>") ? rbc_any_ind_error_reporting : ind_error_reporting;
|
||||
|
||||
// phystatus_rst_toggle, RBC-validated
|
||||
localparam rbc_all_phystatus_rst_toggle = "dis_phystatus_rst_toggle";
|
||||
localparam rbc_any_phystatus_rst_toggle = "dis_phystatus_rst_toggle";
|
||||
localparam fnl_phystatus_rst_toggle = (phystatus_rst_toggle == "<auto_any>" || phystatus_rst_toggle == "<auto_single>") ? rbc_any_phystatus_rst_toggle : phystatus_rst_toggle;
|
||||
|
||||
// Validate input parameters against known values or RBC values
|
||||
initial begin
|
||||
//$display("prot_mode = orig: '%s', any:'%s', all:'%s', final: '%s'", prot_mode, rbc_any_prot_mode, rbc_all_prot_mode, fnl_prot_mode);
|
||||
if (!is_in_legal_set(prot_mode, rbc_all_prot_mode)) begin
|
||||
$display("Critical Warning: parameter 'prot_mode' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", prot_mode, rbc_all_prot_mode, fnl_prot_mode);
|
||||
end
|
||||
//$display("ctrl_plane_bonding_consumption = orig: '%s', any:'%s', all:'%s', final: '%s'", ctrl_plane_bonding_consumption, rbc_any_ctrl_plane_bonding_consumption, rbc_all_ctrl_plane_bonding_consumption, fnl_ctrl_plane_bonding_consumption);
|
||||
if (!is_in_legal_set(ctrl_plane_bonding_consumption, rbc_all_ctrl_plane_bonding_consumption)) begin
|
||||
$display("Critical Warning: parameter 'ctrl_plane_bonding_consumption' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", ctrl_plane_bonding_consumption, rbc_all_ctrl_plane_bonding_consumption, fnl_ctrl_plane_bonding_consumption);
|
||||
end
|
||||
//$display("sup_mode = orig: '%s', any:'%s', all:'%s', final: '%s'", sup_mode, rbc_any_sup_mode, rbc_all_sup_mode, fnl_sup_mode);
|
||||
if (!is_in_legal_set(sup_mode, rbc_all_sup_mode)) begin
|
||||
$display("Critical Warning: parameter 'sup_mode' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", sup_mode, rbc_all_sup_mode, fnl_sup_mode);
|
||||
end
|
||||
//$display("use_default_base_address = orig: '%s', any:'%s', all:'%s', final: '%s'", use_default_base_address, rbc_any_use_default_base_address, rbc_all_use_default_base_address, fnl_use_default_base_address);
|
||||
if (!is_in_legal_set(use_default_base_address, rbc_all_use_default_base_address)) begin
|
||||
$display("Critical Warning: parameter 'use_default_base_address' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", use_default_base_address, rbc_all_use_default_base_address, fnl_use_default_base_address);
|
||||
end
|
||||
//$display("hip_mode = orig: '%s', any:'%s', all:'%s', final: '%s'", hip_mode, rbc_any_hip_mode, rbc_all_hip_mode, fnl_hip_mode);
|
||||
if (!is_in_legal_set(hip_mode, rbc_all_hip_mode)) begin
|
||||
$display("Critical Warning: parameter 'hip_mode' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", hip_mode, rbc_all_hip_mode, fnl_hip_mode);
|
||||
end
|
||||
//$display("tx_pipe_enable = orig: '%s', any:'%s', all:'%s', final: '%s'", tx_pipe_enable, rbc_any_tx_pipe_enable, rbc_all_tx_pipe_enable, fnl_tx_pipe_enable);
|
||||
if (!is_in_legal_set(tx_pipe_enable, rbc_all_tx_pipe_enable)) begin
|
||||
$display("Critical Warning: parameter 'tx_pipe_enable' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", tx_pipe_enable, rbc_all_tx_pipe_enable, fnl_tx_pipe_enable);
|
||||
end
|
||||
//$display("rx_pipe_enable = orig: '%s', any:'%s', all:'%s', final: '%s'", rx_pipe_enable, rbc_any_rx_pipe_enable, rbc_all_rx_pipe_enable, fnl_rx_pipe_enable);
|
||||
if (!is_in_legal_set(rx_pipe_enable, rbc_all_rx_pipe_enable)) begin
|
||||
$display("Critical Warning: parameter 'rx_pipe_enable' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", rx_pipe_enable, rbc_all_rx_pipe_enable, fnl_rx_pipe_enable);
|
||||
end
|
||||
//$display("pipe_byte_de_serializer_en = orig: '%s', any:'%s', all:'%s', final: '%s'", pipe_byte_de_serializer_en, rbc_any_pipe_byte_de_serializer_en, rbc_all_pipe_byte_de_serializer_en, fnl_pipe_byte_de_serializer_en);
|
||||
if (!is_in_legal_set(pipe_byte_de_serializer_en, rbc_all_pipe_byte_de_serializer_en)) begin
|
||||
$display("Critical Warning: parameter 'pipe_byte_de_serializer_en' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pipe_byte_de_serializer_en, rbc_all_pipe_byte_de_serializer_en, fnl_pipe_byte_de_serializer_en);
|
||||
end
|
||||
//$display("txswing = orig: '%s', any:'%s', all:'%s', final: '%s'", txswing, rbc_any_txswing, rbc_all_txswing, fnl_txswing);
|
||||
if (!is_in_legal_set(txswing, rbc_all_txswing)) begin
|
||||
$display("Critical Warning: parameter 'txswing' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", txswing, rbc_all_txswing, fnl_txswing);
|
||||
end
|
||||
//$display("rxdetect_bypass = orig: '%s', any:'%s', all:'%s', final: '%s'", rxdetect_bypass, rbc_any_rxdetect_bypass, rbc_all_rxdetect_bypass, fnl_rxdetect_bypass);
|
||||
if (!is_in_legal_set(rxdetect_bypass, rbc_all_rxdetect_bypass)) begin
|
||||
$display("Critical Warning: parameter 'rxdetect_bypass' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", rxdetect_bypass, rbc_all_rxdetect_bypass, fnl_rxdetect_bypass);
|
||||
end
|
||||
//$display("error_replace_pad = orig: '%s', any:'%s', all:'%s', final: '%s'", error_replace_pad, rbc_any_error_replace_pad, rbc_all_error_replace_pad, fnl_error_replace_pad);
|
||||
if (!is_in_legal_set(error_replace_pad, rbc_all_error_replace_pad)) begin
|
||||
$display("Critical Warning: parameter 'error_replace_pad' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", error_replace_pad, rbc_all_error_replace_pad, fnl_error_replace_pad);
|
||||
end
|
||||
//$display("ind_error_reporting = orig: '%s', any:'%s', all:'%s', final: '%s'", ind_error_reporting, rbc_any_ind_error_reporting, rbc_all_ind_error_reporting, fnl_ind_error_reporting);
|
||||
if (!is_in_legal_set(ind_error_reporting, rbc_all_ind_error_reporting)) begin
|
||||
$display("Critical Warning: parameter 'ind_error_reporting' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", ind_error_reporting, rbc_all_ind_error_reporting, fnl_ind_error_reporting);
|
||||
end
|
||||
//$display("phystatus_rst_toggle = orig: '%s', any:'%s', all:'%s', final: '%s'", phystatus_rst_toggle, rbc_any_phystatus_rst_toggle, rbc_all_phystatus_rst_toggle, fnl_phystatus_rst_toggle);
|
||||
if (!is_in_legal_set(phystatus_rst_toggle, rbc_all_phystatus_rst_toggle)) begin
|
||||
$display("Critical Warning: parameter 'phystatus_rst_toggle' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", phystatus_rst_toggle, rbc_all_phystatus_rst_toggle, fnl_phystatus_rst_toggle);
|
||||
end
|
||||
end
|
||||
|
||||
arriav_hssi_pipe_gen1_2 #(
|
||||
.prot_mode(fnl_prot_mode),
|
||||
.avmm_group_channel_index(avmm_group_channel_index),
|
||||
.ctrl_plane_bonding_consumption(fnl_ctrl_plane_bonding_consumption),
|
||||
.elec_idle_delay_val(elec_idle_delay_val),
|
||||
.elecidle_delay(elecidle_delay),
|
||||
.phy_status_delay(phy_status_delay),
|
||||
.phystatus_delay_val(phystatus_delay_val),
|
||||
.rpre_emph_a_val(rpre_emph_a_val),
|
||||
.rpre_emph_b_val(rpre_emph_b_val),
|
||||
.rpre_emph_c_val(rpre_emph_c_val),
|
||||
.rpre_emph_d_val(rpre_emph_d_val),
|
||||
.rpre_emph_e_val(rpre_emph_e_val),
|
||||
.rpre_emph_settings(rpre_emph_settings),
|
||||
.rvod_sel_a_val(rvod_sel_a_val),
|
||||
.rvod_sel_b_val(rvod_sel_b_val),
|
||||
.rvod_sel_c_val(rvod_sel_c_val),
|
||||
.rvod_sel_d_val(rvod_sel_d_val),
|
||||
.rvod_sel_e_val(rvod_sel_e_val),
|
||||
.rvod_sel_settings(rvod_sel_settings),
|
||||
.sup_mode(fnl_sup_mode),
|
||||
.use_default_base_address(fnl_use_default_base_address),
|
||||
.user_base_address(user_base_address),
|
||||
.hip_mode(fnl_hip_mode),
|
||||
.tx_pipe_enable(fnl_tx_pipe_enable),
|
||||
.rx_pipe_enable(fnl_rx_pipe_enable),
|
||||
.pipe_byte_de_serializer_en(fnl_pipe_byte_de_serializer_en),
|
||||
.txswing(fnl_txswing),
|
||||
.rxdetect_bypass(fnl_rxdetect_bypass),
|
||||
.error_replace_pad(fnl_error_replace_pad),
|
||||
.ind_error_reporting(fnl_ind_error_reporting),
|
||||
.phystatus_rst_toggle(fnl_phystatus_rst_toggle)
|
||||
) wys (
|
||||
// ports
|
||||
.avmmaddress(avmmaddress),
|
||||
.avmmbyteen(avmmbyteen),
|
||||
.avmmclk(avmmclk),
|
||||
.avmmread(avmmread),
|
||||
.avmmreaddata(avmmreaddata),
|
||||
.avmmrstn(avmmrstn),
|
||||
.avmmwrite(avmmwrite),
|
||||
.avmmwritedata(avmmwritedata),
|
||||
.blockselect(blockselect),
|
||||
.currentcoeff(currentcoeff),
|
||||
.pcieswitch(pcieswitch),
|
||||
.phystatus(phystatus),
|
||||
.piperxclk(piperxclk),
|
||||
.pipetxclk(pipetxclk),
|
||||
.polinvrx(polinvrx),
|
||||
.polinvrxint(polinvrxint),
|
||||
.powerdown(powerdown),
|
||||
.powerstatetransitiondone(powerstatetransitiondone),
|
||||
.powerstatetransitiondoneena(powerstatetransitiondoneena),
|
||||
.refclkb(refclkb),
|
||||
.refclkbreset(refclkbreset),
|
||||
.revloopback(revloopback),
|
||||
.revloopbk(revloopbk),
|
||||
.revloopbkpcsgen3(revloopbkpcsgen3),
|
||||
.rxd(rxd),
|
||||
.rxdch(rxdch),
|
||||
.rxdetectvalid(rxdetectvalid),
|
||||
.rxelecidle(rxelecidle),
|
||||
.rxelectricalidle(rxelectricalidle),
|
||||
.rxelectricalidleout(rxelectricalidleout),
|
||||
.rxfound(rxfound),
|
||||
.rxpipereset(rxpipereset),
|
||||
.rxpolarity(rxpolarity),
|
||||
.rxstatus(rxstatus),
|
||||
.rxvalid(rxvalid),
|
||||
.sigdetni(sigdetni),
|
||||
.speedchange(speedchange),
|
||||
.speedchangechnldown(speedchangechnldown),
|
||||
.speedchangechnlup(speedchangechnlup),
|
||||
.speedchangeout(speedchangeout),
|
||||
.txd(txd),
|
||||
.txdch(txdch),
|
||||
.txdeemph(txdeemph),
|
||||
.txdetectrx(txdetectrx),
|
||||
.txdetectrxloopback(txdetectrxloopback),
|
||||
.txelecidlecomp(txelecidlecomp),
|
||||
.txelecidlein(txelecidlein),
|
||||
.txelecidleout(txelecidleout),
|
||||
.txmargin(txmargin),
|
||||
.txpipereset(txpipereset),
|
||||
.txswingport(txswingport)
|
||||
);
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
// Verilog RBC parameter resolution wrapper for arriav_hssi_rx_pcs_pma_interface
|
||||
//
|
||||
|
||||
`timescale 1 ns / 1 ps
|
||||
|
||||
module av_hssi_rx_pcs_pma_interface_rbc #(
|
||||
// unconstrained parameters
|
||||
parameter prot_mode = "<auto_single>", // cpri_8g, other_protocols
|
||||
|
||||
// extra unconstrained parameters found in atom map
|
||||
parameter avmm_group_channel_index = 0, // 0..2
|
||||
parameter selectpcs = "eight_g_pcs", // default, eight_g_pcs
|
||||
parameter use_default_base_address = "true", // false, true
|
||||
parameter user_base_address = 0, // 0..2047
|
||||
|
||||
// constrained parameters
|
||||
parameter clkslip_sel = "<auto_single>" // pld, slip_eight_g_pcs
|
||||
) (
|
||||
// ports
|
||||
output wire asynchdatain,
|
||||
input wire [10:0] avmmaddress,
|
||||
input wire [1:0] avmmbyteen,
|
||||
input wire avmmclk,
|
||||
input wire avmmread,
|
||||
output wire [15:0] avmmreaddata,
|
||||
input wire avmmrstn,
|
||||
input wire avmmwrite,
|
||||
input wire [15:0] avmmwritedata,
|
||||
output wire blockselect,
|
||||
input wire clockinfrompma,
|
||||
output wire clockoutto8gpcs,
|
||||
input wire [79:0] datainfrompma,
|
||||
output wire [19:0] dataoutto8gpcs,
|
||||
input wire pcs8grxclkiqout,
|
||||
input wire pcs8grxclkslip,
|
||||
output wire pcs8gsigdetni,
|
||||
input wire pldrxclkslip,
|
||||
input wire pldrxpmarstb,
|
||||
input wire [4:0] pmareservedin,
|
||||
output wire [4:0] pmareservedout,
|
||||
output wire pmarxclkout,
|
||||
output wire pmarxclkslip,
|
||||
input wire pmarxpllphaselockin,
|
||||
output wire pmarxpllphaselockout,
|
||||
output wire pmarxpmarstb,
|
||||
input wire pmasigdet,
|
||||
output wire reset
|
||||
);
|
||||
import altera_xcvr_functions::*;
|
||||
|
||||
// prot_mode external parameter (no RBC)
|
||||
localparam rbc_all_prot_mode = "(cpri_8g,other_protocols)";
|
||||
localparam rbc_any_prot_mode = "other_protocols";
|
||||
localparam fnl_prot_mode = (prot_mode == "<auto_any>" || prot_mode == "<auto_single>") ? rbc_any_prot_mode : prot_mode;
|
||||
|
||||
// selectpcs external parameter (no RBC)
|
||||
localparam rbc_all_selectpcs = "(default,eight_g_pcs)";
|
||||
localparam rbc_any_selectpcs = "eight_g_pcs";
|
||||
localparam fnl_selectpcs = (selectpcs == "<auto_any>" || selectpcs == "<auto_single>") ? rbc_any_selectpcs : selectpcs;
|
||||
|
||||
// use_default_base_address external parameter (no RBC)
|
||||
localparam rbc_all_use_default_base_address = "(false,true)";
|
||||
localparam rbc_any_use_default_base_address = "true";
|
||||
localparam fnl_use_default_base_address = (use_default_base_address == "<auto_any>" || use_default_base_address == "<auto_single>") ? rbc_any_use_default_base_address : use_default_base_address;
|
||||
|
||||
// clkslip_sel, RBC-validated
|
||||
localparam rbc_all_clkslip_sel = (fnl_prot_mode == "cpri_8g") ? ("(slip_eight_g_pcs,pld)") : "pld";
|
||||
localparam rbc_any_clkslip_sel = (fnl_prot_mode == "cpri_8g") ? ("pld") : "pld";
|
||||
localparam fnl_clkslip_sel = (clkslip_sel == "<auto_any>" || clkslip_sel == "<auto_single>") ? rbc_any_clkslip_sel : clkslip_sel;
|
||||
|
||||
// Validate input parameters against known values or RBC values
|
||||
initial begin
|
||||
//$display("prot_mode = orig: '%s', any:'%s', all:'%s', final: '%s'", prot_mode, rbc_any_prot_mode, rbc_all_prot_mode, fnl_prot_mode);
|
||||
if (!is_in_legal_set(prot_mode, rbc_all_prot_mode)) begin
|
||||
$display("Critical Warning: parameter 'prot_mode' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", prot_mode, rbc_all_prot_mode, fnl_prot_mode);
|
||||
end
|
||||
//$display("selectpcs = orig: '%s', any:'%s', all:'%s', final: '%s'", selectpcs, rbc_any_selectpcs, rbc_all_selectpcs, fnl_selectpcs);
|
||||
if (!is_in_legal_set(selectpcs, rbc_all_selectpcs)) begin
|
||||
$display("Critical Warning: parameter 'selectpcs' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", selectpcs, rbc_all_selectpcs, fnl_selectpcs);
|
||||
end
|
||||
//$display("use_default_base_address = orig: '%s', any:'%s', all:'%s', final: '%s'", use_default_base_address, rbc_any_use_default_base_address, rbc_all_use_default_base_address, fnl_use_default_base_address);
|
||||
if (!is_in_legal_set(use_default_base_address, rbc_all_use_default_base_address)) begin
|
||||
$display("Critical Warning: parameter 'use_default_base_address' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", use_default_base_address, rbc_all_use_default_base_address, fnl_use_default_base_address);
|
||||
end
|
||||
//$display("clkslip_sel = orig: '%s', any:'%s', all:'%s', final: '%s'", clkslip_sel, rbc_any_clkslip_sel, rbc_all_clkslip_sel, fnl_clkslip_sel);
|
||||
if (!is_in_legal_set(clkslip_sel, rbc_all_clkslip_sel)) begin
|
||||
$display("Critical Warning: parameter 'clkslip_sel' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", clkslip_sel, rbc_all_clkslip_sel, fnl_clkslip_sel);
|
||||
end
|
||||
end
|
||||
|
||||
arriav_hssi_rx_pcs_pma_interface #(
|
||||
.prot_mode(fnl_prot_mode),
|
||||
.avmm_group_channel_index(avmm_group_channel_index),
|
||||
.selectpcs(fnl_selectpcs),
|
||||
.use_default_base_address(fnl_use_default_base_address),
|
||||
.user_base_address(user_base_address),
|
||||
.clkslip_sel(fnl_clkslip_sel)
|
||||
) wys (
|
||||
// ports
|
||||
.asynchdatain(asynchdatain),
|
||||
.avmmaddress(avmmaddress),
|
||||
.avmmbyteen(avmmbyteen),
|
||||
.avmmclk(avmmclk),
|
||||
.avmmread(avmmread),
|
||||
.avmmreaddata(avmmreaddata),
|
||||
.avmmrstn(avmmrstn),
|
||||
.avmmwrite(avmmwrite),
|
||||
.avmmwritedata(avmmwritedata),
|
||||
.blockselect(blockselect),
|
||||
.clockinfrompma(clockinfrompma),
|
||||
.clockoutto8gpcs(clockoutto8gpcs),
|
||||
.datainfrompma(datainfrompma),
|
||||
.dataoutto8gpcs(dataoutto8gpcs),
|
||||
.pcs8grxclkiqout(pcs8grxclkiqout),
|
||||
.pcs8grxclkslip(pcs8grxclkslip),
|
||||
.pcs8gsigdetni(pcs8gsigdetni),
|
||||
.pldrxclkslip(pldrxclkslip),
|
||||
.pldrxpmarstb(pldrxpmarstb),
|
||||
.pmareservedin(pmareservedin),
|
||||
.pmareservedout(pmareservedout),
|
||||
.pmarxclkout(pmarxclkout),
|
||||
.pmarxclkslip(pmarxclkslip),
|
||||
.pmarxpllphaselockin(pmarxpllphaselockin),
|
||||
.pmarxpllphaselockout(pmarxpllphaselockout),
|
||||
.pmarxpmarstb(pmarxpmarstb),
|
||||
.pmasigdet(pmasigdet),
|
||||
.reset(reset)
|
||||
);
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,254 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
// Verilog RBC parameter resolution wrapper for arriav_hssi_rx_pld_pcs_interface
|
||||
//
|
||||
|
||||
`timescale 1 ns / 1 ps
|
||||
|
||||
module av_hssi_rx_pld_pcs_interface_rbc #(
|
||||
// unconstrained parameters
|
||||
|
||||
// extra unconstrained parameters found in atom map
|
||||
parameter avmm_group_channel_index = 0, // 0..2
|
||||
parameter is_8g_0ppm = "false", // false, true
|
||||
parameter pcs_side_block_sel = "eight_g_pcs", // default, eight_g_pcs
|
||||
parameter pld_side_data_source = "pld", // hip, pld
|
||||
parameter use_default_base_address = "true", // false, true
|
||||
parameter user_base_address = 0 // 0..2047
|
||||
|
||||
// constrained parameters
|
||||
) (
|
||||
// ports
|
||||
output wire asynchdatain,
|
||||
input wire [10:0] avmmaddress,
|
||||
input wire [1:0] avmmbyteen,
|
||||
input wire avmmclk,
|
||||
input wire avmmread,
|
||||
output wire [15:0] avmmreaddata,
|
||||
input wire avmmrstn,
|
||||
input wire avmmwrite,
|
||||
input wire [15:0] avmmwritedata,
|
||||
output wire blockselect,
|
||||
input wire clockinfrom8gpcs,
|
||||
input wire [63:0] datainfrom8gpcs,
|
||||
output wire [63:0] dataouttopld,
|
||||
input wire emsipenablediocsrrdydly,
|
||||
output wire [128:0] emsiprxout,
|
||||
input wire [12:0] emsiprxspecialin,
|
||||
output wire [15:0] emsiprxspecialout,
|
||||
input wire [3:0] pcs8ga1a2k1k2flag,
|
||||
output wire pcs8ga1a2size,
|
||||
input wire pcs8galignstatus,
|
||||
input wire pcs8gbistdone,
|
||||
input wire pcs8gbisterr,
|
||||
output wire pcs8gbitlocreven,
|
||||
output wire pcs8gbitslip,
|
||||
input wire pcs8gbyteordflag,
|
||||
output wire pcs8gbytereven,
|
||||
output wire pcs8gbytordpld,
|
||||
output wire pcs8gcmpfifourst,
|
||||
input wire pcs8gemptyrmf,
|
||||
input wire pcs8gemptyrx,
|
||||
output wire pcs8gencdt,
|
||||
input wire pcs8gfullrmf,
|
||||
input wire pcs8gfullrx,
|
||||
output wire pcs8gphfifourstrx,
|
||||
output wire pcs8gpldrxclk,
|
||||
output wire pcs8gpolinvrx,
|
||||
output wire pcs8grdenablermf,
|
||||
output wire pcs8grdenablerx,
|
||||
input wire pcs8grlvlt,
|
||||
input wire [3:0] pcs8grxdatavalid,
|
||||
output wire pcs8grxurstpcs,
|
||||
input wire pcs8gsignaldetectout,
|
||||
output wire pcs8gsyncsmenoutput,
|
||||
input wire [4:0] pcs8gwaboundary,
|
||||
output wire pcs8gwrdisablerx,
|
||||
output wire pcs8gwrenablermf,
|
||||
output wire [3:0] pld8ga1a2k1k2flag,
|
||||
input wire pld8ga1a2size,
|
||||
output wire pld8galignstatus,
|
||||
output wire pld8gbistdone,
|
||||
output wire pld8gbisterr,
|
||||
input wire pld8gbitlocreven,
|
||||
input wire pld8gbitslip,
|
||||
output wire pld8gbyteordflag,
|
||||
input wire pld8gbytereven,
|
||||
input wire pld8gbytordpld,
|
||||
input wire pld8gcmpfifourstn,
|
||||
output wire pld8gemptyrmf,
|
||||
output wire pld8gemptyrx,
|
||||
input wire pld8gencdt,
|
||||
output wire pld8gfullrmf,
|
||||
output wire pld8gfullrx,
|
||||
input wire pld8gphfifourstrxn,
|
||||
input wire pld8gpldrxclk,
|
||||
input wire pld8gpolinvrx,
|
||||
input wire pld8grdenablermf,
|
||||
input wire pld8grdenablerx,
|
||||
output wire pld8grlvlt,
|
||||
output wire pld8grxclkout,
|
||||
output wire [3:0] pld8grxdatavalid,
|
||||
input wire pld8grxurstpcsn,
|
||||
output wire pld8gsignaldetectout,
|
||||
input wire pld8gsyncsmeninput,
|
||||
output wire [4:0] pld8gwaboundary,
|
||||
input wire pld8gwrdisablerx,
|
||||
input wire pld8gwrenablermf,
|
||||
input wire pldrxclkslipin,
|
||||
output wire pldrxclkslipout,
|
||||
input wire pldrxpmarstbin,
|
||||
output wire pldrxpmarstbout,
|
||||
input wire pmarxplllock,
|
||||
output wire reset,
|
||||
input wire rstsel,
|
||||
input wire usrrstsel
|
||||
);
|
||||
import altera_xcvr_functions::*;
|
||||
|
||||
// is_8g_0ppm external parameter (no RBC)
|
||||
localparam rbc_all_is_8g_0ppm = "(false,true)";
|
||||
localparam rbc_any_is_8g_0ppm = "false";
|
||||
localparam fnl_is_8g_0ppm = (is_8g_0ppm == "<auto_any>" || is_8g_0ppm == "<auto_single>") ? rbc_any_is_8g_0ppm : is_8g_0ppm;
|
||||
|
||||
// pcs_side_block_sel external parameter (no RBC)
|
||||
localparam rbc_all_pcs_side_block_sel = "(default,eight_g_pcs)";
|
||||
localparam rbc_any_pcs_side_block_sel = "eight_g_pcs";
|
||||
localparam fnl_pcs_side_block_sel = (pcs_side_block_sel == "<auto_any>" || pcs_side_block_sel == "<auto_single>") ? rbc_any_pcs_side_block_sel : pcs_side_block_sel;
|
||||
|
||||
// pld_side_data_source external parameter (no RBC)
|
||||
localparam rbc_all_pld_side_data_source = "(hip,pld)";
|
||||
localparam rbc_any_pld_side_data_source = "pld";
|
||||
localparam fnl_pld_side_data_source = (pld_side_data_source == "<auto_any>" || pld_side_data_source == "<auto_single>") ? rbc_any_pld_side_data_source : pld_side_data_source;
|
||||
|
||||
// use_default_base_address external parameter (no RBC)
|
||||
localparam rbc_all_use_default_base_address = "(false,true)";
|
||||
localparam rbc_any_use_default_base_address = "true";
|
||||
localparam fnl_use_default_base_address = (use_default_base_address == "<auto_any>" || use_default_base_address == "<auto_single>") ? rbc_any_use_default_base_address : use_default_base_address;
|
||||
|
||||
// Validate input parameters against known values or RBC values
|
||||
initial begin
|
||||
//$display("is_8g_0ppm = orig: '%s', any:'%s', all:'%s', final: '%s'", is_8g_0ppm, rbc_any_is_8g_0ppm, rbc_all_is_8g_0ppm, fnl_is_8g_0ppm);
|
||||
if (!is_in_legal_set(is_8g_0ppm, rbc_all_is_8g_0ppm)) begin
|
||||
$display("Critical Warning: parameter 'is_8g_0ppm' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", is_8g_0ppm, rbc_all_is_8g_0ppm, fnl_is_8g_0ppm);
|
||||
end
|
||||
//$display("pcs_side_block_sel = orig: '%s', any:'%s', all:'%s', final: '%s'", pcs_side_block_sel, rbc_any_pcs_side_block_sel, rbc_all_pcs_side_block_sel, fnl_pcs_side_block_sel);
|
||||
if (!is_in_legal_set(pcs_side_block_sel, rbc_all_pcs_side_block_sel)) begin
|
||||
$display("Critical Warning: parameter 'pcs_side_block_sel' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pcs_side_block_sel, rbc_all_pcs_side_block_sel, fnl_pcs_side_block_sel);
|
||||
end
|
||||
//$display("pld_side_data_source = orig: '%s', any:'%s', all:'%s', final: '%s'", pld_side_data_source, rbc_any_pld_side_data_source, rbc_all_pld_side_data_source, fnl_pld_side_data_source);
|
||||
if (!is_in_legal_set(pld_side_data_source, rbc_all_pld_side_data_source)) begin
|
||||
$display("Critical Warning: parameter 'pld_side_data_source' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pld_side_data_source, rbc_all_pld_side_data_source, fnl_pld_side_data_source);
|
||||
end
|
||||
//$display("use_default_base_address = orig: '%s', any:'%s', all:'%s', final: '%s'", use_default_base_address, rbc_any_use_default_base_address, rbc_all_use_default_base_address, fnl_use_default_base_address);
|
||||
if (!is_in_legal_set(use_default_base_address, rbc_all_use_default_base_address)) begin
|
||||
$display("Critical Warning: parameter 'use_default_base_address' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", use_default_base_address, rbc_all_use_default_base_address, fnl_use_default_base_address);
|
||||
end
|
||||
end
|
||||
|
||||
arriav_hssi_rx_pld_pcs_interface #(
|
||||
.avmm_group_channel_index(avmm_group_channel_index),
|
||||
.is_8g_0ppm(fnl_is_8g_0ppm),
|
||||
.pcs_side_block_sel(fnl_pcs_side_block_sel),
|
||||
.pld_side_data_source(fnl_pld_side_data_source),
|
||||
.use_default_base_address(fnl_use_default_base_address),
|
||||
.user_base_address(user_base_address)
|
||||
) wys (
|
||||
// ports
|
||||
.asynchdatain(asynchdatain),
|
||||
.avmmaddress(avmmaddress),
|
||||
.avmmbyteen(avmmbyteen),
|
||||
.avmmclk(avmmclk),
|
||||
.avmmread(avmmread),
|
||||
.avmmreaddata(avmmreaddata),
|
||||
.avmmrstn(avmmrstn),
|
||||
.avmmwrite(avmmwrite),
|
||||
.avmmwritedata(avmmwritedata),
|
||||
.blockselect(blockselect),
|
||||
.clockinfrom8gpcs(clockinfrom8gpcs),
|
||||
.datainfrom8gpcs(datainfrom8gpcs),
|
||||
.dataouttopld(dataouttopld),
|
||||
.emsipenablediocsrrdydly(emsipenablediocsrrdydly),
|
||||
.emsiprxout(emsiprxout),
|
||||
.emsiprxspecialin(emsiprxspecialin),
|
||||
.emsiprxspecialout(emsiprxspecialout),
|
||||
.pcs8ga1a2k1k2flag(pcs8ga1a2k1k2flag),
|
||||
.pcs8ga1a2size(pcs8ga1a2size),
|
||||
.pcs8galignstatus(pcs8galignstatus),
|
||||
.pcs8gbistdone(pcs8gbistdone),
|
||||
.pcs8gbisterr(pcs8gbisterr),
|
||||
.pcs8gbitlocreven(pcs8gbitlocreven),
|
||||
.pcs8gbitslip(pcs8gbitslip),
|
||||
.pcs8gbyteordflag(pcs8gbyteordflag),
|
||||
.pcs8gbytereven(pcs8gbytereven),
|
||||
.pcs8gbytordpld(pcs8gbytordpld),
|
||||
.pcs8gcmpfifourst(pcs8gcmpfifourst),
|
||||
.pcs8gemptyrmf(pcs8gemptyrmf),
|
||||
.pcs8gemptyrx(pcs8gemptyrx),
|
||||
.pcs8gencdt(pcs8gencdt),
|
||||
.pcs8gfullrmf(pcs8gfullrmf),
|
||||
.pcs8gfullrx(pcs8gfullrx),
|
||||
.pcs8gphfifourstrx(pcs8gphfifourstrx),
|
||||
.pcs8gpldrxclk(pcs8gpldrxclk),
|
||||
.pcs8gpolinvrx(pcs8gpolinvrx),
|
||||
.pcs8grdenablermf(pcs8grdenablermf),
|
||||
.pcs8grdenablerx(pcs8grdenablerx),
|
||||
.pcs8grlvlt(pcs8grlvlt),
|
||||
.pcs8grxdatavalid(pcs8grxdatavalid),
|
||||
.pcs8grxurstpcs(pcs8grxurstpcs),
|
||||
.pcs8gsignaldetectout(pcs8gsignaldetectout),
|
||||
.pcs8gsyncsmenoutput(pcs8gsyncsmenoutput),
|
||||
.pcs8gwaboundary(pcs8gwaboundary),
|
||||
.pcs8gwrdisablerx(pcs8gwrdisablerx),
|
||||
.pcs8gwrenablermf(pcs8gwrenablermf),
|
||||
.pld8ga1a2k1k2flag(pld8ga1a2k1k2flag),
|
||||
.pld8ga1a2size(pld8ga1a2size),
|
||||
.pld8galignstatus(pld8galignstatus),
|
||||
.pld8gbistdone(pld8gbistdone),
|
||||
.pld8gbisterr(pld8gbisterr),
|
||||
.pld8gbitlocreven(pld8gbitlocreven),
|
||||
.pld8gbitslip(pld8gbitslip),
|
||||
.pld8gbyteordflag(pld8gbyteordflag),
|
||||
.pld8gbytereven(pld8gbytereven),
|
||||
.pld8gbytordpld(pld8gbytordpld),
|
||||
.pld8gcmpfifourstn(pld8gcmpfifourstn),
|
||||
.pld8gemptyrmf(pld8gemptyrmf),
|
||||
.pld8gemptyrx(pld8gemptyrx),
|
||||
.pld8gencdt(pld8gencdt),
|
||||
.pld8gfullrmf(pld8gfullrmf),
|
||||
.pld8gfullrx(pld8gfullrx),
|
||||
.pld8gphfifourstrxn(pld8gphfifourstrxn),
|
||||
.pld8gpldrxclk(pld8gpldrxclk),
|
||||
.pld8gpolinvrx(pld8gpolinvrx),
|
||||
.pld8grdenablermf(pld8grdenablermf),
|
||||
.pld8grdenablerx(pld8grdenablerx),
|
||||
.pld8grlvlt(pld8grlvlt),
|
||||
.pld8grxclkout(pld8grxclkout),
|
||||
.pld8grxdatavalid(pld8grxdatavalid),
|
||||
.pld8grxurstpcsn(pld8grxurstpcsn),
|
||||
.pld8gsignaldetectout(pld8gsignaldetectout),
|
||||
.pld8gsyncsmeninput(pld8gsyncsmeninput),
|
||||
.pld8gwaboundary(pld8gwaboundary),
|
||||
.pld8gwrdisablerx(pld8gwrdisablerx),
|
||||
.pld8gwrenablermf(pld8gwrenablermf),
|
||||
.pldrxclkslipin(pldrxclkslipin),
|
||||
.pldrxclkslipout(pldrxclkslipout),
|
||||
.pldrxpmarstbin(pldrxpmarstbin),
|
||||
.pldrxpmarstbout(pldrxpmarstbout),
|
||||
.pmarxplllock(pmarxplllock),
|
||||
.reset(reset),
|
||||
.rstsel(rstsel),
|
||||
.usrrstsel(usrrstsel)
|
||||
);
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
// Verilog RBC parameter resolution wrapper for arriav_hssi_tx_pcs_pma_interface
|
||||
//
|
||||
|
||||
`timescale 1 ns / 1 ps
|
||||
|
||||
module av_hssi_tx_pcs_pma_interface_rbc #(
|
||||
// unconstrained parameters
|
||||
|
||||
// extra unconstrained parameters found in atom map
|
||||
parameter avmm_group_channel_index = 0, // 0..2
|
||||
parameter selectpcs = "eight_g_pcs", // default, eight_g_pcs
|
||||
parameter use_default_base_address = "true", // false, true
|
||||
parameter user_base_address = 0 // 0..2047
|
||||
|
||||
// constrained parameters
|
||||
) (
|
||||
// ports
|
||||
output wire asynchdatain,
|
||||
input wire [10:0] avmmaddress,
|
||||
input wire [1:0] avmmbyteen,
|
||||
input wire avmmclk,
|
||||
input wire avmmread,
|
||||
output wire [15:0] avmmreaddata,
|
||||
input wire avmmrstn,
|
||||
input wire avmmwrite,
|
||||
input wire [15:0] avmmwritedata,
|
||||
output wire blockselect,
|
||||
input wire clockinfrompma,
|
||||
output wire clockoutto8gpcs,
|
||||
input wire [19:0] datainfrom8gpcs,
|
||||
output wire [79:0] dataouttopma,
|
||||
input wire pcs8gtxclkiqout,
|
||||
input wire pmarxfreqtxcmuplllockin,
|
||||
output wire pmarxfreqtxcmuplllockout,
|
||||
output wire pmatxclkout,
|
||||
output wire reset
|
||||
);
|
||||
import altera_xcvr_functions::*;
|
||||
|
||||
// selectpcs external parameter (no RBC)
|
||||
localparam rbc_all_selectpcs = "(default,eight_g_pcs)";
|
||||
localparam rbc_any_selectpcs = "eight_g_pcs";
|
||||
localparam fnl_selectpcs = (selectpcs == "<auto_any>" || selectpcs == "<auto_single>") ? rbc_any_selectpcs : selectpcs;
|
||||
|
||||
// use_default_base_address external parameter (no RBC)
|
||||
localparam rbc_all_use_default_base_address = "(false,true)";
|
||||
localparam rbc_any_use_default_base_address = "true";
|
||||
localparam fnl_use_default_base_address = (use_default_base_address == "<auto_any>" || use_default_base_address == "<auto_single>") ? rbc_any_use_default_base_address : use_default_base_address;
|
||||
|
||||
// Validate input parameters against known values or RBC values
|
||||
initial begin
|
||||
//$display("selectpcs = orig: '%s', any:'%s', all:'%s', final: '%s'", selectpcs, rbc_any_selectpcs, rbc_all_selectpcs, fnl_selectpcs);
|
||||
if (!is_in_legal_set(selectpcs, rbc_all_selectpcs)) begin
|
||||
$display("Critical Warning: parameter 'selectpcs' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", selectpcs, rbc_all_selectpcs, fnl_selectpcs);
|
||||
end
|
||||
//$display("use_default_base_address = orig: '%s', any:'%s', all:'%s', final: '%s'", use_default_base_address, rbc_any_use_default_base_address, rbc_all_use_default_base_address, fnl_use_default_base_address);
|
||||
if (!is_in_legal_set(use_default_base_address, rbc_all_use_default_base_address)) begin
|
||||
$display("Critical Warning: parameter 'use_default_base_address' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", use_default_base_address, rbc_all_use_default_base_address, fnl_use_default_base_address);
|
||||
end
|
||||
end
|
||||
|
||||
arriav_hssi_tx_pcs_pma_interface #(
|
||||
.avmm_group_channel_index(avmm_group_channel_index),
|
||||
.selectpcs(fnl_selectpcs),
|
||||
.use_default_base_address(fnl_use_default_base_address),
|
||||
.user_base_address(user_base_address)
|
||||
) wys (
|
||||
// ports
|
||||
.asynchdatain(asynchdatain),
|
||||
.avmmaddress(avmmaddress),
|
||||
.avmmbyteen(avmmbyteen),
|
||||
.avmmclk(avmmclk),
|
||||
.avmmread(avmmread),
|
||||
.avmmreaddata(avmmreaddata),
|
||||
.avmmrstn(avmmrstn),
|
||||
.avmmwrite(avmmwrite),
|
||||
.avmmwritedata(avmmwritedata),
|
||||
.blockselect(blockselect),
|
||||
.clockinfrompma(clockinfrompma),
|
||||
.clockoutto8gpcs(clockoutto8gpcs),
|
||||
.datainfrom8gpcs(datainfrom8gpcs),
|
||||
.dataouttopma(dataouttopma),
|
||||
.pcs8gtxclkiqout(pcs8gtxclkiqout),
|
||||
.pmarxfreqtxcmuplllockin(pmarxfreqtxcmuplllockin),
|
||||
.pmarxfreqtxcmuplllockout(pmarxfreqtxcmuplllockout),
|
||||
.pmatxclkout(pmatxclkout),
|
||||
.reset(reset)
|
||||
);
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
// Verilog RBC parameter resolution wrapper for arriav_hssi_tx_pld_pcs_interface
|
||||
//
|
||||
|
||||
`timescale 1 ns / 1 ps
|
||||
|
||||
module av_hssi_tx_pld_pcs_interface_rbc #(
|
||||
// unconstrained parameters
|
||||
|
||||
// extra unconstrained parameters found in atom map
|
||||
parameter avmm_group_channel_index = 0, // 0..2
|
||||
parameter is_8g_0ppm = "false", // false, true
|
||||
parameter pld_side_data_source = "pld", // hip, pld
|
||||
parameter use_default_base_address = "true", // false, true
|
||||
parameter user_base_address = 0 // 0..2047
|
||||
|
||||
// constrained parameters
|
||||
) (
|
||||
// ports
|
||||
output wire asynchdatain,
|
||||
input wire [10:0] avmmaddress,
|
||||
input wire [1:0] avmmbyteen,
|
||||
input wire avmmclk,
|
||||
input wire avmmread,
|
||||
output wire [15:0] avmmreaddata,
|
||||
input wire avmmrstn,
|
||||
input wire avmmwrite,
|
||||
input wire [15:0] avmmwritedata,
|
||||
output wire blockselect,
|
||||
input wire clockinfrom8gpcs,
|
||||
input wire [43:0] datainfrompld,
|
||||
output wire [43:0] dataoutto8gpcs,
|
||||
input wire emsipenablediocsrrdydly,
|
||||
output wire [2:0] emsippcstxclkout,
|
||||
input wire [103:0] emsiptxin,
|
||||
input wire [12:0] emsiptxspecialin,
|
||||
output wire [15:0] emsiptxspecialout,
|
||||
input wire pcs8gemptytx,
|
||||
input wire pcs8gfulltx,
|
||||
output wire pcs8gphfifoursttx,
|
||||
output wire pcs8gpldtxclk,
|
||||
output wire pcs8gpolinvtx,
|
||||
output wire pcs8grddisabletx,
|
||||
output wire pcs8grevloopbk,
|
||||
output wire [4:0] pcs8gtxboundarysel,
|
||||
output wire [3:0] pcs8gtxdatavalid,
|
||||
output wire pcs8gtxurstpcs,
|
||||
output wire pcs8gwrenabletx,
|
||||
output wire pld8gemptytx,
|
||||
output wire pld8gfulltx,
|
||||
input wire pld8gphfifoursttxn,
|
||||
input wire pld8gpldtxclk,
|
||||
input wire pld8gpolinvtx,
|
||||
input wire pld8grddisabletx,
|
||||
input wire pld8grevloopbk,
|
||||
input wire [4:0] pld8gtxboundarysel,
|
||||
output wire pld8gtxclkout,
|
||||
input wire [3:0] pld8gtxdatavalid,
|
||||
input wire pld8gtxurstpcsn,
|
||||
input wire pld8gwrenabletx,
|
||||
input wire pmatxcmuplllock,
|
||||
output wire reset,
|
||||
input wire rstsel,
|
||||
input wire usrrstsel
|
||||
);
|
||||
import altera_xcvr_functions::*;
|
||||
|
||||
// is_8g_0ppm external parameter (no RBC)
|
||||
localparam rbc_all_is_8g_0ppm = "(false,true)";
|
||||
localparam rbc_any_is_8g_0ppm = "false";
|
||||
localparam fnl_is_8g_0ppm = (is_8g_0ppm == "<auto_any>" || is_8g_0ppm == "<auto_single>") ? rbc_any_is_8g_0ppm : is_8g_0ppm;
|
||||
|
||||
// pld_side_data_source external parameter (no RBC)
|
||||
localparam rbc_all_pld_side_data_source = "(hip,pld)";
|
||||
localparam rbc_any_pld_side_data_source = "pld";
|
||||
localparam fnl_pld_side_data_source = (pld_side_data_source == "<auto_any>" || pld_side_data_source == "<auto_single>") ? rbc_any_pld_side_data_source : pld_side_data_source;
|
||||
|
||||
// use_default_base_address external parameter (no RBC)
|
||||
localparam rbc_all_use_default_base_address = "(false,true)";
|
||||
localparam rbc_any_use_default_base_address = "true";
|
||||
localparam fnl_use_default_base_address = (use_default_base_address == "<auto_any>" || use_default_base_address == "<auto_single>") ? rbc_any_use_default_base_address : use_default_base_address;
|
||||
|
||||
// Validate input parameters against known values or RBC values
|
||||
initial begin
|
||||
//$display("is_8g_0ppm = orig: '%s', any:'%s', all:'%s', final: '%s'", is_8g_0ppm, rbc_any_is_8g_0ppm, rbc_all_is_8g_0ppm, fnl_is_8g_0ppm);
|
||||
if (!is_in_legal_set(is_8g_0ppm, rbc_all_is_8g_0ppm)) begin
|
||||
$display("Critical Warning: parameter 'is_8g_0ppm' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", is_8g_0ppm, rbc_all_is_8g_0ppm, fnl_is_8g_0ppm);
|
||||
end
|
||||
//$display("pld_side_data_source = orig: '%s', any:'%s', all:'%s', final: '%s'", pld_side_data_source, rbc_any_pld_side_data_source, rbc_all_pld_side_data_source, fnl_pld_side_data_source);
|
||||
if (!is_in_legal_set(pld_side_data_source, rbc_all_pld_side_data_source)) begin
|
||||
$display("Critical Warning: parameter 'pld_side_data_source' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", pld_side_data_source, rbc_all_pld_side_data_source, fnl_pld_side_data_source);
|
||||
end
|
||||
//$display("use_default_base_address = orig: '%s', any:'%s', all:'%s', final: '%s'", use_default_base_address, rbc_any_use_default_base_address, rbc_all_use_default_base_address, fnl_use_default_base_address);
|
||||
if (!is_in_legal_set(use_default_base_address, rbc_all_use_default_base_address)) begin
|
||||
$display("Critical Warning: parameter 'use_default_base_address' of instance '%m' has illegal value '%s' assigned to it. Valid parameter values are: '%s'. Using value '%s'", use_default_base_address, rbc_all_use_default_base_address, fnl_use_default_base_address);
|
||||
end
|
||||
end
|
||||
|
||||
arriav_hssi_tx_pld_pcs_interface #(
|
||||
.avmm_group_channel_index(avmm_group_channel_index),
|
||||
.is_8g_0ppm(fnl_is_8g_0ppm),
|
||||
.pld_side_data_source(fnl_pld_side_data_source),
|
||||
.use_default_base_address(fnl_use_default_base_address),
|
||||
.user_base_address(user_base_address)
|
||||
) wys (
|
||||
// ports
|
||||
.asynchdatain(asynchdatain),
|
||||
.avmmaddress(avmmaddress),
|
||||
.avmmbyteen(avmmbyteen),
|
||||
.avmmclk(avmmclk),
|
||||
.avmmread(avmmread),
|
||||
.avmmreaddata(avmmreaddata),
|
||||
.avmmrstn(avmmrstn),
|
||||
.avmmwrite(avmmwrite),
|
||||
.avmmwritedata(avmmwritedata),
|
||||
.blockselect(blockselect),
|
||||
.clockinfrom8gpcs(clockinfrom8gpcs),
|
||||
.datainfrompld(datainfrompld),
|
||||
.dataoutto8gpcs(dataoutto8gpcs),
|
||||
.emsipenablediocsrrdydly(emsipenablediocsrrdydly),
|
||||
.emsippcstxclkout(emsippcstxclkout),
|
||||
.emsiptxin(emsiptxin),
|
||||
.emsiptxspecialin(emsiptxspecialin),
|
||||
.emsiptxspecialout(emsiptxspecialout),
|
||||
.pcs8gemptytx(pcs8gemptytx),
|
||||
.pcs8gfulltx(pcs8gfulltx),
|
||||
.pcs8gphfifoursttx(pcs8gphfifoursttx),
|
||||
.pcs8gpldtxclk(pcs8gpldtxclk),
|
||||
.pcs8gpolinvtx(pcs8gpolinvtx),
|
||||
.pcs8grddisabletx(pcs8grddisabletx),
|
||||
.pcs8grevloopbk(pcs8grevloopbk),
|
||||
.pcs8gtxboundarysel(pcs8gtxboundarysel),
|
||||
.pcs8gtxdatavalid(pcs8gtxdatavalid),
|
||||
.pcs8gtxurstpcs(pcs8gtxurstpcs),
|
||||
.pcs8gwrenabletx(pcs8gwrenabletx),
|
||||
.pld8gemptytx(pld8gemptytx),
|
||||
.pld8gfulltx(pld8gfulltx),
|
||||
.pld8gphfifoursttxn(pld8gphfifoursttxn),
|
||||
.pld8gpldtxclk(pld8gpldtxclk),
|
||||
.pld8gpolinvtx(pld8gpolinvtx),
|
||||
.pld8grddisabletx(pld8grddisabletx),
|
||||
.pld8grevloopbk(pld8grevloopbk),
|
||||
.pld8gtxboundarysel(pld8gtxboundarysel),
|
||||
.pld8gtxclkout(pld8gtxclkout),
|
||||
.pld8gtxdatavalid(pld8gtxdatavalid),
|
||||
.pld8gtxurstpcsn(pld8gtxurstpcsn),
|
||||
.pld8gwrenabletx(pld8gwrenabletx),
|
||||
.pmatxcmuplllock(pmatxcmuplllock),
|
||||
.reset(reset),
|
||||
.rstsel(rstsel),
|
||||
.usrrstsel(usrrstsel)
|
||||
);
|
||||
endmodule
|
||||
1089
generic_ip/third_party_ip/xaui_phy_itf/src/xaui_phy_itf/av_pcs.sv
Normal file
1089
generic_ip/third_party_ip/xaui_phy_itf/src/xaui_phy_itf/av_pcs.sv
Normal file
File diff suppressed because it is too large
Load diff
2632
generic_ip/third_party_ip/xaui_phy_itf/src/xaui_phy_itf/av_pcs_ch.sv
Normal file
2632
generic_ip/third_party_ip/xaui_phy_itf/src/xaui_phy_itf/av_pcs_ch.sv
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,386 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
`timescale 1ps/1ps
|
||||
|
||||
module av_pma #(
|
||||
//PARAM_LIST_START
|
||||
parameter rx_enable = 1, // (1,0) Enable or disable reciever PMA
|
||||
parameter tx_enable = 1, // (1,0) Enable or disable transmitter PMA
|
||||
parameter bonded_lanes = 1, // Number of bonded lanes
|
||||
parameter bonding_master_ch = 0, // Indicates which channel is master
|
||||
parameter pma_bonding_master= "0", // (List i.e. "0,3,..."), Indicates which channels is master
|
||||
parameter bonding_master_only= "-1", // Indicates bonding_master_channel is MASTER_ONLY
|
||||
parameter channel_number = 0, //
|
||||
parameter plls = 1, // (1+) Number of high-speed serial clocks from TX plls (tx_ser_clk)
|
||||
parameter pll_sel = 0, // (0 - plls-1) // Which PLL clock to use
|
||||
parameter pma_prot_mode = "basic", // (basic,cpri,cpri_rx_tx,disabled_prot_mode,gige, pipe_g1,pipe_g2,srio_2p1,test,xaui)
|
||||
parameter pma_mode = 8, // (8,10,16,20,32,40,64,80) Serialization factor
|
||||
parameter base_data_rate = "1250000000 bps", // Base data rate for CGB
|
||||
parameter pma_data_rate = "1250000000 bps", // Serial data rate in bits-per-second
|
||||
parameter cdr_reconfig = 0, // 1-Enable CDR reconfiguration, 0-Disable CDR reconfiguration
|
||||
parameter cdr_reference_clock_frequency = "100 Mhz",
|
||||
parameter cdr_refclk_cnt = 1, // # of CDR reference clocks
|
||||
parameter cdr_refclk_sel = 0, // Initial CDR reference clock selection
|
||||
parameter deser_enable_bit_slip = "false",
|
||||
parameter auto_negotiation = "<auto_single>", // ("true","false") PCIe Auto-Negotiation (Gen1,2,3)
|
||||
parameter tx_clk_div = 1, // (1,2,4,8)
|
||||
parameter pcie_rst = "normal_reset",
|
||||
parameter fref_vco_bypass = "NORMAL_OPERATION",
|
||||
parameter sd_on = 16,
|
||||
parameter pdb_sd = "true",
|
||||
parameter pma_bonding_mode = "x1", // valid value "x1", "xN"
|
||||
parameter external_master_cgb = 0,
|
||||
// CvP IOCSR control - cvp_update
|
||||
parameter cvp_en_iocsr = "false" // valid values = "true", "false"
|
||||
//PARAM_LIST_END
|
||||
) (
|
||||
//PORT_LIST_START
|
||||
// TX/RX ports
|
||||
input wire calclk, // Calibration clock (to aux block)
|
||||
input wire [bonded_lanes - 1: 0] seriallpbken, // 1 = enable serial loopback
|
||||
input wire [bonded_lanes-1: 0] pciesw, // PCIe generation select
|
||||
|
||||
// RX ports
|
||||
input wire [bonded_lanes - 1 : 0] rx_rstn, // Active low digital reset for (deserializer, CDR, RX buf)
|
||||
input wire [bonded_lanes - 1 : 0] rx_crurstn, // CDR analog reset (active low)
|
||||
input wire [bonded_lanes - 1 : 0] rx_datain, // RX serial data input
|
||||
input wire [bonded_lanes - 1 : 0] rx_bslip, // PMA bitslip. Slips one clock cycle (2 UI of data)
|
||||
input wire [bonded_lanes*cdr_refclk_cnt-1:0] rx_cdr_ref_clk, // Reference clock for CDR
|
||||
input wire [bonded_lanes - 1 : 0] rx_ltr, // Force lock-to_reference clock
|
||||
input wire [bonded_lanes - 1 : 0] rx_ltd, // Force lock-to-data stream
|
||||
input wire [bonded_lanes - 1 : 0] rx_freqlock, // frequency lock detector input (external PPM detector)
|
||||
input wire [bonded_lanes - 1 : 0] rx_earlyeios, // Early electricle idle ordered sequence
|
||||
input wire [bonded_lanes - 1 : 0] rx_hardoccalen, // Enable Offset cancellation
|
||||
output wire [bonded_lanes - 1 : 0] rx_clkdivrx, // RX parallel clock output
|
||||
output wire [((pma_prot_mode == "pma direct") ? (bonded_lanes*80) : (bonded_lanes*20))-1: 0] rx_dataout, // RX parallel data output
|
||||
output wire [bonded_lanes - 1 : 0] rx_sd, // RX signal detect
|
||||
output wire [bonded_lanes - 1 : 0] rx_clklow, // RX low frequency recovered clock
|
||||
output wire [bonded_lanes - 1 : 0] rx_fref, // RX PFD reference clock (rx_cdr_refclk after divider)
|
||||
output wire [bonded_lanes - 1 : 0] rx_is_lockedtodata, // Indicates lock to incoming data rate
|
||||
output wire [bonded_lanes - 1 : 0] rx_is_lockedtoref, // Indicates lock to reference clock
|
||||
output wire [bonded_lanes - 1 : 0] out_pcs_signal_ok,
|
||||
output wire [bonded_lanes - 1 : 0] out_pcs_rx_pll_phase_lock_out,
|
||||
|
||||
// TX ports
|
||||
//input port for buf
|
||||
input wire [((pma_prot_mode == "pma direct") ? (bonded_lanes*80) : (bonded_lanes*20))-1: 0] tx_datain, // TX parallel data input
|
||||
input wire [bonded_lanes - 1 : 0] tx_txelecidl, // TX force electricle idle
|
||||
input wire tx_rxdetclk, // Clock for detection of downstream receiver (125MHz ?)
|
||||
input wire [bonded_lanes - 1 : 0] tx_txdetrx, // 1 = enable downstream receiver detection
|
||||
//output port for buf
|
||||
output wire [bonded_lanes - 1 : 0] tx_dataout, // TX serial data output
|
||||
output wire [bonded_lanes - 1 : 0] tx_rxdetectvalid, // Indicates corresponding tx_rxfound signal contains valid data
|
||||
output wire [bonded_lanes - 1 : 0] tx_rxfound, // Indicates downnstream receiver is detected (qualify with tx_rxdetectvalid)
|
||||
//input ports for ser
|
||||
input wire tx_rstn, // TODO - Examine resets
|
||||
//output ports for ser
|
||||
output wire [bonded_lanes - 1 : 0] tx_clkdivtx, // TX parallel clock output
|
||||
//input ports for cgb
|
||||
input wire [bonded_lanes*plls-1:0] tx_ser_clk, // High-speed serial clock(s) from PLL
|
||||
input wire tx_pcsrstn,
|
||||
input wire tx_fref,
|
||||
input wire [bonded_lanes*plls-1:0] tx_rstn_cgb_master,
|
||||
input wire [bonded_lanes - 1 : 0] tx_cpulsein,
|
||||
input wire [bonded_lanes - 1 : 0] tx_hclkin,
|
||||
input wire [bonded_lanes - 1 : 0] tx_lfclkin,
|
||||
input wire [bonded_lanes*3-1 : 0] tx_pclkin,
|
||||
//output ports for cgb
|
||||
output wire [bonded_lanes -1 : 0] tx_pcieswdone, // Inidicates PMA has accepted value on pciesw input.
|
||||
|
||||
// AVMM ports
|
||||
input wire [bonded_lanes-1:0 ] pma_avmmrstn, // one for each lane
|
||||
input wire [bonded_lanes-1:0 ] pma_avmmclk, // one for each lane
|
||||
input wire [bonded_lanes-1:0 ] pma_avmmwrite, // one for each lane
|
||||
input wire [bonded_lanes-1:0 ] pma_avmmread, // one for each lane
|
||||
input wire [(bonded_lanes*2)-1:0 ] pma_avmmbyteen, // two for each lane
|
||||
input wire [(bonded_lanes*11)-1:0 ] pma_avmmaddress, // 11 for each lane
|
||||
input wire [(bonded_lanes*16)-1:0 ] pma_avmmwritedata, // 16 for each lane
|
||||
|
||||
output wire [(bonded_lanes*16)-1:0 ] pma_avmmreaddata_tx_cgb, // TX AVMM CGB readdata (16 for each lane)
|
||||
output wire [(bonded_lanes*16)-1:0 ] pma_avmmreaddata_tx_ser, // TX AVMM SER readdata (16 for each lane)
|
||||
output wire [(bonded_lanes*16)-1:0 ] pma_avmmreaddata_tx_buf, // TX AVMM BUF readdata (16 for each lane)
|
||||
output wire [(bonded_lanes*16)-1:0 ] pma_avmmreaddata_rx_ser, // RX AVMM SER readdata (16 for each lane)
|
||||
output wire [(bonded_lanes*16)-1:0 ] pma_avmmreaddata_rx_buf, // RX AVMM BUF readdata (16 for each lane)
|
||||
output wire [(bonded_lanes*16)-1:0 ] pma_avmmreaddata_rx_cdr, // RX AVMM CDR readdata (16 for each lane)
|
||||
output wire [(bonded_lanes*16)-1:0 ] pma_avmmreaddata_rx_mux, // RX AVMM CDR MUX readdata (16 for each lane)
|
||||
output wire [bonded_lanes-1:0 ] pma_blockselect_tx_cgb, // TX AVMM CGB blockselect (1 for each lane)
|
||||
output wire [bonded_lanes-1:0 ] pma_blockselect_tx_ser, // TX AVMM SER blockselect (1 for each lane)
|
||||
output wire [bonded_lanes-1:0 ] pma_blockselect_tx_buf, // TX AVMM BUF blockselect (1 for each lane)
|
||||
output wire [bonded_lanes-1:0 ] pma_blockselect_rx_ser, // RX AVMM SER blockselect (1 for each lane)
|
||||
output wire [bonded_lanes-1:0 ] pma_blockselect_rx_buf, // RX AVMM BUF blockselect (1 for each lane)
|
||||
output wire [bonded_lanes-1:0 ] pma_blockselect_rx_cdr, // RX AVMM SER blockselect (1 for each lane)
|
||||
output wire [bonded_lanes-1:0 ] pma_blockselect_rx_mux, // RX AVMM BUF blockselect (1 for each lane)
|
||||
output wire [bonded_lanes-1:0 ] pll_aux_atb_comp_out // Voltage comparator output for DCD (1 for each lane)
|
||||
|
||||
//PORT_LIST_END
|
||||
);
|
||||
|
||||
import altera_xcvr_functions::*; // Useful functions (primarily for rule-checking)
|
||||
|
||||
localparam rbc_all_prot_mode = "(basic,cpri,cpri_rx_tx,disabled_prot_mode,gige,pipe_g1,pipe_g2,srio_2p1,test,xaui,pma direct)";
|
||||
localparam rbc_any_prot_mode = "basic";
|
||||
localparam fnl_prot_mode = (pma_prot_mode == "<auto_any>" || pma_prot_mode == "<auto_single>") ? rbc_any_prot_mode : pma_prot_mode;
|
||||
localparam pipe_mode = (fnl_prot_mode == "pipe_g1" || fnl_prot_mode == "pipe_g2") ? 1 : 0;
|
||||
|
||||
localparam rbc_all_auto_negotiation = (fnl_prot_mode == "pipe_g1" || fnl_prot_mode == "pipe_g2") ? "(true,false)" : "false";
|
||||
localparam rbc_any_auto_negotiation = "false";
|
||||
localparam fnl_auto_negotiation = (auto_negotiation == "<auto_any>" || auto_negotiation == "<auto_single>") ? rbc_any_auto_negotiation : auto_negotiation;
|
||||
|
||||
// Internal parameters
|
||||
localparam INT_DATA_RATE = str2hz(pma_data_rate); // TODO - may fail due to 32-bit param
|
||||
localparam INT_CDR_OUT_CLOCK_FREQ = INT_DATA_RATE / 2;
|
||||
localparam INT_CDR_OUT_CLOCK_FREQ_STR= hz2str(INT_CDR_OUT_CLOCK_FREQ);
|
||||
localparam pma_width = (pma_prot_mode == "pma direct") ? 80 : 20;
|
||||
|
||||
localparam FIR_COEFF_CTRL_SEL = (pipe_mode == 1)? "dynamic_ctl" : "ram_ctl";
|
||||
// Parameter legality checking
|
||||
initial begin
|
||||
if (!is_in_legal_set(pma_prot_mode, rbc_all_prot_mode)) begin
|
||||
$display("Critical Warning: pma_prot_mode value, '%s', not in legal set: '%s'", pma_prot_mode, rbc_all_prot_mode);
|
||||
end
|
||||
|
||||
if (!is_in_legal_set(auto_negotiation, rbc_all_auto_negotiation)) begin
|
||||
$display("Critical Warning: auto_negotiation value, '%s', not in legal set: '%s'", auto_negotiation, rbc_all_auto_negotiation);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
// Internal signals
|
||||
wire [bonded_lanes - 1: 0] loopback_data;
|
||||
wire [bonded_lanes -1: 0] int_pciesw; // PCIe generation select
|
||||
wire [bonded_lanes-1: 0] int_pcieswdone; // Inidicates PMA has accepted value on pciesw input.
|
||||
|
||||
wire [bonded_lanes - 1: 0] reverse_loopback_data_p;
|
||||
wire [bonded_lanes - 1: 0] reverse_loopback_data_n;
|
||||
wire [bonded_lanes - 1: 0] seriallpbken_n;
|
||||
|
||||
assign int_pciesw = (fnl_auto_negotiation == "true") ? pciesw : {bonded_lanes{1'b0}};
|
||||
assign tx_pcieswdone = (fnl_auto_negotiation == "true" || tx_enable == 0) ? int_pcieswdone : {bonded_lanes{1'b0}};
|
||||
|
||||
assign out_pcs_signal_ok = rx_is_lockedtodata;
|
||||
assign out_pcs_rx_pll_phase_lock_out = rx_is_lockedtodata;
|
||||
// We only drive seriallpbken in duplex mode.
|
||||
assign seriallpbken_n = ((rx_enable == 1) && (tx_enable == 1)) ? ~seriallpbken : {bonded_lanes{1'b1}};
|
||||
|
||||
|
||||
//*********************************************************************
|
||||
//************************ Receiver PMA *******************************
|
||||
generate if(rx_enable == 1) begin
|
||||
av_rx_pma #(
|
||||
.bonded_lanes (bonded_lanes ),
|
||||
.bonding_master_ch_num (pma_bonding_master ),
|
||||
.bonding_master_only (bonding_master_only ),
|
||||
.mode (pma_mode ),
|
||||
//.serial_loopback ("lpbkp_dis" ),
|
||||
.sdclk_enable ("true" ), // TODO Hard-code for now
|
||||
.channel_number (channel_number ),
|
||||
.deser_enable_bit_slip (deser_enable_bit_slip ),
|
||||
.auto_negotiation (fnl_auto_negotiation ),
|
||||
.cdr_refclk_sel (cdr_refclk_sel ),
|
||||
.cdr_reconfig (cdr_reconfig ),
|
||||
.cdr_reference_clock_frequency(cdr_reference_clock_frequency),
|
||||
.cdr_refclk_cnt (cdr_refclk_cnt ),
|
||||
.cdr_output_clock_frequency (INT_CDR_OUT_CLOCK_FREQ_STR ),
|
||||
.rxpll_pd_bw_ctrl ("300" ), // TODO Hard-code for now
|
||||
.sd_on (sd_on ),
|
||||
.pdb_sd (pdb_sd ),
|
||||
.pma_width (pma_width ),
|
||||
.pma_direct ((pma_prot_mode == "pma direct")? "true" : "false"),
|
||||
.cvp_en_iocsr (cvp_en_iocsr ) //Only PCIe CvP designs override this
|
||||
) av_rx_pma(
|
||||
.rstn (rx_rstn ),
|
||||
.crurstn (rx_crurstn ),
|
||||
|
||||
.calclk ({bonded_lanes{calclk}} ),
|
||||
.datain (rx_datain ),
|
||||
.seriallpbkin (loopback_data ),
|
||||
.seriallpbken (seriallpbken_n ),
|
||||
.bslip (rx_bslip ),
|
||||
//.adaptcapture (rx_adaptcapture ),
|
||||
//.adcestandby (rx_adcestandby ),
|
||||
.hardoccalen (rx_hardoccalen ),
|
||||
//.eyemonitor (rx_eyemonitor ),
|
||||
//.adaptdone (rx_adaptdone ),
|
||||
//.hardoccaldone (rx_hardoccaldone ),
|
||||
|
||||
.cdr_ref_clk (rx_cdr_ref_clk ),
|
||||
|
||||
.pciesw (int_pciesw ),
|
||||
|
||||
.ltr (rx_ltr ),
|
||||
.ltd (rx_ltd ),
|
||||
.freqlock (rx_freqlock ),
|
||||
|
||||
.earlyeios (rx_earlyeios ),
|
||||
|
||||
.clkdivrx (rx_clkdivrx ),
|
||||
.dout (rx_dataout ),
|
||||
.sd (rx_sd ),
|
||||
|
||||
.clklow (rx_clklow ),
|
||||
.fref (rx_fref ),
|
||||
|
||||
.rx_is_lockedtodata (rx_is_lockedtodata ),
|
||||
.rx_is_lockedtoref (rx_is_lockedtoref ),
|
||||
|
||||
.avmmrstn (pma_avmmrstn ),
|
||||
.avmmclk (pma_avmmclk ),
|
||||
.avmmwrite (pma_avmmwrite ),
|
||||
.avmmread (pma_avmmread ),
|
||||
.avmmbyteen (pma_avmmbyteen ),
|
||||
.avmmaddress (pma_avmmaddress ),
|
||||
.avmmwritedata (pma_avmmwritedata ),
|
||||
.avmmreaddata_ser (pma_avmmreaddata_rx_ser), // SER readdata
|
||||
.avmmreaddata_buf (pma_avmmreaddata_rx_buf), // BUF readdata
|
||||
.avmmreaddata_cdr (pma_avmmreaddata_rx_cdr), // CDR readdata
|
||||
.avmmreaddata_mux (pma_avmmreaddata_rx_mux), // CDR MUX readdata
|
||||
.blockselect_ser (pma_blockselect_rx_ser ), // SER blockselect
|
||||
.blockselect_buf (pma_blockselect_rx_buf ), // BUF blockselect
|
||||
.blockselect_cdr (pma_blockselect_rx_cdr ), // CDR blockselect
|
||||
.blockselect_mux (pma_blockselect_rx_mux ), // CDR MUX blockselect
|
||||
|
||||
.rdlpbkp (reverse_loopback_data_p)
|
||||
//.rdlpbkn (reverse_loopback_data_n)
|
||||
|
||||
);
|
||||
|
||||
end else begin
|
||||
// Default unused outputs
|
||||
assign rx_clkdivrx = {bonded_lanes{1'b0}};
|
||||
assign rx_dataout = {(bonded_lanes*pma_width){1'b0}};
|
||||
assign rx_sd = {bonded_lanes{1'b0}};
|
||||
assign rx_clklow = {bonded_lanes{1'b0}};
|
||||
assign rx_fref = {bonded_lanes{1'b0}};
|
||||
assign rx_is_lockedtodata = {bonded_lanes{1'b0}};
|
||||
assign rx_is_lockedtoref = {bonded_lanes{1'b0}};
|
||||
//assign rx_adaptdone = {bonded_lanes{1'b0}};
|
||||
//assign rx_hardoccaldone = {bonded_lanes{1'b0}};
|
||||
|
||||
assign pma_avmmreaddata_rx_ser = {bonded_lanes*16{1'b0}};
|
||||
assign pma_avmmreaddata_rx_buf = {bonded_lanes*16{1'b0}};
|
||||
assign pma_avmmreaddata_rx_cdr = {bonded_lanes*16{1'b0}};
|
||||
assign pma_avmmreaddata_rx_mux = {bonded_lanes*16{1'b0}};
|
||||
assign pma_blockselect_rx_ser = {bonded_lanes{1'b0}};
|
||||
assign pma_blockselect_rx_buf = {bonded_lanes{1'b0}};
|
||||
assign pma_blockselect_rx_cdr = {bonded_lanes{1'b0}};
|
||||
assign pma_blockselect_rx_mux = {bonded_lanes{1'b0}};
|
||||
assign reverse_loopback_data_p = {bonded_lanes{1'b0}};
|
||||
end
|
||||
endgenerate
|
||||
//********************** End Receiver PMA *****************************
|
||||
//*********************************************************************
|
||||
|
||||
|
||||
//*********************************************************************
|
||||
//********************** Transmitter PMA ******************************
|
||||
generate if(tx_enable == 1) begin
|
||||
av_tx_pma #(
|
||||
.bonded_lanes (bonded_lanes ),
|
||||
.bonding_master_ch_num (pma_bonding_master ),
|
||||
.bonding_master_only (bonding_master_only ),
|
||||
.base_data_rate (base_data_rate ),
|
||||
.data_rate (pma_data_rate ), // TODO
|
||||
.mode (pma_mode ),
|
||||
.plls (plls ),
|
||||
.pll_sel (pll_sel ),
|
||||
.channel_number (channel_number ),
|
||||
.ser_loopback ("false" ),
|
||||
.auto_negotiation (fnl_auto_negotiation ),
|
||||
.ht_delay_sel ("false" ),
|
||||
.rx_det_pdb ("false" ),
|
||||
.tx_clk_div (tx_clk_div ),
|
||||
.pcie_rst (pcie_rst ),
|
||||
.fref_vco_bypass (fref_vco_bypass ),
|
||||
.pma_width (pma_width ),
|
||||
.pma_bonding_mode (pma_bonding_mode ),
|
||||
.fir_coeff_ctrl_sel (FIR_COEFF_CTRL_SEL ),
|
||||
.pma_direct ((pma_prot_mode == "pma direct")? "true" : "false"),
|
||||
.external_master_cgb (external_master_cgb )
|
||||
) av_tx_pma(
|
||||
//input port for aux
|
||||
.calclk ({bonded_lanes{calclk}} ),
|
||||
//input port for buf
|
||||
.datain (tx_datain ),
|
||||
.txelecidl (tx_txelecidl ),
|
||||
.rxdetclk (tx_rxdetclk ),
|
||||
.txdetrx (tx_txdetrx ),
|
||||
|
||||
//output port for buf
|
||||
.dataout (tx_dataout ),
|
||||
.rxdetectvalid (tx_rxdetectvalid ),
|
||||
.rxfound (tx_rxfound ),
|
||||
|
||||
//input ports for ser
|
||||
.rstn (tx_rstn ),
|
||||
.seriallpbken (seriallpbken_n ),
|
||||
|
||||
//output ports for ser
|
||||
.clkdivtx (tx_clkdivtx ),
|
||||
.seriallpbkout (loopback_data ),
|
||||
|
||||
//input ports for cgb
|
||||
.clk (tx_ser_clk ),
|
||||
.pcsrstn (tx_pcsrstn ),
|
||||
.fref (tx_fref ),
|
||||
.rstn_cgb_master (tx_rstn_cgb_master ),
|
||||
.pciesw (int_pciesw[bonding_master_ch]),
|
||||
.cpulsein (tx_cpulsein ),
|
||||
.hclkin (tx_hclkin ),
|
||||
.lfclkin (tx_lfclkin ),
|
||||
.pclkin (tx_pclkin ),
|
||||
|
||||
//output ports for cgb
|
||||
.pcieswdone (int_pcieswdone ),
|
||||
|
||||
.avmmrstn (pma_avmmrstn ),
|
||||
.avmmclk (pma_avmmclk ),
|
||||
.avmmwrite (pma_avmmwrite ),
|
||||
.avmmread (pma_avmmread ),
|
||||
.avmmbyteen (pma_avmmbyteen ),
|
||||
.avmmaddress (pma_avmmaddress ),
|
||||
.avmmwritedata (pma_avmmwritedata ),
|
||||
.avmmreaddata_cgb (pma_avmmreaddata_tx_cgb), // CGB readdata
|
||||
.avmmreaddata_ser (pma_avmmreaddata_tx_ser), // SER readdata
|
||||
.avmmreaddata_buf (pma_avmmreaddata_tx_buf), // BUF readdata
|
||||
.blockselect_cgb (pma_blockselect_tx_cgb ), // CGB blockselect
|
||||
.blockselect_ser (pma_blockselect_tx_ser ), // SER blockselect
|
||||
.blockselect_buf (pma_blockselect_tx_buf ), // BUF blockselect
|
||||
.atb_comp_out (pll_aux_atb_comp_out ), // pll aux voltage comparator output
|
||||
|
||||
.vrlpbkp (reverse_loopback_data_p),
|
||||
.vrlpbkn ({bonded_lanes{1'b0}})
|
||||
);
|
||||
|
||||
end else begin
|
||||
// Default the outputs
|
||||
assign tx_dataout = {bonded_lanes{1'b0}};
|
||||
assign tx_rxdetectvalid = {bonded_lanes{1'b0}};
|
||||
assign tx_rxfound = {bonded_lanes{1'b0}};
|
||||
assign tx_clkdivtx = {bonded_lanes{1'b0}};
|
||||
assign int_pcieswdone = {bonded_lanes{1'b0}};
|
||||
assign pma_avmmreaddata_tx_cgb = {bonded_lanes*16{1'b0}};
|
||||
assign pma_avmmreaddata_tx_ser = {bonded_lanes*16{1'b0}};
|
||||
assign pma_avmmreaddata_tx_buf = {bonded_lanes*16{1'b0}};
|
||||
assign pma_blockselect_tx_cgb = {bonded_lanes{1'b0}};
|
||||
assign pma_blockselect_tx_ser = {bonded_lanes{1'b0}};
|
||||
assign pma_blockselect_tx_buf = {bonded_lanes{1'b0}};
|
||||
assign pll_aux_atb_comp_out = {bonded_lanes{1'b0}};
|
||||
assign loopback_data = {bonded_lanes{1'b0}};
|
||||
end
|
||||
endgenerate
|
||||
//******************** End Transmitter PMA ****************************
|
||||
//*********************************************************************
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
//
|
||||
// Transceiver native reconfig adapter for Stratix V & derivatives.
|
||||
// Translates from native reconfig wire bundles to separate Av reconfig and testbus signals
|
||||
//
|
||||
// This direction for bundle to separate buses inside the sv_xcvr_protocol_native block
|
||||
//
|
||||
// $Header$
|
||||
//
|
||||
|
||||
`timescale 1 ns / 1 ns
|
||||
|
||||
module av_reconfig_bundle_to_basic #(
|
||||
parameter native_ifs = 1 // number of native reconfig interfaces
|
||||
) (
|
||||
// bundled reconfig buses
|
||||
output wire [native_ifs*altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_TO_XCVR -1:0] reconfig_to_xcvr, // all inputs from reconfig block to native xcvr reconfig ports
|
||||
input wire [native_ifs*altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_FROM_XCVR-1:0] reconfig_from_xcvr,// all input s from native xcvr reconfig ports to reconfig block
|
||||
|
||||
// native reconfig sources
|
||||
output wire [native_ifs*16 -1:0] native_reconfig_readdata, // Avalon DPRIO readdata
|
||||
output wire [native_ifs*3*8-1:0] pif_testbus, // testbus from native reconfig, for all physical interfaces
|
||||
output wire pif_atbout, // Voltage comparator output for DCD (1 for each lane)
|
||||
|
||||
// native reconfig sinks
|
||||
input wire [native_ifs*1 -1:0] native_reconfig_clk,
|
||||
input wire [native_ifs*1 -1:0] native_reconfig_reset,
|
||||
input wire [native_ifs*16 -1:0] native_reconfig_writedata, // Avalon DPRIO writedata
|
||||
input wire [native_ifs*12 -1:0] native_reconfig_address, // Avalon DPRIO address
|
||||
input wire [native_ifs*1 -1:0] native_reconfig_write, // Avalon DPRIO write
|
||||
input wire [native_ifs*1 -1:0] native_reconfig_read, // Avalon DPRIO read
|
||||
input wire [native_ifs*12 -1:0] pif_testbus_sel, // 4 bits per physical channel
|
||||
input wire [native_ifs*1 -1:0] pif_interface_sel,
|
||||
input wire [native_ifs*1 -1:0] pif_ser_shift_load,
|
||||
input wire oc_cal_busy,
|
||||
input wire tx_cal_busy,
|
||||
input wire rx_cal_busy
|
||||
);
|
||||
|
||||
localparam w_bundle_to_xcvr = altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_TO_XCVR;
|
||||
localparam w_bundle_from_xcvr= altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_FROM_XCVR;
|
||||
|
||||
wire [native_ifs*1 -1:0] oc_cal_busy_bus;
|
||||
wire [native_ifs*1 -1:0] tx_cal_busy_bus;
|
||||
wire [native_ifs*1 -1:0] rx_cal_busy_bus;
|
||||
tri0 [native_ifs*1 -1:0] pif_atbout_bus;
|
||||
|
||||
assign oc_cal_busy_bus = {native_ifs{oc_cal_busy}};
|
||||
assign tx_cal_busy_bus = {native_ifs{tx_cal_busy}};
|
||||
assign rx_cal_busy_bus = {native_ifs{rx_cal_busy}};
|
||||
|
||||
assign pif_atbout = |pif_atbout_bus;
|
||||
|
||||
genvar pi;
|
||||
generate
|
||||
for (pi=0; pi<native_ifs; ++pi) begin: pif
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// Any changes to the bit mappings here must also be made in:
|
||||
// - sv_reconfig_bundle_to_xcvr
|
||||
// - sv_reconfig_bundle_to_ip
|
||||
// - sv_reconfig_bundle_merger
|
||||
// native reconfig sinks
|
||||
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr +: 1] = native_reconfig_clk [pi*1 +: 1];
|
||||
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+1 +: 1] = native_reconfig_reset [pi*1 +: 1];
|
||||
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+2 +: 16] = native_reconfig_writedata [pi*16 +: 16];
|
||||
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+18 +: 1] = native_reconfig_write [pi*1 +: 1];
|
||||
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+19 +: 1] = native_reconfig_read [pi*1 +: 1];
|
||||
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+20 +: 12] = native_reconfig_address [pi*12 +: 12];
|
||||
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+32 +: 12] = pif_testbus_sel [pi*12 +: 12];
|
||||
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+44 +: 1] = pif_interface_sel [pi*1 +: 1];
|
||||
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+45 +: 1] = pif_ser_shift_load [pi*1 +: 1];
|
||||
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+46 +: 1] = oc_cal_busy_bus [pi*1 +: 1];
|
||||
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+47 +: 1] = tx_cal_busy_bus [pi*1 +: 1];
|
||||
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+48 +: 1] = rx_cal_busy_bus [pi*1 +: 1];
|
||||
assign reconfig_to_xcvr[pi*w_bundle_to_xcvr+49 +: 21] = {21{1'b0}}; // reserved
|
||||
|
||||
// native reconfig sources
|
||||
assign native_reconfig_readdata[pi*16 +: 16] = reconfig_from_xcvr[pi*w_bundle_from_xcvr +: 16];
|
||||
assign pif_testbus [pi*24 +: 24] = reconfig_from_xcvr[pi*w_bundle_from_xcvr+16 +: 24];
|
||||
assign pif_atbout_bus [pi*1 +: 1] = reconfig_from_xcvr[pi*w_bundle_from_xcvr+40 +: 1];
|
||||
end
|
||||
endgenerate
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
// (C) 2001-2018 Intel Corporation. All rights reserved.
|
||||
// Your use of Intel Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files from any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Intel Program License Subscription
|
||||
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Intel and sold by
|
||||
// Intel or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
//
|
||||
// Transceiver native reconfig adapter for Stratix V & derivatives.
|
||||
// Translates from native reconfig wire bundles to separate Av reconfig and testbus signals
|
||||
//
|
||||
// This direction for bundle to separate buses inside the sv_xcvr_reconfig_basic block
|
||||
//
|
||||
// $Header$
|
||||
//
|
||||
|
||||
`timescale 1 ns / 1 ns
|
||||
|
||||
// altera message_off 10720
|
||||
// altera message_off 13024 21074
|
||||
|
||||
module av_reconfig_bundle_to_xcvr #(
|
||||
parameter native_ifs = 1 // number of native reconfig interfaces
|
||||
) (
|
||||
// bundled reconfig buses
|
||||
input wire [native_ifs*altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_TO_XCVR -1:0] reconfig_to_xcvr, // all inputs from reconfig block to native xcvr reconfig ports
|
||||
output wire [native_ifs*altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_FROM_XCVR-1:0] reconfig_from_xcvr, // all outputs from native xcvr reconfig ports to reconfig block
|
||||
|
||||
// native reconfig sources
|
||||
input wire [native_ifs*16 -1:0] native_reconfig_readdata, // Avalon DPRIO readdata
|
||||
input wire [native_ifs*3*8-1:0] pif_testbus, // testbus from native reconfig, for all physical interfaces
|
||||
|
||||
// Voltage comparator output for DCD
|
||||
input wire pif_atbcompout,
|
||||
|
||||
// native reconfig sinks
|
||||
output wire [native_ifs*1 -1:0] native_reconfig_clk,
|
||||
output wire [native_ifs*1 -1:0] native_reconfig_reset,
|
||||
output wire [native_ifs*16 -1:0] native_reconfig_writedata, // Avalon DPRIO writedata
|
||||
output wire [native_ifs*12 -1:0] native_reconfig_address, // Avalon DPRIO address
|
||||
output wire [native_ifs*1 -1:0] native_reconfig_write, // Avalon DPRIO write
|
||||
output wire [native_ifs*1 -1:0] native_reconfig_read, // Avalon DPRIO read
|
||||
output wire [native_ifs*12 -1:0] pif_testbus_sel, // 4 bits per physical channel
|
||||
output wire [native_ifs*1 -1:0] pif_interface_sel,
|
||||
output wire [native_ifs*1 -1:0] pif_ser_shift_load,
|
||||
output wire tx_cal_busy,
|
||||
output wire rx_cal_busy
|
||||
);
|
||||
|
||||
localparam w_bundle_to_xcvr = altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_TO_XCVR;
|
||||
localparam w_bundle_from_xcvr= altera_xcvr_functions::W_S5_RECONFIG_BUNDLE_FROM_XCVR;
|
||||
|
||||
// tri0 [native_ifs*1 -1:0] oc_cal_busy_bus;
|
||||
tri0 [native_ifs*1 -1:0] tx_cal_busy_bus;
|
||||
tri0 [native_ifs*1 -1:0] rx_cal_busy_bus;
|
||||
tri0 [native_ifs*1 -1:0] pif_atbcompout_bus;
|
||||
|
||||
// assign oc_cal_busy = |oc_cal_busy_bus;
|
||||
//NOTE: This bus is just a fanout from a single source in the Reconfig controller. This OR gate should optimize away.
|
||||
assign tx_cal_busy = |tx_cal_busy_bus;
|
||||
assign rx_cal_busy = |rx_cal_busy_bus;
|
||||
|
||||
assign pif_atbcompout_bus = {native_ifs{pif_atbcompout}};
|
||||
|
||||
genvar pi;
|
||||
generate
|
||||
for (pi=0; pi<native_ifs; ++pi) begin: pif
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// Any changes to the bit mappings here must also be made in:
|
||||
// - sv_reconfig_bundle_to_basic
|
||||
// - sv_reconfig_bundle_to_ip
|
||||
// - sv_reconfig_bundle_merger
|
||||
// native reconfig sinks
|
||||
assign native_reconfig_clk [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr +: 1];
|
||||
assign native_reconfig_reset [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+1 +: 1];
|
||||
assign native_reconfig_writedata[pi*16 +: 16] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+2 +: 16];
|
||||
assign native_reconfig_write [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+18 +: 1];
|
||||
assign native_reconfig_read [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+19 +: 1];
|
||||
assign native_reconfig_address [pi*12 +: 12] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+20 +: 12];
|
||||
assign pif_testbus_sel [pi*12 +: 12] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+32 +: 12];
|
||||
assign pif_interface_sel [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+44 +: 1];
|
||||
assign pif_ser_shift_load [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+45 +: 1];
|
||||
// assign oc_cal_busy_bus [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+46 +: 1];
|
||||
assign tx_cal_busy_bus [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+47 +: 1];
|
||||
assign rx_cal_busy_bus [pi*1 +: 1] = reconfig_to_xcvr[pi*w_bundle_to_xcvr+48 +: 1];
|
||||
|
||||
|
||||
// native reconfig sources
|
||||
assign reconfig_from_xcvr[pi*w_bundle_from_xcvr +: 16] = native_reconfig_readdata[pi*16 +: 16];
|
||||
assign reconfig_from_xcvr[pi*w_bundle_from_xcvr+16 +: 24] = pif_testbus [pi*24 +: 24];
|
||||
assign reconfig_from_xcvr[pi*w_bundle_from_xcvr+40 +: 1] = pif_atbcompout_bus [pi*1 +: 1];
|
||||
assign reconfig_from_xcvr[pi*w_bundle_from_xcvr+41 +: 5] = {5{1'b0}}; // reserved
|
||||
end
|
||||
endgenerate
|
||||
endmodule
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue