Skip to content
Snippets Groups Projects
Commit 30c7ed9c authored by Byron Lathi's avatar Byron Lathi
Browse files

Start work on tx ctrl

parent f4ab7b45
No related branches found
No related tags found
1 merge request!74Resolve "Network Processor"
......@@ -9,6 +9,7 @@ src/regs/ntw_top_regfile.sv
src/network_processor.sv
src/tcp_pkg.sv
src/tcp_tx_ctrl.sv
src/tcp_packet_generator.sv
src/tcp_state_manager.sv
src/tcp_stream.sv
src/tcp.sv
......
......@@ -64,7 +64,6 @@ localparam USER_WIDTH = 1;
localparam DEST_WIDTH = 8;
localparam ID_WIDTH = 8;
ip_intf #(.DATA_WIDTH(8)) tcp_tx_ip();
ip_intf #(.DATA_WIDTH(8)) tcp_stream_tx_ip [NUM_TCP]();
ip_intf #(.DATA_WIDTH(8)) tcp_rx_ip [NUM_TCP]();
ip_intf #(.DATA_WIDTH(8)) tcp_stream_rx_ip [NUM_TCP]();
......@@ -184,7 +183,7 @@ ip_arb_mux_wrapper #(
.i_rst (i_rst),
.s_ip (tcp_stream_tx_ip),
.m_ip (tcp_tx_ip)
.m_ip (m_ip)
);
......
module tcp_packet_generator (
input wire i_clk,
input wire i_rst
input wire i_rst,
axis_intf.SLAVE s_axis_data,
......@@ -9,10 +9,28 @@ module tcp_packet_generator (
input wire [15:0] i_source_port,
input wire [15:0] i_dest_port,
input wire [7:0] i_flags,
input wire [15:0] i_window_size
input wire i_hdr_valid
input wire [15:0] i_window_size,
input wire i_hdr_valid,
input wire [31:0] i_src_ip,
input wire [31:0] i_dst_ip,
ip_intf.MASTER m_ip
);
always_comb begin
m_ip.ip_hdr_valid = '0;
if (i_hdr_valid) begin
m_ip.ip_hdr_valid = '1;
m_ip.ip_dscp = '0;
m_ip.ip_ecn = '0;
m_ip.ip_length = '0;
m_ip.ip_ttl = '1;
m_ip.ip_protocol = 8'h6;
m_ip.ip_source_ip = i_src_ip;
m_ip.ip_dest_ip = i_dst_ip;
end
end
endmodule
\ No newline at end of file
......@@ -40,11 +40,11 @@ tcp_pkg::tx_ctrl_t tx_ctrl;
logic tx_ctrl_valid;
logic tx_ctrl_ack;
logic [31:0] o_seq_number;
logic [31:0] o_ack_number;
logic [7:0] o_flags;
logic [15:0] o_window_size;
logic o_hdr_vali;
logic [31:0] w_tx_seq_number;
logic [31:0] w_tx_ack_number;
logic [7:0] w_tx_flags;
logic [15:0] w_tx_window_size;
logic w_tx_hdr_valid;
tcp_pkg::rx_msg_t rx_msg;
......@@ -179,7 +179,9 @@ tcp_packet_generator u_tcp_packet_generator (
.i_dest_port (hwif_out.dest_port.d.value),
.i_flags (w_tx_flags),
.i_window_size (w_tx_window_size),
.i_hdr_valid (w_tx_hdr_valid)
.i_hdr_valid (w_tx_hdr_valid),
.i_src_ip (hwif_out.source_ip.d.value),
.i_dst_ip (hwif_out.dest_ip.d.value),
.m_ip (m_ip_tx)
);
......
......@@ -15,6 +15,15 @@ module tcp_tx_ctrl(
output logic o_hdr_valid
);
localparam FLAG_FIN = (1 << 0);
localparam FLAG_SYN = (1 << 1);
localparam FLAG_RST = (1 << 2);
localparam FLAG_PSH = (1 << 3);
localparam FLAG_ACK = (1 << 4);
localparam FLAG_URG = (1 << 5);
localparam FLAG_ECE = (1 << 6);
localparam FLAG_CWR = (1 << 7);
enum logic [2:0] {IDLE, SEND_SYN} state, state_next;
always_ff @(posedge i_clk) begin
......@@ -26,12 +35,27 @@ always_ff @(posedge i_clk) begin
end
always_comb begin
o_seq_number = '0;
o_ack_number = '0;
o_flags = '0;
o_window_size = '0;
o_hdr_valid = '0;
case (state)
IDLE: begin
if (i_tx_ctrl) begin
if (i_tx_ctrl_valid) begin
o_tx_ctrl_ack = '1;
case (i_tx_ctrl)
TX_CTRL_SEND_SYN: state_next = SEND_SYN;
endcase
end
end
SEND_SYN: begin
o_flags = FLAG_SYN;
o_hdr_valid = '1;
end
endcase
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment