2017-03-28 71 views
0

我正在写VHDL代码,以便找到范围从0到7的集合中的数字,它们与集合中的其他数字没有任何公共除数。我试图在BASYS 3板上实现它。它正在使用BASYS 3,但是当我试图为我的代码编写测试工作台时,我得到了很多U和UU。为什么你认为这是事实?我怎样才能写出适当的测试平台?我是初学者,所以任何想法都会有所帮助。vhdl仿真不起作用

顶层模块:

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; 

这是测试平台:

试验台:

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; 

回答

0

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