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

asked Sep 16, 2017 at 19:56
\$\endgroup\$
0

1 Answer 1

2
\$\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

answered Sep 19, 2017 at 12:59
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.