带整数参数的VHDL比较运算符的行为
考虑以下示例,使用VHDL-2008支持编译带整数参数的VHDL比较运算符的行为,vhdl,Vhdl,考虑以下示例,使用VHDL-2008支持编译 library ieee; use ieee.numeric_std.all; ... if (to_unsigned(0, 3) <= 8) then StatementsA end if; if (to_unsigned(1, 3) <= 8) then StatementsB end if; ieee库; 使用ieee.numeric_std.all; ... 顺便说一句,如果(to_unsigned(0,3),你在用
library ieee;
use ieee.numeric_std.all;
...
if (to_unsigned(0, 3) <= 8) then
StatementsA
end if;
if (to_unsigned(1, 3) <= 8) then
StatementsB
end if;
ieee库;
使用ieee.numeric_std.all;
...
顺便说一句,如果(to_unsigned(0,3),你在用什么编译器?我写了一个小的虚拟程序,包含上面的语句,语句B会被执行!我在用Modelsim。我无法确认你在“你的经验”中看到的行为。这是我的代码示例
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity e is
end entity e;
architecture RTL of e is
begin
name : process is
begin
if (to_unsigned(0, 3) <= 8) then
report "StatementsA";
end if;
if (to_unsigned(1, 3) <= 8) then
report "StatementsB";
end if;
wait;
end process name;
end architecture RTL;
你能再次检查并更新你的问题吗?你确定你的意思不是真的吗
library ieee;
use ieee.numeric_std.all;
...
if (to_unsigned(0, 3) <= 8) then
StatementsA
elsif (to_unsigned(1, 3) <= 8) then
StatementsB
end if;
ieee库;
使用ieee.numeric_std.all;
...
如果(to_unsigned(0,3)否,编译器不会将整数转换为无符号。有一个函数"谢谢你的澄清。更新了我的回复。嗨,乔希。西蒙和我都不能复制你看到的东西。你能再检查一遍吗?@Philippe是的,我现在正在重新访问。我也在复制问题,不知道是否有我没有正确描述的事情。如果这个问题有误,请关闭它。它会让我困惑se未来的读者。@Philippe是的,我发现了我的错误。问题不在于这个运算符,而在于使用?运算符时(如?>?=,等等)。这个问题应该结束。我已经这样投票了。
library ieee;
use ieee.numeric_std.all;
...
if (to_unsigned(0, 3) <= 8) then
StatementsA
elsif (to_unsigned(1, 3) <= 8) then
StatementsB
end if;