use work.trb_net_gbe_components.all;
use work.med_sync_define_RS.all;
+-- short documentation:
+-- LINK_MODE: set to c_IS_SLAVE for uplink port, c_IS_MASTER for downlink port,
+-- and c_IS_UNUSED for port not being used.
+-- Signals for internal port are automatically generated in case of c_IS_SLAVE.
+-- INCLUDE_DLM: '1' inserts Trudy and Eve, and activates the control signals.
+-- '0' is "normal" operation.
+
+-- In case no Slave Port is inside the media interface, local port signals are set to zero.
+-- If a Slave Port is inside, the local port is connected there.
+
entity gbe_med_fifo is
generic(
- LINKS_ACTIVE : std_logic_vector(3 downto 0) := "1111";
- SNIFFER_PORT : integer range 0 to 3 := 0;
+ LINK_MODE : int_array_t(3 downto 0) := (c_IS_UNUSED, c_IS_UNUSED, c_IS_UNUSED, c_IS_UNUSED);
INCLUDE_DLM : int_array_t(3 downto 0) := (1, 1, 1, 1)
);
port(
SD_PRSNT_N_IN : in std_logic_vector(3 downto 0) := (others => '1');
SD_LOS_IN : in std_logic_vector(3 downto 0) := (others => '1');
SD_TXDIS_OUT : out std_logic_vector(3 downto 0);
- -- internal sniffer port
+ -- internal port
MAC_RX_DATA_OUT : out std_logic_vector(7 downto 0);
MAC_RX_WRITE_OUT : out std_logic;
MAC_RX_EOF_OUT : out std_logic;
PCS_AN_READY_OUT : out std_logic_vector(3 downto 0); -- for internal SCTRL
LINK_ACTIVE_OUT : out std_logic_vector(3 downto 0); -- for internal SCTRL
TICK_MS_IN : in std_logic;
+ -- syntonous operation
+-- MASTER_CLK_IN : in std_logic;
-- DLM
DLM_INJECT_IN : in std_logic_vector(3 downto 0) := (others => '0');
DLM_DATA_IN : in std_logic_vector(4 * 8 - 1 downto 0) := (others => '0');
-- attribute HGROUP of gbe_med_fifo_arch : architecture is "gbe_med_fifo_group";
-- attribute BBOX of ddmtd_arch : architecture is "2,2";
+ signal quad_mode : integer range 0 to 100;
+
begin
+-- constants used as reminder
+-- unused = 0, master = 1, slave = 8
+
+-------------------------------------------------
+-- check settings of media interface
+-------------------------------------------------
+ quad_mode <= LINK_MODE(3) + LINK_MODE(2) + LINK_MODE(1) + LINK_MODE(0);
+
+ -- reject illegal combinations
+ assert not (quad_mode = 0) report "Error: QUAD not used" severity error;
+ assert not (quad_mode > 11) report "Error: multi slave QUAD detected" severity error;
+
+ -- notify user on status
+ assert not ((quad_mode >= 1) and (quad_mode <= 4)) report "Note: QUAD with only master ports detected" severity note;
+ assert not (quad_mode = 8) report "Note: QUAD with one slave port detected" severity note;
+ assert not ((quad_mode >= 9) and (quad_mode <= 11)) report "Note: mixed master/slave QUAD detected" severity note;
+
+-------------------------------------------------
+-- SerDes quad
+-------------------------------------------------
gbe_serdes: entity serdes_gbe_4ch_ds
port map(
-- CH0 --
);
TX_PLOL_LOL_OUT <= tx_plol_lol;
+
+ -- in case we have no uplink port...
+ NO_LOCAL_GEN: if (quad_mode < 8) generate
+ MAC_RX_DATA_OUT <= (others => '0');
+ MAC_RX_WRITE_OUT <= '0';
+ MAC_RX_EOF_OUT <= '0';
+ MAC_RX_ERROR_OUT <= '0';
+ end generate NO_LOCAL_GEN;
CHANNEL_GEN : for i in 0 to 3 generate
- CHANNEL_ACTIVE_GEN : if LINKS_ACTIVE(i) = '1' generate
+ CHANNEL_ACTIVE_GEN : if ((LINK_MODE(i) = c_IS_SLAVE) or (LINK_MODE(i) = c_IS_MASTER)) generate
THE_TX_PARSER: entity parser
port map(
DEBUG_OUT((i + 1) * 32 - 5) <= '0';
DEBUG_OUT((i + 1) * 32 - 6) <= '0';
DEBUG_OUT((i + 1) * 32 - 7) <= '0';
- DEBUG_OUT((i + 1) * 32 - 8) <= '0';
- DEBUG_OUT((i + 1) * 32 - 9) <= '0';
- DEBUG_OUT((i + 1) * 32 - 10) <= '0';
- DEBUG_OUT((i + 1) * 32 - 11) <= '0';
- DEBUG_OUT((i + 1) * 32 - 12) <= '0';
+ DEBUG_OUT((i + 1) * 32 - 8) <= link_active(i);
+ DEBUG_OUT((i + 1) * 32 - 9) <= mac_ready_conf(i);
+ DEBUG_OUT((i + 1) * 32 - 10) <= mac_reconf(i);
+ DEBUG_OUT((i + 1) * 32 - 11) <= an_complete(i);
+ DEBUG_OUT((i + 1) * 32 - 12) <= mr_page_rx(i);
DEBUG_OUT((i + 1) * 32 - 13) <= mr_restart_an(i);
DEBUG_OUT((i + 1) * 32 - 14) <= cfg_rx_int(i);
DEBUG_OUT((i + 1) * 32 - 15) <= idle_rx_int(i);
STATUS_OUT(i * 8 + 1) <= link_rx_ready(i); -- SerDes Rx channel operational
STATUS_OUT(i * 8 + 0) <= TX_LINK_READY_IN; -- SerDes Tx channel operational
+ INT_PORT_GEN: if (LINK_MODE(i) = c_IS_SLAVE) generate
+ MAC_RX_DATA_OUT <= mac_rx_data((i + 1) * 8 - 1 downto i * 8);
+ MAC_RX_WRITE_OUT <= mac_rx_wr(i);
+ MAC_RX_EOF_OUT <= mac_rx_eof(i);
+ MAC_RX_ERROR_OUT <= mac_rx_err(i);
+ end generate INT_PORT_GEN;
+
end generate CHANNEL_ACTIVE_GEN;
- CHANNEL_INACTIVE_GEN : if LINKS_ACTIVE(i) = '0' generate
+ CHANNEL_INACTIVE_GEN : if (LINK_MODE(i) = c_IS_UNUSED) generate
DEBUG_OUT((i + 1) * 32 - 1 downto i * 32) <= (others => '0');
end generate CHANNEL_INACTIVE_GEN;
end generate CHANNEL_GEN;
-
- MAC_RX_DATA_OUT <= mac_rx_data((SNIFFER_PORT + 1) * 8 - 1 downto SNIFFER_PORT * 8);
- MAC_RX_WRITE_OUT <= mac_rx_wr(SNIFFER_PORT);
- MAC_RX_EOF_OUT <= mac_rx_eof(SNIFFER_PORT);
- MAC_RX_ERROR_OUT <= mac_rx_err(SNIFFER_PORT);
-
THE_LED_TIMER_PROC: process( CLK_125 )
begin