entity trb_net16_med_ecp_sfp is
port(
CLK : in std_logic;
- RESET : in std_logic;
+ RESET : in std_logic; --must be applied for at least 2 clock cycles
CLK_EN : in std_logic;
--Internal Connection
MED_DATA_IN : in std_logic_vector(c_DATA_WIDTH-1 downto 0);
--link start-up state machine
----------------------
- medium_states : process(ff_rxhalfclk)
+ medium_states : process(ff_rxhalfclk, RESET)
begin
- if rising_edge(ff_rxhalfclk) then
- if RESET = '0' then
- counter <= counter + 1;
- swap_bytes <= '0';
- tx_allow <= '0';
- rx_allow <= '0';
- end if;
- swap_bytes <= swap_bytes;
+ if RESET = '1' then
+ swap_bytes <= '0';
+ tx_allow <= '0';
+ rx_allow <= '0';
+ state <= start;
+ MED_ERROR_OUT <= ERROR_NC;
+ counter <= (others => '0');
+ elsif rising_edge(ff_rxhalfclk) then
+ counter <= counter + 1;
case state is
when start =>
if counter(7 downto 0) = x"FF" then