首页 > 解决方案 > 来自 std.textio 的函数 to_hstring 不起作用 [VHDL]

问题描述

我尝试从 Stack Overflow 运行一些代码(How to write an integer to stdout as hexadecimal in VHDL?),结果发现to_hstring不起作用(即使std库是 VHDL 的标准库)。我正在使用 Active-HDL 9.1(可能问题的根源在于旧版本的 Active-HDL)。我是 VHDL 编码的新手,所以我相信我错过了一些明显的东西。谢谢你的帮助!

这是示例代码:

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; 

和编译器的输出: 在此处输入图像描述

标签: vhdlactive-hdl

解决方案


在写问题时,我再次阅读(How to write an integer to stdout as hexadecimal in VHDL?),发现提到了VHDL-2008。之后我检查了我的编译命令(由 Active-HDL 自动生成),结果发现VHDL-2002是编译命令的默认值: 在此处输入图像描述

将参数更改为-2008后,一切正常:

在此处输入图像描述

以下是部分内容

help acom

输出

在此处输入图像描述

以及程序执行的输出:

在此处输入图像描述


推荐阅读