From fc895feacb8dde3b02c9a4eccb4b4f4a654f2881 Mon Sep 17 00:00:00 2001 From: Wade Fife Date: Fri, 21 Feb 2020 08:35:24 -0600 Subject: 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); --- .../rfnoc-example/fpga/rfnoc_block_gain/rfnoc_block_gain_tb.sv | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'host/examples/rfnoc-example/fpga') diff --git a/host/examples/rfnoc-example/fpga/rfnoc_block_gain/rfnoc_block_gain_tb.sv b/host/examples/rfnoc-example/fpga/rfnoc_block_gain/rfnoc_block_gain_tb.sv index 1f76563a8..2b0c892f7 100644 --- a/host/examples/rfnoc-example/fpga/rfnoc_block_gain/rfnoc_block_gain_tb.sv +++ b/host/examples/rfnoc-example/fpga/rfnoc_block_gain/rfnoc_block_gain_tb.sv @@ -27,11 +27,12 @@ module rfnoc_block_gain_tb; localparam [ 9:0] THIS_PORTID = 10'h123; localparam [31:0] NOC_ID = 32'h00000B16; localparam int CHDR_W = 64; + localparam int ITEM_W = 32; localparam int NUM_PORTS_I = 1; localparam int NUM_PORTS_O = 1; 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 @@ -64,6 +65,10 @@ module rfnoc_block_gain_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 -- cgit v1.2.3