From cf1798b576b99745c7f95137e8d4d1465df18be9 Mon Sep 17 00:00:00 2001 From: tmeissner Date: Mon, 18 Jan 2016 23:37:08 +0100 Subject: [PATCH] Guard test for value with to_ux01() function --- common/UtilsP.vhd | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/UtilsP.vhd b/common/UtilsP.vhd index 2ef5334..b4c14a9 100644 --- a/common/UtilsP.vhd +++ b/common/UtilsP.vhd @@ -102,7 +102,9 @@ package body UtilsP is variable v_return : natural := 0; begin for i in data'range loop - v_return := v_return + 1; + if (to_ux01(data(i)) = '1') then + v_return := v_return + 1; + end if; end loop; return v_return; end function count_ones; @@ -117,7 +119,7 @@ package body UtilsP is function is_unknown (data : in std_logic_vector) return boolean is begin for i in data'range loop - if (data(i) = 'U') then + if (to_ux01(data(i)) = 'U') then return true; end if; end loop;