0

我正在尝试通过命令提示符在 GTKWave 上运行以下代码(使用 ghdl,用 VHDL 编写)。我不明白我应该如何编写测试台(在代码下方),以便我可以看到简单代码的所有信号和变量。

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;

ENTITY q2 IS
    PORT( clk, a : IN STD_LOGIC;
        b,c,d,e : OUT STD_LOGIC);
END q2;

ARCHITECTURE logic OF q2 IS
    SIGNAL f : STD_LOGIC;
BEGIN
    PROCESS(clk,a,f)
        VARIABLE g : STD_LOGIC;
    BEGIN
        IF rising_edge(clk) THEN
            b<=a;
            f<=a;
            e<=f;
            c<=g;
            g:=a;
        END IF;
        
        d<=f;
    END PROCESS;
END ARCHITECTURE logic;

试验台:

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;

ENTITY tut2q6_sim is
END ENTITY tut2q6_sim;

ARCHITECTURE sim OF tut2q6_sim IS

    SIGNAL clks,as,bs,cs,ds,es : STD_LOGIC;

BEGIN

    tut2q6_0: entity work.tut2q6
    port map(
        clk => clks,
        a => as,
        b => bs,
        c => cs,
        d => ds,
        e => es
    );
    
    PROCESS
    BEGIN
        clks <= '0';
        wait for 1 ns;
        clks <= '1';
        wait for 1 ns;
    END PROCESS;
    
END ARCHITECTURE sim;

请你让我知道我哪里出错了或者我需要添加什么以便观察 GTKWave 中信号和变量的变化,提前谢谢你!

4

0 回答 0