ISIMでVHDLコードをシミュレートしようとすると、すべての出力に対して唯一U
が表示されます。ISimはすべてのフリップフロップ出力に対してUを表示します
ちょうど3つのカスケードD型フリップフロップで構成されています。
そして、ここに私のVHDLコードは次のとおりです。
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity az_4_2 is
Port (clk: in std_logic;
X : in STD_LOGIC;
Ain : in STD_LOGIC;
Bin : in STD_LOGIC;
Cin : in STD_LOGIC;
Aout : out STD_LOGIC;
Bout : out STD_LOGIC;
Cout : out STD_LOGIC;
Y : out STD_LOGIC;
reset : in std_logic);
end az_4_2;
architecture Behavioral of az_4_2 is
begin
process(clk, reset, Ain, Bin, Cin, X)
begin
if (reset = '1') then
Y <= '0';
elsif (Ain = '0') and (Bin = '0') and (Cin = '0') then
Y <= '0';
elsif (Ain = '0') and (Bin = '0') and (Cin = '1') then
Y <= '0';
elsif (Ain = '0') and (Bin = '1') and (Cin = '0') then
Y <= '0';
elsif (Ain = '0') and (Bin = '1') and (Cin = '1') then
if (x = '0') then
Y <= '0';
else
Y <= '1';
end if;
elsif (Ain = '1') and (Bin = '0') and (Cin = '0') then
if (x = '0') then
Y <= '0';
else
Y <= '1';
end if;
end if;
if(rising_edge(clk)) then
if (reset = '1') then
Aout <= '0';
Bout <= '0';
Cout <= '0';
elsif (Ain = '0') and (Bin = '0') and (Cin = '0') then
if (x = '0') then
Aout <= '0';
Bout <= '0';
Cout <= '0';
else
Aout <= '1';
Bout <= '0';
Cout <= '0';
end if;
elsif (Ain = '0') and (Bin = '0') and (Cin = '1') then
if (x = '0') then
Aout <= '0';
Bout <= '1';
Cout <= '0';
else
Aout <= '0';
Bout <= '1';
Cout <= '1';
end if;
elsif (Ain = '0') and (Bin = '1') and (Cin = '0') then
if (x = '0') then
Aout <= '0';
Bout <= '0';
Cout <= '0';
else
Aout <= '0';
Bout <= '1';
Cout <= '1';
end if;
elsif (Ain = '0') and (Bin = '1') and (Cin = '1') then
if (x = '0') then
Aout <= '1';
Bout <= '0';
Cout <= '0';
else
Aout <= '0';
Bout <= '1';
Cout <= '1';
end if;
elsif (Ain = '1') and (Bin = '0') and (Cin = '0') then
if (x = '0') then
Aout <= '0';
Bout <= '0';
Cout <= '0';
else
Aout <= '0';
Bout <= '1';
Cout <= '1';
end if;
end if;
end if;
end process;
end Behavioral;
そして、ここでは私のTEST_BENCHです:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
ENTITY tb_az_4 IS
END tb_az_4;
ARCHITECTURE behavior OF tb_az_4 IS
COMPONENT az_4
Port (clk: in std_logic;
reset: in std_logic;
X : in STD_LOGIC;
Ain : in STD_LOGIC;
Bin : in STD_LOGIC;
Cin : in STD_LOGIC;
Aout : out STD_LOGIC;
Bout : out STD_LOGIC;
Cout : out STD_LOGIC;
Y : out STD_LOGIC);
END COMPONENT;
--Inputs
signal clk, reset : std_logic := '0';
--BiDirs
signal X, Ain, Bin, Cin, Aout, Bout, Cout, Y : std_logic;
begin
uut: az_4 PORT MAP (
clk => clk,
reset => reset,
X => X,
Ain => Ain,
Aout => Aout,
Bin => Bin,
Bout => Bout,
Cin => Cin,
Cout => Cout,
Y => Y
);
-- Clock process definitions
clock_process :process
begin
clk <= '0';
wait for 5 ns;
clk <= '1';
wait for 5 ns;
end process;
-- Stimulus process
stim_proc: process
begin
-- hold reset state for 100 ns.
reset <= '1';
wait for 10 ns;
reset <= '0';
Ain <= '0';
Bin <= '0';
Cin <= '0';
x <= '0';
wait;
end process;
END behavior;
、なぜこれが起こっていますか?どうすればこの問題を解決できますか?
コンポーネント自体ではなく、テストベンチをシミュレートするかどうかを確認してください。あなたの質問にインデントを修正してください。 – JHBonarius