Length hacked a little less, hack window size
This commit is contained in:
@@ -4,6 +4,7 @@ module tcp_packet_generator (
|
||||
|
||||
axis_intf.SLAVE s_axis_data,
|
||||
|
||||
input wire [15:0] i_ip_len,
|
||||
input wire [31:0] i_seq_number,
|
||||
input wire [31:0] i_ack_number,
|
||||
input wire [15:0] i_source_port,
|
||||
@@ -50,7 +51,7 @@ always_comb begin
|
||||
m_ip.ip_hdr_valid = '1;
|
||||
m_ip.ip_dscp = '0;
|
||||
m_ip.ip_ecn = '0;
|
||||
m_ip.ip_length = 16'd40;
|
||||
m_ip.ip_length = i_ip_len;
|
||||
m_ip.ip_ttl = '1;
|
||||
m_ip.ip_protocol = 8'h6;
|
||||
m_ip.ip_source_ip = i_src_ip;
|
||||
@@ -86,7 +87,7 @@ always_comb begin
|
||||
17: m_ip.ip_payload_axis_tdata = checksum[7:0];
|
||||
18: m_ip.ip_payload_axis_tdata = '0;
|
||||
19: begin
|
||||
m_ip.ip_payload_axis_tdata = '1;
|
||||
m_ip.ip_payload_axis_tdata = '0;
|
||||
m_ip.ip_payload_axis_tlast = '1;
|
||||
end
|
||||
endcase
|
||||
|
||||
@@ -47,6 +47,7 @@ tcp_pkg::rx_msg_t rx_msg;
|
||||
logic rx_msg_valid;
|
||||
logic rx_msg_ack;
|
||||
|
||||
logic [15:0] w_tx_ip_len;
|
||||
logic [31:0] w_tx_seq_number;
|
||||
logic [31:0] w_tx_ack_number;
|
||||
logic [7:0] w_tx_flags;
|
||||
@@ -177,6 +178,7 @@ tcp_tx_ctrl u_tcp_tx_ctrl (
|
||||
.i_tx_ctrl_valid (tx_ctrl_valid),
|
||||
.o_tx_ctrl_ack (tx_ctrl_ack),
|
||||
|
||||
.o_ip_len (w_tx_ip_len),
|
||||
.o_seq_number (w_tx_seq_number),
|
||||
// .o_ack_number (w_tx_ack_number),
|
||||
.o_flags (w_tx_flags),
|
||||
@@ -193,6 +195,7 @@ tcp_packet_generator u_tcp_packet_generator (
|
||||
|
||||
.s_axis_data (m2s_post_saf_axis),
|
||||
|
||||
.i_ip_len (w_tx_ip_len),
|
||||
.i_seq_number (w_tx_seq_number),
|
||||
.i_ack_number (w_tx_ack_number),
|
||||
.i_source_port (hwif_out.source_port.d.value),
|
||||
|
||||
@@ -8,6 +8,7 @@ module tcp_tx_ctrl(
|
||||
input logic i_tx_ctrl_valid,
|
||||
output logic o_tx_ctrl_ack,
|
||||
|
||||
output logic [15:0] o_ip_len,
|
||||
output logic [31:0] o_seq_number,
|
||||
output logic [31:0] o_ack_number,
|
||||
output logic [7:0] o_flags,
|
||||
@@ -26,23 +27,31 @@ localparam FLAG_URG = (1 << 5);
|
||||
localparam FLAG_ECE = (1 << 6);
|
||||
localparam FLAG_CWR = (1 << 7);
|
||||
|
||||
logic [31:0] seq_num, seq_num_next;
|
||||
assign o_seq_number = seq_num;
|
||||
|
||||
enum logic [2:0] {IDLE, SEND_SYN, SEND_ACK} state, state_next;
|
||||
|
||||
always_ff @(posedge i_clk) begin
|
||||
if (i_rst) begin
|
||||
state <= IDLE;
|
||||
seq_num <= '0;
|
||||
end else begin
|
||||
state <= state_next;
|
||||
seq_num <= seq_num_next;
|
||||
end
|
||||
end
|
||||
|
||||
always_comb begin
|
||||
o_seq_number = '0;
|
||||
o_ack_number = '0;
|
||||
o_flags = '0;
|
||||
o_window_size = '0;
|
||||
o_window_size = 16'b1;
|
||||
o_hdr_valid = '0;
|
||||
|
||||
seq_num_next = seq_num;
|
||||
|
||||
o_ip_len = 16'd40; // default length of IP packet
|
||||
|
||||
case (state)
|
||||
IDLE: begin
|
||||
if (i_tx_ctrl_valid) begin
|
||||
@@ -61,6 +70,7 @@ always_comb begin
|
||||
|
||||
if (i_packet_done) begin
|
||||
state_next = IDLE;
|
||||
seq_num_next = seq_num + 1;
|
||||
end
|
||||
end
|
||||
|
||||
@@ -70,6 +80,7 @@ always_comb begin
|
||||
|
||||
if (i_packet_done) begin
|
||||
state_next = IDLE;
|
||||
seq_num_next = seq_num + 1;
|
||||
end
|
||||
end
|
||||
endcase
|
||||
|
||||
Reference in New Issue
Block a user