Compare commits
5 Commits
37714d5c2d
...
afb545cd02
Author | SHA1 | Date | |
---|---|---|---|
afb545cd02 | |||
4e39e3b371 | |||
a2edc540b2 | |||
6f8bb7ba54 | |||
76eaff20fd |
@ -54,8 +54,7 @@ begin
|
|||||||
);
|
);
|
||||||
|
|
||||||
-- strobify
|
-- strobify
|
||||||
b_toggle_last <= '0' when b_rst
|
b_toggle_last <= '0' when b_rst else
|
||||||
else b_toggle when rising_edge(b_clk)
|
b_toggle when rising_edge(b_clk);
|
||||||
;
|
|
||||||
b_out <= (b_toggle ?/= b_toggle_last);
|
b_out <= (b_toggle ?/= b_toggle_last);
|
||||||
end architecture rtl;
|
end architecture rtl;
|
||||||
|
@ -79,6 +79,7 @@ begin
|
|||||||
mac_out.rx_mac_crc_ok <= '0';
|
mac_out.rx_mac_crc_ok <= '0';
|
||||||
mac_out.rx_mac_header_rcv <= '0';
|
mac_out.rx_mac_header_rcv <= '0';
|
||||||
crc_clear <= '0';
|
crc_clear <= '0';
|
||||||
|
state <= HEAD;
|
||||||
|
|
||||||
elsif rising_edge(clk) then
|
elsif rising_edge(clk) then
|
||||||
mac_out.rx_mac_valid <= '0';
|
mac_out.rx_mac_valid <= '0';
|
||||||
@ -168,6 +169,9 @@ begin
|
|||||||
begin
|
begin
|
||||||
if rst then
|
if rst then
|
||||||
mac_out.tx_mac_data_ack <= '0';
|
mac_out.tx_mac_data_ack <= '0';
|
||||||
|
tx_state <= IDLE;
|
||||||
|
sr_cnt <= 0;
|
||||||
|
byte_cnt <= 0;
|
||||||
|
|
||||||
elsif rising_edge(clk) then
|
elsif rising_edge(clk) then
|
||||||
mac_out.tx_mac_data_ack <= '0';
|
mac_out.tx_mac_data_ack <= '0';
|
||||||
|
@ -56,7 +56,7 @@ begin
|
|||||||
signal bit_cnt : integer range 0 to 7;
|
signal bit_cnt : integer range 0 to 7;
|
||||||
|
|
||||||
-- NLP supervision
|
-- NLP supervision
|
||||||
constant NLP_TIMEOUT_CNT_MAX : integer := integer(round(real(F_CLK) * 16.0 * 10.0**(-3))); -- Every 16 ms
|
constant NLP_TIMEOUT_CNT_MAX : integer := integer(round(real(F_CLK) * 16.0 * 10.0 ** (-3))); -- Every 16 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
|
||||||
@ -260,7 +260,7 @@ begin
|
|||||||
-- -------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------
|
||||||
|
|
||||||
transmitter : block
|
transmitter : block
|
||||||
constant TX_STB_CNT_MAX : integer := F_CLK / (F_ETH * 2) - 1;
|
constant TX_STB_CNT_MAX : integer := integer(round(real(F_CLK) / real((F_ETH * 2)))) - 1;
|
||||||
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);
|
||||||
@ -268,7 +268,7 @@ begin
|
|||||||
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_NLP : integer := 16000 / 100; -- 16 ms (timebase 100 ns)
|
constant BIT_CNT_MAX_NLP : integer := 16000000 / 100; -- 16 ms (timebase 100 ns)
|
||||||
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(maximum(BIT_CNT_MAX_NLP, BIT_CNT_MAX_DATA), BIT_CNT_MAX_IPG);
|
signal bit_cnt : integer range 0 to maximum(maximum(BIT_CNT_MAX_NLP, BIT_CNT_MAX_DATA), BIT_CNT_MAX_IPG);
|
||||||
@ -319,6 +319,8 @@ begin
|
|||||||
phy_out.tx_data_ack <= '0';
|
phy_out.tx_data_ack <= '0';
|
||||||
tx_stb_cnt <= TX_STB_CNT_MAX;
|
tx_stb_cnt <= TX_STB_CNT_MAX;
|
||||||
tx_mode <= OFF;
|
tx_mode <= OFF;
|
||||||
|
tx_state <= IDLE;
|
||||||
|
bit_cnt <= 0;
|
||||||
go_idle;
|
go_idle;
|
||||||
|
|
||||||
elsif rising_edge(clk) then
|
elsif rising_edge(clk) then
|
||||||
@ -378,7 +380,7 @@ begin
|
|||||||
end case;
|
end case;
|
||||||
end if;
|
end if;
|
||||||
end process tx_main;
|
end process tx_main;
|
||||||
phy_out.tx_active <= '1' when tx_state /= IDLE else '0';
|
phy_out.tx_active <= '1' when (tx_state /= IDLE and tx_state /= NLP) else '0';
|
||||||
|
|
||||||
driver : process(clk, rst) is
|
driver : process(clk, rst) is
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user