From f08b843392d8695d9cf079d0cb9e2a6c1388f688 Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Thu, 24 Aug 2023 16:14:01 +0200
Subject: [PATCH] Add assert to check nof octets in data of unpack_data()

---
 libraries/base/common/src/vhdl/common_pkg.vhd | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libraries/base/common/src/vhdl/common_pkg.vhd b/libraries/base/common/src/vhdl/common_pkg.vhd
index 58df9c2e47..3820f51255 100644
--- a/libraries/base/common/src/vhdl/common_pkg.vhd
+++ b/libraries/base/common/src/vhdl/common_pkg.vhd
@@ -829,6 +829,9 @@ package body common_pkg is
     variable v_data       : std_logic_vector(data'length - 1 downto 0) := data;
     variable v_a          : t_slv_8_arr(c_nof_octets - 1 downto 0);
   begin
+    assert data'length = c_nof_octets * c_octet_w
+      report "common_pkg: unpack_data must be integer number of octest"
+      severity FAILURE;
     for I in v_a'range loop
       v_a(I) := v_data((I + 1) * c_octet_w - 1 downto I * c_octet_w);
     end loop;
-- 
GitLab