diff options
Diffstat (limited to 'fpga/usrp3/sim/rfnoc')
-rw-r--r-- | fpga/usrp3/sim/rfnoc/PkgAxiStreamBfm.sv | 44 | ||||
-rw-r--r-- | fpga/usrp3/sim/rfnoc/PkgAxisCtrlBfm.sv | 18 | ||||
-rw-r--r-- | fpga/usrp3/sim/rfnoc/PkgChdrBfm.sv | 66 | ||||
-rw-r--r-- | fpga/usrp3/sim/rfnoc/PkgChdrIfaceBfm.sv | 16 |
4 files changed, 72 insertions, 72 deletions
diff --git a/fpga/usrp3/sim/rfnoc/PkgAxiStreamBfm.sv b/fpga/usrp3/sim/rfnoc/PkgAxiStreamBfm.sv index f68054dc7..9e2530350 100644 --- a/fpga/usrp3/sim/rfnoc/PkgAxiStreamBfm.sv +++ b/fpga/usrp3/sim/rfnoc/PkgAxiStreamBfm.sv @@ -71,7 +71,7 @@ package PkgAxiStreamBfm; typedef logic [DATA_WIDTH/8-1:0] keep_t; // Single TKEEP word typedef logic [USER_WIDTH-1:0] user_t; // Single TUSER word - typedef AxiStreamPacket #(DATA_WIDTH, USER_WIDTH) AxisPacket; + typedef AxiStreamPacket #(DATA_WIDTH, USER_WIDTH) AxisPacket_t; //------------ @@ -88,8 +88,8 @@ package PkgAxiStreamBfm; //--------- // Return a handle to a copy of this transaction - function AxisPacket copy(); - AxisPacket temp; + function AxisPacket_t copy(); + AxisPacket_t temp; temp = new(); temp.data = this.data; temp.user = this.user; @@ -107,7 +107,7 @@ package PkgAxiStreamBfm; // Return true if this packet equals that of the argument - virtual function bit equal(AxisPacket packet); + virtual function bit equal(AxisPacket_t packet); // These variables are needed to workaround Vivado queue support issues data_t data_a, data_b; user_t user_a, user_b; @@ -186,10 +186,10 @@ package PkgAxiStreamBfm; // Type Definitions //------------------ - typedef AxiStreamPacket #(DATA_WIDTH, USER_WIDTH) AxisPacket; - typedef AxisPacket::data_t data_t; - typedef AxisPacket::user_t user_t; - typedef AxisPacket::keep_t keep_t; + typedef AxiStreamPacket #(DATA_WIDTH, USER_WIDTH) AxisPacket_t; + typedef AxisPacket_t::data_t data_t; + typedef AxisPacket_t::user_t user_t; + typedef AxisPacket_t::keep_t keep_t; //------------ @@ -200,9 +200,9 @@ package PkgAxiStreamBfm; local const int DEF_STALL_PROB = 38; // Default values to use for idle bus cycles - local const AxisPacket::data_t IDLE_DATA = {DATA_WIDTH{1'bX}}; - local const AxisPacket::user_t IDLE_USER = {(USER_WIDTH > 1 ? USER_WIDTH : 1){1'bX}}; - local const AxisPacket::keep_t IDLE_KEEP = {(DATA_WIDTH/8){1'bX}}; + local const AxisPacket_t::data_t IDLE_DATA = {DATA_WIDTH{1'bX}}; + local const AxisPacket_t::user_t IDLE_USER = {(USER_WIDTH > 1 ? USER_WIDTH : 1){1'bX}}; + local const AxisPacket_t::keep_t IDLE_KEEP = {(DATA_WIDTH/8){1'bX}}; // Virtual interfaces for master and slave connections to DUT local virtual AxiStreamIf #(DATA_WIDTH, USER_WIDTH).master master; @@ -213,8 +213,8 @@ package PkgAxiStreamBfm; local bit slave_en; // Queues to store the bus transactions - mailbox #(AxisPacket) tx_packets; - mailbox #(AxisPacket) rx_packets; + mailbox #(AxisPacket_t) tx_packets; + mailbox #(AxisPacket_t) rx_packets; // Properties for the stall behavior of the BFM protected int master_stall_prob = DEF_STALL_PROB; @@ -226,7 +226,7 @@ package PkgAxiStreamBfm; //--------- // Returns 1 if the packets have the same contents, otherwise returns 0. - function bit packets_equal(AxisPacket a, AxisPacket b); + function bit packets_equal(AxisPacket_t a, AxisPacket_t b); return a.equal(b); endfunction : packets_equal @@ -247,7 +247,7 @@ package PkgAxiStreamBfm; // Queue the provided packet for transmission - task put(AxisPacket packet); + task put(AxisPacket_t packet); assert (master_en) else $fatal(1, "Cannot use TX operations for a null master"); tx_packets.put(packet); endtask : put @@ -255,14 +255,14 @@ package PkgAxiStreamBfm; // Attempt to queue the provided packet for transmission. Return 1 if // successful, return 0 if the queue is full. - function bit try_put(AxisPacket packet); + function bit try_put(AxisPacket_t packet); assert (master_en) else $fatal(1, "Cannot use TX operations for a null master"); return tx_packets.try_put(packet); endfunction : try_put // Get the next packet when it becomes available (waits if necessary) - task get(output AxisPacket packet); + task get(output AxisPacket_t packet); assert (slave_en) else $fatal(1, "Cannot use RX operations for a null slave"); rx_packets.get(packet); endtask : get @@ -270,7 +270,7 @@ package PkgAxiStreamBfm; // Get the next packet if there's one available and return 1. Return 0 if // there's no packet available. - function bit try_get(output AxisPacket packet); + function bit try_get(output AxisPacket_t packet); assert (slave_en) else $fatal(1, "Cannot use RX operations for a null slave"); return rx_packets.try_get(packet); endfunction : try_get @@ -278,7 +278,7 @@ package PkgAxiStreamBfm; // Get the next packet when it becomes available (wait if necessary), but // don't remove it from the receive queue. - task peek(output AxisPacket packet); + task peek(output AxisPacket_t packet); assert (slave_en) else $fatal(1, "Cannot use RX operations for a null slave"); rx_packets.peek(packet); endtask : peek @@ -287,7 +287,7 @@ package PkgAxiStreamBfm; // Get the next packet if there's one available and return 1, but don't // remove it from the receive queue. Return 0 if there's no packet // available. - function bit try_peek(output AxisPacket packet); + function bit try_peek(output AxisPacket_t packet); assert (slave_en) else $fatal(1, "Cannot use RX operations for a null slave"); return rx_packets.try_peek(packet); endfunction : try_peek @@ -388,7 +388,7 @@ package PkgAxiStreamBfm; //---------------- local task master_body(); - AxisPacket packet; + AxisPacket_t packet; master.tvalid <= 0; master.tdata <= IDLE_DATA; @@ -443,7 +443,7 @@ package PkgAxiStreamBfm; //--------------- local task slave_body(); - AxisPacket packet = new(); + AxisPacket_t packet = new(); slave.tready <= 0; diff --git a/fpga/usrp3/sim/rfnoc/PkgAxisCtrlBfm.sv b/fpga/usrp3/sim/rfnoc/PkgAxisCtrlBfm.sv index 7d7c01eff..148ef5488 100644 --- a/fpga/usrp3/sim/rfnoc/PkgAxisCtrlBfm.sv +++ b/fpga/usrp3/sim/rfnoc/PkgAxisCtrlBfm.sv @@ -117,9 +117,9 @@ package PkgAxisCtrlBfm; extern function bit try_get_ctrl(output AxisCtrlPacket ctrl_packet); - extern function AxisPacket axis_ctrl_to_axis(AxisCtrlPacket ctrl_packet); + extern function AxisPacket_t axis_ctrl_to_axis(AxisCtrlPacket ctrl_packet); - extern function AxisCtrlPacket axis_to_axis_ctrl(AxisPacket axis_packet); + extern function AxisCtrlPacket axis_to_axis_ctrl(AxisPacket_t axis_packet); endclass : AxisCtrlBfm @@ -141,7 +141,7 @@ package PkgAxisCtrlBfm; // Queue the provided packet for transmission task AxisCtrlBfm::put_ctrl(AxisCtrlPacket ctrl_packet); - AxisPacket axis_packet; + AxisPacket_t axis_packet; axis_packet = axis_ctrl_to_axis(ctrl_packet); super.put(axis_packet); endtask : put_ctrl @@ -150,14 +150,14 @@ package PkgAxisCtrlBfm; // Attempt to queue the provided packet for transmission. Return 1 if // successful, return 0 if the queue is full. task AxisCtrlBfm::try_put_ctrl(AxisCtrlPacket ctrl_packet); - AxisPacket axis_packet; + AxisPacket_t axis_packet; axis_packet = axis_ctrl_to_axis(ctrl_packet); super.put(axis_packet); endtask : try_put_ctrl // Get the next packet when it becomes available (waits if necessary) task AxisCtrlBfm::get_ctrl(output AxisCtrlPacket ctrl_packet); - AxisPacket axis_packet; + AxisPacket_t axis_packet; super.get(axis_packet); ctrl_packet = axis_to_axis_ctrl(axis_packet); endtask : get_ctrl @@ -166,7 +166,7 @@ package PkgAxisCtrlBfm; // Get the next packet if there's one available and return 1. Return 0 if // there's no packet available. function bit AxisCtrlBfm::try_get_ctrl(output AxisCtrlPacket ctrl_packet); - AxisPacket axis_packet; + AxisPacket_t axis_packet; if(!super.try_get(axis_packet)) return 0; ctrl_packet = axis_to_axis_ctrl(axis_packet); return 1; @@ -175,8 +175,8 @@ package PkgAxisCtrlBfm; // Convert an AXIS-Ctrl packet data structure to an AXI-Stream packet data // structure. - function AxisCtrlBfm::AxisPacket AxisCtrlBfm::axis_ctrl_to_axis(AxisCtrlPacket ctrl_packet); - AxisPacket axis_packet = new(); + function AxisCtrlBfm::AxisPacket_t AxisCtrlBfm::axis_ctrl_to_axis(AxisCtrlPacket ctrl_packet); + AxisPacket_t axis_packet = new(); int index; // Insert words 0 and 1 (header) @@ -203,7 +203,7 @@ package PkgAxisCtrlBfm; // Convert an AXI-Stream packet data structure to an AXIS-Ctrl packet data // structure. - function AxisCtrlPacket AxisCtrlBfm::axis_to_axis_ctrl(AxisPacket axis_packet); + function AxisCtrlPacket AxisCtrlBfm::axis_to_axis_ctrl(AxisPacket_t axis_packet); AxisCtrlPacket ctrl_packet = new(); int i; // Use an index instead of pop_front() to workaround a ModelSim bug diff --git a/fpga/usrp3/sim/rfnoc/PkgChdrBfm.sv b/fpga/usrp3/sim/rfnoc/PkgChdrBfm.sv index 908447806..a485eca59 100644 --- a/fpga/usrp3/sim/rfnoc/PkgChdrBfm.sv +++ b/fpga/usrp3/sim/rfnoc/PkgChdrBfm.sv @@ -23,7 +23,7 @@ package PkgChdrBfm; class ChdrPacket #(int CHDR_W = 64); - typedef ChdrPacket #(CHDR_W) ChdrPacket; + typedef ChdrPacket #(CHDR_W) ChdrPacket_t; typedef ChdrData #(CHDR_W)::chdr_word_t chdr_word_t; const int BYTES_PER_CHDR_W = CHDR_W / 8; @@ -33,10 +33,10 @@ package PkgChdrBfm; chdr_word_t metadata[$]; chdr_word_t data[$]; - extern function ChdrPacket copy(); - extern function bit equal(ChdrPacket packet); - extern function string sprint(bit pretty = 1); - extern function void print(bit pretty = 1); + extern function ChdrPacket_t copy(); + extern function bit equal(ChdrPacket_t packet); + extern function string sprint(bit pretty = 1); + extern function void print(bit pretty = 1); // Accessors extern function void write_raw (ref chdr_header_t header, @@ -97,7 +97,7 @@ package PkgChdrBfm; parameter int USER_WIDTH = 1 ) extends AxiStreamBfm #(CHDR_W, USER_WIDTH); - typedef ChdrPacket #(CHDR_W) ChdrPacket; + typedef ChdrPacket #(CHDR_W) ChdrPacket_t; typedef ChdrData #(CHDR_W)::chdr_word_t chdr_word_t; const int BYTES_PER_CHDR_W = CHDR_W / 8; @@ -114,20 +114,20 @@ package PkgChdrBfm; // Send Transactions - extern task put_chdr(ChdrPacket chdr_packet); - extern function bit try_put_chdr(ChdrPacket chdr_packet); + extern task put_chdr(ChdrPacket_t chdr_packet); + extern function bit try_put_chdr(ChdrPacket_t chdr_packet); // Receive Transactions - extern task get_chdr(output ChdrPacket chdr_packet); - extern function bit try_get_chdr(output ChdrPacket chdr_packet); - extern task peek_chdr(output ChdrPacket chdr_packet); - extern function bit try_peek_chdr(output ChdrPacket chdr_packet); + extern task get_chdr(output ChdrPacket_t chdr_packet); + extern function bit try_get_chdr(output ChdrPacket_t chdr_packet); + extern task peek_chdr(output ChdrPacket_t chdr_packet); + extern function bit try_peek_chdr(output ChdrPacket_t chdr_packet); // AXI-Stream/CHDR Conversion Functions - extern function ChdrPacket axis_to_chdr (AxisPacket axis_packet); - extern function AxisPacket chdr_to_axis (ChdrPacket chdr_packet); + extern function ChdrPacket_t axis_to_chdr (AxisPacket_t axis_packet); + extern function AxisPacket_t chdr_to_axis (ChdrPacket_t chdr_packet); endclass : ChdrBfm @@ -138,8 +138,8 @@ package PkgChdrBfm; //--------------------------------------------------------------------------- // Create a copy of this packet and return a handle to the copy - function ChdrPacket::ChdrPacket ChdrPacket::copy(); - ChdrPacket temp; + function ChdrPacket::ChdrPacket_t ChdrPacket::copy(); + ChdrPacket_t temp; temp = new(); temp.header = this.header; temp.timestamp = this.timestamp; @@ -150,7 +150,7 @@ package PkgChdrBfm; // Return true if this packet equals that of the argument - function bit ChdrPacket::equal(ChdrPacket packet); + function bit ChdrPacket::equal(ChdrPacket_t packet); if (header != packet.header) return 0; if (!chdr_word_queues_equal(data, packet.data)) return 0; if (!chdr_word_queues_equal(metadata, packet.metadata)) return 0; @@ -616,8 +616,8 @@ package PkgChdrBfm; // Queue the provided packet for transmission - task ChdrBfm::put_chdr (ChdrPacket chdr_packet); - AxisPacket axis_packet; + task ChdrBfm::put_chdr (ChdrPacket_t chdr_packet); + AxisPacket_t axis_packet; axis_packet = chdr_to_axis(chdr_packet); super.put(axis_packet); @@ -626,8 +626,8 @@ package PkgChdrBfm; // Attempt to queue the provided packet for transmission. Return 1 if // successful, return 0 if the queue is full. - function bit ChdrBfm::try_put_chdr (ChdrPacket chdr_packet); - AxisPacket axis_packet; + function bit ChdrBfm::try_put_chdr (ChdrPacket_t chdr_packet); + AxisPacket_t axis_packet; bit status; axis_packet = chdr_to_axis(chdr_packet); @@ -636,8 +636,8 @@ package PkgChdrBfm; // Get the next packet when it becomes available (wait if necessary) - task ChdrBfm::get_chdr (output ChdrPacket chdr_packet); - AxisPacket axis_packet; + task ChdrBfm::get_chdr (output ChdrPacket_t chdr_packet); + AxisPacket_t axis_packet; super.get(axis_packet); chdr_packet = axis_to_chdr(axis_packet); endtask : get_chdr @@ -645,8 +645,8 @@ package PkgChdrBfm; // Get the next packet if there's one available and return 1. Return 0 if // there's no packet available. - function bit ChdrBfm::try_get_chdr (output ChdrPacket chdr_packet); - AxisPacket axis_packet; + function bit ChdrBfm::try_get_chdr (output ChdrPacket_t chdr_packet); + AxisPacket_t axis_packet; if (!super.try_get(axis_packet)) return 0; chdr_packet = axis_to_chdr(axis_packet); return 1; @@ -655,8 +655,8 @@ package PkgChdrBfm; // Get the next packet when it becomes available (wait if necessary), but // don't remove it from the receive queue. - task ChdrBfm::peek_chdr (output ChdrPacket chdr_packet); - AxisPacket axis_packet; + task ChdrBfm::peek_chdr (output ChdrPacket_t chdr_packet); + AxisPacket_t axis_packet; super.peek(axis_packet); chdr_packet = axis_to_chdr(axis_packet); endtask : peek_chdr @@ -664,8 +664,8 @@ package PkgChdrBfm; // Get the next packet if there's one available and return 1, but don't // remove it from the receive queue. Return 0 if there's no packet available. - function bit ChdrBfm::try_peek_chdr (output ChdrPacket chdr_packet); - AxisPacket axis_packet; + function bit ChdrBfm::try_peek_chdr (output ChdrPacket_t chdr_packet); + AxisPacket_t axis_packet; if (!super.try_get(axis_packet)) return 0; chdr_packet = axis_to_chdr(axis_packet); return 1; @@ -674,12 +674,12 @@ package PkgChdrBfm; // Convert the data payload of an AXI Stream packet data structure to a CHDR // packet data structure. - function ChdrBfm::ChdrPacket ChdrBfm::axis_to_chdr (AxisPacket axis_packet); + function ChdrBfm::ChdrPacket_t ChdrBfm::axis_to_chdr (AxisPacket_t axis_packet); enum int { ST_HEADER, ST_TIMESTAMP, ST_METADATA, ST_PAYLOAD } rx_state; data_t word; int num_rx_mdata; int num_rx_bytes; - ChdrPacket chdr_packet = new(); + ChdrPacket_t chdr_packet = new(); rx_state = ST_HEADER; @@ -744,10 +744,10 @@ package PkgChdrBfm; // Convert a CHDR packet data structure to a an AXI-Stream packet data // structure. - function ChdrBfm::AxisPacket ChdrBfm::chdr_to_axis (ChdrPacket chdr_packet); + function ChdrBfm::AxisPacket_t ChdrBfm::chdr_to_axis (ChdrPacket_t chdr_packet); int num_words, expected_words; data_t bus_word = 0; - AxisPacket axis_packet = new(); + AxisPacket_t axis_packet = new(); // Check that we have the right number of metadata words assert (chdr_packet.metadata.size() == chdr_packet.header.num_mdata) else begin diff --git a/fpga/usrp3/sim/rfnoc/PkgChdrIfaceBfm.sv b/fpga/usrp3/sim/rfnoc/PkgChdrIfaceBfm.sv index a25f29d18..6d6dd9a5b 100644 --- a/fpga/usrp3/sim/rfnoc/PkgChdrIfaceBfm.sv +++ b/fpga/usrp3/sim/rfnoc/PkgChdrIfaceBfm.sv @@ -26,9 +26,9 @@ package PkgChdrIfaceBfm; class ChdrIfaceBfm #(CHDR_W = 64, ITEM_W = 32) extends ChdrBfm #(CHDR_W); - // Redefine the ChdrPacket and chdr_word_t data types from ChdrBfm due to a - // bug in Vivado 2019.1. - typedef ChdrPacket #(CHDR_W) ChdrPacket; + // Redefine the ChdrPacket_t and chdr_word_t data types from ChdrBfm due to + // a bug in Vivado 2019.1. + typedef ChdrPacket #(CHDR_W) ChdrPacket_t; typedef ChdrData #(CHDR_W, ITEM_W)::chdr_word_t chdr_word_t; typedef ChdrData #(CHDR_W, ITEM_W)::item_t item_t; @@ -116,8 +116,8 @@ package PkgChdrIfaceBfm; input chdr_word_t metadata[$] = {}, input packet_info_t pkt_info = 0 ); - ChdrPacket chdr_packet; - chdr_header_t chdr_header; + ChdrPacket_t chdr_packet; + chdr_header_t chdr_header; // Build packet chdr_packet = new(); @@ -175,7 +175,7 @@ package PkgChdrIfaceBfm; input chdr_word_t metadata[$] = {}, input packet_info_t pkt_info = 0 ); - ChdrPacket chdr_packet; + ChdrPacket_t chdr_packet; chdr_header_t chdr_header; chdr_pkt_type_t pkt_type; chdr_word_t timestamp; @@ -295,7 +295,7 @@ package PkgChdrIfaceBfm; output chdr_word_t metadata[$], output packet_info_t pkt_info ); - ChdrPacket chdr_packet; + ChdrPacket_t chdr_packet; get_chdr(chdr_packet); data = chdr_packet.data; @@ -343,7 +343,7 @@ package PkgChdrIfaceBfm; // chdr_word_t size. // task recv(output chdr_word_t data[$], output int data_bytes); - ChdrPacket chdr_packet; + ChdrPacket_t chdr_packet; get_chdr(chdr_packet); data = chdr_packet.data; data_bytes = chdr_packet.data_bytes(); |