Nat*_*ate 5 vhdl modelsim intel-fpga quartus
我无法使以下报告语句起作用:
report "ERROR: instruction address '" & CONV_INTEGER(a(7 downto 2)) & "' out of memory range." severity failure;
Run Code Online (Sandbox Code Playgroud)
哪里a是 类型in std_logic_vector(31 downto 0)。
我得到的错误是:
No feasible entries for infix operator "&".
Run Code Online (Sandbox Code Playgroud)
我想打印出一个字符串,连接整数值,然后连接另一个字符串。
我究竟做错了什么?
小智 5
使用“图像”的示例:
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity foo is
end entity;
architecture fum of foo is
signal a: std_logic_vector (31 downto 0) := x"deadbeef";
begin
process (a)
begin
report "ERROR: instruction address '" &
-- CONV_INTEGER(a(7 downto 2)) &
INTEGER'IMAGE(to_integer(unsigned (a(7 downto 2)))) &
"' out of memory range." ;-- severity failure;
end process;
end architecture;
Run Code Online (Sandbox Code Playgroud)
我使用了包 numeric_std。原理相同,转换例程的名称不同。
'IMAGE 是一个预定义的属性,它返回一个类型值的字符串表示(在本例中是一个 INTEGER)。
您的失败消息是因为没有可用的“&”连接运算符知道如何将整数连接到字符串上,因此您提供整数的字符串图像。
运行时:
ghdl -r foo
foo.vhdl:13:9:@0ms:(report note): 错误:指令地址“59”超出内存范围。
从位串初始化开始,第 7 位到第 2 位是“111011”,当表示为整数时恰好等于 59。
| 归档时间: |
|
| 查看次数: |
7902 次 |
| 最近记录: |