]> jspc29.x-matter.uni-frankfurt.de Git - trbnet.git/commitdiff
Revert "gk: updated link status"
authorJan Michel <j.michel@gsi.de>
Fri, 15 Dec 2017 15:44:25 +0000 (16:44 +0100)
committerJan Michel <j.michel@gsi.de>
Fri, 15 Dec 2017 15:44:25 +0000 (16:44 +0100)
This reverts commit 1d08a812cf5b8f4ef87b8af7b7381314060030d3.

gbe_trb/base/trb_net16_gbe_main_control.vhd

index 0537eabf42330f098832c3f54598e70d8f8c8f89..122cc31dd5ab832e4f92c23c367e014b769c91ae 100644 (file)
@@ -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';