fpga: rfnoc: Add SV packages for use with RFNoC

Original-commit: c2b8eb4a88534230ce31dd4d40e4c069644c4d10
This commit is contained in:
Wade Fife
2024-12-17 22:13:42 +01:00
committed by Jörg Hofrichter
parent 48d8e384b6
commit 7e792d4a25
4 changed files with 52 additions and 5 deletions
+2
View File
@@ -15,6 +15,8 @@ ctrlport.vh \
)) ))
RFNOC_CORE_SRCS = $(abspath $(addprefix $(BASE_DIR)/../lib/rfnoc/core/, \ RFNOC_CORE_SRCS = $(abspath $(addprefix $(BASE_DIR)/../lib/rfnoc/core/, \
rfnoc_chdr_utils_pkg.sv \
ctrlport_pkg.sv \
axis_ctrl_endpoint.v \ axis_ctrl_endpoint.v \
axis_ctrl_master.v \ axis_ctrl_master.v \
axis_ctrl_slave.v \ axis_ctrl_slave.v \
+17
View File
@@ -0,0 +1,17 @@
//
// Copyright 2024 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: LGPL-3.0-or-later
//
// Package: ctrlport_pkg
//
// Description:
//
// Defines constants for the control-port interface.
//
package ctrlport_pkg;
`include "ctrlport.vh"
endpackage : ctrlport_pkg
+16 -5
View File
@@ -8,10 +8,10 @@
// CHDR Bitfields // CHDR Bitfields
// ============================================================= // =============================================================
// //
// The Condensed Hierarchical Datagram for RFNoC (CHDR) is // The Condensed Hierarchical Datagram for RFNoC (CHDR) is
// a protocol that defines the fundamental unit of data transfer // a protocol that defines the fundamental unit of data transfer
// in an RFNoC network. // in an RFNoC network.
// //
// ----------------------- // -----------------------
// Header // Header
// ----------------------- // -----------------------
@@ -25,7 +25,7 @@
// 47:32 seq_num Sequence number for the packet // 47:32 seq_num Sequence number for the packet
// 31:16 length Length of the datagram in bytes // 31:16 length Length of the datagram in bytes
// 15:0 dst_epid Destination Endpoint ID // 15:0 dst_epid Destination Endpoint ID
// //
// Field: Packet Type // Field: Packet Type
// ----------------------- // -----------------------
// 3'd0 Management // 3'd0 Management
@@ -57,6 +57,17 @@ localparam [4:0] CHDR_NO_MDATA = 5'd0;
// EPID // EPID
localparam [15:0] NULL_EPID = 16'd0; localparam [15:0] NULL_EPID = 16'd0;
// CHDR field lengths
localparam CHDR_VC_W = 6;
localparam CHDR_EOB_W = 1;
localparam CHDR_EOV_W = 1;
localparam CHDR_PKT_TYPE_W = 3;
localparam CHDR_NUM_MDATA_W = 5;
localparam CHDR_SEQ_NUM_W = 16;
localparam CHDR_LENGTH_W = 16;
localparam CHDR_DST_EPID_W = 16;
localparam CHDR_TIMESTAMP_W = 64;
// CHDR Getter Functions // CHDR Getter Functions
// //
function [5:0] chdr_get_vc(input [63:0] header); function [5:0] chdr_get_vc(input [63:0] header);
@@ -215,7 +226,7 @@ function [63:0] chdr_update_length(
end end
mdata_length = chdr_get_num_mdata(base_hdr) * (chdr_w/8); mdata_length = chdr_get_num_mdata(base_hdr) * (chdr_w/8);
length = header_length + mdata_length + payload_length; length = header_length + mdata_length + payload_length;
chdr_update_length = chdr_set_length(base_hdr, length); chdr_update_length = chdr_set_length(base_hdr, length);
end end
endfunction endfunction
+17
View File
@@ -0,0 +1,17 @@
//
// Copyright 2024 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: LGPL-3.0-or-later
//
// Module: rfnoc_chdr_utils_pkg
//
// Description:
//
// Package containing constants and functions for working with CHDR.
//
package rfnoc_chdr_utils_pkg;
`include "rfnoc_chdr_utils.vh"
endpackage : rfnoc_chdr_utils_pkg