我在几个地方遇到过这个问题,我最好的猜测是为什么我没有从设计实体(在本例中为 4:1 多路复用器)获得任何输出,因为其中一个输入未分配(U)。
所以假设这个 Mux 嵌入在许多其他结构中,所以我不能将输入强制为我想要的任何东西,有时它们中的一些将没有任何驱动它们。
说:输入0 =“111111111111111”
但是:输入3 =“UUUUUUUUUUUUUUUU”
我想要的只是输出input0(c0 = c1 = 0),所以input3在逻辑上应该无关紧要
我仍然得到
输出=“UUUUUUUUUUUUUUU”(默认值)
此外,编译或运行中没有错误。
这是代码:
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
ENTITY Mux4to1 IS
GENERIC (size : POSITIVE := 16); -- Size of the input
PORT (input0, input1, input2, input3 : IN std_logic_vector (size-1 DOWNTO 0);
output: OUT std_logic_vector (size-1 DOWNTO 0);
control0, control1 : IN std_logic );
END ENTITY Mux4to1;
--
ARCHITECTURE Behavior OF Mux4to1 IS
BEGIN
PROCESS ( input0, input1, input2, input3, control0, control1 )
BEGIN
IF (control0 = '0') THEN
IF (control1 = '0') THEN -- Enable 00
output <= input0;
ELSIF(control1 = '1')THEN -- Enable 10
output <= input2;
END IF;
ELSIF (control0 = '1') THEN
IF (control1 = '0') THEN -- Enable 01
output <= input1;
ELSIF(control1 = '1')THEN -- Enable 11
output <= input3;
END IF;
END IF;
END PROCESS;
END ARCHITECTURE Behavior;
我能做些什么来解决这个烂摊子?