Hi! Thanks a lot to the developer of the 1G UDP/IP stack. It works well and was easy to integrate.
However, I found an issue which could lead to a wrong first byte of the TX IP frame (destination MAC address). It also seems to depend on the implementation of the TEMAC. I tested it with Xilinx XCVU9P-L2FLGA2104E FPGA and tri_mode_ethernet_mac v9.0 (axi_ethernet v7.1 IP).
In IPv4_TX.vhd, sending the TX IP frame starts in state SEND_ETH_HDR. When entering this state, mac_data_valid is asserted to indicate that data is there. However, mac_data_out has no valid data yet because the assignment occurs only when mac_data_out_ready is asserted. In my case, the TEMAC still propagated this wrong first byte although mac_data_out_ready was not valid in the beginning.
That's why I suggest to always assign the correct value to mac_data_out and only use mac_data_out_ready to calculate the next state in the TX FSM. Here is the new code snippet I propose for the state SEND_ETH_HDR in IPv4_TX.vhd:
when SEND_ETH_HDR =>
ip_tx_data_out_ready <= '0'; -- in this state, we are unable to accept user data for tx
if mac_data_out_ready = '1' then
if tx_count < x"00d" then
tx_count_mode <= INCR;
elsif tx_count = x"00d" then
tx_count_mode <= RST;
next_tx_state <= SEND_IP_HDR;
set_tx_state <= '1';
else
-- shouldnt get here - handle as error
next_tx_result <= IPTX_RESULT_ERR;
set_tx_result <= '1';
next_tx_state <= IDLE;
set_tx_state <= '1';
end if;
end if;
case tx_count is
when x"000" =>
mac_data_out_first <= mac_data_out_ready;
tx_data <= tx_mac (47 downto 40); -- trg = mac from ARP lookup
when x"001" => tx_data <= tx_mac (39 downto 32);
when x"002" => tx_data <= tx_mac (31 downto 24);
when x"003" => tx_data <= tx_mac (23 downto 16);
when x"004" => tx_data <= tx_mac (15 downto 8);
when x"005" => tx_data <= tx_mac (7 downto 0);
when x"006" => tx_data <= our_mac_address (47 downto 40); -- src = our mac
when x"007" => tx_data <= our_mac_address (39 downto 32);
when x"008" => tx_data <= our_mac_address (31 downto 24);
when x"009" => tx_data <= our_mac_address (23 downto 16);
when x"00a" => tx_data <= our_mac_address (15 downto 8);
when x"00b" => tx_data <= our_mac_address (7 downto 0);
when x"00c" => tx_data <= x"08"; -- pkt type = 0800 : IP
when x"00d" => tx_data <= x"00";
when others => tx_data <= x"00";
end case;