aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils/rfnoc_blocktool
diff options
context:
space:
mode:
authorWade Fife <wade.fife@ettus.com>2020-02-21 08:35:24 -0600
committerWade Fife <wade.fife@ettus.com>2020-03-09 13:43:05 -0500
commitfc895feacb8dde3b02c9a4eccb4b4f4a654f2881 (patch)
tree0325ce379611fae9e9902e0e9a5fd299c1c48243 /host/utils/rfnoc_blocktool
parent369594ef16d7b2d519940269d2af035cfe648f50 (diff)
downloaduhd-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 'host/utils/rfnoc_blocktool')
-rw-r--r--host/utils/rfnoc_blocktool/templates/rfnoc_block_template_tb.sv.mako7
1 files changed, 6 insertions, 1 deletions
diff --git a/host/utils/rfnoc_blocktool/templates/rfnoc_block_template_tb.sv.mako b/host/utils/rfnoc_blocktool/templates/rfnoc_block_template_tb.sv.mako
index 4ec1d1b93..ef535f166 100644
--- a/host/utils/rfnoc_blocktool/templates/rfnoc_block_template_tb.sv.mako
+++ b/host/utils/rfnoc_blocktool/templates/rfnoc_block_template_tb.sv.mako
@@ -28,6 +28,7 @@ module rfnoc_block_${config['module_name']}_tb;
localparam [ 9:0] THIS_PORTID = 10'h123;
localparam [31:0] NOC_ID = 32'h${format(config['noc_id'], "08X")};
localparam int CHDR_W = ${config['chdr_width']};
+ localparam int ITEM_W = 32;
%if 'parameters' in config:
%for param, value in config['parameters'].items():
localparam int ${'{:<15}'.format(param)} = ${value};
@@ -37,7 +38,7 @@ module rfnoc_block_${config['module_name']}_tb;
localparam int NUM_PORTS_O = ${func.num_ports_out_str()};
localparam int MTU = 13;
localparam int SPP = 64;
- localparam int PKT_SIZE_BYTES = SPP * 4; // Assumes 4 bytes per sample
+ localparam int PKT_SIZE_BYTES = SPP * (ITEM_W/8);
localparam int STALL_PROB = 25; // Default BFM stall probability
localparam real CHDR_CLK_PER = 5.0; // 200 MHz
localparam real CTRL_CLK_PER = 25.0; // 40 MHz
@@ -85,6 +86,10 @@ module rfnoc_block_${config['module_name']}_tb;
// Block Controller BFM
RfnocBlockCtrlBfm #(.CHDR_W(CHDR_W)) blk_ctrl = new(backend, m_ctrl, s_ctrl);
+ // 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;
+
// Connect block controller to BFMs
for (genvar i = 0; i < NUM_PORTS_I; i++) begin : gen_bfm_input_connections
initial begin