diff --git a/lib/rfnoc/core/Makefile.srcs b/lib/rfnoc/core/Makefile.srcs index 893222f..0159fb9 100644 --- a/lib/rfnoc/core/Makefile.srcs +++ b/lib/rfnoc/core/Makefile.srcs @@ -15,6 +15,8 @@ ctrlport.vh \ )) RFNOC_CORE_SRCS = $(abspath $(addprefix $(BASE_DIR)/../lib/rfnoc/core/, \ +rfnoc_chdr_utils_pkg.sv \ +ctrlport_pkg.sv \ axis_ctrl_endpoint.v \ axis_ctrl_master.v \ axis_ctrl_slave.v \ diff --git a/lib/rfnoc/core/ctrlport_pkg.sv b/lib/rfnoc/core/ctrlport_pkg.sv new file mode 100644 index 0000000..35a0b0c --- /dev/null +++ b/lib/rfnoc/core/ctrlport_pkg.sv @@ -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 diff --git a/lib/rfnoc/core/rfnoc_chdr_utils.vh b/lib/rfnoc/core/rfnoc_chdr_utils.vh index 88d19c8..f4b22b4 100644 --- a/lib/rfnoc/core/rfnoc_chdr_utils.vh +++ b/lib/rfnoc/core/rfnoc_chdr_utils.vh @@ -8,10 +8,10 @@ // 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 -// in an RFNoC network. -// +// in an RFNoC network. +// // ----------------------- // Header // ----------------------- @@ -25,7 +25,7 @@ // 47:32 seq_num Sequence number for the packet // 31:16 length Length of the datagram in bytes // 15:0 dst_epid Destination Endpoint ID -// +// // Field: Packet Type // ----------------------- // 3'd0 Management @@ -57,6 +57,17 @@ localparam [4:0] CHDR_NO_MDATA = 5'd0; // EPID 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 // function [5:0] chdr_get_vc(input [63:0] header); @@ -215,7 +226,7 @@ function [63:0] chdr_update_length( end mdata_length = chdr_get_num_mdata(base_hdr) * (chdr_w/8); length = header_length + mdata_length + payload_length; - + chdr_update_length = chdr_set_length(base_hdr, length); end endfunction diff --git a/lib/rfnoc/core/rfnoc_chdr_utils_pkg.sv b/lib/rfnoc/core/rfnoc_chdr_utils_pkg.sv new file mode 100644 index 0000000..36730b0 --- /dev/null +++ b/lib/rfnoc/core/rfnoc_chdr_utils_pkg.sv @@ -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