Testbench输入10500语法错误

时间:2016-06-08 12:28:21

标签: vhdl quartus

我尝试在Quartus中为两个输入AND门创建一个简单的hello world测试平台。我一直遇到以下错误:

  

错误(10500):在文本“IN”附近的Scott_2InputAndGate_Test.vhd(19)处的VHDL语法错误;期望标识符(“in”是保留关键字)或字符串文字

我的代码:

--------------------------------------
------------TOP LEVEL ENTITY----------
--------------------------------------
LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
USE IEEE.numeric_std.all;


ENTITY s_2InputAndGate IS
    PORT(a, b : IN  std_logic;
            z : OUT std_logic);
END ENTITY s_2InputAndGate;


ARCHITECTURE behaviour OF s_2InputAndGate IS
    BEGIN
        z <= a AND b;

END ARCHITECTURE behaviour;


--------------------------------------
------------TESTBENCH-----------------
--------------------------------------
LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
USE IEEE.numeric_std.all;

--No Entity for TestBench;
ENTITY s_2InputAndGate_Test IS END;



--Line 10
--Line 11
--Line 12...etc



--Behaviour of the Test bench;
ARCHITECTURE behaviour OF s_2InputAndGate_Test IS

    SIGNAL A_test, B_test : IN  std_logic;   --lINE(19 - ERROR HERE!)
                    Z_test: OUT std_logic;

    BEGIN
        A_test <= 0;
        B_test <= 0;

        WAIT FOR 50ns;

        A_test <= 0;
        B_test <= 1;

    WAIT FOR 50ns;

        A_test <= 1;
        B_test <= 0;

        WAIT FOR 50ns;

        A_test <= 1;
        B_test <= 1;

        WAIT;
END ARCHITECTURE behaviour;

编译器似乎一直在抱怨测试平台中的信号声明。我检查了语法,似乎无法找到任何明显的问题。任何人都有任何想法为什么这一行应该阻止编译成功?

1 个答案:

答案 0 :(得分:1)

SIGNAL A_test, B_test : IN  std_logic;

信号没有方向。只需使用:

SIGNAL A_test, B_test : std_logic;

此外,您的第Z_test: OUT std_logic;行无效。删除方向后,可以将此信号声明与其他两个一起添加。