为什么VHDL属性调用需要一个进程?
如果我有以下VHDL-200X体系结构:为什么VHDL属性调用需要一个进程?,vhdl,Vhdl,如果我有以下VHDL-200X体系结构: architecture my_arc of my_entity is signal test_char : std_logic_vector(7 downto 0); signal test_char_c : character; signal test_char_i : integer; begin test_char <= "01001010"; test_char_i <= to_int
architecture my_arc of my_entity is
signal test_char : std_logic_vector(7 downto 0);
signal test_char_c : character;
signal test_char_i : integer;
begin
test_char <= "01001010";
test_char_i <= to_integer(unsigned(test_char));
test_char_c <= character'val(test_char_i);
end architecture my_arc;
…然后,test\u char\u c
获得了我所期望的值J
我认为,如果右侧的任何信号发生变化,裸信号分配将同时更新。换句话说,它相当于一个对任务中涉及的所有信号都敏感的过程
为什么test\u char\u c
在第一个实例中没有得到更新
编辑:将
test\u char\u i
更改为natural
不会更改结果。在初始化时,test\u char\u i
的值为integer'low
,该值不会映射到字符
-Modelsim 10.0报告:
# ** Fatal: (vsim-3390) Result ?(-2147483648) of attribute 'VAL is out of range NUL (0) to 'ÿ' (255).
# Time: 0 ns Iteration: 0 Process: /my_entity/line__15 File: attr.vhd
# Fatal error in Architecture my_arc at attr.vhd line 15
#
如果我将test\u char\u I
anatural
,使其初始化为0
,则一切正常(至少在Modelsim中,没有尝试iSim)
我认为,如果右侧的任何信号发生变化,裸信号分配将同时更新。换句话说,它相当于一个对任务中涉及的所有信号都敏感的过程
没错
为什么test_char_c在第一个实例中没有得到更新
是的
一个监视器进程,该进程将报告test\u char\u c
上的所有值更新:
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity my_entity is
end entity;
architecture my_arc of my_entity is
signal test_char : std_logic_vector(7 downto 0);
signal test_char_c : character;
signal test_char_i : natural; -- integer;
begin
test_char <= "01001010";
test_char_i <= to_integer(unsigned(test_char));
test_char_c <= character'val(test_char_i);
process (test_char_c)
begin
report "test_char_c = " & character'image(test_char_c);
end process;
end architecture my_arc;
您会发现,只显示第一条报表语句,因为会计算断言语句条件,当发现错误断言时
同样,如果条件中的“/”更改为“=”,则仅显示第二条报告语句(显示“J”)
如果不提供MCVe,您的问题就不能被复制(或归咎于当时新生的ISIM)。事实上,根据标准,等效过程的灵敏度是
test\u char\i
。所以iSim不遵循标准,ModelSim也遵循标准。使test_char_i
自然不会改变结果,但这对于错误报告来说很方便。那么,如果我尝试合成这样的东西会发生什么呢?@detly:我怀疑它是否有效,但可能这取决于你对角色的处理方式(执行printf
?;-))。您应该根据标准和可合成VHDL及其合成工具的解释,仔细区分合法VHDL及其行为。我认为您所展示的代码应该仅限于非合成模块,如测试台。@wap26:我不同意-这应该是完全有效的合成代码。就因为有一些中间信号,我所知道的任何合成器都不应该阻止你将8位向量转换为字符。你的想法是正确的,这是iSim的错误/不符合。@wap26:我不太确定,因为iSim被要求做一些它做不到的事情。它可能只需要一条错误信息…@MartinThompson:这似乎没什么关系,我已经和Xilinx一起打开了一个网络视频,看看他们是怎么想的。
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity my_entity is
end entity;
architecture my_arc of my_entity is
signal test_char : std_logic_vector(7 downto 0);
signal test_char_c : character;
signal test_char_i : natural; -- integer;
begin
test_char <= "01001010";
test_char_i <= to_integer(unsigned(test_char));
test_char_c <= character'val(test_char_i);
process (test_char_c)
begin
report "test_char_c = " & character'image(test_char_c);
end process;
end architecture my_arc;
assert test_char_c /= NUL
report "test_char_c = " & character'image(test_char_c);