Reformat code using latest version of Sigasi
This commit is contained in:
parent
154604aacd
commit
f67e8d8b37
@ -1,35 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<com.sigasi.hdt.shared.librarymapping.model:LibraryMappings xmlns:com.sigasi.hdt.shared.librarymapping.model="com.sigasi.hdt.vhdl.scoping.librarymapping" Version="2">
|
<com.sigasi.hdt.shared.librarymapping.model:LibraryMappings xmlns:com.sigasi.hdt.shared.librarymapping.model="com.sigasi.hdt.vhdl.scoping.librarymapping" Version="2">
|
||||||
<Mappings Location="bench" Library="bench"/>
|
<Mappings Location="bench" Library="bench"/>
|
||||||
<Mappings Location="cocotb" Library="cocotb"/>
|
|
||||||
<Mappings Location="design" Library="design"/>
|
<Mappings Location="design" Library="design"/>
|
||||||
<Mappings Location="Common Libraries/IEEE" Library="ieee"/>
|
<Mappings Location="Common Libraries/IEEE" Library="ieee"/>
|
||||||
<Mappings Location="Common Libraries/IEEE Synopsys" Library="ieee"/>
|
<Mappings Location="Common Libraries/IEEE Synopsys" Library="ieee"/>
|
||||||
<Mappings Location="" Library="not mapped"/>
|
|
||||||
<Mappings Location="Common Libraries" Library="not mapped"/>
|
<Mappings Location="Common Libraries" Library="not mapped"/>
|
||||||
<Mappings Location="Common Libraries/vunit" Library="not mapped"/>
|
|
||||||
<Mappings Location="cocotb/__pycache__" Library="not mapped"/>
|
|
||||||
<Mappings Location="cocotb/sim_build" Library="not mapped"/>
|
|
||||||
<Mappings Location="Common Libraries/STD" Library="std"/>
|
<Mappings Location="Common Libraries/STD" Library="std"/>
|
||||||
<Mappings Location="trashernet" Library="trashernet"/>
|
<Mappings Location="trashernet" Library="trashernet"/>
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/IP_complete_nomac.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/IPv4.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/IPv4_RX.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/IPv4_TX.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/UDP_Complete_nomac.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/UDP_RX.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/UDP_TX.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/arp.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/arp_REQ.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/arp_RX.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/arp_STORE_br.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/arp_SYNC.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/arp_TX.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/arp_types.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/arpv2.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/axi.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/ipv4_types.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="udp_ip_stack/rtl/vhdl/tx_arbitrator.vhd" Library="udpip"/>
|
|
||||||
<Mappings Location="Common Libraries/vunit/vunit/vhdl" Library="vunit_lib"/>
|
|
||||||
<Mappings Location="Common Libraries/src" Library="xp2"/>
|
|
||||||
</com.sigasi.hdt.shared.librarymapping.model:LibraryMappings>
|
</com.sigasi.hdt.shared.librarymapping.model:LibraryMappings>
|
||||||
|
27
.project
27
.project
@ -5,16 +5,6 @@
|
|||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
<buildSpec>
|
<buildSpec>
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
|
|
||||||
<triggers>full,incremental,</triggers>
|
|
||||||
<arguments>
|
|
||||||
<dictionary>
|
|
||||||
<key>LaunchConfigHandle</key>
|
|
||||||
<value><project>/.externalToolBuilders/com.sigasi.hdt.toolchains.vunit.builder.launch</value>
|
|
||||||
</dictionary>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
|
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
@ -22,9 +12,9 @@
|
|||||||
</buildCommand>
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
|
<nature>com.sigasi.hdt.verilog.ui.verilogNature</nature>
|
||||||
<nature>com.sigasi.hdt.vhdl.ui.vhdlNature</nature>
|
<nature>com.sigasi.hdt.vhdl.ui.vhdlNature</nature>
|
||||||
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
|
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
|
||||||
<nature>com.sigasi.hdt.toolchains.vunit.nature</nature>
|
|
||||||
</natures>
|
</natures>
|
||||||
<linkedResources>
|
<linkedResources>
|
||||||
<link>
|
<link>
|
||||||
@ -32,11 +22,6 @@
|
|||||||
<type>2</type>
|
<type>2</type>
|
||||||
<locationURI>virtual:/virtual</locationURI>
|
<locationURI>virtual:/virtual</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
|
||||||
<name>Common Libraries/DRAG_REUSABLE_LIBRARIES_HERE.txt</name>
|
|
||||||
<type>1</type>
|
|
||||||
<locationURI>sigasiresource:/vhdl/readme.txt</locationURI>
|
|
||||||
</link>
|
|
||||||
<link>
|
<link>
|
||||||
<name>Common Libraries/IEEE</name>
|
<name>Common Libraries/IEEE</name>
|
||||||
<type>2</type>
|
<type>2</type>
|
||||||
@ -52,15 +37,5 @@
|
|||||||
<type>2</type>
|
<type>2</type>
|
||||||
<locationURI>sigasiresource:/vhdl/2008/STD</locationURI>
|
<locationURI>sigasiresource:/vhdl/2008/STD</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
|
||||||
<name>Common Libraries/src</name>
|
|
||||||
<type>2</type>
|
|
||||||
<location>/usr/local/diamond/3.12/cae_library/simulation/vhdl/xp2/src</location>
|
|
||||||
</link>
|
|
||||||
<link>
|
|
||||||
<name>Common Libraries/vunit</name>
|
|
||||||
<type>2</type>
|
|
||||||
<locationURI>PARENT-1-PROJECT_LOC/vunit</locationURI>
|
|
||||||
</link>
|
|
||||||
</linkedResources>
|
</linkedResources>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
VUnitScriptLocation=vunit/run.py
|
|
||||||
eclipse.preferences.version=1
|
|
2
.settings/com.sigasi.hdt.verilog.linting.prefs
Normal file
2
.settings/com.sigasi.hdt.verilog.linting.prefs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
isEnabled=true
|
1
.settings/com.sigasi.hdt.verilog.version.prefs
Normal file
1
.settings/com.sigasi.hdt.verilog.version.prefs
Normal file
@ -0,0 +1 @@
|
|||||||
|
<project>=sv2012
|
2
.settings/com.sigasi.hdt.vhdl.linting.prefs
Normal file
2
.settings/com.sigasi.hdt.vhdl.linting.prefs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
isEnabled=true
|
@ -1,5 +1,5 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
encoding//Common\ Libraries/IEEE=utf-8
|
encoding//Common\ Libraries/IEEE=UTF-8
|
||||||
encoding//Common\ Libraries/IEEE\ Synopsys=utf-8
|
encoding//Common\ Libraries/IEEE\ Synopsys=UTF-8
|
||||||
encoding//Common\ Libraries/STD=utf-8
|
encoding//Common\ Libraries/STD=UTF-8
|
||||||
encoding/Common\ Libraries=utf-8
|
encoding//Common\ Libraries=UTF-8
|
||||||
|
@ -19,12 +19,12 @@ end entity bench_crc;
|
|||||||
|
|
||||||
architecture bench of bench_crc is
|
architecture bench of bench_crc is
|
||||||
constant POLYNOMIAL : std_logic_vector(31 downto 0) := x"04C11DB7";
|
constant POLYNOMIAL : std_logic_vector(31 downto 0) := x"04C11DB7";
|
||||||
signal clk : std_logic;
|
signal clk : std_logic;
|
||||||
signal rst : std_logic;
|
signal rst : std_logic;
|
||||||
signal data : std_logic_vector(7 downto 0);
|
signal data : std_logic_vector(7 downto 0);
|
||||||
signal data_valid : std_logic;
|
signal data_valid : std_logic;
|
||||||
signal crc_clear : std_logic;
|
signal crc_clear : std_logic;
|
||||||
signal crc_out : std_logic_vector(POLYNOMIAL'range);
|
signal crc_out : std_logic_vector(POLYNOMIAL'range);
|
||||||
begin
|
begin
|
||||||
crc_inst : entity trashernet.crc
|
crc_inst : entity trashernet.crc
|
||||||
generic map(
|
generic map(
|
||||||
|
@ -30,7 +30,7 @@ package body bench_pkg is
|
|||||||
wait for 50 ns;
|
wait for 50 ns;
|
||||||
end loop;
|
end loop;
|
||||||
end loop;
|
end loop;
|
||||||
wait for 16 us; -- IPG
|
wait for 16 us; -- IPG
|
||||||
report "Frame TX complete";
|
report "Frame TX complete";
|
||||||
end procedure send_data;
|
end procedure send_data;
|
||||||
end package body bench_pkg;
|
end package body bench_pkg;
|
||||||
|
@ -22,15 +22,14 @@ entity bench_trashernet_phy is
|
|||||||
end entity bench_trashernet_phy;
|
end entity bench_trashernet_phy;
|
||||||
|
|
||||||
architecture bench of bench_trashernet_phy is
|
architecture bench of bench_trashernet_phy is
|
||||||
signal clk : std_logic;
|
signal clk : std_logic;
|
||||||
signal phy_clk : std_logic;
|
signal phy_clk : std_logic;
|
||||||
signal rst : std_logic;
|
signal rst : std_logic;
|
||||||
signal phy_out : phy_out_t;
|
signal phy_out : phy_out_t;
|
||||||
signal phy_in : phy_in_t;
|
signal phy_in : phy_in_t;
|
||||||
signal rx_p : std_logic;
|
signal rx_p : std_logic;
|
||||||
signal tx_p : std_logic;
|
signal tx_p : std_logic;
|
||||||
signal tx_n : std_logic;
|
signal tx_n : std_logic;
|
||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
trashernet_phy_cdc_inst : entity trashernet.trashernet_phy_cdc
|
trashernet_phy_cdc_inst : entity trashernet.trashernet_phy_cdc
|
||||||
@ -39,14 +38,14 @@ begin
|
|||||||
F_CLK_PHY => 100000000
|
F_CLK_PHY => 100000000
|
||||||
)
|
)
|
||||||
port map(
|
port map(
|
||||||
clk => clk,
|
clk => clk,
|
||||||
phy_clk => phy_clk,
|
phy_clk => phy_clk,
|
||||||
rst => rst,
|
rst => rst,
|
||||||
phy_out => phy_out,
|
phy_out => phy_out,
|
||||||
phy_in => phy_in,
|
phy_in => phy_in,
|
||||||
rx_p => rx_p,
|
rx_p => rx_p,
|
||||||
tx_p => tx_p,
|
tx_p => tx_p,
|
||||||
tx_n => tx_n
|
tx_n => tx_n
|
||||||
);
|
);
|
||||||
|
|
||||||
clock_driver : process
|
clock_driver : process
|
||||||
|
@ -29,8 +29,8 @@ end entity ledcon;
|
|||||||
|
|
||||||
architecture RTL of ledcon is
|
architecture RTL of ledcon is
|
||||||
constant MS_CNT_MAX : integer := integer(round(real(F_CLK) * (1.0 * 10.0 ** (-3))));
|
constant MS_CNT_MAX : integer := integer(round(real(F_CLK) * (1.0 * 10.0 ** (-3))));
|
||||||
signal ms_cnt : integer range 0 to MS_CNT_MAX;
|
signal ms_cnt : integer range 0 to MS_CNT_MAX;
|
||||||
signal ms_tick : std_logic;
|
signal ms_tick : std_logic;
|
||||||
begin
|
begin
|
||||||
mstimer : process(clk, rst) is
|
mstimer : process(clk, rst) is
|
||||||
begin
|
begin
|
||||||
@ -50,7 +50,7 @@ begin
|
|||||||
ledblock : block
|
ledblock : block
|
||||||
constant LED_CNT_MAX : integer := 50; -- on time, in ms
|
constant LED_CNT_MAX : integer := 50; -- on time, in ms
|
||||||
constant LED_CNT_MIN : integer := -50; -- off time, in ms
|
constant LED_CNT_MIN : integer := -50; -- off time, in ms
|
||||||
signal led_cnt : integer range LED_CNT_MIN to LED_CNT_MAX;
|
signal led_cnt : integer range LED_CNT_MIN to LED_CNT_MAX;
|
||||||
begin
|
begin
|
||||||
ledgen : if BLINK(i) generate
|
ledgen : if BLINK(i) generate
|
||||||
ledproc : process(clk, rst) is
|
ledproc : process(clk, rst) is
|
||||||
|
@ -57,13 +57,13 @@ architecture mac of top_hwitl is
|
|||||||
signal mac_out : mac_out_t;
|
signal mac_out : mac_out_t;
|
||||||
signal mac_in : mac_in_t;
|
signal mac_in : mac_in_t;
|
||||||
|
|
||||||
type status_t is (IDLE, TX);
|
type status_t is (IDLE, TX);
|
||||||
signal state : status_t;
|
signal state : status_t;
|
||||||
constant BYTE_CNT_MAX : integer := 100;
|
constant BYTE_CNT_MAX : integer := 100;
|
||||||
signal byte_cnt : integer range 0 to BYTE_CNT_MAX;
|
signal byte_cnt : integer range 0 to BYTE_CNT_MAX;
|
||||||
|
|
||||||
constant TMO_MAX : integer := integer(round((real(F_CLK) * 0.25))) - 1;
|
constant TMO_MAX : integer := integer(round((real(F_CLK) * 0.25))) - 1;
|
||||||
signal tmo : integer range 0 to TMO_MAX;
|
signal tmo : integer range 0 to TMO_MAX;
|
||||||
begin
|
begin
|
||||||
trashernet_mac_inst : entity trashernet.trashernet_mac
|
trashernet_mac_inst : entity trashernet.trashernet_mac
|
||||||
port map(
|
port map(
|
||||||
@ -206,10 +206,10 @@ architecture eth of top_hwitl is
|
|||||||
PROT_ARP => ETHERNET_II_PROTOCOL_ARP,
|
PROT_ARP => ETHERNET_II_PROTOCOL_ARP,
|
||||||
PROT_IPV4 => ETHERNET_II_PROTOCOL_IPV4
|
PROT_IPV4 => ETHERNET_II_PROTOCOL_IPV4
|
||||||
);
|
);
|
||||||
signal ethernet_i_out : ethernet_i_out_t;
|
signal ethernet_i_out : ethernet_i_out_t;
|
||||||
signal ethernet_i_in : ethernet_i_in_t;
|
signal ethernet_i_in : ethernet_i_in_t;
|
||||||
signal ethernet_ii_out : ethernet_ii_out_vector(ETHERNET_II_PROTOCOLS'range);
|
signal ethernet_ii_out : ethernet_ii_out_vector(ETHERNET_II_PROTOCOLS'range);
|
||||||
signal ethernet_ii_in : ethernet_ii_in_vector(ETHERNET_II_PROTOCOLS'range);
|
signal ethernet_ii_in : ethernet_ii_in_vector(ETHERNET_II_PROTOCOLS'range);
|
||||||
|
|
||||||
signal arp_out : arp_out_t;
|
signal arp_out : arp_out_t;
|
||||||
signal arp_in : arp_in_t;
|
signal arp_in : arp_in_t;
|
||||||
@ -217,14 +217,14 @@ architecture eth of top_hwitl is
|
|||||||
signal ipv4_out : ipv4_out_t;
|
signal ipv4_out : ipv4_out_t;
|
||||||
signal ipv4_in : ipv4_in_t;
|
signal ipv4_in : ipv4_in_t;
|
||||||
|
|
||||||
constant IPROT_ICMP : integer := 0;
|
constant IPROT_ICMP : integer := 0;
|
||||||
constant IPROT_UDP : integer := 1;
|
constant IPROT_UDP : integer := 1;
|
||||||
constant IPV4_PROTOCOLS : ipv4_protocol_vector := (
|
constant IPV4_PROTOCOLS : ipv4_protocol_vector := (
|
||||||
IPROT_ICMP => IPV4_PROTOCOL_ICMP,
|
IPROT_ICMP => IPV4_PROTOCOL_ICMP,
|
||||||
IPROT_UDP => IPV4_PROTOCOL_UDP
|
IPROT_UDP => IPV4_PROTOCOL_UDP
|
||||||
);
|
);
|
||||||
signal ipv4_protocol_out : ipv4_protocol_out_vector(IPV4_PROTOCOLS'range);
|
signal ipv4_protocol_out : ipv4_protocol_out_vector(IPV4_PROTOCOLS'range);
|
||||||
signal ipv4_protocol_in : ipv4_protocol_in_vector(IPV4_PROTOCOLS'range);
|
signal ipv4_protocol_in : ipv4_protocol_in_vector(IPV4_PROTOCOLS'range);
|
||||||
|
|
||||||
signal udp_out : udp_out_t;
|
signal udp_out : udp_out_t;
|
||||||
signal udp_in : udp_in_t;
|
signal udp_in : udp_in_t;
|
||||||
|
@ -68,16 +68,16 @@ architecture rtl of top_mac_test is
|
|||||||
signal mac_out : mac_out_t;
|
signal mac_out : mac_out_t;
|
||||||
signal mac_in : mac_in_t;
|
signal mac_in : mac_in_t;
|
||||||
|
|
||||||
type status_t is (IDLE, TX);
|
type status_t is (IDLE, TX);
|
||||||
signal state : status_t;
|
signal state : status_t;
|
||||||
constant BYTE_CNT_MAX : integer := 100;
|
constant BYTE_CNT_MAX : integer := 100;
|
||||||
signal byte_cnt : integer range 0 to BYTE_CNT_MAX;
|
signal byte_cnt : integer range 0 to BYTE_CNT_MAX;
|
||||||
|
|
||||||
signal button_n_sync : std_logic_vector(button_n'range);
|
signal button_n_sync : std_logic_vector(button_n'range);
|
||||||
signal button : std_logic_vector(button_n'range);
|
signal button : std_logic_vector(button_n'range);
|
||||||
|
|
||||||
constant TMO_MAX : integer := integer(round((real(F_CLK) * 0.25))) - 1;
|
constant TMO_MAX : integer := integer(round((real(F_CLK) * 0.25))) - 1;
|
||||||
signal tmo : integer range 0 to TMO_MAX;
|
signal tmo : integer range 0 to TMO_MAX;
|
||||||
begin
|
begin
|
||||||
trashernet_mac_inst : entity trashernet.trashernet_mac
|
trashernet_mac_inst : entity trashernet.trashernet_mac
|
||||||
port map(
|
port map(
|
||||||
@ -190,7 +190,7 @@ begin
|
|||||||
if mac_out.tx_mac_data_ack then
|
if mac_out.tx_mac_data_ack then
|
||||||
if byte_cnt = 1 then
|
if byte_cnt = 1 then
|
||||||
mac_in.tx_mac_data_en <= '0';
|
mac_in.tx_mac_data_en <= '0';
|
||||||
state <= IDLE;
|
state <= IDLE;
|
||||||
else
|
else
|
||||||
byte_cnt <= byte_cnt - 1;
|
byte_cnt <= byte_cnt - 1;
|
||||||
end if;
|
end if;
|
||||||
|
@ -79,10 +79,10 @@ architecture rtl of top_pingable is
|
|||||||
PROT_ARP => ETHERNET_II_PROTOCOL_ARP,
|
PROT_ARP => ETHERNET_II_PROTOCOL_ARP,
|
||||||
PROT_IPV4 => ETHERNET_II_PROTOCOL_IPV4
|
PROT_IPV4 => ETHERNET_II_PROTOCOL_IPV4
|
||||||
);
|
);
|
||||||
signal ethernet_i_out : ethernet_i_out_t;
|
signal ethernet_i_out : ethernet_i_out_t;
|
||||||
signal ethernet_i_in : ethernet_i_in_t;
|
signal ethernet_i_in : ethernet_i_in_t;
|
||||||
signal ethernet_ii_out : ethernet_ii_out_vector(ETHERNET_II_PROTOCOLS'range);
|
signal ethernet_ii_out : ethernet_ii_out_vector(ETHERNET_II_PROTOCOLS'range);
|
||||||
signal ethernet_ii_in : ethernet_ii_in_vector(ETHERNET_II_PROTOCOLS'range);
|
signal ethernet_ii_in : ethernet_ii_in_vector(ETHERNET_II_PROTOCOLS'range);
|
||||||
|
|
||||||
signal arp_out : arp_out_t;
|
signal arp_out : arp_out_t;
|
||||||
signal arp_in : arp_in_t;
|
signal arp_in : arp_in_t;
|
||||||
@ -90,12 +90,12 @@ architecture rtl of top_pingable is
|
|||||||
signal ipv4_out : ipv4_out_t;
|
signal ipv4_out : ipv4_out_t;
|
||||||
signal ipv4_in : ipv4_in_t;
|
signal ipv4_in : ipv4_in_t;
|
||||||
|
|
||||||
constant IPROT_ICMP : integer := 0;
|
constant IPROT_ICMP : integer := 0;
|
||||||
constant IPV4_PROTOCOLS : ipv4_protocol_vector := (
|
constant IPV4_PROTOCOLS : ipv4_protocol_vector := (
|
||||||
IPROT_ICMP => IPV4_PROTOCOL_ICMP
|
IPROT_ICMP => IPV4_PROTOCOL_ICMP
|
||||||
);
|
);
|
||||||
signal ipv4_protocol_out : ipv4_protocol_out_vector(IPV4_PROTOCOLS'range);
|
signal ipv4_protocol_out : ipv4_protocol_out_vector(IPV4_PROTOCOLS'range);
|
||||||
signal ipv4_protocol_in : ipv4_protocol_in_vector(IPV4_PROTOCOLS'range);
|
signal ipv4_protocol_in : ipv4_protocol_in_vector(IPV4_PROTOCOLS'range);
|
||||||
|
|
||||||
signal button_n_sync : std_logic_vector(button_n'range);
|
signal button_n_sync : std_logic_vector(button_n'range);
|
||||||
signal button : std_logic_vector(button_n'range);
|
signal button : std_logic_vector(button_n'range);
|
||||||
|
@ -34,11 +34,11 @@ entity fifo is
|
|||||||
end entity fifo;
|
end entity fifo;
|
||||||
|
|
||||||
architecture rtl of fifo is
|
architecture rtl of fifo is
|
||||||
type memory_t is array (natural range <>) of std_logic_vector(data_in'range);
|
type memory_t is array (natural range <>) of std_logic_vector(data_in'range);
|
||||||
signal memory : memory_t(0 to DEPTH - 1);
|
signal memory : memory_t(0 to DEPTH - 1);
|
||||||
|
|
||||||
subtype memory_pointer_t is integer range 0 to DEPTH - 1;
|
subtype memory_pointer_t is integer range 0 to DEPTH - 1;
|
||||||
subtype usage_counter_t is integer range 0 to DEPTH;
|
subtype usage_counter_t is integer range 0 to DEPTH;
|
||||||
|
|
||||||
signal read_pointer : memory_pointer_t;
|
signal read_pointer : memory_pointer_t;
|
||||||
signal write_pointer : memory_pointer_t;
|
signal write_pointer : memory_pointer_t;
|
||||||
|
@ -64,8 +64,8 @@ architecture rtl of trashernet_arp is
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
resolver : block
|
resolver : block
|
||||||
type resolver_state_t is (IDLE, QUERY_MAC);
|
type resolver_state_t is (IDLE, QUERY_MAC);
|
||||||
signal state : resolver_state_t;
|
signal state : resolver_state_t;
|
||||||
|
|
||||||
signal query_mac_found : std_logic;
|
signal query_mac_found : std_logic;
|
||||||
signal query_timeout : std_logic := '0'; -- TODO: Implement
|
signal query_timeout : std_logic := '0'; -- TODO: Implement
|
||||||
@ -146,19 +146,19 @@ begin
|
|||||||
signal sr : byte_vector(0 to BYTECOUNT_ADDRESSES - 1);
|
signal sr : byte_vector(0 to BYTECOUNT_ADDRESSES - 1);
|
||||||
|
|
||||||
constant SR_HEAD_OFFSET : integer := BYTECOUNT_ADDRESSES - BYTECOUNT_HEAD;
|
constant SR_HEAD_OFFSET : integer := BYTECOUNT_ADDRESSES - BYTECOUNT_HEAD;
|
||||||
alias sr_head_htype is sr(SR_HEAD_OFFSET + 0 to SR_HEAD_OFFSET + 1);
|
alias sr_head_htype is sr(SR_HEAD_OFFSET + 0 to SR_HEAD_OFFSET + 1);
|
||||||
alias sr_head_ptype is sr(SR_HEAD_OFFSET + 2 to SR_HEAD_OFFSET + 3);
|
alias sr_head_ptype is sr(SR_HEAD_OFFSET + 2 to SR_HEAD_OFFSET + 3);
|
||||||
alias sr_head_hlen is sr(SR_HEAD_OFFSET + 4);
|
alias sr_head_hlen is sr(SR_HEAD_OFFSET + 4);
|
||||||
alias sr_head_plen is sr(SR_HEAD_OFFSET + 5);
|
alias sr_head_plen is sr(SR_HEAD_OFFSET + 5);
|
||||||
alias sr_head_oper is sr(SR_HEAD_OFFSET + 6 to SR_HEAD_OFFSET + 7);
|
alias sr_head_oper is sr(SR_HEAD_OFFSET + 6 to SR_HEAD_OFFSET + 7);
|
||||||
|
|
||||||
constant SR_ADDRESSES_OFFSET : integer := -8;
|
constant SR_ADDRESSES_OFFSET : integer := -8;
|
||||||
alias sr_addresses_sha is sr(8 + SR_ADDRESSES_OFFSET to 13 + SR_ADDRESSES_OFFSET);
|
alias sr_addresses_sha is sr(8 + SR_ADDRESSES_OFFSET to 13 + SR_ADDRESSES_OFFSET);
|
||||||
alias sr_addresses_spa is sr(14 + SR_ADDRESSES_OFFSET to 17 + SR_ADDRESSES_OFFSET);
|
alias sr_addresses_spa is sr(14 + SR_ADDRESSES_OFFSET to 17 + SR_ADDRESSES_OFFSET);
|
||||||
alias sr_addresses_tha is sr(18 + SR_ADDRESSES_OFFSET to 23 + SR_ADDRESSES_OFFSET); -- @suppress "Unused declaration": We don't need to check this as this is already done by the MAC
|
alias sr_addresses_tha is sr(18 + SR_ADDRESSES_OFFSET to 23 + SR_ADDRESSES_OFFSET); -- @suppress "Unused declaration": We don't need to check this as this is already done by the MAC
|
||||||
alias sr_addresses_tpa is sr(24 + SR_ADDRESSES_OFFSET to 27 + SR_ADDRESSES_OFFSET);
|
alias sr_addresses_tpa is sr(24 + SR_ADDRESSES_OFFSET to 27 + SR_ADDRESSES_OFFSET);
|
||||||
|
|
||||||
type state_t is (HEAD, ADDRESSES, WAITCRC, SENDREPLY, IGNORE);
|
type state_t is (HEAD, ADDRESSES, WAITCRC, SENDREPLY, IGNORE);
|
||||||
signal state : state_t;
|
signal state : state_t;
|
||||||
signal bytecount : integer range 0 to BYTECOUNT_ADDRESSES;
|
signal bytecount : integer range 0 to BYTECOUNT_ADDRESSES;
|
||||||
signal shifted : std_logic;
|
signal shifted : std_logic;
|
||||||
@ -240,7 +240,7 @@ begin
|
|||||||
state <= HEAD;
|
state <= HEAD;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
when IGNORE => -- @suppress "Dead state 'IGNORE'": Outgoing transition provided outside of case statement (on RX ok/err)
|
when IGNORE => -- @suppress "Dead state 'IGNORE'": Outgoing transition provided outside of case statement (on RX ok/err)
|
||||||
null;
|
null;
|
||||||
end case;
|
end case;
|
||||||
end if;
|
end if;
|
||||||
@ -253,14 +253,14 @@ begin
|
|||||||
end block rx;
|
end block rx;
|
||||||
|
|
||||||
tx : block
|
tx : block
|
||||||
signal sr : byte_vector(0 to 27);
|
signal sr : byte_vector(0 to 27);
|
||||||
signal arp_reply_preload : byte_vector(sr'range);
|
signal arp_reply_preload : byte_vector(sr'range);
|
||||||
signal arp_request_preload : byte_vector(sr'range);
|
signal arp_request_preload : byte_vector(sr'range);
|
||||||
constant BYTECOUNT_MAX : integer := sr'length + 1;
|
constant BYTECOUNT_MAX : integer := sr'length + 1;
|
||||||
signal bytecount : integer range 0 to BYTECOUNT_MAX;
|
signal bytecount : integer range 0 to BYTECOUNT_MAX;
|
||||||
|
|
||||||
type state_t is (IDLE, TRANSMIT);
|
type state_t is (IDLE, TRANSMIT);
|
||||||
signal state : state_t;
|
signal state : state_t;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
arp_reply_preload <= HTYPE & PTYPE & HLEN & PLEN & OPER_REPLY & -- Header
|
arp_reply_preload <= HTYPE & PTYPE & HLEN & PLEN & OPER_REPLY & -- Header
|
||||||
|
@ -46,11 +46,11 @@ architecture rtl of trashernet_eth is
|
|||||||
signal tx_data_ack_i : std_logic;
|
signal tx_data_ack_i : std_logic;
|
||||||
begin
|
begin
|
||||||
rx : block
|
rx : block
|
||||||
constant SEL_ETH_I : integer := ethernet_ii_out'low - 1;
|
constant SEL_ETH_I : integer := ethernet_ii_out'low - 1;
|
||||||
constant SEL_ETH_NONE : integer := ethernet_ii_out'low - 2;
|
constant SEL_ETH_NONE : integer := ethernet_ii_out'low - 2;
|
||||||
signal sel : integer range SEL_ETH_NONE to ethernet_ii_out'high;
|
signal sel : integer range SEL_ETH_NONE to ethernet_ii_out'high;
|
||||||
signal mac_destination_matches : std_logic;
|
signal mac_destination_matches : std_logic;
|
||||||
signal rx_mac_header_rcv_delayed : std_logic;
|
signal rx_mac_header_rcv_delayed : std_logic;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
mac_destination_matches <= '1' when --
|
mac_destination_matches <= '1' when --
|
||||||
@ -112,10 +112,10 @@ begin
|
|||||||
end block rx;
|
end block rx;
|
||||||
|
|
||||||
tx : block
|
tx : block
|
||||||
type state_t is (IDLE, TXD);
|
type state_t is (IDLE, TXD);
|
||||||
signal state : state_t;
|
signal state : state_t;
|
||||||
constant SEL_ETH_I : integer := ethernet_ii_out'low - 1;
|
constant SEL_ETH_I : integer := ethernet_ii_out'low - 1;
|
||||||
signal sel : integer range SEL_ETH_I to ethernet_ii_in'high;
|
signal sel : integer range SEL_ETH_I to ethernet_ii_in'high;
|
||||||
begin
|
begin
|
||||||
arb : process(clk, rst) is
|
arb : process(clk, rst) is
|
||||||
begin
|
begin
|
||||||
|
@ -56,13 +56,13 @@ begin
|
|||||||
);
|
);
|
||||||
|
|
||||||
rx : block
|
rx : block
|
||||||
signal sr : byte_vector(0 to 3);
|
signal sr : byte_vector(0 to 3);
|
||||||
alias sr_type is sr(0);
|
alias sr_type is sr(0);
|
||||||
alias sr_code is sr(1);
|
alias sr_code is sr(1);
|
||||||
alias sr_checksum is sr(2 to 3);
|
alias sr_checksum is sr(2 to 3);
|
||||||
|
|
||||||
type state_t is (HEADER, DATA, IGNORE);
|
type state_t is (HEADER, DATA, IGNORE);
|
||||||
signal state : state_t;
|
signal state : state_t;
|
||||||
|
|
||||||
signal byte_count : integer range 0 to sr'length;
|
signal byte_count : integer range 0 to sr'length;
|
||||||
|
|
||||||
@ -117,8 +117,8 @@ begin
|
|||||||
signal checksum : unsigned(16 downto 0);
|
signal checksum : unsigned(16 downto 0);
|
||||||
signal checksum_ones : unsigned(15 downto 0);
|
signal checksum_ones : unsigned(15 downto 0);
|
||||||
|
|
||||||
type state_t is (IDLE, HEADER, PAYLOAD);
|
type state_t is (IDLE, HEADER, PAYLOAD);
|
||||||
signal state : state_t;
|
signal state : state_t;
|
||||||
|
|
||||||
signal sr : byte_vector(0 to 3);
|
signal sr : byte_vector(0 to 3);
|
||||||
signal byte_count : integer range 0 to sr'subtype'high;
|
signal byte_count : integer range 0 to sr'subtype'high;
|
||||||
|
@ -44,27 +44,27 @@ begin
|
|||||||
constant BYTECOUNT_HEADER : integer := 20; -- Mandatory header fields
|
constant BYTECOUNT_HEADER : integer := 20; -- Mandatory header fields
|
||||||
|
|
||||||
signal sr : byte_vector(0 to BYTECOUNT_HEADER - 1) := (others => x"00"); -- Init to zero to squelch metavalue warnings
|
signal sr : byte_vector(0 to BYTECOUNT_HEADER - 1) := (others => x"00"); -- Init to zero to squelch metavalue warnings
|
||||||
alias sr_version is sr(0)(7 downto 4);
|
alias sr_version is sr(0)(7 downto 4);
|
||||||
alias sr_ihl is sr(0)(3 downto 0);
|
alias sr_ihl is sr(0)(3 downto 0);
|
||||||
alias sr_dscp is sr(1)(7 downto 2);
|
alias sr_dscp is sr(1)(7 downto 2);
|
||||||
alias sr_ecn is sr(1)(1 downto 0);
|
alias sr_ecn is sr(1)(1 downto 0);
|
||||||
alias sr_total_length is sr(2 to 3);
|
alias sr_total_length is sr(2 to 3);
|
||||||
alias sr_identification is sr(4 to 5);
|
alias sr_identification is sr(4 to 5);
|
||||||
alias sr_flags is sr(6)(7 downto 5);
|
alias sr_flags is sr(6)(7 downto 5);
|
||||||
signal sr_fragment_offset : std_logic_vector(12 downto 0);
|
signal sr_fragment_offset : std_logic_vector(12 downto 0);
|
||||||
alias sr_ttl is sr(8);
|
alias sr_ttl is sr(8);
|
||||||
alias sr_protocol is sr(9);
|
alias sr_protocol is sr(9);
|
||||||
alias sr_header_cks is sr(10 to 11);
|
alias sr_header_cks is sr(10 to 11);
|
||||||
alias sr_source_ip is sr(12 to 15);
|
alias sr_source_ip is sr(12 to 15);
|
||||||
alias sr_destination_ip is sr(16 to 19);
|
alias sr_destination_ip is sr(16 to 19);
|
||||||
|
|
||||||
signal header_ok : std_logic;
|
signal header_ok : std_logic;
|
||||||
|
|
||||||
signal bytecount : integer range 0 to 65535;
|
signal bytecount : integer range 0 to 65535;
|
||||||
signal block_done : std_logic;
|
signal block_done : std_logic;
|
||||||
|
|
||||||
type state_t is (HEADER, OPT, PAYLOAD, DONE);
|
type state_t is (HEADER, OPT, PAYLOAD, DONE);
|
||||||
signal state : state_t;
|
signal state : state_t;
|
||||||
begin
|
begin
|
||||||
sr_fragment_offset <= sr(6)(4 downto 0) & sr(7);
|
sr_fragment_offset <= sr(6)(4 downto 0) & sr(7);
|
||||||
|
|
||||||
@ -138,8 +138,8 @@ begin
|
|||||||
end block rx;
|
end block rx;
|
||||||
|
|
||||||
tx : block
|
tx : block
|
||||||
type state_t is (IDLE, ARP, CALC_CKS, HEADER, PAYLOAD);
|
type state_t is (IDLE, ARP, CALC_CKS, HEADER, PAYLOAD);
|
||||||
signal state : state_t;
|
signal state : state_t;
|
||||||
|
|
||||||
signal full_length : ipv4_length;
|
signal full_length : ipv4_length;
|
||||||
|
|
||||||
|
@ -83,8 +83,8 @@ begin
|
|||||||
end block rx;
|
end block rx;
|
||||||
|
|
||||||
tx : block
|
tx : block
|
||||||
type state_t is (IDLE, TXD);
|
type state_t is (IDLE, TXD);
|
||||||
signal state : state_t;
|
signal state : state_t;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
arb : process(clk, rst) is
|
arb : process(clk, rst) is
|
||||||
|
@ -41,10 +41,10 @@ begin
|
|||||||
|
|
||||||
constant HEAD_LENGTH : integer := mac_out.rx_header.mac_destination'length + mac_out.rx_header.mac_source'length + mac_out.rx_header.mac_ethertype'length;
|
constant HEAD_LENGTH : integer := mac_out.rx_header.mac_destination'length + mac_out.rx_header.mac_source'length + mac_out.rx_header.mac_ethertype'length;
|
||||||
constant CRC_LENGTH : integer := 4;
|
constant CRC_LENGTH : integer := 4;
|
||||||
signal state : state_t;
|
signal state : state_t;
|
||||||
signal sr_head : byte_vector(0 to HEAD_LENGTH - 1);
|
signal sr_head : byte_vector(0 to HEAD_LENGTH - 1);
|
||||||
constant BYTE_COUNT_MAX : integer := maximum(HEAD_LENGTH, CRC_LENGTH) - 1;
|
constant BYTE_COUNT_MAX : integer := maximum(HEAD_LENGTH, CRC_LENGTH) - 1;
|
||||||
signal byte_count : integer range 0 to BYTE_COUNT_MAX;
|
signal byte_count : integer range 0 to BYTE_COUNT_MAX;
|
||||||
|
|
||||||
signal sr_payload : byte_vector(0 to 4);
|
signal sr_payload : byte_vector(0 to 4);
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ begin
|
|||||||
byte_count <= byte_count + 1;
|
byte_count <= byte_count + 1;
|
||||||
end if;
|
end if;
|
||||||
end if;
|
end if;
|
||||||
when PAYLOAD => -- @suppress "Dead state 'PAYLOAD'": Outgoing transition provided outside of case statement (RX disabled or error)
|
when PAYLOAD => -- @suppress "Dead state 'PAYLOAD'": Outgoing transition provided outside of case statement (RX disabled or error)
|
||||||
if phy_out.rx_data_valid then
|
if phy_out.rx_data_valid then
|
||||||
sr_payload <= sr_payload(sr_payload'low + 1 to sr_payload'high) & phy_out.rx_data;
|
sr_payload <= sr_payload(sr_payload'low + 1 to sr_payload'high) & phy_out.rx_data;
|
||||||
if byte_count = CRC_LENGTH then
|
if byte_count = CRC_LENGTH then
|
||||||
@ -136,14 +136,14 @@ begin
|
|||||||
end block rx;
|
end block rx;
|
||||||
|
|
||||||
tx : block
|
tx : block
|
||||||
type tx_state_t is (IDLE, HEADER, DATA, PAD, TXCRC);
|
type tx_state_t is (IDLE, HEADER, DATA, PAD, TXCRC);
|
||||||
signal tx_state : tx_state_t;
|
signal tx_state : tx_state_t;
|
||||||
|
|
||||||
signal sr : byte_vector(0 to mac_in.tx_header.mac_destination'length + mac_in.tx_header.mac_source'length + mac_in.tx_header.mac_ethertype'length - 1);
|
signal sr : byte_vector(0 to mac_in.tx_header.mac_destination'length + mac_in.tx_header.mac_source'length + mac_in.tx_header.mac_ethertype'length - 1);
|
||||||
constant SR_CNT_MAX : integer := sr'high;
|
constant SR_CNT_MAX : integer := sr'high;
|
||||||
signal sr_cnt : integer range 0 to SR_CNT_MAX;
|
signal sr_cnt : integer range 0 to SR_CNT_MAX;
|
||||||
constant BYTE_CNT_MAX : integer := ETH_FRAME_MIN_LENGTH - 4; -- Minus four because the CRC is *after* the PAD
|
constant BYTE_CNT_MAX : integer := ETH_FRAME_MIN_LENGTH - 4; -- Minus four because the CRC is *after* the PAD
|
||||||
signal byte_cnt : integer range 0 to BYTE_CNT_MAX;
|
signal byte_cnt : integer range 0 to BYTE_CNT_MAX;
|
||||||
|
|
||||||
signal crc : std_logic_vector(ETH_POLYNOMIAL'range);
|
signal crc : std_logic_vector(ETH_POLYNOMIAL'range);
|
||||||
signal crc_clear : std_logic;
|
signal crc_clear : std_logic;
|
||||||
|
@ -44,7 +44,7 @@ begin
|
|||||||
|
|
||||||
common : block
|
common : block
|
||||||
constant TICK_MS_CNT_MAX : integer := (F_CLK / 1000) - 1;
|
constant TICK_MS_CNT_MAX : integer := (F_CLK / 1000) - 1;
|
||||||
signal tick_ms_count : integer range 0 to TICK_MS_CNT_MAX;
|
signal tick_ms_count : integer range 0 to TICK_MS_CNT_MAX;
|
||||||
begin
|
begin
|
||||||
mstick : process(clk, rst) is
|
mstick : process(clk, rst) is
|
||||||
begin
|
begin
|
||||||
@ -80,7 +80,7 @@ begin
|
|||||||
|
|
||||||
-- NLP supervision
|
-- NLP supervision
|
||||||
constant NLP_TIMEOUT_CNT_MAX : integer := (16 + 8) - 1; -- Every 16 ms (timebase 1 ms)
|
constant NLP_TIMEOUT_CNT_MAX : integer := (16 + 8) - 1; -- Every 16 ms (timebase 1 ms)
|
||||||
signal nlp_timeout_cnt : integer range 0 to NLP_TIMEOUT_CNT_MAX;
|
signal nlp_timeout_cnt : integer range 0 to NLP_TIMEOUT_CNT_MAX;
|
||||||
begin
|
begin
|
||||||
-- Synchronize RX input
|
-- Synchronize RX input
|
||||||
synchronizer_rxp_inst : entity work.synchronizer
|
synchronizer_rxp_inst : entity work.synchronizer
|
||||||
@ -111,26 +111,26 @@ begin
|
|||||||
|
|
||||||
demanchestizer : block
|
demanchestizer : block
|
||||||
-- Transition detector
|
-- Transition detector
|
||||||
constant BIT_LENGTH_LONG : integer := F_CLK / F_ETH - 1;
|
constant BIT_LENGTH_LONG : integer := F_CLK / F_ETH - 1;
|
||||||
constant BIT_LENGTH_SHORT : integer := F_CLK / (F_ETH * 2) - 1;
|
constant BIT_LENGTH_SHORT : integer := F_CLK / (F_ETH * 2) - 1;
|
||||||
constant BIT_LENGTH_TOLERANCE : integer := (F_CLK / F_ETH) / 5;
|
constant BIT_LENGTH_TOLERANCE : integer := (F_CLK / F_ETH) / 5;
|
||||||
constant BIT_LENGTH_TIMEOUT : integer := BIT_LENGTH_LONG + BIT_LENGTH_TOLERANCE + 1;
|
constant BIT_LENGTH_TIMEOUT : integer := BIT_LENGTH_LONG + BIT_LENGTH_TOLERANCE + 1;
|
||||||
signal sample_count : integer range 0 to BIT_LENGTH_TIMEOUT;
|
signal sample_count : integer range 0 to BIT_LENGTH_TIMEOUT;
|
||||||
type transition_duration_t is (SHORT, LONG);
|
type transition_duration_t is (SHORT, LONG);
|
||||||
signal transition_duration : transition_duration_t;
|
signal transition_duration : transition_duration_t;
|
||||||
signal transition_stb : std_logic;
|
signal transition_stb : std_logic;
|
||||||
signal transition_activity : std_logic;
|
signal transition_activity : std_logic;
|
||||||
|
|
||||||
-- Transition analysis
|
-- Transition analysis
|
||||||
signal last_transition : transition_duration_t;
|
signal last_transition : transition_duration_t;
|
||||||
type bit_ev_t is (NONE, TOGGLE, KEEP, ERROR);
|
type bit_ev_t is (NONE, TOGGLE, KEEP, ERROR);
|
||||||
signal bit_ev : bit_ev_t;
|
signal bit_ev : bit_ev_t;
|
||||||
|
|
||||||
-- Bit recovery
|
-- Bit recovery
|
||||||
type demanchestization_state_t is (SYNC, DATA, ERROR);
|
type demanchestization_state_t is (SYNC, DATA, ERROR);
|
||||||
signal demanchestization_state : demanchestization_state_t;
|
signal demanchestization_state : demanchestization_state_t;
|
||||||
constant DEMANCHESTIZATION_MIN_SYNC_CNT_MAX : integer := (4 * 8) - 1; -- 4 good sync bytes
|
constant DEMANCHESTIZATION_MIN_SYNC_CNT_MAX : integer := (4 * 8) - 1; -- 4 good sync bytes
|
||||||
signal demanchestization_min_sync_cnt : integer range 0 to DEMANCHESTIZATION_MIN_SYNC_CNT_MAX;
|
signal demanchestization_min_sync_cnt : integer range 0 to DEMANCHESTIZATION_MIN_SYNC_CNT_MAX;
|
||||||
begin
|
begin
|
||||||
-- Detects spacing of transitions
|
-- Detects spacing of transitions
|
||||||
transition_detector : process(clk, rst) is
|
transition_detector : process(clk, rst) is
|
||||||
@ -253,7 +253,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
if rst then
|
if rst then
|
||||||
phy_out.rx_data_valid <= '0';
|
phy_out.rx_data_valid <= '0';
|
||||||
phy_out.rx_data <= (others => '0'); -- Needed for yosys to compile
|
phy_out.rx_data <= (others => '0'); -- Needed for yosys to compile
|
||||||
|
|
||||||
elsif rising_edge(clk) then
|
elsif rising_edge(clk) then
|
||||||
phy_out.rx_data_valid <= '0';
|
phy_out.rx_data_valid <= '0';
|
||||||
@ -301,21 +301,21 @@ begin
|
|||||||
constant TX_STB_SKIP_ERROR : real := abs (round(TX_STB_CNT_IDEAL) - TX_STB_CNT_IDEAL);
|
constant TX_STB_SKIP_ERROR : real := abs (round(TX_STB_CNT_IDEAL) - TX_STB_CNT_IDEAL);
|
||||||
constant TX_STB_CNT_MAX : integer := integer(round(TX_STB_CNT_IDEAL + 0.25)) - 1; -- Round up starting for error > 0.25
|
constant TX_STB_CNT_MAX : integer := integer(round(TX_STB_CNT_IDEAL + 0.25)) - 1; -- Round up starting for error > 0.25
|
||||||
constant TX_STB_SKIP_SECOND : boolean := TX_STB_SKIP_ERROR >= 0.25; -- Skip one clock cycle every other symbol to hit clock rate in between when the divider is close to x.5
|
constant TX_STB_SKIP_SECOND : boolean := TX_STB_SKIP_ERROR >= 0.25; -- Skip one clock cycle every other symbol to hit clock rate in between when the divider is close to x.5
|
||||||
signal tx_stb_cnt : integer range 0 to TX_STB_CNT_MAX;
|
signal tx_stb_cnt : integer range 0 to TX_STB_CNT_MAX;
|
||||||
|
|
||||||
type tx_state_t is (IDLE, NLP, TX, IPG);
|
type tx_state_t is (IDLE, NLP, TX, IPG);
|
||||||
signal tx_state : tx_state_t;
|
signal tx_state : tx_state_t;
|
||||||
signal sr : std_logic_vector(phy_in.tx_data'range);
|
signal sr : std_logic_vector(phy_in.tx_data'range);
|
||||||
signal bit_stage : std_logic;
|
signal bit_stage : std_logic;
|
||||||
|
|
||||||
constant BIT_CNT_MAX_IPG : integer := 96;
|
constant BIT_CNT_MAX_IPG : integer := 96;
|
||||||
constant BIT_CNT_MAX_DATA : integer := sr'length - 1;
|
constant BIT_CNT_MAX_DATA : integer := sr'length - 1;
|
||||||
signal bit_cnt : integer range 0 to maximum(BIT_CNT_MAX_IPG, BIT_CNT_MAX_DATA);
|
signal bit_cnt : integer range 0 to maximum(BIT_CNT_MAX_IPG, BIT_CNT_MAX_DATA);
|
||||||
constant NLP_CNT_MAX : integer := 15; -- specced 16 ms, but there's margin, so let's choose 15 to save a bit (timebase 1 ms)
|
constant NLP_CNT_MAX : integer := 15; -- specced 16 ms, but there's margin, so let's choose 15 to save a bit (timebase 1 ms)
|
||||||
signal nlp_cnt : integer range 0 to NLP_CNT_MAX;
|
signal nlp_cnt : integer range 0 to NLP_CNT_MAX;
|
||||||
|
|
||||||
type tx_mode_t is (OFF, NLP, ACTIVE);
|
type tx_mode_t is (OFF, NLP, ACTIVE);
|
||||||
signal tx_mode : tx_mode_t;
|
signal tx_mode : tx_mode_t;
|
||||||
begin
|
begin
|
||||||
tx_main : process(clk, rst) is
|
tx_main : process(clk, rst) is
|
||||||
procedure transmit_byte is
|
procedure transmit_byte is
|
||||||
|
@ -14,14 +14,14 @@ use ieee.numeric_std.all;
|
|||||||
|
|
||||||
package trashernet_pkg is
|
package trashernet_pkg is
|
||||||
-- General types
|
-- General types
|
||||||
subtype byte is std_logic_vector(7 downto 0);
|
subtype byte is std_logic_vector(7 downto 0);
|
||||||
type byte_vector is array (natural range <>) of byte;
|
type byte_vector is array (natural range <>) of byte;
|
||||||
|
|
||||||
-- MAC specific types
|
-- MAC specific types
|
||||||
subtype mac_addr_t is byte_vector(0 to 5);
|
subtype mac_addr_t is byte_vector(0 to 5);
|
||||||
constant MAC_ADDR_BROADCAST : mac_addr_t := (others => x"FF");
|
constant MAC_ADDR_BROADCAST : mac_addr_t := (others => x"FF");
|
||||||
function mac_to_string(constant mac_address : in mac_addr_t) return string;
|
function mac_to_string(constant mac_address : in mac_addr_t) return string;
|
||||||
subtype ethertype_t is byte_vector(0 to 1);
|
subtype ethertype_t is byte_vector(0 to 1);
|
||||||
|
|
||||||
type mac_header_fields is record
|
type mac_header_fields is record
|
||||||
mac_destination : mac_addr_t; -- Destination MAC address
|
mac_destination : mac_addr_t; -- Destination MAC address
|
||||||
@ -80,13 +80,13 @@ package trashernet_pkg is
|
|||||||
end record mac_out_t;
|
end record mac_out_t;
|
||||||
|
|
||||||
-- MAC ETH interface
|
-- MAC ETH interface
|
||||||
type ethernet_ii_protocol_t is record
|
type ethernet_ii_protocol_t is record
|
||||||
ethertype : ethertype_t;
|
ethertype : ethertype_t;
|
||||||
end record;
|
end record;
|
||||||
type ethernet_ii_protocol_vector is array (natural range <>) of ethernet_ii_protocol_t;
|
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"))); -- @suppress "Null range": We want a NULL vector here to remove the logic
|
constant ETHERNET_II_PROTOCOLS_NONE : ethernet_ii_protocol_vector(0 to -1) := (others => (ethertype => (x"00", x"00"))); -- @suppress "Null range": We want a NULL vector here to remove the logic
|
||||||
constant ETHERNET_II_PROTOCOL_IPV4 : ethernet_ii_protocol_t := (ethertype => (x"08", x"00"));
|
constant ETHERNET_II_PROTOCOL_IPV4 : ethernet_ii_protocol_t := (ethertype => (x"08", x"00"));
|
||||||
constant ETHERNET_II_PROTOCOL_ARP : ethernet_ii_protocol_t := (ethertype => (x"08", x"06"));
|
constant ETHERNET_II_PROTOCOL_ARP : ethernet_ii_protocol_t := (ethertype => (x"08", x"06"));
|
||||||
|
|
||||||
type ethernet_i_out_t is record
|
type ethernet_i_out_t is record
|
||||||
rx_mac_address : mac_addr_t; -- Source MAC address
|
rx_mac_address : mac_addr_t; -- Source MAC address
|
||||||
@ -121,9 +121,9 @@ package trashernet_pkg is
|
|||||||
tx_data : byte; -- TX data
|
tx_data : byte; -- TX data
|
||||||
tx_en : std_logic; -- Start and continue transmitting
|
tx_en : std_logic; -- Start and continue transmitting
|
||||||
end record;
|
end record;
|
||||||
type ethernet_ii_out_vector is array (natural range <>) of ethernet_ii_out_t;
|
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;
|
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');
|
constant ETHERNET_II_IN_UNUSED : ethernet_ii_in_t := (tx_mac_address => (others => x"00"), tx_data => x"00", others => '0');
|
||||||
|
|
||||||
-- ARP interface
|
-- ARP interface
|
||||||
type arp_out_t is record
|
type arp_out_t is record
|
||||||
@ -137,12 +137,12 @@ package trashernet_pkg is
|
|||||||
end record arp_in_t;
|
end record arp_in_t;
|
||||||
|
|
||||||
-- IPv4 interface
|
-- IPv4 interface
|
||||||
subtype ipv4_protocol is byte;
|
subtype ipv4_protocol is byte;
|
||||||
type ipv4_protocol_vector is array (natural range <>) of ipv4_protocol;
|
type ipv4_protocol_vector is array (natural range <>) of ipv4_protocol;
|
||||||
constant IPV4_PROTOCOL_ICMP : ipv4_protocol := x"01";
|
constant IPV4_PROTOCOL_ICMP : ipv4_protocol := x"01";
|
||||||
constant IPV4_PROTOCOL_TCP : ipv4_protocol := x"06";
|
constant IPV4_PROTOCOL_TCP : ipv4_protocol := x"06";
|
||||||
constant IPV4_PROTOCOL_UDP : ipv4_protocol := x"11";
|
constant IPV4_PROTOCOL_UDP : ipv4_protocol := x"11";
|
||||||
subtype ipv4_length is unsigned(15 downto 0);
|
subtype ipv4_length is unsigned(15 downto 0);
|
||||||
|
|
||||||
type ipv4_out_t is record
|
type ipv4_out_t is record
|
||||||
rx_ip_address : ip_addr_t; -- Source IP address
|
rx_ip_address : ip_addr_t; -- Source IP address
|
||||||
@ -189,12 +189,12 @@ package trashernet_pkg is
|
|||||||
tx_en : std_logic; -- Start and continue transmitting
|
tx_en : std_logic; -- Start and continue transmitting
|
||||||
end record ipv4_protocol_in_t;
|
end record ipv4_protocol_in_t;
|
||||||
type ipv4_protocol_out_vector is array (natural range <>) of ipv4_protocol_out_t;
|
type ipv4_protocol_out_vector is array (natural range <>) of ipv4_protocol_out_t;
|
||||||
type ipv4_protocol_in_vector is array (natural range <>) of ipv4_protocol_in_t;
|
type ipv4_protocol_in_vector is array (natural range <>) of ipv4_protocol_in_t;
|
||||||
|
|
||||||
-- UDP interface
|
-- UDP interface
|
||||||
subtype udp_port_t is unsigned(15 downto 0);
|
subtype udp_port_t is unsigned(15 downto 0);
|
||||||
subtype udp_length_t is unsigned(15 downto 0);
|
subtype udp_length_t is unsigned(15 downto 0);
|
||||||
type udp_out_t is record
|
type udp_out_t is record
|
||||||
rx_data : byte; -- RX Data
|
rx_data : byte; -- RX Data
|
||||||
rx_data_valid : std_logic; -- RX data valid strobe
|
rx_data_valid : std_logic; -- RX data valid strobe
|
||||||
|
|
||||||
@ -220,20 +220,20 @@ package trashernet_pkg is
|
|||||||
tx_data : byte;
|
tx_data : byte;
|
||||||
end record udp_in_t;
|
end record udp_in_t;
|
||||||
|
|
||||||
type udpprot_rx_out_t is record
|
type udpprot_rx_out_t is record
|
||||||
temp : std_logic;
|
temp : std_logic;
|
||||||
end record udpprot_rx_out_t;
|
end record udpprot_rx_out_t;
|
||||||
type udpprot_rx_in_t is record
|
type udpprot_rx_in_t is record
|
||||||
temp : std_logic;
|
temp : std_logic;
|
||||||
end record udpprot_rx_in_t;
|
end record udpprot_rx_in_t;
|
||||||
type udpprot_tx_out_t is record
|
type udpprot_tx_out_t is record
|
||||||
temp : std_logic;
|
temp : std_logic;
|
||||||
end record udpprot_tx_out_t;
|
end record udpprot_tx_out_t;
|
||||||
type udpprot_tx_in_t is record
|
type udpprot_tx_in_t is record
|
||||||
temp : std_logic;
|
temp : std_logic;
|
||||||
end record udpprot_tx_in_t;
|
end record udpprot_tx_in_t;
|
||||||
subtype portnum is integer range 0 to 65535;
|
subtype portnum is integer range 0 to 65535;
|
||||||
type udp_port_vector is array (natural range <>) of portnum;
|
type udp_port_vector is array (natural range <>) of portnum;
|
||||||
|
|
||||||
-- General helper functions
|
-- General helper functions
|
||||||
function to_std_logic(constant bool : boolean) return std_logic;
|
function to_std_logic(constant bool : boolean) return std_logic;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user