1

I tried to run some code from Stack Overflow (How to write an integer to stdout as hexadecimal in VHDL?) and it turned out that to_hstring doesn't work (Even though std library is standard for VHDL). I am using Active-HDL 9.1 (probably the root of the problem is in the old version of Active-HDL). I'm new to VHDL coding, so I believe I missed something obvious there. Thanks for any help!

Here is the sample code:

library ieee,std;
    use std.textio.all;
    use ieee.std_logic_1164.all;
    use ieee.numeric_std.all;

entity min is
end min;

architecture behav of min is
begin
    process is
    begin
        report "i = 0x" & to_hstring(to_signed(16, 32));
    end process;
end behav; 

And output of the compiler: enter image description here

  • 1
    to_string functions are not part of std.textio. They live in the same packages as the types. So for `std_logic_vector`, `to_(h/o)string` exists in package `std_logic_1164`. `std.textio` defines how to output text to files. – Tricky Nov 15 '20 at 22:44
  • @Tricky After reading the answer to this question (https://stackoverflow.com/questions/37879954/how-to-write-an-integer-to-stdout-as-hexadecimal-in-vhdl) I thought that std.textio is the requirement to use the to_(h/o)string and these functions are part of it. But now I get it, thanks! – Петр Воротинцев Nov 16 '20 at 08:31

1 Answers1

1

While writing the question, I read again (How to write an integer to stdout as hexadecimal in VHDL?) and found that was mentioned VHDL-2008. After that I checked my compile command (automatically generated by Active-HDL) it turned out that VHDL-2002 is the default for compilation command: enter image description here

After changing the parameter to -2008, everything worked:

enter image description here

Below is part of the

help acom

output

enter image description here

And the output of the program execution:

enter image description here

  • Function declarations for to_string, to_hstring, to_ostring and their aliases for array types declared in IEEE packages found in library ieee and incorporated into the -2008 revisions are found in those same packages. See IEEE Std 1076-008 Annex E, Changes from IEEE Std 1076-2002. IEEE Std 1076.2-1996, IEEE Std 1164-1993, and IEEE Std 1076.3-1997are superseded by revision -2008. The sources for these packages are available from the [IEEE-SA](http://standards.ieee.org/downloads/) for download. –  Nov 16 '20 at 01:14