Browse Source

Guard test for value with to_ux01() function

T. Meissner 3 years ago
parent
commit
cf1798b576
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      common/UtilsP.vhd

+ 4
- 2
common/UtilsP.vhd View File

@@ -102,7 +102,9 @@ package body UtilsP is
102 102
     variable v_return : natural := 0;
103 103
   begin
104 104
     for i in data'range loop
105
-      v_return := v_return + 1;
105
+      if (to_ux01(data(i)) = '1') then
106
+        v_return := v_return + 1;
107
+      end if;
106 108
     end loop;
107 109
     return v_return;
108 110
   end function count_ones;
@@ -117,7 +119,7 @@ package body UtilsP is
117 119
   function is_unknown (data : in std_logic_vector) return boolean is
118 120
   begin
119 121
     for i in data'range loop
120
-      if (data(i) = 'U') then
122
+      if (to_ux01(data(i)) = 'U') then
121 123
         return true;
122 124
       end if;
123 125
     end loop;