Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/tcp_apps/open_loop_app/include/open_loop_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ package open_loop_pkg;
localparam APP_CNTXT_W = $bits(app_cntxt_struct);

typedef struct packed {
logic [PAYLOAD_PTR_W:0] ptr;
logic [PAYLOAD_PTR_W:0] len;
// logic [PAYLOAD_PTR_W:0] ptr;
// logic [PAYLOAD_PTR_W:0] len;
tcp_buf_with_idx stored_buf;
} notif_struct;

localparam APP_NOTIF_IF_FBITS = TCP_RX_APP_NOTIF_FBITS;
Expand Down
15 changes: 9 additions & 6 deletions apps/tcp_apps/open_loop_app/rx_engine_datap.sv
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ import beehive_tcp_msg::*;
always_comb begin
notif_next = notif_reg;
if (ctrl_datap_store_notif) begin
notif_next.ptr = notif_hdr_flit_cast.inner.head_ptr;
notif_next.len = flow_cntxt_reg.bufsize;
// notif_next.ptr = notif_hdr_flit_cast.inner.head_ptr;
// notif_next.len = flow_cntxt_reg.bufsize;
notif_next.stored_buf = notif_hdr_flit_cast.inner.msg_specific.tcp_msg_resp.resp_buf;
end
end

Expand All @@ -117,14 +118,16 @@ import beehive_tcp_msg::*;

req_hdr_flit.inner.flowid = recv_q_data_reg;

req_hdr_flit.inner.length = flow_cntxt_reg.bufsize;
// req_hdr_flit.inner.length = flow_cntxt_reg.bufsize;

if (ctrl_datap_out_mux_sel == PTR_UPDATE) begin
req_hdr_flit.core.msg_type = TCP_RX_ADJUST_PTR;
req_hdr_flit.inner.head_ptr = notif_reg.ptr + flow_cntxt_reg.bufsize;
req_hdr_flit.core.msg_type = TCP_RX_ADJUST_IDX;
// req_hdr_flit.inner.head_ptr = notif_reg.ptr + flow_cntxt_reg.bufsize;
req_hdr_flit.inner.msg_specific.tcp_adjust_idx.old_buf = notif_reg.stored_buf; // TODO: add notif_reg.buf
end
else begin
req_hdr_flit.core.msg_type = TCP_RX_MSG_REQ;
req_hdr_flit.core.msg_type = TCP_RX_MSG_REQ2;
req_hdr_flit.inner.msg_specific.tcp_msg_req.__length = 1;
end
end
endmodule
2 changes: 1 addition & 1 deletion apps/tcp_apps/open_loop_app/setup_handler_datap.sv
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ import beehive_tcp_msg::*;
req_hdr_flit.inner.flowid = flowid_reg;

req_hdr_flit.inner.length = SETUP_HDR_BYTES;

