diff --git a/trashernet/trashernet_mac.vhd b/trashernet/trashernet_mac.vhd index db548d3..caad636 100644 --- a/trashernet/trashernet_mac.vhd +++ b/trashernet/trashernet_mac.vhd @@ -215,6 +215,8 @@ begin phy_in.tx_data_en <= '1' when tx_state /= IDLE else '0'; crc_clear <= '1' when tx_state = HEADER else '0'; phy_in.tx_data <= sr(sr'low); + + mac_out.tx_active <= phy_out.tx_active; end block tx; end architecture rtl; diff --git a/trashernet/trashernet_pkg.vhd b/trashernet/trashernet_pkg.vhd index 3426b32..9c5244e 100644 --- a/trashernet/trashernet_pkg.vhd +++ b/trashernet/trashernet_pkg.vhd @@ -29,6 +29,11 @@ package trashernet_pkg is -- IP specific types subtype ip_addr_t is byte_vector(0 to 3); + -- Configuration interface + type configuration_t is record + mac_address : mac_addr_t; -- MAC address of this node + end record configuration_t; + -- PHY interface type phy_in_t is record tx_data : byte; -- TX Data @@ -59,11 +64,41 @@ package trashernet_pkg is rx_mac_data : byte; -- Ethernet data (after Ethertype) rx_mac_valid : std_logic; -- `rx_mac` values (headers + data) are valid tx_mac_data_ack : std_logic; -- The byte on `tx_mac_data` has been latched. Update to next word. + tx_active : std_logic; -- Transmission in progress rx_mac_crc_ok : std_logic; -- End of packet, CRC OK (strobe independent from other rx_mac fields) rx_mac_crc_error : std_logic; -- End of packet, CRC invalid end record mac_out_t; + -- MAC ETH interface + type ethernet_ii_protocol_t is record + ethertype : ethertype_t; + end record; + type ethernet_ii_protocol_vector is array (natural range <>) of ethernet_ii_protocol_t; + constant ETHERNET_II_PROTOCOLS_NONE : ethernet_ii_protocol_vector(0 to -1) := (others => (ethertype => (x"00", x"00"))); -- NULL range + + type ethernet_i_out_t is record + tbd : std_logic; -- TODO + end record; + type ethernet_i_in_t is record + tbd : std_logic; -- TODO + end record; + constant ETHERNET_I_IN_UNUSED : ethernet_i_in_t := (others => '0'); -- TODO + + type ethernet_ii_out_t is record + rx_mac_address : mac_addr_t; -- Source MAC address + rx_data : byte; -- RX data + rx_data_valid : std_logic; -- RX data valid strobe + tx_data_ack : std_logic; -- Give next data byte or disable `tx_en` + end record; + type ethernet_ii_in_t is record + tx_mac_address : mac_addr_t; -- Destination MAC address + tx_data : byte; -- TX data + tx_en : std_logic; -- Start and continue transmitting + end record; + type ethernet_ii_out_vector is array (natural range <>) of ethernet_ii_out_t; + type ethernet_ii_in_vector is array (natural range <>) of ethernet_ii_in_t; + constant ETHERNET_II_IN_UNUSED : ethernet_ii_in_t := (tx_mac_address => (others => x"00"), tx_data => x"00", others => '0'); end package trashernet_pkg; package body trashernet_pkg is