【发布时间】:2020-05-26 17:02:01
【问题描述】:
我正在尝试使用带有端口映射的加法器、mux2 和 mux4 组件制作 ALU。 我已经写了ALU,它通过编译OK。问题是当我尝试在 modelsim 中给出值时,加法器工作正常,但 mux2 (sub_module) & mux4 (sub_module x2) 不给出输出。我替换了2-3次mux代码,问题是一样的。我只得到 outY 的 UUUUUUUU 值。 我已将代码最小化。
主 ALU 最小化
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity ALU7_minimal is
Port ( inpA : IN STD_LOGIC_VECTOR (7 downto 0) :="10110001";
inpB : IN STD_LOGIC_VECTOR (7 downto 0) :="00011001";
ALUS0 : in STD_LOGIC := '0';
outY : out STD_LOGIC_VECTOR (7 downto 0));
end ALU7_minimal;
architecture Behavioral of ALU7_minimal is
component sub_module
port(x,y : in STD_LOGIC_VECTOR (7 downto 0);
s: in STD_LOGIC;
z: out STD_LOGIC_VECTOR (7 downto 0));
end component;
begin
U0: sub_module port map (inpA, inpB, ALUS0, outY );
end Behavioral ;
mux2-1
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity sub_module is
port(x,y : in STD_LOGIC_VECTOR (7 downto 0);
s: in STD_LOGIC;
z: out STD_LOGIC_VECTOR (7 downto 0));
end sub_module ;
architecture Behavioral of sub_module is
begin
process (x,y,s) is
begin
if (s ='0') then
z <= x;
else
z <= y;
end if;
end process;
end Behavioral;
【问题讨论】:
-
提供minimal reproducible example。 The problem can't be replicated 来自使用从链接波形收集的输入提供的信息。注意 U3 (adder8bit) 是未绑定的(并且不负责所有的 'U's),
out0被驱动但不用作输入,out12也不是。 -
我已将示例最小化。
-
现在,如果您只提供一个可重现的示例。 The problem still can't be replicated 来自使用从链接波形收集的输入的信息。考虑提供(和使用)一个测试平台。您似乎在做一些程序上的错误。
-
再次感谢。这正是问题所在。代码很简单,但仍然会产生错误。也许问题不在代码中,而 Modelsim 中有需要查看的设置?你知道我可以尝试相同代码的任何其他测试环境吗?