Hi Experts, what is the easiest way to check whether a std_logic_vector value has invalid/uninitialized bit(s) in it (such as 'X', 'U', 'Z'). VHDL-2008 would be okay. Regards...
I would write a function:
1 | function has_X( value : std_logic_vector) return boolean is |
2 | begin
|
3 | for index in value'range loop |
4 | if value( index) = 'X' then |
5 | return true; |
6 | end if; |
7 | end loop; |
8 | return false; |
9 | end function has_X; |
Duke
This function is already defined in std_logic_1164. Excerpt:
1 | FUNCTION Is_X ( s : std_logic_vector ) RETURN BOOLEAN IS |
2 | BEGIN
|
3 | FOR i IN s'RANGE LOOP |
4 | CASE s(i) IS |
5 | WHEN 'U' | 'X' | 'Z' | 'W' | '-' => RETURN TRUE; |
6 | WHEN OTHERS => NULL; |
7 | END CASE; |
8 | END LOOP; |
9 | RETURN FALSE; |
10 | END; |
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.