trashernet/trashernet/trashernet_pkg.vhd

48 lines
1.8 KiB
VHDL
Raw Normal View History

2021-09-04 19:33:32 +02:00
-- -------------------------------------------------------------------------- --
-- TRASHERNET - A Trashy Ethernet Stack for FPGAs --
-- -------------------------------------------------------------------------- --
-- trashernet_types.vhd : VHDL types used throughout Trashernet
-- -------------------------------------------------------------------------- --
-- Author : Markus Koch <markus@notsyncing.net>
-- Contributors : None
-- License : Mozilla Public License (MPL) Version 2
-- -------------------------------------------------------------------------- --
2021-08-31 20:35:15 +02:00
library ieee;
use ieee.std_logic_1164.all;
package trashernet_pkg is
2021-08-31 20:35:15 +02:00
subtype byte is std_logic_vector(7 downto 0);
type byte_vector is array (natural range <>) of byte;
subtype mac_addr_t is byte_vector(0 to 5);
subtype ip_addr_t is byte_vector(0 to 3);
subtype ethertype_t is byte_vector(0 to 1);
2021-09-25 11:20:26 +02:00
type mac_header_fields is record
mac_destination : mac_addr_t; -- Destination MAC address
mac_source : mac_addr_t; -- Source MAC address
mac_ethertype : ethertype_t; -- Ethertype or length
2021-09-25 11:20:26 +02:00
end record mac_header_fields;
-- PHY interface
type phy_in_t is record
tx_data : byte; -- TX Data
tx_data_en : std_logic; -- Transmitter enable
end record phy_in_t;
type phy_out_t is record
rx_data : byte; -- RX Data
rx_data_valid : std_logic; -- RX Data valid
rx_active : std_logic; -- RX of packet in progress
tx_data_ack : std_logic; -- Latched data_tx
tx_active : std_logic; -- Transmission in progress
carrier_detect : std_logic; -- Carrier detected
rx_error : std_logic; -- Receive error
end record phy_out_t;
end package trashernet_pkg;
2021-08-31 20:35:15 +02:00
package body trashernet_pkg is
2021-08-31 20:35:15 +02:00
end package body trashernet_pkg;