// TODO: same thing here
if (ctrl_datap_buf_mux_sel == setup_open_loop_pkg::PTR_UPDATE) begin
req_hdr_flit.core.msg_type = TCP_RX_ADJUST_PTR;
req_hdr_flit.inner.head_ptr = notif_reg.ptr + SETUP_HDR_BYTES;
Expand Down
6 changes: 3 additions & 3 deletions include/beehive_noc_msg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ package beehive_noc_msg;
localparam [`MSG_TYPE_WIDTH-1:0] IP_TX_DATAGRAM = `MSG_TYPE_WIDTH'd4;

localparam [`MSG_TYPE_WIDTH-1:0] TCP_NEW_FLOW_NOTIF = `MSG_TYPE_WIDTH'd5;
localparam [`MSG_TYPE_WIDTH-1:0] TCP_RX_MSG_REQ = `MSG_TYPE_WIDTH'd6;
localparam [`MSG_TYPE_WIDTH-1:0] TCP_RX_MSG_RESP = `MSG_TYPE_WIDTH'd8;
localparam [`MSG_TYPE_WIDTH-1:0] TCP_RX_ADJUST_PTR = `MSG_TYPE_WIDTH'd7;
localparam [`MSG_TYPE_WIDTH-1:0] TCP_RX_MSG_REQ2 = `MSG_TYPE_WIDTH'd6;
localparam [`MSG_TYPE_WIDTH-1:0] TCP_RX_MSG_RESP2 = `MSG_TYPE_WIDTH'd8;
localparam [`MSG_TYPE_WIDTH-1:0] TCP_RX_ADJUST_IDX = `MSG_TYPE_WIDTH'd7;

localparam [`MSG_TYPE_WIDTH-1:0] TCP_TX_MSG_REQ = `MSG_TYPE_WIDTH'd9;
localparam [`MSG_TYPE_WIDTH-1:0] TCP_TX_MSG_RESP = `MSG_TYPE_WIDTH'd10;
Expand Down
68 changes: 64 additions & 4 deletions include/beehive_tcp_msg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,76 @@ package beehive_tcp_msg;
localparam [`NOC_FBITS_WIDTH-1:0] TCP_TX_APP_PTR_IF_FBITS = {1'b1, TCP_TX_APP_PTR_IF_FBITS_VALUE[`NOC_FBITS_WIDTH-2:0]};

localparam MAX_PAYLOAD_PTR_W = 32;
localparam MAX_NUM_BUFS = 8; // i think 8 buffers per flow is enough... who knows?. this is per flow.
localparam MAX_PAYLOAD_IDX_W = $clog2(MAX_NUM_BUFS);
localparam RX_PAYLOAD_IDX_W = MAX_PAYLOAD_IDX_W;

// TODO: what to do about these ptr type lengths being longer than the real ones used? do i need to declare 2 types now, one for the one in the pkt and one for the one here?
// TODO: convert sram write req stuff (e.g. store buf commit ptr rd req) all to idx instead. but what type/bit width?
typedef struct packed {
logic [MAX_PAYLOAD_PTR_W-1:0] ptr;
// these need to be one bit longer to save the wrap-around bit
logic [MAX_PAYLOAD_PTR_W:0] len;
logic [MAX_PAYLOAD_PTR_W:0] cap;
} tcp_buf;
localparam TCP_BUF_W = $bits(tcp_buf);

typedef struct packed {
logic [MAX_PAYLOAD_IDX_W:0] idx;
} tcp_buf_idx;

typedef struct packed {
tcp_buf buf_info;
tcp_buf_idx idx;
} tcp_buf_with_idx;
localparam TCP_BUF_WITH_IDX_W = $bits(tcp_buf_with_idx);

// typedef struct packed {
// logic [MAX_PAYLOAD_PTR_W:0] leftover_bytes_consumed; // assumed to be 0 at the moment (e.g. you use the entire buffer we give you)
// logic [MAX_PAYLOAD_IDX_W:0] bufs_consumed; // assumed to be 1 at the moment (e.g. you use the entire buffer we give you)
// tcp_buf_with_idx prev_buf;
// } tcp_buf_update;
// localparam TCP_BUF_UPDATE_W = $bits(tcp_buf_update);

// has to be sorted biggest to smallest to make padding calculation work
typedef struct packed {
// tcp_buf_update update_info;
tcp_buf_with_idx old_buf;
} tcp_adjust_idx;
localparam TCP_ADJUST_IDX_W = $bits(tcp_adjust_idx);

typedef struct packed {
logic [MAX_PAYLOAD_PTR_W:0] __length; // unused at the moment, we just return 1 buf unilaterally (bc we can't return more than 1 yet.)
logic [TCP_ADJUST_IDX_W-MAX_PAYLOAD_PTR_W-2:0] padding;
} tcp_msg_req;
localparam TCP_MSG_REQ_W = $bits(tcp_msg_req);

typedef struct packed {
tcp_buf_with_idx resp_buf;
// logic [TCP_ADJUST_IDX_W-TCP_BUF_WITH_IDX_W-1:0] padding;
} tcp_msg_resp;
localparam TCP_MSG_RESP_W = $bits(tcp_msg_resp);

// problem: what does the mechanism to update a ptr look like? ideally it would be incr(amt), but that requires a rd req to first read it and then update.
// maybe incr(amt, old_data)? then the tcp_slow module adds amt to old.ptr, if it's > len, it will know to incr idx. and for now assert that it should always be == len.
// that's the most flexible interface bc if we just had idx_update_req then it wouldn't support compaction, if we just did ptr_update_to then it wouldn't really be what it's doing

// TODO: update tcp.sv interface to have ptr reads and writes be the right way

// this is a TCP specific NoC flit
typedef union packed {
tcp_msg_req tcp_msg_req;
tcp_msg_resp tcp_msg_resp;
tcp_adjust_idx tcp_adjust_idx;
} msg_specific;

typedef struct packed {
logic [MAX_FLOWID_W-1:0] flowid;
logic [MAX_PAYLOAD_PTR_W:0] length;
// these need to be one bit longer to save the wrap-around bit
logic [MAX_PAYLOAD_PTR_W:0] head_ptr;
logic [MAX_PAYLOAD_PTR_W:0] tail_ptr;
msg_specific msg_specific;
} tcp_flit_inner;
localparam TCP_FLIT_INNER_W = $bits(tcp_flit_inner);

// TODO: check to make sure this doesn't go below 0
localparam TCP_HDR_FLIT_PAD_W = `NOC_DATA_WIDTH - BASE_FLIT_W - TCP_FLIT_INNER_W;
localparam TCP_EXTRA_W = TCP_FLIT_INNER_W;

Expand Down
Loading