0
\$\begingroup\$

Having a std_logic_vector how can I convert value value to HEX, and then how can I convert the hex to string?

Example: std_logic_vector(15 downto 0) = "0000000001010101", HEX = 0055, and hex to string

\$\endgroup\$
0

1 Answer 1

1
\$\begingroup\$

I'm not sure if this is a VHDL 2008 only operation, but in ieee.numeric_std there is a function called "to_hex_string" that takes in a std_logic_vector and outputs the hex representation as a string.

constant test   :   std_logic_vector(7 downto 0) := "00001111"; 
...
begin
...
assert false report to_hex_string(test) severity failure;

Otherwise, you could build your own function or try a third party package like this one : https://github.com/suoto/hdl_string_format

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.