vhdl模拟不起作用

时间:2017-03-28 20:13:04

标签: vhdl test-bench

我正在编写VHDL代码,以便找到0到7范围内的数字,这些数字与集合中的其他数字没有任何公约数。我试图在BASYS 3板上实现它。它正在使用BASYS 3,但当我尝试为我的代码编写测试平台时,我得到了很多U和UU。为什么你认为是这种情况?我怎样才能写一个合适的测试台?我是初学者,所以任何想法都会有所帮助。

TOP MODULE:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity Top is
    Port ( Basys_Clock_Top : in STD_LOGIC;
           New_Clock_Top : out std_logic_vector(3 downto 0);
           SegDisp_Top : out std_logic_vector(6 downto 0);
           Binary_Top : out std_logic_vector(3 downto 0);
           F : out STD_LOGIC);
end Top;

architecture Behavioral of Top is
    --clock component 
    component NewClock
        Port ( New_Clock : out std_logic_vector(3 downto 0);
               Basys_Clock : in STD_LOGIC);
    end component;

    --ssd component
    component SSD
    Port ( Basys_Clock : in STD_LOGIC;
               Binary : in std_logic_vector(3 downto 0);
               SegDisplay : out std_logic_vector(6 downto 0));
    end component; 

    --signals
    signal X, Y, Z, Cont : std_logic;
    signal BCD_Top : std_logic_vector(3 downto 0);

begin
    --port maps
    NewClockModule : NewClock port map( New_Clock => New_Clock_Top, Basys_Clock => Basys_Clock_Top);
    SSDModule : SSD port map( Basys_Clock => Basys_Clock_Top, Binary => BCD_Top, SegDisplay => SegDisp_Top);

    --input assignment
    New_Clock_Top(0) <= Z;
    New_Clock_Top(1) <= Y;
    New_Clock_Top(2) <= X;

    Binary_Top <= "1110";
    F <= Z or ((not X) and Y);
    F <= Cont;

    process(BCD_Top, Cont)
    begin
        if(Cont = '1') then
            BCD_Top(0) <= Z;
            BCD_Top(1) <= Y;
            BCD_Top(2) <= X;
            BCD_Top(3) <= '0';
        else
            BCD_Top <= "1111";
        end if;
    end process;
end Behavioral; 

这是测试平台:

TEST BENCH:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity TestBench is
--  Port ( );
end TestBench;

architecture Behavioral of TestBench is
    component Top
        Port ( Basys_Clock_Top : in STD_LOGIC;
               New_Clock_Top : out std_logic_vector(3 downto 0);
               SegDisp_Top : out std_logic_vector(6 downto 0);
               Binary_Top : out std_logic_vector(3 downto 0);
               F : out STD_LOGIC);
    end component;

    --signals
    signal Basys_Clock_Top : STD_LOGIC;
    signal New_Clock_Top : std_logic_vector(3 downto 0);
    signal Binary_Top : std_logic_vector(3 downto 0);
    signal SegDisp_Top : std_logic_vector(6 downto 0);
    signal F : std_logic; 

begin
    uut : Top Port Map ( Basys_Clock_Top => Basys_Clock_Top, New_Clock_Top => New_Clock_Top, SegDisp_Top => SegDisp_Top, Binary_Top => Binary_Top, F => F);

    stim_proc : process
    begin
        Basys_Clock_Top <= '0';
        wait for 10 ps;
        Basys_Clock_Top <= '1';
        wait for 10 ps;
        Basys_Clock_Top <= '0';
    end process;
end Behavioral;

1 个答案:

答案 0 :(得分:0)

我注意到一件事:在你的TOP模块中,X, Y, Z, and Cont没有分配任何内容。但是你使用它们的值......因此U