From 2e3c72f15588b955bfa1e8547be11dd4ad96e8ad Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Fri, 15 Dec 2017 16:44:25 +0100 Subject: [PATCH] Revert "gk: updated link status" This reverts commit 1d08a812cf5b8f4ef87b8af7b7381314060030d3. --- gbe_trb/base/trb_net16_gbe_main_control.vhd | 93 ++++++++++----------- 1 file changed, 42 insertions(+), 51 deletions(-) diff --git a/gbe_trb/base/trb_net16_gbe_main_control.vhd b/gbe_trb/base/trb_net16_gbe_main_control.vhd index 0537eab..122cc31 100644 --- a/gbe_trb/base/trb_net16_gbe_main_control.vhd +++ b/gbe_trb/base/trb_net16_gbe_main_control.vhd @@ -201,7 +201,7 @@ architecture trb_net16_gbe_main_control of trb_net16_gbe_main_control is signal tsm_hwrite_n : std_logic; signal tsm_hread_n : std_logic; - type link_states is (INACTIVE, ACTIVE, ENABLE_MAC, TIMEOUT, FINALIZE, WAIT_FOR_BOOT); --, GET_ADDRESS); + type link_states is (INACTIVE, ACTIVE, ENABLE_MAC, TIMEOUT, FINALIZE, WAIT_FOR_BOOT, GET_ADDRESS); signal link_current_state, link_next_state : link_states; attribute syn_encoding of link_current_state : signal is "onehot"; @@ -425,18 +425,13 @@ begin if (RESET = '1') then disable_redirect <= '0'; elsif (redirect_current_state = CHECK_TYPE) then - if (link_current_state = ACTIVE) then - disable_redirect <= '0'; - else - disable_redirect <= '1'; + if (link_current_state /= ACTIVE and link_current_state /= GET_ADDRESS) then + disable_redirect <= '1'; + elsif (link_current_state = GET_ADDRESS and RC_FRAME_PROTO_IN /= "10") then + disable_redirect <= '1'; + else + disable_redirect <= '0'; end if; --- if (link_current_state /= ACTIVE and link_current_state /= GET_ADDRESS) then --- disable_redirect <= '1'; --- elsif (link_current_state = GET_ADDRESS and RC_FRAME_PROTO_IN /= "10") then --- disable_redirect <= '1'; --- else --- disable_redirect <= '0'; --- end if; else disable_redirect <= disable_redirect; end if; @@ -481,8 +476,8 @@ begin redirect_state <= x"2"; if (link_current_state = ACTIVE) then redirect_next_state <= CHECK_BUSY; --- elsif (link_current_state = GET_ADDRESS and RC_FRAME_PROTO_IN = "10") then --- redirect_next_state <= CHECK_BUSY; + elsif (link_current_state = GET_ADDRESS and RC_FRAME_PROTO_IN = "10") then + redirect_next_state <= CHECK_BUSY; else redirect_next_state <= DROP; end if; @@ -659,35 +654,31 @@ begin lsm_impl_gen : if DO_SIMULATION = 0 generate LINK_STATE_MACHINE_PROC : process(MC_RESET_LINK_IN, CLK) begin - --if MC_RESET_LINK_IN = '1' then - -- link_current_state <= INACTIVE; - --elsif rising_edge(CLK) then - if rising_edge(CLK) then - if (RESET = '1' or MC_RESET_LINK_IN = '1') then - link_current_state <= INACTIVE; - else - if RX_PATH_ENABLE = 1 then - link_current_state <= link_next_state; - else - link_current_state <= INACTIVE; - end if; - end if; + if MC_RESET_LINK_IN = '1' then + link_current_state <= INACTIVE; + elsif rising_edge(CLK) then + if RX_PATH_ENABLE = 1 then + link_current_state <= link_next_state; + else + link_current_state <= INACTIVE; + end if; + end if; end process; end generate lsm_impl_gen; lsm_sim_gen : if DO_SIMULATION = 1 generate --- LINK_STATE_MACHINE_PROC : process(MC_RESET_LINK_IN, CLK) --- begin --- if MC_RESET_LINK_IN = '1' then --- link_current_state <= GET_ADDRESS; --- elsif rising_edge(CLK) then --- if RX_PATH_ENABLE = 1 then --- link_current_state <= link_next_state; --- else --- link_current_state <= ACTIVE; --- end if; --- end if; --- end process; + LINK_STATE_MACHINE_PROC : process(MC_RESET_LINK_IN, CLK) + begin + if MC_RESET_LINK_IN = '1' then + link_current_state <= GET_ADDRESS; + elsif rising_edge(CLK) then + if RX_PATH_ENABLE = 1 then + link_current_state <= link_next_state; + else + link_current_state <= ACTIVE; + end if; + end if; + end process; end generate lsm_sim_gen; incl_dhcp_gen : if (INCLUDE_DHCP = '1') generate @@ -757,17 +748,17 @@ begin end if; end if; --- when GET_ADDRESS => --- link_state <= x"6"; --- if (PCS_AN_COMPLETE_IN = '0') then --- link_next_state <= INACTIVE; --- else --- if (dhcp_done = '1') then --- link_next_state <= ACTIVE; --- else --- link_next_state <= GET_ADDRESS; --- end if; --- end if; + when GET_ADDRESS => + link_state <= x"6"; + if (PCS_AN_COMPLETE_IN = '0') then + link_next_state <= INACTIVE; + else + if (dhcp_done = '1') then + link_next_state <= ACTIVE; + else + link_next_state <= GET_ADDRESS; + end if; + end if; when ACTIVE => link_state <= x"7"; @@ -801,7 +792,7 @@ begin -- end if; --if (link_current_state = GET_ADDRESS) then - if (incl_dhcp = '1' and link_current_state = ACTIVE) then + if (incl_dhcp = '1') then dhcp_start <= '1'; else dhcp_start <= '0'; -- 2.43.0