mirror of
https://github.com/fpganinja/taxi.git
synced 2025-12-09 08:58:40 -08:00
eth: Optimize frame length enforcement logic in BASE-R MACs
Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
@@ -181,7 +181,9 @@ logic is_mcast_reg = 1'b0, is_mcast_next;
|
||||
logic is_bcast_reg = 1'b0, is_bcast_next;
|
||||
logic is_8021q_reg = 1'b0, is_8021q_next;
|
||||
logic [15:0] frame_len_reg = '0, frame_len_next;
|
||||
logic [15:0] frame_len_lim_reg = '0, frame_len_lim_next;
|
||||
logic [12:0] frame_len_lim_cyc_reg = '0, frame_len_lim_cyc_next;
|
||||
logic [2:0] frame_len_lim_last_reg = '0, frame_len_lim_last_next;
|
||||
logic frame_len_lim_check_reg = '0, frame_len_lim_check_next;
|
||||
|
||||
logic [DATA_W-1:0] m_axis_rx_tdata_reg = '0, m_axis_rx_tdata_next;
|
||||
logic [KEEP_W-1:0] m_axis_rx_tkeep_reg = '0, m_axis_rx_tkeep_next;
|
||||
@@ -318,7 +320,9 @@ always_comb begin
|
||||
is_bcast_next = is_bcast_reg;
|
||||
is_8021q_next = is_8021q_reg;
|
||||
frame_len_next = frame_len_reg;
|
||||
frame_len_lim_next = frame_len_lim_reg;
|
||||
frame_len_lim_cyc_next = frame_len_lim_cyc_reg;
|
||||
frame_len_lim_last_next = frame_len_lim_last_reg;
|
||||
frame_len_lim_check_next = frame_len_lim_check_reg;
|
||||
|
||||
m_axis_rx_tdata_next = input_data_d1;
|
||||
m_axis_rx_tkeep_next = 8'd0;
|
||||
@@ -359,10 +363,14 @@ always_comb begin
|
||||
end
|
||||
|
||||
// counter for max frame length enforcement
|
||||
if (frame_len_lim_reg[15:3] != 0) begin
|
||||
frame_len_lim_next = frame_len_lim_reg - 16'(KEEP_W);
|
||||
if (frame_len_lim_cyc_reg != 0) begin
|
||||
frame_len_lim_cyc_next = frame_len_lim_cyc_reg - 1;
|
||||
end else begin
|
||||
frame_len_lim_next = '0;
|
||||
frame_len_lim_cyc_next = '0;
|
||||
end
|
||||
|
||||
if (frame_len_lim_cyc_reg == 2) begin
|
||||
frame_len_lim_check_next = 1'b1;
|
||||
end
|
||||
|
||||
// address and ethertype checks
|
||||
@@ -386,8 +394,10 @@ always_comb begin
|
||||
// idle state - wait for packet
|
||||
reset_crc = 1'b1;
|
||||
|
||||
frame_oversize_next = 1'b0;
|
||||
frame_len_next = 16'(KEEP_W);
|
||||
frame_len_lim_next = cfg_rx_max_pkt_len;
|
||||
{frame_len_lim_cyc_next, frame_len_lim_last_next} = cfg_rx_max_pkt_len;
|
||||
frame_len_lim_check_next = 1'b0;
|
||||
hdr_ptr_next = 0;
|
||||
|
||||
pre_ok_next = input_data_d1[63:8] == 56'hD5555555555555;
|
||||
@@ -411,10 +421,17 @@ always_comb begin
|
||||
|
||||
if (input_type_d0[3]) begin
|
||||
stat_rx_byte_next = 4'(input_type_d0[2:0]);
|
||||
frame_oversize_next = frame_len_lim_reg < 16'(8+input_type_d0[2:0]);
|
||||
if (frame_len_lim_check_reg) begin
|
||||
if (frame_len_lim_last_reg < input_type_d0[2:0]) begin
|
||||
frame_oversize_next = 1'b1;
|
||||
end
|
||||
end
|
||||
end else begin
|
||||
stat_rx_byte_next = 4'(KEEP_W);
|
||||
frame_oversize_next = frame_len_lim_reg < 8;
|
||||
if (frame_len_lim_check_reg) begin
|
||||
// at the limit but this isn't a termination character
|
||||
frame_oversize_next = 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
if (input_type_d0[3]) begin
|
||||
@@ -563,7 +580,9 @@ always_ff @(posedge clk) begin
|
||||
is_bcast_reg <= is_bcast_next;
|
||||
is_8021q_reg <= is_8021q_next;
|
||||
frame_len_reg <= frame_len_next;
|
||||
frame_len_lim_reg <= frame_len_lim_next;
|
||||
frame_len_lim_cyc_reg <= frame_len_lim_cyc_next;
|
||||
frame_len_lim_last_reg <= frame_len_lim_last_next;
|
||||
frame_len_lim_check_reg <= frame_len_lim_check_next;
|
||||
|
||||
m_axis_rx_tdata_reg <= m_axis_rx_tdata_next;
|
||||
m_axis_rx_tkeep_reg <= m_axis_rx_tkeep_next;
|
||||
|
||||
Reference in New Issue
Block a user