【发布时间】:2020-11-15 21:31:09
【问题描述】:
我尝试从 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;
【问题讨论】:
-
to_string 函数不是 std.textio 的一部分。它们与类型位于相同的包中。所以对于
std_logic_vector,to_(h/o)string存在于包std_logic_1164中。std.textio定义如何将文本输出到文件。 -
@Tricky 在阅读了这个问题的答案 (stackoverflow.com/questions/37879954/…) 后,我认为 std.textio 是使用 to_(h/o) 字符串的要求,这些函数是其中的一部分。但现在我明白了,谢谢!
标签: vhdl active-hdl