-2
\$\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\$
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, privacy policy and cookie policy

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