enter image description here串聯STD_LOGIC到測試平臺內STD_LOGIC_VECTOR在VHDL
這是我4比1 MUX的簡單示意圖。和我連接LOGIC到LOGIC_VECTOR時遇到問題...
這裏是我的測試臺代碼。我只是想展示MUX的所有可能輸入的性能。它編譯得很好,但它不像我預期的那樣工作。 我猜新聲明的矢量「X」和「我」是不是與原理的實際輸入鏈接
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
use ieee.std_logic_unsigned.all;
USE ieee.numeric_std.ALL;
LIBRARY UNISIM;
USE UNISIM.Vcomponents.ALL;
ENTITY MUX_SCHE_MUX_SCHE_sch_tb IS
END MUX_SCHE_MUX_SCHE_sch_tb;
ARCHITECTURE behavioral OF MUX_SCHE_MUX_SCHE_sch_tb IS
COMPONENT MUX_SCHE
PORT(X3 : IN STD_LOGIC;
X2 : IN STD_LOGIC;
X1 : IN STD_LOGIC;
X0 : IN STD_LOGIC;
I0 : IN STD_LOGIC;
I1 : IN STD_LOGIC;
Y : OUT STD_LOGIC);
END COMPONENT;
SIGNAL X3 : STD_LOGIC := '0';
SIGNAL X2 : STD_LOGIC := '0';
SIGNAL X1 : STD_LOGIC := '0';
SIGNAL X0 : STD_LOGIC := '0';
SIGNAL I0 : STD_LOGIC := '0';
SIGNAL I1 : STD_LOGIC := '0';
SIGNAL Y : STD_LOGIC;
---------- New Variable ----------
SIGNAL X : STD_LOGIC_VECTOR(3 downto 0);
SIGNAL I : STD_LOGIC_VECTOR(1 downto 0);
SIGNAL j : integer := 0;
SIGNAL k : integer := 0;
BEGIN
X <= X3 & X2 & X1 & X0;
I <= I1 & I0;
UUT: MUX_SCHE PORT MAP(
X3 => X3,
X2 => X2,
X1 => X1,
X0 => X0,
I0 => I0,
I1 => I1,
Y => Y
);
-- *** Test Bench - User Defined Section ***
tb : PROCESS
BEGIN
X <= "0000";
I <= "00";
while(j<4) loop
while(k<8) loop
X <= X + '1'; WAIT FOR 10 NS;
end loop;
I <= I + '1'; WAIT FOR 10 NS;
end loop;
END PROCESS;
-- *** End Test Bench - User Defined Section ***
END;
您對X和I的分配似乎是錯誤的方式,使DUT端口沒有值。簡單地刪除信號X3等並將端口映射爲'X => X(3),'等等 –