diff options
author | Wade Fife <wade.fife@ettus.com> | 2020-08-24 21:31:18 -0500 |
---|---|---|
committer | Wade Fife <wade.fife@ettus.com> | 2020-08-31 08:16:43 -0500 |
commit | ccf5d1e0a06bf8d46d7bf6dc33a17e3228a1bff4 (patch) | |
tree | 8e43b81a3e5458be176928da4504ebec803c766b /fpga | |
parent | c6bb9924e56664ccb337694f8ef485ba8245edfd (diff) | |
download | uhd-ccf5d1e0a06bf8d46d7bf6dc33a17e3228a1bff4.tar.gz uhd-ccf5d1e0a06bf8d46d7bf6dc33a17e3228a1bff4.tar.bz2 uhd-ccf5d1e0a06bf8d46d7bf6dc33a17e3228a1bff4.zip |
fpga: sim: Fix stream command and status models
This updates PkgChdrBfm to correct some errors when modeling stream
command and stream status packets.
- Fix behavior when CHDR_W = 512
- Fix assertions in read_ctrl()
Diffstat (limited to 'fpga')
-rw-r--r-- | fpga/usrp3/sim/rfnoc/PkgChdrBfm.sv | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fpga/usrp3/sim/rfnoc/PkgChdrBfm.sv b/fpga/usrp3/sim/rfnoc/PkgChdrBfm.sv index 08b61712f..cc081050e 100644 --- a/fpga/usrp3/sim/rfnoc/PkgChdrBfm.sv +++ b/fpga/usrp3/sim/rfnoc/PkgChdrBfm.sv @@ -324,7 +324,7 @@ package PkgChdrBfm; for (int i = 0; i < $bits(status); i += CHDR_W) begin data.push_back( status[i +: CHDR_W] ); end - update_lengths(); + update_lengths($bits(status)/8); endfunction : write_stream_status @@ -344,8 +344,8 @@ package PkgChdrBfm; end header = this.header; - for (int i = 0; i < $bits(status)/CHDR_W; i++) begin - status[i*CHDR_W +: CHDR_W] = data[i]; + for (int i = 0; i < $bits(status); i+= CHDR_W) begin + status[i +: CHDR_W] = data[i/CHDR_W]; end endfunction : read_stream_status @@ -361,7 +361,7 @@ package PkgChdrBfm; for (int i = 0; i < $bits(command); i += CHDR_W) begin data.push_back( command[i +: CHDR_W] ); end - update_lengths(); + update_lengths($bits(command)/8); endfunction : write_stream_cmd @@ -381,8 +381,8 @@ package PkgChdrBfm; end header = this.header; - for (int i = 0; i < $bits(command)/CHDR_W; i++) begin - command[i*CHDR_W +: CHDR_W] = data[i]; + for (int i = 0; i < $bits(command); i += CHDR_W) begin + command[i +: CHDR_W] = data[i/CHDR_W]; end endfunction : read_stream_cmd @@ -530,10 +530,10 @@ package PkgChdrBfm; // words. ctrl_packet_size = 3 + ctrl_header.num_data; // header + op_word + data if (ctrl_header.has_time) ctrl_packet_size += 2; // timestamp - assert(data32.size() < ctrl_packet_size) else begin + assert (data32.size() >= ctrl_packet_size) else begin $error("ChdrPacket::read_ctrl: Not enough CHDR payload for control packet"); end - assert(data32.size() > ctrl_packet_size) else begin + assert (data32.size() <= ctrl_packet_size) else begin $warning("ChdrPacket::read_ctrl: Excess CHDR payload for control packet"); end @@ -612,7 +612,7 @@ package PkgChdrBfm; // Returns 1 if the queues have the same contents, up to the // data_byte_length, if present. - function automatic bit ChdrPacket::chdr_word_queues_equal( + function bit ChdrPacket::chdr_word_queues_equal( ref chdr_word_t a[$], ref chdr_word_t b[$], input int data_byte_length = -1 |