我在 VHDL 测试用例上运行 modelsim 时遇到上述错误,我无法理解为什么会出现错误。
测试用例:
LIBRARY IEEE;
Use ieee.std_logic_1164.all;
entity a is
port (in11 : in std_logic
);
end a;
架构a是:
component b_1
port ( in1 : in bit);
end component;
begin
inst : b_1 port map ( in1=> **to_Bit**(in11));
end a;
最佳答案
这是一个 modelsim 错误,实际上它应该报告您不允许在端口映射中实际使用此函数,这有效:
LIBRARY IEEE; Use ieee.std_logic_1164.all;
entity a is port (in11 : in std_logic ); end a;
architecture a of a is
signal inBit : Bit;
component b_1 port ( in1 : in bit); end component;
begin
inBit <= to_bit(in11);
inst : b_1 port map ( in1=> inBit); end a;
有一些限制适用于端口映射中的实际值,参见vhdl 引用:
The actual, if a port or signal, must be denoted by a static name (see 6.1). The actual, if an expression, must be a globally static expression (see 7.4).
问题是,这两种情况都应该是全局静态的......
关于vhdl - 转换函数 "To_bit"必须只有一个形参,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12741947/