fpga: rfnoc: Add labels to chdr_mgmt_pkt_handler

Original-commit: a8bb7d3ad98a77fb23e3695721b4bdd3768e6508
This commit is contained in:
Wade Fife
2021-10-28 23:15:41 -05:00
parent 4e769632be
commit 1a72b843e8
+35 -20
View File
@@ -1,31 +1,42 @@
//
// Copyright 2018 Ettus Research, A National Instruments Company
// Copyright 2021 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: LGPL-3.0-or-later
//
// Module: chdr_mgmt_pkt_handler
//
// Description:
// This module sits inline on a CHDR stream and adds a management
// node that is discoverable and configurable by software. As a
// management node, a control-port master to configure any slave.
// The output CHDR stream has an additional tdest and tid which can
// be used to make routing decisions for management packets only.
// tid will be CHDR_MGMT_ROUTE_TDEST when tdest should be used.
//
// This module sits inline on a CHDR stream and adds a management node that
// is discoverable and configurable by software. As a management node, it has
// a control-port master to configure any slave. The output CHDR stream has
// an additional tdest and tid which can be used to make routing decisions
// for management packets only. tid will be CHDR_MGMT_ROUTE_TDEST when tdest
// should be used.
//
// Parameters:
//
// - PROTOVER: RFNoC protocol version {8'd<major>, 8'd<minor>}
// - CHDR_W: Width of the CHDR bus in bits
// - USER_W: Width of the user/data bits that accompany an advertisement op
// - RESP_FIFO_SIZE: Log2 of the depth of the response FIFO
// Maximum value = 8
// - RESP_FIFO_SIZE: Log2 of the depth of the response FIFO (max value of 8)
//
// Signals:
//
// - s_axis_chdr_* : Input CHDR stream (AXI-Stream)
// - m_axis_chdr_* : Output CHDR stream (AXI-Stream)
// - m_axis_chdr_tid contains the routing mode, whose values
// are defined in rfnoc_chdr_internal_utils.vh.
// - m_axis_chdr_tdest contains the manual routing
// destination, which is only valid for tid =
// CHDR_MGMT_ROUTE_TDEST.
// - node_info : Info about the node that contains this management slave
// - ctrlport_* : Control-port master for management peripheral
// - op_* : Strobe and info signals for a mgmt advertisement
`default_nettype none
module chdr_mgmt_pkt_handler #(
parameter [15:0] PROTOVER = {8'd1, 8'd0},
parameter CHDR_W = 256,
@@ -46,8 +57,8 @@ module chdr_mgmt_pkt_handler #(
input wire [USER_W-1:0] s_axis_chdr_tuser,
// CHDR Data Out (AXI-Stream)
output wire [CHDR_W-1:0] m_axis_chdr_tdata,
output wire [1:0] m_axis_chdr_tid, // Routing mode. Values defined in rfnoc_chdr_internal_utils.vh
output wire [9:0] m_axis_chdr_tdest, // Manual routing destination (only valid for tid = CHDR_MGMT_ROUTE_TDEST)
output wire [1:0] m_axis_chdr_tid,
output wire [9:0] m_axis_chdr_tdest,
output wire m_axis_chdr_tlast,
output wire m_axis_chdr_tvalid,
input wire m_axis_chdr_tready,
@@ -86,7 +97,7 @@ module chdr_mgmt_pkt_handler #(
wire s_mgmt_tlast, s_mgmt_tvalid, s_mgmt_tready;
wire m_mgmt_tlast, m_mgmt_tvalid, m_mgmt_tready;
generate if (!MGMT_ONLY) begin
generate if (!MGMT_ONLY) begin : gen_not_mgmt_only
// Instantiate MUX and DEMUX to segregate management and non-management packets.
// Management packets go to the main state machine, all others get bypassed to
// the output.
@@ -130,7 +141,7 @@ module chdr_mgmt_pkt_handler #(
.o_tlast(m_axis_chdr_tlast),
.o_tvalid(m_axis_chdr_tvalid), .o_tready(m_axis_chdr_tready)
);
end else begin
end else begin : gen_mgmt_only
// We are assuming that only management packets come into this module so we don't
// instantiate a bypass path to save resources.
assign s_mgmt_tdata = s_axis_chdr_tdata;
@@ -180,8 +191,9 @@ module chdr_mgmt_pkt_handler #(
);
generate
if (CHDR_W > 64)
if (CHDR_W > 64) begin : gen_upper_mgmt_tdata
assign m_mgmt_tdata[CHDR_W-1:64] = 'h0;
end
endgenerate
// ---------------------------------------------------
@@ -193,8 +205,8 @@ module chdr_mgmt_pkt_handler #(
localparam [3:0] ST_MGMT_OP_EXEC = 4'd3; // Management operation started
localparam [3:0] ST_MGMT_OP_WAIT = 4'd4; // Waiting for management op to finish
localparam [3:0] ST_MGMT_OP_DONE = 4'd5; // Consuming management op line
localparam [3:0] ST_CHDR_OUT_HDR = 4'd6; // Outputing a CHDR header
localparam [3:0] ST_MGMT_OUT_HDR = 4'd7; // Outputing a managment header
localparam [3:0] ST_CHDR_OUT_HDR = 4'd6; // Outputting a CHDR header
localparam [3:0] ST_MGMT_OUT_HDR = 4'd7; // Outputting a management header
localparam [3:0] ST_PASS_PAYLOAD = 4'd8; // Passing payload for downstream hops
localparam [3:0] ST_MOD_LAST_HOP = 4'd9; // Processing last hop
localparam [3:0] ST_POP_RESPONSE = 4'd10; // Popping response from response FIFO
@@ -269,7 +281,7 @@ module chdr_mgmt_pkt_handler #(
// ST_MGMT_IN_HDR
// ------------------
// - Cache and consume the managment header. It will be modified
// - Cache and consume the management header. It will be modified
// later before the packet is sent out.
// - Initialize management specific state
ST_MGMT_IN_HDR: begin
@@ -366,7 +378,7 @@ module chdr_mgmt_pkt_handler #(
// ST_MGMT_OP_DONE
// ------------------
// - The management operation has finished
// - Consume a word on the input CHDR stream and update interal state
// - Consume a word on the input CHDR stream and update internal state
ST_MGMT_OP_DONE: begin
if (i64_tvalid && i64_tready) begin
if (!i64_tlast) begin
@@ -390,7 +402,7 @@ module chdr_mgmt_pkt_handler #(
// ST_CHDR_OUT_HDR
// ------------------
// - We are outputing the CHDR header
// - We are outputting the CHDR header
ST_CHDR_OUT_HDR: begin
if (o64_tvalid && o64_tready)
pkt_state <= ST_MGMT_OUT_HDR;
@@ -398,7 +410,7 @@ module chdr_mgmt_pkt_handler #(
// ST_CHDR_OUT_HDR
// ------------------
// - We are outputing the management header
// - We are outputting the management header
ST_MGMT_OUT_HDR: begin
if (o64_tvalid && o64_tready)
if (resp_o_tvalid && (hops_remaining == 10'd1))
@@ -615,3 +627,6 @@ module chdr_mgmt_pkt_handler #(
assign num_resp_pending = resp_fifo_occ[7:0];
endmodule // chdr_mgmt_pkt_handler
`default_nettype wire