diff options
author | Wade Fife <wade.fife@ettus.com> | 2020-02-21 08:35:24 -0600 |
---|---|---|
committer | Wade Fife <wade.fife@ettus.com> | 2020-03-09 13:43:05 -0500 |
commit | fc895feacb8dde3b02c9a4eccb4b4f4a654f2881 (patch) | |
tree | 0325ce379611fae9e9902e0e9a5fd299c1c48243 /fpga/usrp3/sim/rfnoc/PkgChdrUtils.sv | |
parent | 369594ef16d7b2d519940269d2af035cfe648f50 (diff) | |
download | uhd-fc895feacb8dde3b02c9a4eccb4b4f4a654f2881.tar.gz uhd-fc895feacb8dde3b02c9a4eccb4b4f4a654f2881.tar.bz2 uhd-fc895feacb8dde3b02c9a4eccb4b4f4a654f2881.zip |
sim: Parameterize chdr_word_t data type
This replaces chdr_word_t, which was a statically defined 64-bit data
type, with a paramaterizable data type that matches the defined CHDR_W.
Code that formerly referenced the chdr_word_t data type can now define
the data type for their desired CHDR_W and ITEM_W as follows:
// Define the CHDR word and item/sample data types
typedef ChdrData #(CHDR_W, ITEM_W)::chdr_word_t chdr_word_t;
typedef ChdrData #(CHDR_W, ITEM_W)::item_t item_t;
ITEM_W is optional when defining chdr_word_t if items are not
needed. Static methods in the ChdrData class also provide the ability to
convert between CHDR words and data items. For example:
// Convert CHDR data buffer to a buffer of samples
samples = ChdrData#(CHDR_W, ITEM_W)::chdr_to_item(data);
Diffstat (limited to 'fpga/usrp3/sim/rfnoc/PkgChdrUtils.sv')
-rw-r--r-- | fpga/usrp3/sim/rfnoc/PkgChdrUtils.sv | 63 |
1 files changed, 18 insertions, 45 deletions
diff --git a/fpga/usrp3/sim/rfnoc/PkgChdrUtils.sv b/fpga/usrp3/sim/rfnoc/PkgChdrUtils.sv index 5f7abb46f..31c6984d7 100644 --- a/fpga/usrp3/sim/rfnoc/PkgChdrUtils.sv +++ b/fpga/usrp3/sim/rfnoc/PkgChdrUtils.sv @@ -13,16 +13,20 @@ package PkgChdrUtils; + import PkgChdrData::*; + + //--------------------------------------------------------------------------- // Type Definitions //--------------------------------------------------------------------------- - // CHDR Definitions - // ---------------- + //---------------------- + // AXIS-CHDR Definitions + //---------------------- - // The fundamental unit of the CHDR bus, which is always a multiple of 64-bits - typedef logic [63:0] chdr_word_t; - typedef chdr_word_t chdr_word_queue_t[$]; + // Expose the CHDR word and item/sample data types and methods in the + // ChdrData class. The width of these types is a class parameter. + export PkgChdrData::ChdrData; // CHDR header fields typedef enum bit [2:0] { @@ -37,10 +41,13 @@ package PkgChdrUtils; } chdr_pkt_type_t; // CHDR Packet Type typedef bit [ 5:0] chdr_vc_t; // CHDR Virtual Channel field + typedef bit [ 0:0] chdr_eob_t; // CHDR End of Burst field + typedef bit [ 0:0] chdr_eov_t; // CHDR End of Vector field typedef bit [ 4:0] chdr_num_mdata_t; // CHDR Num Metadata field typedef bit [15:0] chdr_seq_num_t; // CHDR SeqNum field typedef bit [15:0] chdr_length_t; // CHDR Length field typedef bit [15:0] chdr_epid_t; // CHDR EPID field + typedef bit [63:0] chdr_timestamp_t; // CHDR Timestamp field // CHDR Context Field Identifiers typedef enum bit [3:0] { @@ -50,8 +57,9 @@ package PkgChdrUtils; CONTEXT_FIELD_MDATA = 4'd3 } chdr_context_type_t; + //---------------------- // AXIS-Ctrl Definitions - // --------------------- + //---------------------- // The fundamental unit of the AXIS-Ctrl (control) bus, which is always 32 bits typedef logic [31:0] ctrl_word_t; @@ -82,9 +90,9 @@ package PkgChdrUtils; typedef bit [3:0] ctrl_byte_en_t; // AXIS-Ctrl ByteEnable field typedef bit [19:0] ctrl_address_t; // AXIS-Ctrl Address field - + //------------------------------- // CHDR Type-Specific Definitions - // ------------------------------ + //------------------------------- // CHDR Status packet fields typedef enum bit [3:0] { @@ -141,8 +149,8 @@ package PkgChdrUtils; // CHDR packet header typedef struct packed { chdr_vc_t vc; - bit eob; - bit eov; + chdr_eob_t eob; + chdr_eov_t eov; chdr_pkt_type_t pkt_type; chdr_num_mdata_t num_mdata; chdr_seq_num_t seq_num; @@ -237,39 +245,4 @@ package PkgChdrUtils; } chdr_mgmt_t; - - //--------------------------------------------------------------------------- - // Functions - //--------------------------------------------------------------------------- - - // Returns 1 if the queues have the same contents, otherwise returns 0. This - // function is equivalent to (a == b), but this doesn't work correctly yet in - // Vivado 2018.3. - function automatic bit chdr_word_queues_equal(ref chdr_word_t a[$], ref chdr_word_t b[$]); - chdr_word_t x, y; - if (a.size() != b.size()) return 0; - foreach (a[i]) begin - x = a[i]; - y = b[i]; - if (x !== y) return 0; - end - return 1; - endfunction : chdr_word_queues_equal - - - // Returns 1 if the queues have the same contents, otherwise returns 0. This - // function is equivalent to (a == b), but this doesn't work correctly yet in - // Vivado 2018.3. - function automatic bit chdr_mgmt_op_queues_equal(ref chdr_mgmt_op_t a[$], ref chdr_mgmt_op_t b[$]); - chdr_mgmt_op_t x, y; - if (a.size() != b.size()) return 0; - foreach (a[i]) begin - x = a[i]; - y = b[i]; - if (x !== y) return 0; - end - return 1; - endfunction : chdr_mgmt_op_queues_equal - - endpackage : PkgChdrUtils |