From 2615547a82bc4e06ff5fcb79c5c1efed76b058c7 Mon Sep 17 00:00:00 2001
From: Wade Fife <wade.fife@ettus.com>
Date: Mon, 14 Jun 2021 16:29:19 -0500
Subject: fpga: sim: Check for empty packet in clear_unused_bytes

---
 fpga/usrp3/sim/rfnoc/PkgEthernet.sv | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'fpga')

diff --git a/fpga/usrp3/sim/rfnoc/PkgEthernet.sv b/fpga/usrp3/sim/rfnoc/PkgEthernet.sv
index f5dda046a..6005ffe1f 100644
--- a/fpga/usrp3/sim/rfnoc/PkgEthernet.sv
+++ b/fpga/usrp3/sim/rfnoc/PkgEthernet.sv
@@ -557,6 +557,10 @@ package PkgEthernet;
     // clear bytes that aren't marked as valid by keep
     function void  clear_unused_bytes();
       keep_t last_tkeep;
+
+      // check for empty packet, in which case there's nothing to clear
+      if (this.data.size() == 0) return;
+
       last_tkeep = this.keep[$];
       // check that the last user is the same as the last keep
       assert (this.keep[$] == calc_last_tkeep(this.user[$])) else
-- 
cgit v1.2.3