\r
architecture gbe_frame_constr_arch of gbe_frame_constr is\r
\r
-attribute syn_encoding : string;\r
-\r
-type constructStates is (IDLE, DEST_MAC_ADDR, SRC_MAC_ADDR, FRAME_TYPE_S, VERSION,\r
- TOS_S, IP_LENGTH, IDENT, FLAGS, TTL_S, PROTO, HEADER_CS,\r
- SRC_IP_ADDR, DEST_IP_ADDR, SRC_PORT, DEST_PORT, UDP_LENGTH,\r
- UDP_CS, SAVE_DATA, CLEANUP, DELAY);\r
-signal constructCurrentState, constructNextState : constructStates;\r
-attribute syn_encoding of constructCurrentState: signal is "onehot";\r
-\r
-signal headers_int_counter : integer range 0 to 6;\r
-signal fpf_data : std_logic_vector(7 downto 0);\r
-signal fpf_wr_en : std_logic;\r
-signal fpf_rd_en : std_logic;\r
-signal fpf_rd_en_q : std_logic;\r
-signal fpf_q : std_logic_vector(8 downto 0);\r
-signal ip_size : std_logic_vector(15 downto 0);\r
-signal ip_checksum : std_logic_vector(31 downto 0);\r
-signal udp_size : std_logic_vector(15 downto 0);\r
-signal udp_checksum : std_logic_vector(15 downto 0);\r
-signal put_udp_headers : std_logic;\r
-signal ready : std_logic;\r
-signal headers_ready : std_logic;\r
-\r
-signal cur_max : integer range 0 to 10;\r
-\r
-signal ip_cs_temp_right : std_logic_vector(15 downto 0);\r
-\r
-signal delay_ctr : std_logic_vector(31 downto 0);\r
-signal frame_delay_reg : std_logic_vector(31 downto 0);\r
-signal fpf_data_q : std_logic_vector(7 downto 0);\r
-signal fpf_wr_en_q : std_logic;\r
-signal fpf_eod_q : std_logic;\r
-\r
-signal mon_sent_frames : unsigned(31 downto 0);\r
-signal mon_sent_bytes : unsigned(31 downto 0);\r
+ attribute syn_encoding : string;\r
+\r
+ type constructStates is (IDLE, DEST_MAC_ADDR, SRC_MAC_ADDR, FRAME_TYPE_S, VERSION,\r
+ TOS_S, IP_LENGTH, IDENT, FLAGS, TTL_S, PROTO, HEADER_CS,\r
+ SRC_IP_ADDR, DEST_IP_ADDR, SRC_PORT, DEST_PORT, UDP_LENGTH,\r
+ UDP_CS, SAVE_DATA, CLEANUP, DELAY);\r
+ signal constructCurrentState, constructNextState : constructStates;\r
+ attribute syn_encoding of constructCurrentState: signal is "onehot";\r
+\r
+ signal headers_int_counter : integer range 0 to 6;\r
+ signal fpf_data : std_logic_vector(7 downto 0);\r
+ signal fpf_wr_en : std_logic;\r
+ signal fpf_rd_en : std_logic;\r
+ signal fpf_rd_en_q : std_logic;\r
+ signal fpf_q : std_logic_vector(8 downto 0);\r
+ signal ip_size : std_logic_vector(15 downto 0);\r
+ signal ip_checksum : std_logic_vector(31 downto 0);\r
+ signal udp_size : std_logic_vector(15 downto 0);\r
+ signal udp_checksum : std_logic_vector(15 downto 0);\r
+ signal put_udp_headers : std_logic;\r
+ signal ready : std_logic;\r
+ signal headers_ready : std_logic;\r
+\r
+ signal cur_max : integer range 0 to 10;\r
+\r
+ signal ip_cs_temp_right : std_logic_vector(15 downto 0);\r
+\r
+ signal delay_ctr : std_logic_vector(31 downto 0);\r
+ signal frame_delay_reg : std_logic_vector(31 downto 0);\r
+ signal fpf_data_q : std_logic_vector(7 downto 0);\r
+ signal fpf_wr_en_q : std_logic;\r
+ signal fpf_eod_q : std_logic;\r
+\r
+ signal mon_sent_frames : unsigned(31 downto 0);\r
+ signal mon_sent_bytes : unsigned(31 downto 0);\r
\r
begin\r
\r
--- No checksum test needed\r
-udp_checksum <= x"0000";\r
+ -- No checksum test needed\r
+ udp_checksum <= x"0000";\r
\r
--- frame constructor ready\r
-THE_READY_PROC: process( CLK )\r
-begin\r
-if( rising_edge(CLK) )then\r
- if( constructCurrentState = IDLE ) then\r
- ready <= '1';\r
- else\r
- ready <= '0';\r
- end if;\r
-\r
- if( constructCurrentState = SAVE_DATA ) then\r
- headers_ready <= '1';\r
- else\r
- headers_ready <= '0';\r
- end if;\r
-end if;\r
-end process;\r
+ -- frame constructor ready\r
+ PROC_READY: process( CLK )\r
+ begin\r
+ if( rising_edge(CLK) )then\r
+ if( constructCurrentState = IDLE ) then\r
+ ready <= '1';\r
+ else\r
+ ready <= '0';\r
+ end if;\r
\r
--- Calculate UDP and IP sizes\r
-THE_SIZE_PROC: process( CLK )\r
-begin\r
- if( rising_edge(CLK) ) then\r
- if( (put_udp_headers = '1') and (DEST_UDP_PORT_IN /= x"0000") ) then\r
- ip_size <= IP_F_SIZE_IN + x"14" + x"8";\r
- udp_size <= UDP_P_SIZE_IN + x"8";\r
+ if( constructCurrentState = SAVE_DATA ) then\r
+ headers_ready <= '1';\r
else\r
- ip_size <= IP_F_SIZE_IN + x"14";\r
- udp_size <= UDP_P_SIZE_IN;\r
+ headers_ready <= '0';\r
end if;\r
end if;\r
-end process THE_SIZE_PROC;\r
+ end process PROC_READY;\r
+\r
+ -- Calculate UDP and IP sizes\r
+ PROC_SIZE: process( CLK )\r
+ begin\r
+ if( rising_edge(CLK) ) then\r
+ if( (put_udp_headers = '1') and (DEST_UDP_PORT_IN /= x"0000") ) then\r
+ ip_size <= IP_F_SIZE_IN + x"14" + x"8";\r
+ udp_size <= UDP_P_SIZE_IN + x"8";\r
+ else\r
+ ip_size <= IP_F_SIZE_IN + x"14";\r
+ udp_size <= UDP_P_SIZE_IN;\r
+ end if;\r
+ end if;\r
+ end process PROC_SIZE;\r
\r
-THE_IP_CS_PROC : process( CLK )\r
-begin\r
- if( rising_edge(CLK) ) then\r
- if( constructCurrentState = IDLE ) then\r
- ip_checksum <= x"00000000";\r
- else\r
+ PROC_IP_CS : process( CLK )\r
+ begin\r
+ if( rising_edge(CLK) ) then\r
+ if( constructCurrentState = IDLE ) then\r
+ ip_checksum <= x"00000000";\r
+ else\r
+ case constructCurrentState is\r
+ when DEST_MAC_ADDR =>\r
+ case headers_int_counter is\r
+ when 0 =>\r
+ ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + SRC_IP_ADDRESS_IN(7 downto 0);\r
+ when 1 =>\r
+ ip_checksum <= ip_checksum + SRC_IP_ADDRESS_IN(15 downto 8);\r
+ when 2 =>\r
+ ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + SRC_IP_ADDRESS_IN(23 downto 16);\r
+ when 3 =>\r
+ ip_checksum <= ip_checksum + SRC_IP_ADDRESS_IN(31 downto 24);\r
+ when 4 =>\r
+ ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + DEST_IP_ADDRESS_IN(7 downto 0);\r
+ when 5 =>\r
+ ip_checksum <= ip_checksum + DEST_IP_ADDRESS_IN(15 downto 8);\r
+ when others => null;\r
+ end case;\r
+ when SRC_MAC_ADDR =>\r
+ case headers_int_counter is\r
+ when 0 =>\r
+ ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + DEST_IP_ADDRESS_IN(23 downto 16);\r
+ when 1 =>\r
+ ip_checksum <= ip_checksum + DEST_IP_ADDRESS_IN(31 downto 24);\r
+ when 2 =>\r
+ ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + IHL_VERSION_IN;\r
+ when 3 =>\r
+ ip_checksum <= ip_checksum + TOS_IN;\r
+ when 4 =>\r
+ ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + ip_size(15 downto 8);\r
+ when 5 =>\r
+ ip_checksum <= ip_checksum + ip_size(7 downto 0);\r
+ when others => null;\r
+ end case;\r
+ when VERSION =>\r
+ if( headers_int_counter = 0 ) then\r
+ ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + IDENTIFICATION_IN(7 downto 0);\r
+ end if;\r
+ when TOS_S =>\r
+ if( headers_int_counter = 0 ) then\r
+ ip_checksum <= ip_checksum + IDENTIFICATION_IN(15 downto 8);\r
+ end if;\r
+ when IP_LENGTH =>\r
+ if( headers_int_counter = 0 ) then\r
+ ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + FLAGS_OFFSET_IN(15 downto 8);\r
+ elsif headers_int_counter = 1 then\r
+ ip_checksum <= ip_checksum + FLAGS_OFFSET_IN(7 downto 0);\r
+ end if;\r
+ when IDENT =>\r
+ if headers_int_counter = 0 then\r
+ ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + TTL_IN;\r
+ elsif headers_int_counter = 1 then\r
+ ip_checksum <= ip_checksum + PROTOCOL_IN;\r
+ end if;\r
+ -- gk 29.03.10 corrected the bug with bad checksums when sum larger than 16b\r
+ when FLAGS =>\r
+ if ( headers_int_counter = 0 ) then\r
+ ip_cs_temp_right <= ip_checksum(31 downto 16);\r
+ elsif( headers_int_counter = 1 ) then\r
+ ip_checksum(31 downto 16) <= (others => '0');\r
+ end if;\r
+ when TTL_S =>\r
+ if( headers_int_counter = 0 ) then\r
+ ip_checksum <= ip_checksum + ip_cs_temp_right;\r
+ end if;\r
+ when PROTO =>\r
+ if( headers_int_counter = 0 ) then\r
+ ip_checksum(15 downto 0) <= ip_checksum(15 downto 0) + ip_checksum(31 downto 16);\r
+ end if;\r
+ when others => null;\r
+ end case;\r
+ end if;\r
+ end if;\r
+ end process PROC_IP_CS;\r
+\r
+\r
+ PROC_CONSTRUCT: process( CLK, RESET )\r
+ begin\r
+ if ( RESET = '1' ) then\r
+ constructCurrentState <= IDLE;\r
+ elsif( rising_edge(CLK) ) then\r
+ constructCurrentState <= constructNextState;\r
+ end if;\r
+ end process PROC_CONSTRUCT;\r
+\r
+ --find next state of construct machine\r
+ PROC_CONSTRUCT_TRANSITIONS: process( constructCurrentState, delay_ctr, FRAME_DELAY_IN, START_OF_DATA_IN,\r
+ END_OF_DATA_IN, headers_int_counter, put_udp_headers, CUR_MAX,\r
+ FRAME_TYPE_IN, DEST_UDP_PORT_IN)\r
+ begin\r
+ constructNextState <= constructCurrentState;\r
+ if( headers_int_counter = cur_max ) then --can be checked everytime - if not in use, counter and cur_max are 0\r
case constructCurrentState is\r
+ when IDLE =>\r
+ if( START_OF_DATA_IN = '1' ) then\r
+ constructNextState <= DEST_MAC_ADDR;\r
+ end if;\r
when DEST_MAC_ADDR =>\r
- case headers_int_counter is\r
- when 0 =>\r
- ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + SRC_IP_ADDRESS_IN(7 downto 0);\r
- when 1 =>\r
- ip_checksum <= ip_checksum + SRC_IP_ADDRESS_IN(15 downto 8);\r
- when 2 =>\r
- ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + SRC_IP_ADDRESS_IN(23 downto 16);\r
- when 3 =>\r
- ip_checksum <= ip_checksum + SRC_IP_ADDRESS_IN(31 downto 24);\r
- when 4 =>\r
- ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + DEST_IP_ADDRESS_IN(7 downto 0);\r
- when 5 =>\r
- ip_checksum <= ip_checksum + DEST_IP_ADDRESS_IN(15 downto 8);\r
- when others => null;\r
- end case;\r
+ constructNextState <= SRC_MAC_ADDR;\r
when SRC_MAC_ADDR =>\r
- case headers_int_counter is\r
- when 0 =>\r
- ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + DEST_IP_ADDRESS_IN(23 downto 16);\r
- when 1 =>\r
- ip_checksum <= ip_checksum + DEST_IP_ADDRESS_IN(31 downto 24);\r
- when 2 =>\r
- ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + IHL_VERSION_IN;\r
- when 3 =>\r
- ip_checksum <= ip_checksum + TOS_IN;\r
- when 4 =>\r
- ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + ip_size(15 downto 8);\r
- when 5 =>\r
- ip_checksum <= ip_checksum + ip_size(7 downto 0);\r
- when others => null;\r
- end case;\r
- when VERSION =>\r
- if( headers_int_counter = 0 ) then\r
- ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + IDENTIFICATION_IN(7 downto 0);\r
+ constructNextState <= FRAME_TYPE_S;\r
+ when FRAME_TYPE_S =>\r
+ if( FRAME_TYPE_IN = x"0008" ) then\r
+ constructNextState <= VERSION;\r
+ else -- otherwise transmit data as pure ethernet frame\r
+ constructNextState <= SAVE_DATA;\r
end if;\r
+ when VERSION =>\r
+ constructNextState <= TOS_S;\r
when TOS_S =>\r
- if( headers_int_counter = 0 ) then\r
- ip_checksum <= ip_checksum + IDENTIFICATION_IN(15 downto 8);\r
- end if;\r
+ constructNextState <= IP_LENGTH;\r
when IP_LENGTH =>\r
- if( headers_int_counter = 0 ) then\r
- ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + FLAGS_OFFSET_IN(15 downto 8);\r
- elsif headers_int_counter = 1 then\r
- ip_checksum <= ip_checksum + FLAGS_OFFSET_IN(7 downto 0);\r
- end if;\r
+ constructNextState <= IDENT;\r
when IDENT =>\r
- if headers_int_counter = 0 then\r
- ip_checksum(31 downto 8) <= ip_checksum(31 downto 8) + TTL_IN;\r
- elsif headers_int_counter = 1 then\r
- ip_checksum <= ip_checksum + PROTOCOL_IN;\r
- end if;\r
- -- gk 29.03.10 corrected the bug with bad checksums when sum larger than 16b\r
+ constructNextState <= FLAGS;\r
when FLAGS =>\r
- if ( headers_int_counter = 0 ) then\r
- ip_cs_temp_right <= ip_checksum(31 downto 16);\r
- elsif( headers_int_counter = 1 ) then\r
- ip_checksum(31 downto 16) <= (others => '0');\r
- end if;\r
+ constructNextState <= TTL_S;\r
when TTL_S =>\r
- if( headers_int_counter = 0 ) then\r
- ip_checksum <= ip_checksum + ip_cs_temp_right;\r
- end if;\r
+ constructNextState <= PROTO;\r
when PROTO =>\r
- if( headers_int_counter = 0 ) then\r
- ip_checksum(15 downto 0) <= ip_checksum(15 downto 0) + ip_checksum(31 downto 16);\r
+ constructNextState <= HEADER_CS;\r
+ when HEADER_CS =>\r
+ constructNextState <= SRC_IP_ADDR;\r
+ when SRC_IP_ADDR =>\r
+ constructNextState <= DEST_IP_ADDR;\r
+ when DEST_IP_ADDR =>\r
+ if( (put_udp_headers = '1') and (DEST_UDP_PORT_IN /= x"0000") ) then\r
+ constructNextState <= SRC_PORT;\r
+ else\r
+ constructNextState <= SAVE_DATA;\r
+ end if;\r
+ when SRC_PORT =>\r
+ constructNextState <= DEST_PORT;\r
+ when DEST_PORT =>\r
+ constructNextState <= UDP_LENGTH;\r
+ when UDP_LENGTH =>\r
+ constructNextState <= UDP_CS;\r
+ when UDP_CS =>\r
+ constructNextState <= SAVE_DATA;\r
+ when SAVE_DATA =>\r
+ if( END_OF_DATA_IN = '1' ) then\r
+ constructNextState <= CLEANUP;\r
end if;\r
- when others => null;\r
+ when CLEANUP =>\r
+ constructNextState <= DELAY;\r
+ when DELAY =>\r
+ if (delay_ctr = FRAME_DELAY_IN) then\r
+ constructNextState <= IDLE;\r
+ else\r
+ constructNextState <= DELAY;\r
+ end if;\r
+\r
+ when others =>\r
+ constructNextState <= IDLE;\r
end case;\r
end if;\r
- end if;\r
-end process THE_IP_CS_PROC;\r
-\r
+ end process PROC_CONSTRUCT_TRANSITIONS;\r
+\r
+ PROC_DELAY_CTR: process( CLK )\r
+ begin\r
+ if( rising_edge(CLK) ) then\r
+ if ( (constructCurrentState = IDLE) or (constructCurrentState = CLEANUP) ) then\r
+ delay_ctr <= (others => '0');\r
+ elsif( constructCurrentState = DELAY ) then\r
+ delay_ctr <= delay_ctr + x"1";\r
+ end if;\r
\r
-THE_CONSTRUCT_PROC: process( CLK )\r
-begin\r
- if( rising_edge(CLK) ) then\r
- if( RESET = '1' ) then\r
- constructCurrentState <= IDLE;\r
- else\r
- constructCurrentState <= constructNextState;\r
+ frame_delay_reg <= FRAME_DELAY_IN;\r
end if;\r
- end if;\r
-end process THE_CONSTRUCT_PROC;\r
+ end process PROC_DELAY_CTR;\r
\r
---find next state of construct machine\r
-constructMachine: process( constructCurrentState, delay_ctr, FRAME_DELAY_IN, START_OF_DATA_IN,\r
- END_OF_DATA_IN, headers_int_counter, put_udp_headers, CUR_MAX,\r
- FRAME_TYPE_IN, DEST_UDP_PORT_IN)\r
-begin\r
- constructNextState <= constructCurrentState;\r
- if( headers_int_counter = cur_max ) then --can be checked everytime - if not in use, counter and cur_max are 0\r
+ PROC_BSM_CONSTR: process( constructCurrentState )\r
+ begin\r
+ --find maximum time in each state & set state bits\r
case constructCurrentState is\r
- when IDLE =>\r
- if( START_OF_DATA_IN = '1' ) then\r
- constructNextState <= DEST_MAC_ADDR;\r
- end if;\r
- when DEST_MAC_ADDR =>\r
- constructNextState <= SRC_MAC_ADDR;\r
- when SRC_MAC_ADDR =>\r
- constructNextState <= FRAME_TYPE_S;\r
- when FRAME_TYPE_S =>\r
- if( FRAME_TYPE_IN = x"0008" ) then\r
- constructNextState <= VERSION;\r
- else -- otherwise transmit data as pure ethernet frame\r
- constructNextState <= SAVE_DATA;\r
- end if;\r
- when VERSION =>\r
- constructNextState <= TOS_S;\r
- when TOS_S =>\r
- constructNextState <= IP_LENGTH;\r
- when IP_LENGTH =>\r
- constructNextState <= IDENT;\r
- when IDENT =>\r
- constructNextState <= FLAGS;\r
- when FLAGS =>\r
- constructNextState <= TTL_S;\r
- when TTL_S =>\r
- constructNextState <= PROTO;\r
- when PROTO =>\r
- constructNextState <= HEADER_CS;\r
- when HEADER_CS =>\r
- constructNextState <= SRC_IP_ADDR;\r
- when SRC_IP_ADDR =>\r
- constructNextState <= DEST_IP_ADDR;\r
- when DEST_IP_ADDR =>\r
- if( (put_udp_headers = '1') and (DEST_UDP_PORT_IN /= x"0000") ) then\r
- constructNextState <= SRC_PORT;\r
- else\r
- constructNextState <= SAVE_DATA;\r
- end if;\r
- when SRC_PORT =>\r
- constructNextState <= DEST_PORT;\r
- when DEST_PORT =>\r
- constructNextState <= UDP_LENGTH;\r
- when UDP_LENGTH =>\r
- constructNextState <= UDP_CS;\r
- when UDP_CS =>\r
- constructNextState <= SAVE_DATA;\r
- when SAVE_DATA =>\r
- if( END_OF_DATA_IN = '1' ) then\r
- constructNextState <= CLEANUP;\r
- end if;\r
- when CLEANUP =>\r
- constructNextState <= DELAY;\r
- when DELAY =>\r
- if (delay_ctr = FRAME_DELAY_IN) then\r
- constructNextState <= IDLE;\r
+ when IDLE => cur_max <= 0;\r
+ when DEST_MAC_ADDR => cur_max <= 5;\r
+ when SRC_MAC_ADDR => cur_max <= 5;\r
+ when FRAME_TYPE_S => cur_max <= 1;\r
+ when VERSION => cur_max <= 0;\r
+ when TOS_S => cur_max <= 0;\r
+ when IP_LENGTH => cur_max <= 1;\r
+ when IDENT => cur_max <= 1;\r
+ when FLAGS => cur_max <= 1;\r
+ when TTL_S => cur_max <= 0;\r
+ when PROTO => cur_max <= 0;\r
+ when HEADER_CS => cur_max <= 1;\r
+ when SRC_IP_ADDR => cur_max <= 3;\r
+ when DEST_IP_ADDR => cur_max <= 3;\r
+ when SRC_PORT => cur_max <= 1;\r
+ when DEST_PORT => cur_max <= 1;\r
+ when UDP_LENGTH => cur_max <= 1;\r
+ when UDP_CS => cur_max <= 1;\r
+ when SAVE_DATA => cur_max <= 0;\r
+ when CLEANUP => cur_max <= 0;\r
+ when DELAY => cur_max <= 0;\r
+ when others => cur_max <= 0;\r
+ end case;\r
+ end process PROC_BSM_CONSTR;\r
+\r
+ PROC_HEADERS_INT: process( CLK )\r
+ begin\r
+ if( rising_edge(CLK) ) then\r
+ if( constructCurrentState = IDLE ) then\r
+ headers_int_counter <= 0;\r
+ else\r
+ if( headers_int_counter = cur_max ) then\r
+ headers_int_counter <= 0;\r
else\r
- constructNextState <= DELAY;\r
+ headers_int_counter <= headers_int_counter + 1;\r
end if;\r
-\r
- when others =>\r
- constructNextState <= IDLE;\r
- end case;\r
- end if;\r
-end process constructMachine;\r
-\r
-THE_DELAY_CTR_PROC: process( CLK )\r
-begin\r
- if( rising_edge(CLK) ) then\r
- if ( (constructCurrentState = IDLE) or (constructCurrentState = CLEANUP) ) then\r
- delay_ctr <= (others => '0');\r
- elsif( constructCurrentState = DELAY ) then\r
- delay_ctr <= delay_ctr + x"1";\r
- end if;\r
-\r
- frame_delay_reg <= FRAME_DELAY_IN;\r
+ end if;\r
end if;\r
-end process THE_DELAY_CTR_PROC;\r
+ end process PROC_HEADERS_INT;\r
\r
-THE_BSM_CONSTR_PROC: process( constructCurrentState )\r
-begin\r
---find maximum time in each state & set state bits\r
- case constructCurrentState is\r
- when IDLE => cur_max <= 0;\r
- when DEST_MAC_ADDR => cur_max <= 5;\r
- when SRC_MAC_ADDR => cur_max <= 5;\r
- when FRAME_TYPE_S => cur_max <= 1;\r
- when VERSION => cur_max <= 0;\r
- when TOS_S => cur_max <= 0;\r
- when IP_LENGTH => cur_max <= 1;\r
- when IDENT => cur_max <= 1;\r
- when FLAGS => cur_max <= 1;\r
- when TTL_S => cur_max <= 0;\r
- when PROTO => cur_max <= 0;\r
- when HEADER_CS => cur_max <= 1;\r
- when SRC_IP_ADDR => cur_max <= 3;\r
- when DEST_IP_ADDR => cur_max <= 3;\r
- when SRC_PORT => cur_max <= 1;\r
- when DEST_PORT => cur_max <= 1;\r
- when UDP_LENGTH => cur_max <= 1;\r
- when UDP_CS => cur_max <= 1;\r
- when SAVE_DATA => cur_max <= 0;\r
- when CLEANUP => cur_max <= 0;\r
- when DELAY => cur_max <= 0;\r
- when others => cur_max <= 0;\r
-end case;\r
-end process THE_BSM_CONSTR_PROC;\r
-\r
-THE_HEADERS_INT_PROC: process( CLK )\r
-begin\r
- if( rising_edge(CLK) ) then\r
- if( constructCurrentState = IDLE ) then\r
- headers_int_counter <= 0;\r
- else\r
- if( headers_int_counter = cur_max ) then\r
- headers_int_counter <= 0;\r
+ PROC_PUT_UDP_HEADERS: process( CLK )\r
+ begin\r
+ if( rising_edge(CLK) ) then\r
+ if( FLAGS_OFFSET_IN(12 downto 0) = "0000000000000" ) then\r
+ put_udp_headers <= '1';\r
else\r
- headers_int_counter <= headers_int_counter + 1;\r
+ put_udp_headers <= '0';\r
end if;\r
end if;\r
-end if;\r
-end process THE_HEADERS_INT_PROC;\r
+ end process PROC_PUT_UDP_HEADERS;\r
\r
-THE_PUT_UDP_HEADERS_PROC: process( CLK )\r
-begin\r
- if( rising_edge(CLK) ) then\r
- if( FLAGS_OFFSET_IN(12 downto 0) = "0000000000000" ) then\r
- put_udp_headers <= '1';\r
+ PROC_FPF_WREN: process( constructCurrentState, WR_EN_IN, LINK_OK_IN )\r
+ begin\r
+ if ( LINK_OK_IN = '0' ) then\r
+ fpf_wr_en <= '0';\r
+ elsif( (constructCurrentState /= IDLE) and (constructCurrentState /= CLEANUP) and (constructCurrentState /= SAVE_DATA) and (constructCurrentState /= DELAY) ) then\r
+ fpf_wr_en <= '1';\r
+ elsif( (constructCurrentState = SAVE_DATA) and (WR_EN_IN = '1') ) then\r
+ fpf_wr_en <= '1';\r
else\r
- put_udp_headers <= '0';\r
+ fpf_wr_en <= '0';\r
end if;\r
- end if;\r
-end process THE_PUT_UDP_HEADERS_PROC;\r
-\r
-THE_FPF_WREN_PROC : process( constructCurrentState, WR_EN_IN, LINK_OK_IN )\r
-begin\r
- if ( LINK_OK_IN = '0' ) then\r
- fpf_wr_en <= '0';\r
- elsif( (constructCurrentState /= IDLE) and (constructCurrentState /= CLEANUP) and (constructCurrentState /= SAVE_DATA) and (constructCurrentState /= DELAY) ) then\r
- fpf_wr_en <= '1';\r
- elsif( (constructCurrentState = SAVE_DATA) and (WR_EN_IN = '1') ) then\r
- fpf_wr_en <= '1';\r
- else\r
- fpf_wr_en <= '0';\r
- end if;\r
-end process THE_FPF_WREN_PROC;\r
+ end process PROC_FPF_WREN;\r
\r
-THE_FPF_DATA_PROC: process( constructCurrentState, DEST_MAC_ADDRESS_IN, SRC_MAC_ADDRESS_IN, FRAME_TYPE_IN, IHL_VERSION_IN,\r
- TOS_IN, ip_size, IDENTIFICATION_IN, FLAGS_OFFSET_IN, TTL_IN, PROTOCOL_IN,\r
- ip_checksum, SRC_IP_ADDRESS_IN, DEST_IP_ADDRESS_IN,\r
- SRC_UDP_PORT_IN, DEST_UDP_PORT_IN, udp_size, udp_checksum, headers_int_counter, DATA_IN )\r
-begin\r
- case constructCurrentState is\r
- when IDLE => fpf_data <= DEST_MAC_ADDRESS_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
- when DEST_MAC_ADDR => fpf_data <= DEST_MAC_ADDRESS_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
- when SRC_MAC_ADDR => fpf_data <= SRC_MAC_ADDRESS_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
- when FRAME_TYPE_S => fpf_data <= FRAME_TYPE_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
- when VERSION => fpf_data <= IHL_VERSION_IN;\r
- when TOS_S => fpf_data <= TOS_IN;\r
- when IP_LENGTH => fpf_data <= ip_size(15 - headers_int_counter * 8 downto 8 - headers_int_counter * 8);\r
- when IDENT => fpf_data <= IDENTIFICATION_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
- when FLAGS => fpf_data <= FLAGS_OFFSET_IN(15 - headers_int_counter * 8 downto 8 - headers_int_counter * 8);\r
- when TTL_S => fpf_data <= TTL_IN;\r
- when PROTO => fpf_data <= PROTOCOL_IN;\r
- when HEADER_CS => fpf_data <= x"ff" - ip_checksum(15 - headers_int_counter * 8 downto 8 - headers_int_counter * 8);\r
- when SRC_IP_ADDR => fpf_data <= SRC_IP_ADDRESS_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
- when DEST_IP_ADDR => fpf_data <= DEST_IP_ADDRESS_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
- when SRC_PORT => fpf_data <= SRC_UDP_PORT_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
- when DEST_PORT => fpf_data <= DEST_UDP_PORT_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
- when UDP_LENGTH => fpf_data <= udp_size(15 - headers_int_counter * 8 downto 8 - headers_int_counter * 8);\r
- when UDP_CS => fpf_data <= udp_checksum(15 - headers_int_counter * 8 downto 8 - headers_int_counter * 8);\r
- when SAVE_DATA => fpf_data <= DATA_IN;\r
- when CLEANUP => fpf_data <= x"ab";\r
- when DELAY => fpf_data <= x"ac";\r
- when others => fpf_data <= x"00";\r
- end case;\r
-end process THE_FPF_DATA_PROC;\r
-\r
-THE_SYNC_PROC: process( CLK )\r
-begin\r
- if( rising_edge(CLK) ) then\r
- fpf_data_q <= fpf_data;\r
- fpf_wr_en_q <= fpf_wr_en;\r
- fpf_eod_q <= END_OF_DATA_IN;\r
- end if;\r
-end process THE_SYNC_PROC;\r
-\r
--- count bytes sent\r
-THE_MON_SENT_BYTES_PROC: process( CLK )\r
-begin\r
- if( rising_edge(CLK) ) then\r
- if( LINK_OK_IN = '0' ) then\r
- mon_sent_bytes <= (others => '0');\r
- elsif( fpf_rd_en = '1' ) then\r
- mon_sent_bytes <= mon_sent_bytes + 1;\r
- else\r
- mon_sent_bytes <= mon_sent_bytes;\r
+ PROC_FPF_DATA: process( constructCurrentState, DEST_MAC_ADDRESS_IN, SRC_MAC_ADDRESS_IN, FRAME_TYPE_IN, IHL_VERSION_IN,\r
+ TOS_IN, ip_size, IDENTIFICATION_IN, FLAGS_OFFSET_IN, TTL_IN, PROTOCOL_IN,\r
+ ip_checksum, SRC_IP_ADDRESS_IN, DEST_IP_ADDRESS_IN,\r
+ SRC_UDP_PORT_IN, DEST_UDP_PORT_IN, udp_size, udp_checksum, headers_int_counter, DATA_IN )\r
+ begin\r
+ case constructCurrentState is\r
+ when IDLE => fpf_data <= DEST_MAC_ADDRESS_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
+ when DEST_MAC_ADDR => fpf_data <= DEST_MAC_ADDRESS_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
+ when SRC_MAC_ADDR => fpf_data <= SRC_MAC_ADDRESS_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
+ when FRAME_TYPE_S => fpf_data <= FRAME_TYPE_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
+ when VERSION => fpf_data <= IHL_VERSION_IN;\r
+ when TOS_S => fpf_data <= TOS_IN;\r
+ when IP_LENGTH => fpf_data <= ip_size(15 - headers_int_counter * 8 downto 8 - headers_int_counter * 8);\r
+ when IDENT => fpf_data <= IDENTIFICATION_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
+ when FLAGS => fpf_data <= FLAGS_OFFSET_IN(15 - headers_int_counter * 8 downto 8 - headers_int_counter * 8);\r
+ when TTL_S => fpf_data <= TTL_IN;\r
+ when PROTO => fpf_data <= PROTOCOL_IN;\r
+ when HEADER_CS => fpf_data <= x"ff" - ip_checksum(15 - headers_int_counter * 8 downto 8 - headers_int_counter * 8);\r
+ when SRC_IP_ADDR => fpf_data <= SRC_IP_ADDRESS_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
+ when DEST_IP_ADDR => fpf_data <= DEST_IP_ADDRESS_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
+ when SRC_PORT => fpf_data <= SRC_UDP_PORT_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
+ when DEST_PORT => fpf_data <= DEST_UDP_PORT_IN(headers_int_counter * 8 + 7 downto headers_int_counter * 8);\r
+ when UDP_LENGTH => fpf_data <= udp_size(15 - headers_int_counter * 8 downto 8 - headers_int_counter * 8);\r
+ when UDP_CS => fpf_data <= udp_checksum(15 - headers_int_counter * 8 downto 8 - headers_int_counter * 8);\r
+ when SAVE_DATA => fpf_data <= DATA_IN;\r
+ when CLEANUP => fpf_data <= x"ab";\r
+ when DELAY => fpf_data <= x"ac";\r
+ when others => fpf_data <= x"00";\r
+ end case;\r
+ end process PROC_FPF_DATA;\r
+\r
+ PROC_SYNC: process( CLK )\r
+ begin\r
+ if( rising_edge(CLK) ) then\r
+ fpf_data_q <= fpf_data;\r
+ fpf_wr_en_q <= fpf_wr_en;\r
+ fpf_eod_q <= END_OF_DATA_IN;\r
end if;\r
- end if;\r
-end process THE_MON_SENT_BYTES_PROC;\r
-\r
--- count frames sent\r
-THE_MON_SENT_FRAMES_PROC: process( CLK )\r
-begin\r
- if( rising_edge(CLK) )then\r
- if ( LINK_OK_IN = '0' ) then\r
- mon_sent_frames <= (others => '0');\r
- elsif( (fpf_wr_en_q = '1') and (fpf_eod_q = '1') ) then -- TO BE TESTED\r
- mon_sent_frames <= mon_sent_frames + 1;\r
- else\r
- mon_sent_frames <= mon_sent_frames;\r
+ end process PROC_SYNC;\r
+\r
+ -- count bytes sent\r
+ PROC_MON_SENT_BYTES: process( CLK )\r
+ begin\r
+ if( rising_edge(CLK) ) then\r
+ if( LINK_OK_IN = '0' ) then\r
+ mon_sent_bytes <= (others => '0');\r
+ elsif( fpf_rd_en = '1' ) then\r
+ mon_sent_bytes <= mon_sent_bytes + 1;\r
+ else\r
+ mon_sent_bytes <= mon_sent_bytes;\r
+ end if;\r
end if;\r
- end if;\r
-end process THE_MON_SENT_FRAMES_PROC;\r
-\r
--- Outputs\r
+ end process PROC_MON_SENT_BYTES;\r
+\r
+ -- count frames sent\r
+ PROC_MON_SENT_FRAMES: process( CLK )\r
+ begin\r
+ if( rising_edge(CLK) )then\r
+ if ( LINK_OK_IN = '0' ) then\r
+ mon_sent_frames <= (others => '0');\r
+ elsif( (fpf_wr_en_q = '1') and (fpf_eod_q = '1') ) then -- TO BE TESTED\r
+ mon_sent_frames <= mon_sent_frames + 1;\r
+ else\r
+ mon_sent_frames <= mon_sent_frames;\r
+ end if;\r
+ end if;\r
+ end process PROC_MON_SENT_FRAMES;\r
\r
-FT_TX_DATA_OUT(7 downto 0) <= fpf_data_q;\r
-FT_TX_DATA_OUT(8) <= fpf_eod_q;\r
-FT_TX_WR_OUT <= fpf_wr_en_q;\r
+ -- Outputs\r
+ FT_TX_DATA_OUT(7 downto 0) <= fpf_data_q;\r
+ FT_TX_DATA_OUT(8) <= fpf_eod_q;\r
+ FT_TX_WR_OUT <= fpf_wr_en_q;\r
\r
-READY_OUT <= ready;\r
-HEADERS_READY_OUT <= headers_ready;\r
+ READY_OUT <= ready;\r
+ HEADERS_READY_OUT <= headers_ready;\r
\r
-MONITOR_TX_BYTES_OUT <= std_logic_vector(mon_sent_bytes);\r
-MONITOR_TX_FRAMES_OUT <= std_logic_vector(mon_sent_frames);\r
+ MONITOR_TX_BYTES_OUT <= std_logic_vector(mon_sent_bytes);\r
+ MONITOR_TX_FRAMES_OUT <= std_logic_vector(mon_sent_frames);\r
\r
end gbe_frame_constr_arch;\r
attribute syn_encoding : string;\r
type filter_states is (IDLE, REMOVE_DEST, REMOVE_SRC, REMOVE_TYPE, SAVE_FRAME, DROP_FRAME,\r
REMOVE_IP, REMOVE_UDP, DELAY, CLEANUP);\r
- signal filter_current_state, filter_next_state : filter_states;\r
- attribute syn_encoding of filter_current_state : signal is "onehot";\r
+ signal FILTER_CS, FILTER_NS : filter_states;\r
+ attribute syn_encoding of FILTER_CS : signal is "onehot";\r
\r
signal fifo_wr_en : std_logic;\r
signal rx_bytes_ctr : std_logic_vector(15 downto 0);\r
begin\r
\r
-- Debug lines\r
- DEBUG_OUT(31 downto 26) <= (others => '0');\r
+ DEBUG_OUT(31 downto 28) <= state;\r
+ DEBUG_OUT(27 downto 16) <= (others => '0');\r
\r
DEBUG_OUT(15) <= frame_valid_q;\r
DEBUG_OUT(14) <= fifo_wr_en;\r
PROC_FILTER_FSM: process( CLK, RESET )\r
begin\r
if ( RESET = '1' ) then\r
- filter_current_state <= IDLE;\r
+ FILTER_CS <= IDLE;\r
oob_select <= '0';\r
elsif( rising_edge(CLK) ) then\r
- filter_current_state <= filter_next_state;\r
+ FILTER_CS <= FILTER_NS;\r
oob_select <= oob_select_x;\r
end if;\r
end process PROC_FILTER_FSM;\r
\r
- PROC_FILTER_TRANSITIONS : process( filter_current_state, saved_frame_type, LINK_OK_IN, saved_proto, MY_MAC_IN,\r
+ PROC_FILTER_TRANSITIONS : process( FILTER_CS, saved_frame_type, LINK_OK_IN, saved_proto, MY_MAC_IN,\r
saved_dest_mac, remove_ctr, new_frame, MAC_RX_EOF_IN, frame_type_valid, ALLOW_RX_IN)\r
begin\r
set_proto_x <= (others => '0');\r
oob_select_x <= '0';\r
\r
- case filter_current_state is\r
+ case FILTER_CS is\r
\r
when IDLE =>\r
state <= x"1";\r
if( (new_frame = '1') and (ALLOW_RX_IN = '1') and (LINK_OK_IN = '1') ) then\r
- filter_next_state <= REMOVE_DEST;\r
+ FILTER_NS <= REMOVE_DEST;\r
else\r
- filter_next_state <= IDLE;\r
+ FILTER_NS <= IDLE;\r
end if;\r
\r
-- frames arrive without preamble!\r
if( remove_ctr = x"03" ) then -- counter starts with a delay that's why only 3\r
-- destination MAC address filtering here\r
if( (saved_dest_mac = MY_MAC_IN) or (saved_dest_mac = x"ffffffffffff") ) then -- must accept broadcasts for ARP\r
- filter_next_state <= REMOVE_SRC;\r
+ FILTER_NS <= REMOVE_SRC;\r
else\r
- filter_next_state <= DROP_FRAME; -- wrong MAC, were are done\r
+ FILTER_NS <= DROP_FRAME; -- wrong MAC, were are done\r
-- could be done in REMOVE_SRC to gain some clock cycles\r
end if;\r
else\r
- filter_next_state <= REMOVE_DEST;\r
+ FILTER_NS <= REMOVE_DEST;\r
end if;\r
\r
when REMOVE_SRC =>\r
state <= x"4";\r
if( remove_ctr = x"09" ) then\r
- filter_next_state <= REMOVE_TYPE;\r
+ FILTER_NS <= REMOVE_TYPE;\r
else\r
- filter_next_state <= REMOVE_SRC;\r
+ FILTER_NS <= REMOVE_SRC;\r
end if;\r
\r
when REMOVE_TYPE =>\r
case saved_frame_type is\r
when x"0800" =>\r
-- IPv4 frame, to be investigated\r
- filter_next_state <= REMOVE_IP;\r
+ FILTER_NS <= REMOVE_IP;\r
when x"0806" =>\r
-- ARP frame, to be stored\r
- filter_next_state <= DELAY;\r
+ FILTER_NS <= DELAY;\r
set_proto_x(0) <= '1';\r
-- NB: first two bytes of ARP frame are dropped silently\r
when others =>\r
- filter_next_state <= DROP_FRAME;\r
+ FILTER_NS <= DROP_FRAME;\r
end case;\r
else\r
- filter_next_state <= REMOVE_TYPE;\r
+ FILTER_NS <= REMOVE_TYPE;\r
end if;\r
\r
when REMOVE_IP =>\r
case saved_proto is\r
when x"11" =>\r
-- UDP, to be investigated\r
- filter_next_state <= REMOVE_UDP;\r
+ FILTER_NS <= REMOVE_UDP;\r
when x"01" =>\r
-- ICMP, to be stored\r
- filter_next_state <= DELAY;\r
+ FILTER_NS <= DELAY;\r
set_proto_x(4) <= '1';\r
when others =>\r
- filter_next_state <= DROP_FRAME;\r
+ FILTER_NS <= DROP_FRAME;\r
end case;\r
else\r
- filter_next_state <= REMOVE_IP;\r
+ FILTER_NS <= REMOVE_IP;\r
end if;\r
\r
when REMOVE_UDP =>\r
case saved_dest_udp is\r
when x"0044" =>\r
-- DHCP frame, to be stored\r
- filter_next_state <= DELAY;\r
+ FILTER_NS <= DELAY;\r
set_proto_x(1) <= '1';\r
when x"6590" =>\r
-- SCTRL frame, to be stored\r
- filter_next_state <= DELAY;\r
+ FILTER_NS <= DELAY;\r
set_proto_x(2) <= '1';\r
when others =>\r
- filter_next_state <= DROP_FRAME;\r
+ FILTER_NS <= DROP_FRAME;\r
oob_select_x <= '1';\r
end case;\r
else\r
- filter_next_state <= REMOVE_UDP;\r
+ FILTER_NS <= REMOVE_UDP;\r
end if;\r
\r
when DELAY =>\r
state <= x"6";\r
- filter_next_state <= SAVE_FRAME;\r
+ FILTER_NS <= SAVE_FRAME;\r
\r
when SAVE_FRAME =>\r
state <= x"7";\r
if( MAC_RX_EOF_IN = '1' ) then\r
- filter_next_state <= CLEANUP;\r
+ FILTER_NS <= CLEANUP;\r
else\r
- filter_next_state <= SAVE_FRAME;\r
+ FILTER_NS <= SAVE_FRAME;\r
end if;\r
\r
when DROP_FRAME =>\r
state <= x"8";\r
if( MAC_RX_EOF_IN = '1' ) then\r
- filter_next_state <= CLEANUP;\r
+ FILTER_NS <= CLEANUP;\r
else\r
- filter_next_state <= DROP_FRAME;\r
+ FILTER_NS <= DROP_FRAME;\r
end if;\r
\r
when CLEANUP =>\r
state <= x"9";\r
- filter_next_state <= IDLE;\r
+ FILTER_NS <= IDLE;\r
\r
when others => null;\r
\r
for I in c_MAX_PROTOCOLS - 1 downto 0 loop\r
if ( set_proto_x(I) = '1' ) then\r
proto_select(I) <= '1';\r
- elsif( filter_current_state = CLEANUP ) then\r
+ elsif( FILTER_CS = CLEANUP ) then\r
proto_select(I) <= '0';\r
end if;\r
end loop;\r
PROC_REMOVE_CTR: process( CLK )\r
begin\r
if( rising_edge(CLK) ) then\r
- if ( (filter_current_state = IDLE) or\r
- ((filter_current_state = REMOVE_TYPE) and (remove_ctr = x"0b")) ) then\r
+ if ( (FILTER_CS = IDLE) or\r
+ ((FILTER_CS = REMOVE_TYPE) and (remove_ctr = x"0b")) ) then\r
remove_ctr <= (others => '1');\r
- elsif( (MAC_RX_EN_IN = '1') and (filter_current_state /= IDLE) ) then\r
+ elsif( (MAC_RX_EN_IN = '1') and (FILTER_CS /= IDLE) ) then\r
remove_ctr <= remove_ctr + 1;\r
end if;\r
end if;\r
PROC_SAVED_PROTO: process( CLK )\r
begin\r
if( rising_edge(CLK) ) then\r
- if ( filter_current_state = CLEANUP ) then\r
+ if ( FILTER_CS = CLEANUP ) then\r
saved_proto <= (others => '0');\r
- elsif( (filter_current_state = REMOVE_IP) and (remove_ctr = x"07") ) then\r
+ elsif( (FILTER_CS = REMOVE_IP) and (remove_ctr = x"07") ) then\r
saved_proto <= MAC_RXD_IN;\r
end if;\r
end if;\r
PROC_SAVED_DEST_MAC: process( CLK )\r
begin\r
if( rising_edge(CLK) ) then\r
- if ( filter_current_state = CLEANUP ) then\r
+ if ( FILTER_CS = CLEANUP ) then\r
saved_dest_mac <= (others => '0');\r
- elsif( (filter_current_state = IDLE) and (MAC_RX_EN_IN = '1') and (new_frame = '0') ) then\r
+ elsif( (FILTER_CS = IDLE) and (MAC_RX_EN_IN = '1') and (new_frame = '0') ) then\r
saved_dest_mac(7 downto 0) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = IDLE) and (new_frame = '1') and (ALLOW_RX_IN = '1') ) then\r
+ elsif( (FILTER_CS = IDLE) and (new_frame = '1') and (ALLOW_RX_IN = '1') ) then\r
saved_dest_mac(15 downto 8) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_DEST) and (remove_ctr = x"FF") ) then\r
+ elsif( (FILTER_CS = REMOVE_DEST) and (remove_ctr = x"FF") ) then\r
saved_dest_mac(23 downto 16) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_DEST) and (remove_ctr = x"00") ) then\r
+ elsif( (FILTER_CS = REMOVE_DEST) and (remove_ctr = x"00") ) then\r
saved_dest_mac(31 downto 24) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_DEST) and (remove_ctr = x"01") ) then\r
+ elsif( (FILTER_CS = REMOVE_DEST) and (remove_ctr = x"01") ) then\r
saved_dest_mac(39 downto 32) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_DEST) and (remove_ctr = x"02") ) then\r
+ elsif( (FILTER_CS = REMOVE_DEST) and (remove_ctr = x"02") ) then\r
saved_dest_mac(47 downto 40) <= MAC_RXD_IN;\r
end if;\r
end if;\r
PROC_SAVED_SRC_MAC: process( CLK )\r
begin\r
if( rising_edge(CLK) ) then\r
- if ( filter_current_state = CLEANUP ) then\r
+ if ( FILTER_CS = CLEANUP ) then\r
saved_src_mac <= (others => '0');\r
- elsif( (filter_current_state = REMOVE_DEST) and (remove_ctr = x"03") )then\r
+ elsif( (FILTER_CS = REMOVE_DEST) and (remove_ctr = x"03") )then\r
saved_src_mac(7 downto 0) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_SRC) and (remove_ctr = x"04") ) then\r
+ elsif( (FILTER_CS = REMOVE_SRC) and (remove_ctr = x"04") ) then\r
saved_src_mac(15 downto 8) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_SRC) and (remove_ctr = x"05") ) then\r
+ elsif( (FILTER_CS = REMOVE_SRC) and (remove_ctr = x"05") ) then\r
saved_src_mac(23 downto 16) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_SRC) and (remove_ctr = x"06") ) then\r
+ elsif( (FILTER_CS = REMOVE_SRC) and (remove_ctr = x"06") ) then\r
saved_src_mac(31 downto 24) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_SRC) and (remove_ctr = x"07") ) then\r
+ elsif( (FILTER_CS = REMOVE_SRC) and (remove_ctr = x"07") ) then\r
saved_src_mac(39 downto 32) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_SRC) and (remove_ctr = x"08") ) then\r
+ elsif( (FILTER_CS = REMOVE_SRC) and (remove_ctr = x"08") ) then\r
saved_src_mac(47 downto 40) <= MAC_RXD_IN;\r
end if;\r
end if;\r
PROC_SAVED_FRAME_TYPE: process( CLK )\r
begin\r
if( rising_edge(CLK) ) then\r
- if ( filter_current_state = CLEANUP ) then\r
+ if ( FILTER_CS = CLEANUP ) then\r
saved_frame_type <= (others => '0');\r
- elsif( (filter_current_state = REMOVE_SRC) and (remove_ctr = x"09") ) then\r
+ elsif( (FILTER_CS = REMOVE_SRC) and (remove_ctr = x"09") ) then\r
saved_frame_type(15 downto 8) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_TYPE) and (remove_ctr = x"0a") ) then\r
+ elsif( (FILTER_CS = REMOVE_TYPE) and (remove_ctr = x"0a") ) then\r
saved_frame_type(7 downto 0) <= MAC_RXD_IN;\r
end if;\r
end if;\r
PROC_SAVED_SRC_IP: process( CLK )\r
begin\r
if( rising_edge(CLK) ) then\r
- if ( filter_current_state = CLEANUP ) then\r
+ if ( FILTER_CS = CLEANUP ) then\r
saved_src_ip <= (others => '0');\r
- elsif( (filter_current_state = REMOVE_IP) and (remove_ctr = x"0a") ) then\r
+ elsif( (FILTER_CS = REMOVE_IP) and (remove_ctr = x"0a") ) then\r
saved_src_ip(7 downto 0) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_IP) and (remove_ctr = x"0b") ) then\r
+ elsif( (FILTER_CS = REMOVE_IP) and (remove_ctr = x"0b") ) then\r
saved_src_ip(15 downto 8) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_IP) and (remove_ctr = x"0c") ) then\r
+ elsif( (FILTER_CS = REMOVE_IP) and (remove_ctr = x"0c") ) then\r
saved_src_ip(23 downto 16) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_IP) and (remove_ctr = x"0d") ) then\r
+ elsif( (FILTER_CS = REMOVE_IP) and (remove_ctr = x"0d") ) then\r
saved_src_ip(31 downto 24) <= MAC_RXD_IN;\r
end if;\r
end if;\r
PROC_SAVED_DEST_IP: process( CLK )\r
begin\r
if( rising_edge(CLK) ) then\r
- if ( filter_current_state = CLEANUP ) then\r
+ if ( FILTER_CS = CLEANUP ) then\r
saved_dest_ip <= (others => '0');\r
- elsif( (filter_current_state = REMOVE_IP) and (remove_ctr = x"0e") ) then\r
+ elsif( (FILTER_CS = REMOVE_IP) and (remove_ctr = x"0e") ) then\r
saved_dest_ip(7 downto 0) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_IP) and (remove_ctr = x"0f") ) then\r
+ elsif( (FILTER_CS = REMOVE_IP) and (remove_ctr = x"0f") ) then\r
saved_dest_ip(15 downto 8) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_IP) and (remove_ctr = x"10") ) then\r
+ elsif( (FILTER_CS = REMOVE_IP) and (remove_ctr = x"10") ) then\r
saved_dest_ip(23 downto 16) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_IP) and (remove_ctr = x"11") ) then\r
+ elsif( (FILTER_CS = REMOVE_IP) and (remove_ctr = x"11") ) then\r
saved_dest_ip(31 downto 24) <= MAC_RXD_IN;\r
end if;\r
end if;\r
PROC_SAVED_SRC_UDP: process( CLK )\r
begin\r
if( rising_edge(CLK) ) then\r
- if ( filter_current_state = CLEANUP ) then\r
+ if ( FILTER_CS = CLEANUP ) then\r
saved_src_udp <= (others => '0');\r
- elsif( (filter_current_state = REMOVE_UDP) and (remove_ctr = x"12") ) then\r
+ elsif( (FILTER_CS = REMOVE_UDP) and (remove_ctr = x"12") ) then\r
saved_src_udp(15 downto 8) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_UDP) and (remove_ctr = x"13") ) then\r
+ elsif( (FILTER_CS = REMOVE_UDP) and (remove_ctr = x"13") ) then\r
saved_src_udp(7 downto 0) <= MAC_RXD_IN;\r
end if;\r
end if;\r
PROC_SAVED_DEST_UDP: process( CLK )\r
begin\r
if( rising_edge(CLK) ) then\r
- if ( filter_current_state = CLEANUP ) then\r
+ if ( FILTER_CS = CLEANUP ) then\r
saved_dest_udp <= (others => '0');\r
- elsif( (filter_current_state = REMOVE_UDP) and (remove_ctr = x"14") ) then\r
+ elsif( (FILTER_CS = REMOVE_UDP) and (remove_ctr = x"14") ) then\r
saved_dest_udp(15 downto 8) <= MAC_RXD_IN;\r
- elsif( (filter_current_state = REMOVE_UDP) and (remove_ctr = x"15") ) then\r
+ elsif( (FILTER_CS = REMOVE_UDP) and (remove_ctr = x"15") ) then\r
saved_dest_udp(7 downto 0) <= MAC_RXD_IN;\r
end if;\r
end if;\r
if ( RESET = '1' ) then\r
frame_type_valid <= '0';\r
elsif( rising_edge(CLK) ) then\r
- if ( filter_current_state = SAVE_FRAME ) then\r
+ if ( FILTER_CS = SAVE_FRAME ) then\r
frame_type_valid <= '1';\r
- elsif( filter_current_state = CLEANUP ) then\r
+ elsif( FILTER_CS = CLEANUP ) then\r
frame_type_valid <= '0';\r
end if;\r
end if;\r
PROC_KILLER_PING: process( CLK )\r
begin\r
if( rising_edge(CLK) ) then\r
- if( (filter_current_state = SAVE_FRAME) and\r
+ if( (FILTER_CS = SAVE_FRAME) and\r
(saved_proto = x"01") and\r
(saved_frame_type = x"0800") and\r
(rx_bytes_ctr = x"001A") and\r
rx_data(7 downto 0) <= MAC_RXD_IN;\r
\r
if( MAC_RX_EN_IN = '1' ) then\r
- if ( filter_current_state = SAVE_FRAME ) then\r
+ if ( FILTER_CS = SAVE_FRAME ) then\r
fifo_wr_en <= '1';\r
- elsif( (filter_current_state = DELAY) ) then\r
+ elsif( (FILTER_CS = DELAY) ) then\r
fifo_wr_en <= '1';\r
else\r
fifo_wr_en <= '0';\r
if ( RESET = '1' ) then\r
dbg_drp_frames <= (others => '0');\r
elsif( rising_edge(CLK) ) then\r
- if( (filter_current_state = DELAY) and (frame_type_valid = '0') ) then\r
+ if( (FILTER_CS = DELAY) and (frame_type_valid = '0') ) then\r
dbg_drp_frames <= dbg_drp_frames + 1;\r
end if;\r
end if;\r
entity gbe_logic_wrapper is
generic(
- INCLUDE_SLOWCTRL : std_logic := '0';
- INCLUDE_DHCP : std_logic := '0';
- INCLUDE_ARP : std_logic := '0';
- INCLUDE_PING : std_logic := '0';
- INCLUDE_FWD : std_logic := '0';
- SLOWCTRL_BUFFER_SIZE : integer range 1 to 4 := 1
+ INCLUDE_SLOWCTRL : std_logic := '0';
+ INCLUDE_DHCP : std_logic := '0';
+ INCLUDE_ARP : std_logic := '0';
+ INCLUDE_PING : std_logic := '0';
+ INCLUDE_FWD : std_logic := '0';
+ SLOWCTRL_BUFFER_SIZE : integer range 1 to 4 := 1
);
port(
CLK_125_IN : in std_logic;
signal fr_get_frame : std_logic;
signal mc_transmit_done : std_logic;
--- signal fr_frame_proto : std_logic_vector(15 downto 0);
signal rc_frame_proto : std_logic_vector(c_MAX_PROTOCOLS - 1 downto 0);
signal mc_type : std_logic_vector(15 downto 0);
signal fc_src_ip : std_logic_vector(31 downto 0);
signal fc_src_udp : std_logic_vector(15 downto 0);
signal fc_type : std_logic_vector(15 downto 0);
- signal fc_ihl_version : std_logic_vector(7 downto 0);
- signal fc_tos : std_logic_vector(7 downto 0);
- signal fc_ttl : std_logic_vector(7 downto 0);
signal fc_protocol : std_logic_vector(7 downto 0);
signal ft_data : std_logic_vector(8 downto 0);
signal link_ok : std_logic;
signal dhcp_done : std_logic;
- signal monitor_tx_packets : std_logic_vector(31 downto 0);
- signal monitor_rx_bytes : std_logic_vector(31 downto 0);
- signal monitor_rx_frames : std_logic_vector(31 downto 0);
- signal monitor_tx_bytes : std_logic_vector(31 downto 0);
- signal monitor_tx_frames : std_logic_vector(31 downto 0);
- signal monitor_dropped : std_logic_vector(31 downto 0);
-
+ signal debug_fr : std_logic_vector(31 downto 0);
+
signal make_reset : std_logic;
signal frame_pause : std_logic_vector(31 downto 0);
-- DEBUG_OUT(7 downto 0) <= rc_q(7 downto 0);
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
+ DEBUG_OUT(31 downto 28) <= debug_fr(31 downto 28);
DEBUG_OUT(27 downto 0) <= debug_main(27 downto 0);
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
- fc_ihl_version <= x"45";
- fc_tos <= x"10";
- fc_ttl <= x"ff";
-
DHCP_DONE_OUT <= dhcp_done;
THE_GBE_MAIN_CONTROL: entity work.gbe_main_control
SRC_MAC_ADDRESS_OUT => fc_src_mac,
SRC_IP_ADDRESS_OUT => fc_src_ip,
SRC_UDP_PORT_OUT => fc_src_udp,
- MONITOR_TX_PACKETS_OUT => monitor_tx_packets
+ MONITOR_TX_PACKETS_OUT => MONITOR_TX_PACKETS_OUT
);
THE_FRAME_CONSTR: entity work.gbe_frame_constr
SRC_IP_ADDRESS_IN => fc_src_ip,
SRC_UDP_PORT_IN => fc_src_udp,
FRAME_TYPE_IN => fc_type,
- IHL_VERSION_IN => fc_ihl_version,
- TOS_IN => fc_tos,
+ IHL_VERSION_IN => x"45", --fc_ihl_version,
+ TOS_IN => x"10", --fc_tos,
IDENTIFICATION_IN => fc_ident,
FLAGS_OFFSET_IN => fc_flags_offset,
- TTL_IN => fc_ttl,
+ TTL_IN => x"ff", --fc_ttl,
PROTOCOL_IN => fc_protocol,
FRAME_DELAY_IN => frame_pause,
FT_TX_DATA_OUT => FT_TX_DATA_OUT,
FT_TX_WR_OUT => FT_TX_WR_OUT,
FT_TX_FIFOFULL_IN => FT_TX_FIFOFULL_IN,
- MONITOR_TX_BYTES_OUT => monitor_tx_bytes,
- MONITOR_TX_FRAMES_OUT => monitor_tx_frames
+ MONITOR_TX_BYTES_OUT => MONITOR_TX_BYTES_OUT,
+ MONITOR_TX_FRAMES_OUT => MONITOR_TX_FRAMES_OUT
);
--- frame_pause <= x"0000" & CFG_THROTTLE_PAUSE_IN; -- TAKE CARE!!!
frame_pause <= x"0000" & x"0000"; -- TAKE CARE!!!
THE_RECEIVE_CONTROL: entity work.gbe_receive_control
OOB_REGISTER_2_OUT => OOB_REGISTER_2_OUT,
OOB_REGISTER_3_OUT => OOB_REGISTER_3_OUT,
--
- MONITOR_RX_BYTES_OUT => monitor_rx_bytes,
- MONITOR_RX_FRAMES_OUT => monitor_rx_frames,
- MONITOR_DROPPED_OUT => monitor_dropped,
+ MONITOR_RX_BYTES_OUT => MONITOR_RX_BYTES_OUT,
+ MONITOR_RX_FRAMES_OUT => MONITOR_RX_FRAMES_OUT,
+ MONITOR_DROPPED_OUT => MONITOR_DROPPED_OUT,
--
- DEBUG_OUT(15 downto 0) => open,
- DEBUG_OUT(31 downto 16) => open
+ DEBUG_OUT => debug_fr --open
);
- MONITOR_RX_FRAMES_OUT <= monitor_rx_frames;
- MONITOR_RX_BYTES_OUT <= monitor_rx_bytes;
- MONITOR_TX_FRAMES_OUT <= monitor_tx_frames;
- MONITOR_TX_BYTES_OUT <= monitor_tx_bytes;
- MONITOR_TX_PACKETS_OUT <= monitor_tx_packets;
- MONITOR_DROPPED_OUT <= monitor_dropped;
-
-
end architecture gbe_logic_wrapper_arch;
end if;\r
end process PROC_FLOW_FSM;\r
\r
- PROC_FLOW_TRANSITIONS: process(FLOW_CS, TC_TRANSMIT_DONE_IN, ps_response_ready, tc_data)\r
+ PROC_FLOW_TRANSITIONS: process( FLOW_CS, TC_TRANSMIT_DONE_IN, ps_response_ready, tc_data )\r
begin\r
flow_state <= x"0";\r
\r
GSC_REPLY_READ_OUT => GSC_REPLY_READ_OUT,\r
GSC_BUSY_IN => GSC_BUSY_IN,\r
MAKE_RESET_OUT => MAKE_RESET_OUT,\r
-\r
MY_TRBNET_ADDRESS_IN => MY_TRBNET_ADDRESS_IN,\r
-\r
CFG_MAX_REPLY_SIZE_IN => CFG_MAX_REPLY_SIZE_IN,\r
-\r
FWD_DST_MAC_IN => FWD_DST_MAC_IN,\r
FWD_DST_IP_IN => FWD_DST_IP_IN,\r
FWD_DST_UDP_IN => FWD_DST_UDP_IN,\r
FWD_EOP_IN => FWD_EOP_IN,\r
FWD_READY_OUT => FWD_READY_OUT,\r
FWD_FULL_OUT => FWD_FULL_OUT,\r
-\r
-- input for statistics from outside\r
MONITOR_SELECT_REC_OUT => MONITOR_SELECT_REC_OUT,\r
MONITOR_SELECT_REC_BYTES_OUT => MONITOR_SELECT_REC_BYTES_OUT,\r
end if;\r
end process PROC_SYNC;\r
\r
-\r
PROC_LOADING_DONE: process( CLK )\r
begin\r
if rising_edge(CLK) then\r
- if (RC_DATA_IN(8) = '1' and ps_wr_en_q = '1') then\r
+ if ((RC_DATA_IN(8) = '1') and (ps_wr_en_q = '1') ) then\r
RC_LOADING_DONE_OUT <= '1';\r
else\r
RC_LOADING_DONE_OUT <= '0';\r
PROC_LOADED_BYTES_CTR: process( CLK )\r
begin\r
if rising_edge(CLK) then\r
- if ( REDIRECT_CS = IDLE) then\r
+ if ( REDIRECT_CS = IDLE ) then\r
loaded_bytes_ctr <= (others => '0');\r
elsif( ((REDIRECT_CS = LOAD) or (REDIRECT_CS = DROP)) ) then\r
loaded_bytes_ctr <= loaded_bytes_ctr + 1;\r
signal state : std_logic_vector(3 downto 0);\r
signal proto_code : std_logic_vector(c_MAX_PROTOCOLS - 1 downto 0);\r
signal reset_prioritizer : std_logic;\r
-\r
- -- debug only\r
signal saved_proto : std_logic_vector(c_MAX_PROTOCOLS - 1 downto 0);\r
\r
begin\r
else\r
saved_proto <= (others => '0');\r
end if;\r
- else\r
- saved_proto <= saved_proto;\r
end if;\r
end if;\r
end process SAVED_PROTO_PROC;\r
port(
CLK_125_IN : in std_logic;
RESET : in std_logic;
- GSR_N : in std_logic;
-- we connect to FIFO interface directly
-- FIFO interface TX (send frames)
FIFO_DATA_OUT : out std_logic_vector(8 downto 0);
architecture gbe_response_constructor_ARP_arch of gbe_response_constructor_ARP is
- attribute syn_encoding : string;
+ attribute syn_encoding: string;
type dissect_states is (IDLE, READ_FRAME, DECIDE, LOAD_FRAME, WAIT_FOR_LOAD, CLEANUP);
signal dissect_current_state, dissect_next_state : dissect_states;
when IDLE =>
state <= x"1";
- if (PS_WR_EN_IN = '1' and PS_ACTIVATE_IN = '1') then
+ if( (PS_WR_EN_IN = '1') and (PS_ACTIVATE_IN = '1') ) then
dissect_next_state <= READ_FRAME;
else
dissect_next_state <= IDLE;
when READ_FRAME =>
state <= x"2";
- if (PS_DATA_IN(8) = '1') then
+ if( PS_DATA_IN(8) = '1' ) then
dissect_next_state <= DECIDE;
else
dissect_next_state <= READ_FRAME;
when DECIDE =>
state <= x"3";
- if (saved_target_ip = MY_IP_IN) then
+ if( saved_target_ip = MY_IP_IN ) then
dissect_next_state <= WAIT_FOR_LOAD;
- -- in case the request is not for me, drop it
+ -- in case the request is not for me, drop it
else
dissect_next_state <= IDLE;
end if;
when WAIT_FOR_LOAD =>
state <= x"4";
- if (PS_SELECTED_IN = '1') then
+ if( PS_SELECTED_IN = '1' ) then
dissect_next_state <= LOAD_FRAME;
else
dissect_next_state <= WAIT_FOR_LOAD;
when LOAD_FRAME =>
state <= x"5";
- if (data_ctr = 28) then
+ if( data_ctr = 28 ) then
dissect_next_state <= CLEANUP;
else
dissect_next_state <= LOAD_FRAME;
if ( (dissect_current_state = IDLE) and (PS_WR_EN_IN = '0') ) then
data_ctr <= 0;
-- data_ctr <= 1;
- elsif( dissect_current_state = WAIT_FOR_LOAD ) then
+ elsif( (dissect_current_state = WAIT_FOR_LOAD) ) then
data_ctr <= 1;
- elsif( dissect_current_state = IDLE and PS_WR_EN_IN = '1' and PS_ACTIVATE_IN = '1' ) then
+ elsif( (dissect_current_state = IDLE) and (PS_WR_EN_IN = '1') and (PS_ACTIVATE_IN = '1') ) then
data_ctr <= data_ctr + 1;
- elsif( dissect_current_state = READ_FRAME and PS_WR_EN_IN = '1' and PS_ACTIVATE_IN = '1' ) then -- in case of saving data from incoming frame
+ elsif( (dissect_current_state = READ_FRAME) and (PS_WR_EN_IN = '1') and (PS_ACTIVATE_IN = '1') ) then -- in case of saving data from incoming frame
data_ctr <= data_ctr + 1;
- elsif( dissect_current_state = LOAD_FRAME and PS_SELECTED_IN = '1' and TC_RD_EN_IN = '1' ) then -- in case of constructing response
+ elsif( (dissect_current_state = LOAD_FRAME) and (PS_SELECTED_IN = '1') and (TC_RD_EN_IN = '1') ) then -- in case of constructing response
data_ctr <= data_ctr + 1;
end if;
end if;
saved_sender_ip <= (others => '0');
saved_target_ip <= (others => '0');
elsif( rising_edge(CLK) ) then
- if (dissect_current_state = READ_FRAME) then
- case (data_ctr) is
+ if( dissect_current_state = READ_FRAME ) then
+ case data_ctr is
when 6 =>
- saved_opcode(7 downto 0) <= PS_DATA_IN(7 downto 0);
+ saved_opcode(7 downto 0) <= PS_DATA_IN(7 downto 0);
when 7 =>
saved_opcode(15 downto 8) <= PS_DATA_IN(7 downto 0);
when 13 =>
if( rising_edge(CLK) ) then
tc_data(8) <= '0';
- if (dissect_current_state = LOAD_FRAME) then
+ if( dissect_current_state = LOAD_FRAME ) then
for i in 0 to 7 loop
tc_data(i) <= values((data_ctr - 1) * 8 + i);
end loop;
-- mark the last byte
- if (data_ctr = 28) then
+ if( data_ctr = 28 ) then
tc_data(8) <= '1';
end if;
else
PROC_PS_RESPONSE_SYNC: process( CLK )
begin
if( rising_edge(CLK) ) then
- if( dissect_current_state = WAIT_FOR_LOAD or dissect_current_state = LOAD_FRAME or dissect_current_state = CLEANUP ) then
+ if( (dissect_current_state = WAIT_FOR_LOAD) or (dissect_current_state = LOAD_FRAME) or (dissect_current_state = CLEANUP) ) then
PS_RESPONSE_READY_OUT <= '1';
else
PS_RESPONSE_READY_OUT <= '0';
end process PROC_PS_RESPONSE_SYNC;
TC_FRAME_SIZE_OUT <= x"001c"; -- fixed frame size
-
TC_FRAME_TYPE_OUT <= x"0608";
TC_DEST_MAC_OUT <= PS_SRC_MAC_ADDRESS_IN;
TC_DEST_IP_OUT <= x"00000000"; -- doesnt matter
TC_IDENT_OUT <= (others => '0'); -- doesn't matter
end gbe_response_constructor_ARP_arch;
-
-
attribute syn_encoding : string;\r
\r
type main_states is (BOOTING, DELAY, SENDING_DISCOVER, WAITING_FOR_OFFER, SENDING_REQUEST, WAITING_FOR_ACK, ESTABLISHED);\r
- signal main_current_state, main_next_state : main_states;\r
- attribute syn_encoding of main_current_state: signal is "onehot";\r
+ signal MAIN_CS, MAIN_NS : main_states;\r
+ attribute syn_encoding of MAIN_CS: signal is "onehot";\r
\r
type receive_states is (IDLE, DISCARD, CLEANUP, SAVE_VALUES);\r
- signal receive_current_state, receive_next_state : receive_states;\r
- attribute syn_encoding of receive_current_state: signal is "onehot";\r
+ signal RECEIVE_CS, RECEIVE_NS : receive_states;\r
+ attribute syn_encoding of RECEIVE_CS: signal is "onehot";\r
\r
type discover_states is (IDLE, WAIT_FOR_LOAD, BOOTP_HEADERS, CLIENT_IP, YOUR_IP, ZEROS1, MY_MAC, ZEROS2, VENDOR_VALS, VENDOR_VALS2, TERMINATION, CLEANUP);\r
- signal construct_current_state, construct_next_state : discover_states;\r
- attribute syn_encoding of construct_current_state: signal is "onehot";\r
+ signal CONSTRUCT_CS, CONSTRUCT_NS : discover_states;\r
+ attribute syn_encoding of CONSTRUCT_CS: signal is "onehot";\r
\r
- type stats_states is (IDLE, LOAD_SENT, LOAD_RECEIVED, LOAD_DISCARDED, CLEANUP);\r
- signal stats_current_state, stats_next_state : stats_states;\r
- attribute syn_encoding of stats_current_state : signal is "onehot";\r
+-- type stats_states is (IDLE, LOAD_SENT, LOAD_RECEIVED, LOAD_DISCARDED, CLEANUP);\r
+-- signal STATS_CS, STATS_NS : stats_states;\r
+-- attribute syn_encoding of STATS_CS : signal is "onehot";\r
\r
signal state : std_logic_vector(3 downto 0);\r
signal rec_frames : std_logic_vector(15 downto 0);\r
\r
signal wait_value : unsigned(31 downto 0);\r
\r
- signal my_ip : std_logic_vector(31 downto 0);\r
-\r
begin\r
\r
-- ****\r
-- fixing the constant values for DHCP request headers\r
- TC_DEST_MAC_OUT <= x"ffffffffffff" when (main_current_state = BOOTING or main_current_state = SENDING_DISCOVER) else saved_server_mac;\r
- TC_DEST_IP_OUT <= x"ffffffff" when (main_current_state = BOOTING or main_current_state = SENDING_DISCOVER) else saved_server_ip;\r
+ TC_DEST_MAC_OUT <= x"ffffffffffff" when (MAIN_CS = BOOTING or MAIN_CS = SENDING_DISCOVER) else saved_server_mac;\r
+ TC_DEST_IP_OUT <= x"ffffffff" when (MAIN_CS = BOOTING or MAIN_CS = SENDING_DISCOVER) else saved_server_ip;\r
TC_DEST_UDP_OUT <= x"4300";\r
TC_SRC_MAC_OUT <= MY_MAC_IN;\r
- TC_SRC_IP_OUT <= x"00000000" when (main_current_state = BOOTING or main_current_state = SENDING_DISCOVER) else saved_proposed_ip;\r
+ TC_SRC_IP_OUT <= x"00000000" when (MAIN_CS = BOOTING or MAIN_CS = SENDING_DISCOVER) else saved_proposed_ip;\r
TC_SRC_UDP_OUT <= x"4400";\r
TC_IP_PROTOCOL_OUT <= x"11"; -- udp\r
bootp_hdr(7 downto 0) <= x"01"; -- message type(request)\r
bootp_hdr(95 downto 64) <= x"0000_0000"; -- seconds elapsed/flags\r
transaction_id <= x"cefa" & MY_MAC_IN(47 downto 40) & MY_MAC_IN(23 downto 16);\r
vendor_values(31 downto 0) <= x"63538263"; -- magic cookie (dhcp message)\r
- vendor_values(55 downto 32) <= x"010135" when (main_current_state = BOOTING or main_current_state = SENDING_DISCOVER) else x"030135"; -- dhcp discover, then dhcp request\r
+ vendor_values(55 downto 32) <= x"010135" when (MAIN_CS = BOOTING or MAIN_CS = SENDING_DISCOVER) else x"030135"; -- dhcp discover, then dhcp request\r
vendor_values(79 downto 56) <= x"01073d"; -- client identifier\r
vendor_values(127 downto 80) <= MY_MAC_IN; -- client identifier\r
vendor_values(143 downto 128) <= x"040c"; -- client name\r
\r
--*****************\r
-- setting of global variable for IP address\r
- my_ip <= saved_true_ip when main_current_state = ESTABLISHED else (others => '0');\r
- MY_IP_OUT <= my_ip;\r
- --\r
+ MY_IP_OUT <= saved_true_ip when (MAIN_CS) = ESTABLISHED else (others => '0');\r
--*****************\r
\r
PROC_SAVE_SERVER_ADDR: process( CLK )\r
begin\r
if( rising_edge(CLK) ) then\r
- if ( main_current_state = BOOTING ) then\r
+ if ( MAIN_CS = BOOTING ) then\r
saved_server_mac <= (others => '0');\r
saved_server_ip <= (others => '0');\r
- elsif( (main_current_state = WAITING_FOR_OFFER) and (receive_current_state = SAVE_VALUES and save_ctr = 1) ) then\r
+ elsif( (MAIN_CS = WAITING_FOR_OFFER) and (RECEIVE_CS = SAVE_VALUES and save_ctr = 1) ) then\r
saved_server_mac <= PS_SRC_MAC_ADDRESS_IN;\r
saved_server_ip <= PS_SRC_IP_ADDRESS_IN;\r
end if;\r
end if;\r
end process PROC_SAVE_SERVER_ADDR;\r
\r
-\r
-- **** MAIN MACHINE PART\r
\r
PROC_MAIN_FSM: process( CLK, RESET)\r
begin\r
if ( RESET = '1' ) then\r
- main_current_state <= BOOTING;\r
+ MAIN_CS <= BOOTING;\r
elsif( rising_edge(CLK) ) then\r
- main_current_state <= main_next_state;\r
+ MAIN_CS <= MAIN_NS;\r
end if;\r
end process PROC_MAIN_FSM;\r
\r
wait_value <= x"2000_0000";\r
-- wait_value <= x"0000_2000";\r
\r
- PROC_MAIN_TRANSITIONS : process(main_current_state, DHCP_START_IN, construct_current_state, wait_ctr, receive_current_state, PS_DATA_IN, wait_value)\r
+ PROC_MAIN_TRANSITIONS : process( MAIN_CS, DHCP_START_IN, CONSTRUCT_CS, wait_ctr, RECEIVE_CS, PS_DATA_IN, wait_value )\r
begin\r
state2 <= x"0";\r
\r
- case (main_current_state) is\r
+ case (MAIN_CS) is\r
\r
when BOOTING =>\r
state2 <= x"1";\r
- if (DHCP_START_IN = '1') then\r
- main_next_state <= DELAY;\r
+ if( DHCP_START_IN = '1' ) then\r
+ MAIN_NS <= DELAY;\r
else\r
- main_next_state <= BOOTING;\r
+ MAIN_NS <= BOOTING;\r
end if;\r
\r
when DELAY =>\r
state2 <= x"2";\r
- if (wait_ctr = wait_value) then\r
- main_next_state <= SENDING_DISCOVER;\r
+ if( wait_ctr = wait_value ) then\r
+ MAIN_NS <= SENDING_DISCOVER;\r
else\r
- main_next_state <= DELAY;\r
+ MAIN_NS <= DELAY;\r
end if;\r
\r
when SENDING_DISCOVER =>\r
state2 <= x"3";\r
- if (construct_current_state = CLEANUP) then\r
- main_next_state <= WAITING_FOR_OFFER;\r
+ if( CONSTRUCT_CS = CLEANUP ) then\r
+ MAIN_NS <= WAITING_FOR_OFFER;\r
else\r
- main_next_state <= SENDING_DISCOVER;\r
+ MAIN_NS <= SENDING_DISCOVER;\r
end if;\r
\r
when WAITING_FOR_OFFER =>\r
state2 <= x"4";\r
- if (receive_current_state = SAVE_VALUES) and (PS_DATA_IN(8) = '1') then\r
- main_next_state <= SENDING_REQUEST;\r
- elsif (wait_ctr = x"2000_0000") then\r
- main_next_state <= BOOTING;\r
+ if( (RECEIVE_CS = SAVE_VALUES) and (PS_DATA_IN(8) = '1') ) then\r
+ MAIN_NS <= SENDING_REQUEST;\r
+ elsif( wait_ctr = x"2000_0000" ) then\r
+ MAIN_NS <= BOOTING;\r
else\r
- main_next_state <= WAITING_FOR_OFFER;\r
+ MAIN_NS <= WAITING_FOR_OFFER;\r
end if;\r
\r
when SENDING_REQUEST =>\r
state2 <= x"5";\r
- if (construct_current_state = CLEANUP) then\r
- main_next_state <= WAITING_FOR_ACK;\r
+ if( CONSTRUCT_CS = CLEANUP ) then\r
+ MAIN_NS <= WAITING_FOR_ACK;\r
else\r
- main_next_state <= SENDING_REQUEST;\r
+ MAIN_NS <= SENDING_REQUEST;\r
end if;\r
\r
when WAITING_FOR_ACK =>\r
state2 <= x"6";\r
- if (receive_current_state = SAVE_VALUES) and (PS_DATA_IN(8) = '1') then\r
- main_next_state <= ESTABLISHED;\r
- elsif (wait_ctr = x"2000_0000") then\r
- main_next_state <= BOOTING;\r
+ if( (RECEIVE_CS = SAVE_VALUES) and (PS_DATA_IN(8) = '1') ) then\r
+ MAIN_NS <= ESTABLISHED;\r
+ elsif( wait_ctr = x"2000_0000" ) then\r
+ MAIN_NS <= BOOTING;\r
else\r
- main_next_state <= WAITING_FOR_ACK;\r
+ MAIN_NS <= WAITING_FOR_ACK;\r
end if;\r
\r
when ESTABLISHED =>\r
state2 <= x"7";\r
if( DHCP_START_IN = '0' ) then\r
- main_next_state <= BOOTING;\r
+ MAIN_NS <= BOOTING;\r
else\r
- main_next_state <= ESTABLISHED;\r
+ MAIN_NS <= ESTABLISHED;\r
end if;\r
\r
- when others => main_next_state <= BOOTING;\r
+ when others => \r
+ MAIN_NS <= BOOTING;\r
\r
end case;\r
\r
PROC_WAIT_CTR: process( CLK )\r
begin\r
if( rising_edge(CLK) ) then\r
- if ( main_current_state = SENDING_DISCOVER or main_current_state = SENDING_REQUEST or main_current_state = BOOTING ) then\r
+ if ( (MAIN_CS = SENDING_DISCOVER) or (MAIN_CS = SENDING_REQUEST) or (MAIN_CS = BOOTING) ) then\r
wait_ctr <= (others => '0');\r
- elsif( main_current_state = WAITING_FOR_ACK and receive_current_state = SAVE_VALUES and PS_DATA_IN(8) = '1' ) then\r
+ elsif( (MAIN_CS = WAITING_FOR_ACK) and (RECEIVE_CS = SAVE_VALUES) and (PS_DATA_IN(8) = '1') ) then\r
wait_ctr <= (others => '0');\r
- elsif( main_current_state = WAITING_FOR_ACK or main_current_state = WAITING_FOR_OFFER or main_current_state = DELAY or main_current_state = ESTABLISHED ) then\r
+ elsif( (MAIN_CS = WAITING_FOR_ACK) or (MAIN_CS = WAITING_FOR_OFFER) or (MAIN_CS = DELAY) or (MAIN_CS = ESTABLISHED) ) then\r
wait_ctr <= wait_ctr + 1;\r
end if;\r
end if;\r
end process PROC_WAIT_CTR;\r
\r
- DHCP_DONE_OUT <= '1' when main_current_state = ESTABLISHED else '0';\r
+ DHCP_DONE_OUT <= '1' when MAIN_CS = ESTABLISHED else '0';\r
\r
-- **** MESSAGES RECEIVING PART\r
\r
PROC_RECEIVE_FSM: process( CLK, RESET )\r
begin\r
if ( RESET = '1' ) then\r
- receive_current_state <= IDLE;\r
+ RECEIVE_CS <= IDLE;\r
elsif( rising_edge(CLK) ) then\r
- receive_current_state <= receive_next_state;\r
+ RECEIVE_CS <= RECEIVE_NS;\r
end if;\r
end process PROC_RECEIVE_FSM;\r
\r
- PROC_RECEIVE_TRANSITIONS: process( receive_current_state, main_current_state, bootp_hdr, saved_dhcp_type, saved_transaction_id,\r
+ PROC_RECEIVE_TRANSITIONS: process( RECEIVE_CS, MAIN_CS, bootp_hdr, saved_dhcp_type, saved_transaction_id,\r
PS_DATA_IN, PS_DEST_MAC_ADDRESS_IN, MY_MAC_IN, PS_ACTIVATE_IN, PS_WR_EN_IN, save_ctr )\r
begin\r
state3 <= x"0";\r
\r
- case receive_current_state is\r
+ case RECEIVE_CS is\r
\r
when IDLE =>\r
state3 <= x"1";\r
- if (PS_ACTIVATE_IN = '1' and PS_WR_EN_IN = '1') then\r
- if (main_current_state = WAITING_FOR_OFFER or main_current_state = WAITING_FOR_ACK) then -- ready to receive dhcp frame\r
- if (PS_DEST_MAC_ADDRESS_IN = MY_MAC_IN) then -- check if i'm the addressee (discards broadcasts also)\r
- receive_next_state <= SAVE_VALUES;\r
+ if( (PS_ACTIVATE_IN = '1') and (PS_WR_EN_IN = '1') ) then\r
+ if( (MAIN_CS = WAITING_FOR_OFFER) or (MAIN_CS = WAITING_FOR_ACK) ) then -- ready to receive dhcp frame\r
+ if( PS_DEST_MAC_ADDRESS_IN = MY_MAC_IN ) then -- check if i'm the addressee (discards broadcasts also)\r
+ RECEIVE_NS <= SAVE_VALUES;\r
else\r
- receive_next_state <= DISCARD; -- discard if the frame is not for me\r
+ RECEIVE_NS <= DISCARD; -- discard if the frame is not for me\r
end if;\r
else\r
- receive_next_state <= DISCARD; -- discard if the frame arrived at wrong time\r
+ RECEIVE_NS <= DISCARD; -- discard if the frame arrived at wrong time\r
end if;\r
else\r
- receive_next_state <= IDLE;\r
+ RECEIVE_NS <= IDLE;\r
end if;\r
\r
when SAVE_VALUES =>\r
state3 <= x"2";\r
- if (PS_DATA_IN(8) = '1') then\r
- receive_next_state <= CLEANUP;\r
+ if ( PS_DATA_IN(8) = '1' ) then\r
+ RECEIVE_NS <= CLEANUP;\r
-- check if the same transaction\r
- elsif (save_ctr = 9) and (saved_transaction_id /= bootp_hdr(63 downto 32)) then\r
- receive_next_state <= DISCARD;\r
+ elsif( (save_ctr = 9) and (saved_transaction_id /= bootp_hdr(63 downto 32)) ) then\r
+ RECEIVE_NS <= DISCARD;\r
-- if the wrong message at the wrong time\r
- elsif (main_current_state = WAITING_FOR_OFFER) and (save_ctr = 242) and (saved_dhcp_type /= x"020135") then\r
- receive_next_state <= DISCARD;\r
+ elsif( (MAIN_CS = WAITING_FOR_OFFER) and (save_ctr = 242) and (saved_dhcp_type /= x"020135") ) then\r
+ RECEIVE_NS <= DISCARD;\r
-- if the wrong message at the wrong time\r
- elsif (main_current_state = WAITING_FOR_ACK) and (save_ctr = 242) and (saved_dhcp_type /= x"050135") then\r
- receive_next_state <= DISCARD;\r
+ elsif( (MAIN_CS = WAITING_FOR_ACK) and (save_ctr = 242) and (saved_dhcp_type /= x"050135") ) then\r
+ RECEIVE_NS <= DISCARD;\r
else\r
- receive_next_state <= SAVE_VALUES;\r
+ RECEIVE_NS <= SAVE_VALUES;\r
end if;\r
\r
when DISCARD =>\r
state3 <= x"3";\r
- if (PS_DATA_IN(8) = '1') then\r
- receive_next_state <= CLEANUP;\r
+ if( PS_DATA_IN(8) = '1' ) then\r
+ RECEIVE_NS <= CLEANUP;\r
else\r
- receive_next_state <= DISCARD;\r
+ RECEIVE_NS <= DISCARD;\r
end if;\r
\r
when CLEANUP =>\r
state3 <= x"4";\r
- receive_next_state <= IDLE;\r
+ RECEIVE_NS <= IDLE;\r
\r
- when others => receive_next_state <= IDLE;\r
+ when others => \r
+ RECEIVE_NS <= IDLE;\r
\r
end case;\r
\r
PROC_SAVE_CTR: process( CLK )\r
begin\r
if( rising_edge(CLK) ) then\r
- if ( receive_current_state = IDLE ) then\r
+ if ( RECEIVE_CS = IDLE ) then\r
save_ctr <= 0;\r
- elsif( receive_current_state = SAVE_VALUES and PS_WR_EN_IN = '1' and PS_ACTIVATE_IN = '1' ) then\r
+ elsif( (RECEIVE_CS = SAVE_VALUES) and (PS_WR_EN_IN = '1') and (PS_ACTIVATE_IN = '1') ) then\r
save_ctr <= save_ctr + 1;\r
end if;\r
end if;\r
PROC_SAVE_VALUES: process( CLK )\r
begin\r
if( rising_edge(CLK) ) then\r
- if ( main_current_state = BOOTING ) then\r
+ if ( MAIN_CS = BOOTING ) then\r
saved_transaction_id <= (others => '0');\r
saved_proposed_ip <= (others => '0');\r
saved_true_ip <= (others => '0');\r
saved_dhcp_type <= (others => '0');\r
-- dissection of DHCP Offer message\r
- elsif( main_current_state = WAITING_FOR_OFFER and receive_current_state = SAVE_VALUES ) then\r
+ elsif( (MAIN_CS = WAITING_FOR_OFFER) and (RECEIVE_CS = SAVE_VALUES) ) then\r
\r
saved_true_ip <= saved_true_ip;\r
\r
\r
end case;\r
-- dissection on DHCP Ack message\r
- elsif( main_current_state = WAITING_FOR_ACK and receive_current_state = SAVE_VALUES ) then\r
+ elsif( (MAIN_CS = WAITING_FOR_ACK) and (RECEIVE_CS = SAVE_VALUES) ) then\r
\r
saved_proposed_ip <= saved_proposed_ip;\r
\r
when 6 =>\r
saved_transaction_id(31 downto 24) <= PS_DATA_IN(7 downto 0);\r
\r
-\r
when 15 =>\r
saved_true_ip(7 downto 0) <= PS_DATA_IN(7 downto 0);\r
\r
when 18 =>\r
saved_true_ip(31 downto 24) <= PS_DATA_IN(7 downto 0);\r
\r
-\r
when 239 =>\r
saved_dhcp_type(7 downto 0) <= PS_DATA_IN(7 downto 0);\r
\r
when 241 =>\r
saved_dhcp_type(23 downto 16) <= PS_DATA_IN(7 downto 0);\r
\r
- when others => null;\r
+ when others => \r
+ null;\r
\r
end case;\r
end if;\r
PROC_CONSTRUCT_FSM: process( CLK, RESET )\r
begin\r
if ( RESET = '1' ) then\r
- construct_current_state <= IDLE;\r
+ CONSTRUCT_CS <= IDLE;\r
elsif( rising_edge(CLK) ) then\r
- if( main_current_state = BOOTING ) then\r
- construct_current_state <= IDLE;\r
+ if( MAIN_CS = BOOTING ) then\r
+ CONSTRUCT_CS <= IDLE;\r
else\r
- construct_current_state <= construct_next_state;\r
+ CONSTRUCT_CS <= CONSTRUCT_NS;\r
end if;\r
end if;\r
end process PROC_CONSTRUCT_FSM;\r
\r
- PROC_CONSTRUCT_TRANSITIONS: process( construct_current_state, main_current_state, load_ctr, PS_SELECTED_IN )\r
+ PROC_CONSTRUCT_TRANSITIONS: process( CONSTRUCT_CS, MAIN_CS, load_ctr, PS_SELECTED_IN )\r
begin\r
state <= x"0";\r
\r
- case construct_current_state is\r
+ case CONSTRUCT_CS is\r
\r
when IDLE =>\r
state <= x"1";\r
- if (main_current_state = SENDING_DISCOVER) or (main_current_state = SENDING_REQUEST) then\r
- construct_next_state <= WAIT_FOR_LOAD;\r
+ if( (MAIN_CS = SENDING_DISCOVER) or (MAIN_CS = SENDING_REQUEST) ) then\r
+ CONSTRUCT_NS <= WAIT_FOR_LOAD;\r
else\r
- construct_next_state <= IDLE;\r
+ CONSTRUCT_NS <= IDLE;\r
end if;\r
\r
when WAIT_FOR_LOAD =>\r
state <= x"2";\r
- if (PS_SELECTED_IN = '1') then\r
- construct_next_state <= BOOTP_HEADERS;\r
+ if( PS_SELECTED_IN = '1' ) then\r
+ CONSTRUCT_NS <= BOOTP_HEADERS;\r
else\r
- construct_next_state <= WAIT_FOR_LOAD;\r
+ CONSTRUCT_NS <= WAIT_FOR_LOAD;\r
end if;\r
\r
-\r
when BOOTP_HEADERS =>\r
state <= x"3";\r
- if (load_ctr = 11) then\r
- construct_next_state <= CLIENT_IP;\r
+ if( load_ctr = 11 ) then\r
+ CONSTRUCT_NS <= CLIENT_IP;\r
else\r
- construct_next_state <= BOOTP_HEADERS;\r
+ CONSTRUCT_NS <= BOOTP_HEADERS;\r
end if;\r
\r
when CLIENT_IP =>\r
state <= x"4";\r
- if (load_ctr = 15) then\r
- construct_next_state <= YOUR_IP;\r
+ if( load_ctr = 15 ) then\r
+ CONSTRUCT_NS <= YOUR_IP;\r
else\r
- construct_next_state <= CLIENT_IP;\r
+ CONSTRUCT_NS <= CLIENT_IP;\r
end if;\r
\r
when YOUR_IP =>\r
state <= x"5";\r
- if (load_ctr = 19) then\r
- construct_next_state <= ZEROS1;\r
+ if( load_ctr = 19 ) then\r
+ CONSTRUCT_NS <= ZEROS1;\r
else\r
- construct_next_state <= YOUR_IP;\r
+ CONSTRUCT_NS <= YOUR_IP;\r
end if;\r
\r
when ZEROS1 =>\r
state <= x"6";\r
- if (load_ctr = 27) then\r
- construct_next_state <= MY_MAC;\r
+ if( load_ctr = 27 ) then\r
+ CONSTRUCT_NS <= MY_MAC;\r
else\r
- construct_next_state <= ZEROS1;\r
+ CONSTRUCT_NS <= ZEROS1;\r
end if;\r
\r
when MY_MAC =>\r
state <= x"7";\r
- if (load_ctr = 33) then\r
- construct_next_state <= ZEROS2;\r
+ if( load_ctr = 33 ) then\r
+ CONSTRUCT_NS <= ZEROS2;\r
else\r
- construct_next_state <= MY_MAC;\r
+ CONSTRUCT_NS <= MY_MAC;\r
end if;\r
\r
when ZEROS2 =>\r
state <= x"8";\r
- if (load_ctr = 235) then\r
- construct_next_state <= VENDOR_VALS;\r
+ if( load_ctr = 235 ) then\r
+ CONSTRUCT_NS <= VENDOR_VALS;\r
else\r
- construct_next_state <= ZEROS2;\r
+ CONSTRUCT_NS <= ZEROS2;\r
end if;\r
\r
when VENDOR_VALS =>\r
state <= x"9";\r
- if (load_ctr = 257) then\r
+ if( load_ctr = 257 ) then\r
-- for discover it's enough of values\r
- if (main_current_state = SENDING_DISCOVER) then\r
- construct_next_state <= TERMINATION;\r
+ if( MAIN_CS = SENDING_DISCOVER ) then\r
+ CONSTRUCT_NS <= TERMINATION;\r
-- for request there is some more values needed\r
else\r
- construct_next_state <= VENDOR_VALS2;\r
+ CONSTRUCT_NS <= VENDOR_VALS2;\r
end if;\r
else\r
- construct_next_state <= VENDOR_VALS;\r
+ CONSTRUCT_NS <= VENDOR_VALS;\r
end if;\r
\r
when VENDOR_VALS2 =>\r
state <= x"a";\r
- if (load_ctr = 263) then\r
- construct_next_state <= TERMINATION;\r
+ if( load_ctr = 263 ) then\r
+ CONSTRUCT_NS <= TERMINATION;\r
else\r
- construct_next_state <= VENDOR_VALS2;\r
+ CONSTRUCT_NS <= VENDOR_VALS2;\r
end if;\r
\r
when TERMINATION =>\r
state <= x"b";\r
- construct_next_state <= CLEANUP;\r
+ CONSTRUCT_NS <= CLEANUP;\r
\r
when CLEANUP =>\r
state <= x"c";\r
- construct_next_state <= IDLE;\r
+ CONSTRUCT_NS <= IDLE;\r
\r
- when others => construct_next_state <= IDLE;\r
+ when others => \r
+ CONSTRUCT_NS <= IDLE;\r
\r
end case;\r
end process PROC_CONSTRUCT_TRANSITIONS;\r
PROC_LOAD_CTR: process( CLK )\r
begin\r
if( rising_edge(CLK) ) then\r
- if ( construct_current_state = IDLE ) then\r
+ if ( CONSTRUCT_CS = IDLE ) then\r
load_ctr <= 0;\r
elsif( (TC_RD_EN_IN = '1') and (PS_SELECTED_IN = '1') ) then\r
load_ctr <= load_ctr + 1;\r
PROC_TC_DATA: process( CLK )\r
begin\r
if( rising_edge(CLK) ) then\r
- case (construct_current_state) is\r
+ case (CONSTRUCT_CS) is\r
\r
when BOOTP_HEADERS =>\r
for i in 0 to 7 loop\r
tc_data(8) <= '0';\r
\r
when CLIENT_IP =>\r
- if (main_current_state = SENDING_DISCOVER) then\r
+ if ( MAIN_CS = SENDING_DISCOVER ) then\r
tc_data(7 downto 0) <= x"00";\r
- elsif (main_current_state = SENDING_REQUEST) then\r
+ elsif( MAIN_CS = SENDING_REQUEST ) then\r
for i in 0 to 7 loop\r
tc_data(i) <= saved_proposed_ip((load_ctr - 12) * 8 + i);\r
end loop;\r
PROC_PS_RESPONSE_SYNC: process( CLK )\r
begin\r
if( rising_edge(CLK) ) then\r
- if( construct_current_state = IDLE or construct_current_state = CLEANUP ) then\r
+ if( (CONSTRUCT_CS = IDLE) or (CONSTRUCT_CS = CLEANUP) ) then\r
PS_RESPONSE_READY_OUT <= '0';\r
else\r
PS_RESPONSE_READY_OUT <= '1';\r
end if;\r
\r
- if( construct_current_state = IDLE ) then\r
+ if( CONSTRUCT_CS = IDLE ) then\r
PS_BUSY_OUT <= '0';\r
else\r
PS_BUSY_OUT <= '1';\r
end process PROC_PS_RESPONSE_SYNC;\r
\r
-- fixed sizes for discover and request messages\r
- TC_FRAME_SIZE_OUT <= x"0103" when (main_current_state = SENDING_DISCOVER) else x"0109";\r
+ TC_FRAME_SIZE_OUT <= x"0103" when (MAIN_CS = SENDING_DISCOVER) else x"0109";\r
TC_FRAME_TYPE_OUT <= x"0008"; -- frame type: ip\r
TC_IDENT_OUT <= x"1" & std_logic_vector(sent_frames(11 downto 0));\r
\r
if ( RESET = '1') then\r
sent_frames <= (others => '0');\r
elsif( rising_edge(CLK) ) then\r
- if( construct_current_state = CLEANUP ) then\r
+ if( CONSTRUCT_CS = CLEANUP ) then\r
sent_frames <= sent_frames + 1;\r
end if;\r
end if;\r