-2
-----------begin part1.vhdl---------------------
library ieee;
use ieee.std_logic_1164.all;
entity part1 is
generic (width : integer :=7);
PORT(a, b, c, d: IN std_logic_vector(width downto 0);
sel: IN std_logic_vector(1 downto 0);
result: OUT std_logic_vector(width downto 0)
);
end part1;
architecture muxbehav of part1 is
BEGIN
result <= a after 5 ns when sel="00" else
b after 5 ns when sel="01" else
c after 5 ns when sel="10" else
d after 5 ns;
end muxbehav;
-----------end part1.vhdl---------------------
-----------begin part1_tb.vhdl------------------
library ieee;
use ieee.std_logic_1164.all;
entity part1_tb is
generic(width : integer := 7);
end part1_tb;
architecture tb of part1_tb is
signal t_a: std_logic_vector(width downto 0):="00000000";
signal t_b: std_logic_vector(width downto 0):="00000000";
signal t_c: std_logic_vector(width downto 0):="00000000";
signal t_d: std_logic_vector(width downto 0):="00000000";
signal t_s: std_logic_vector(1 downto 0);
signal t_o: std_logic_vector(width downto 0);
component part1
generic(width : integer);
PORT(a, b, c, d: IN std_logic_vector(width downto 0);
sel: IN std_logic_vector(1 downto 0);
result: OUT std_logic_vector(width downto 0)
);
end component;
begin
U_part1: part1 generic map(width) port map(a=>t_a, b=>t_b, c=>t_c, d=>t_d, sel=>t_s, result=>t_o);
process
begin
t_a <= "11111111";
t_b <= "00000001";
t_c <= "10101010";
t_d <= "01010101";
wait for 10 ns;
t_s <= "00";
wait for 6 ns;
assert (t_o="11111111") report "Error input a" severity error;
wait for 10 ns;
t_s <= "01";
wait for 6 ns;
assert (t_o="00000001") report "Error input b" severity error;
wait for 10 ns;
t_s <= "10";
wait for 6 ns;
assert (t_o="10101010") report "Error input c" severity error;
wait for 10 ns;
t_s <= "11";
wait for 6 ns;
assert (t_o="01010101") report "Error input d" severity error;
wait;
end process;
end tb;
-----------end part1_tb.vhdl------------------
안녕하세요, 이것은 VHDL로 작성한 첫 번째 코드입니다. 어떤 너비의 벡터라도 사용할 수있는 단순한 4 대 1 MUX입니다. 그러나 테스트 벤치를 실행하려고하면 GHDL이 멈 춥니 다. 나는 내 것과 비슷한 testbenches를 보았지만, 왜 아직도 광산이 매달려 있는지 찾을 수 없다. 어떤 아이디어?간단한 VHDL 4 대 1 MUX 테스트 벤치가 걸려있다
"끊어짐"으로 시뮬레이션을 실행해도 아무런 문제없이 실행 중이거나 시뮬레이션 시간이 멈추는 것을 의미합니까? –
플랫폼 정보 및 GHDL 버전을 게시 할 수 있습니까? 그리고 당신의 컴파일/실행 명령? –
프로세스가 끝나면 "대기"는 무엇을합니까? 멈추라 고 강요하고 있습니까? 죄송합니다. VHDL에 대해 잘 모릅니다. Verilog 사람이 더 있습니다. – user623879