我正在编写 VHDL 代码以找到从 0 到 7 的集合中的数字,这些数字与集合中的其他数字没有任何公约数。我试图在 BASYS 3 板上实现它。它在 BASYS 3 上运行,但是当我尝试为我的代码编写测试平台时,我得到了很多 U 和 UU。你认为为什么会这样?如何编写合适的测试平台?我是初学者,所以任何想法都会有所帮助。
顶级模块:
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;