VHDL模拟无法运行

时间:2018-11-27 19:27:59

标签: vhdl ghdl

我刚刚学习了《 VHDL设计指南》,并且正在研究第一章中的练习。我的2位多路复用器出现了一个我不明白的问题。

我的多路复用器的代码:

library ieee;
use ieee.std_logic_1164.all;

entity multi2 is
        port
        (
            a,b     : in bit;
            sel     : in boolean;
            z       : out bit   
        );
end multi2;

architecture behave of multi2 is

begin
    storage : process is
        variable stored_d0 : bit;
    begin
    wait for 1 ns;

    if sel then
        z <= a;
    else
        z <= b;
    end if;

    end process storage;
end architecture behave;

我不知道为什么需要“等待1 ns;”线。如果将其移至“如果...结束”行下方,则模拟将无法进行,也不会从GHDL中获取.vcd输出。如果没有等待线,或者它不在正确的位置,则会在我的vcd文件中给我一个关于开始时间和结束时间相同的错误。

我的流程中是否需要等待语句才能起作用?

我的测试台代码如下:

    library ieee;
use ieee.std_logic_1164.all;

entity multi2_tb is
end multi2_tb;

architecture test of multi2_tb is
component multi2
    port
    (
        a,b     : in bit;
        sel     : in boolean;
        z       : out bit
    );
end component;

signal a,b       : bit;
signal sel       : boolean;
signal z         : bit;

begin
multiplexer2: multi2 port map (a => a, b => b, sel => sel, z => z);

process begin

    a <= '0';
    b <= '1';
    sel <= false;
    wait for 3 ns;

    a <= '0';
    b <= '1';
    sel <= true;
    wait for 3 ns;

    a <= '0';
    b <= '1';
    sel <= false;
    wait for 3 ns;


    assert false report "Reached end of test";
    wait;

    end process;
end test;

0 个答案:

没有答案