Line 19... |
Line 19... |
|
|
ARCHITECTURE behavior OF testbench IS
|
ARCHITECTURE behavior OF testbench IS
|
|
|
COMPONENT cpu16
|
COMPONENT cpu16
|
PORT(
|
PORT(
|
clk : IN std_logic;
|
clk_i : IN std_logic;
|
cck : IN std_logic;
|
|
switch : IN std_logic_vector(9 downto 0);
|
switch : IN std_logic_vector(9 downto 0);
|
ser_in : IN std_logic;
|
ser_in : IN std_logic;
|
temp_spo : IN std_logic;
|
temp_spo : IN std_logic;
|
xm_rdat : IN std_logic_vector(7 downto 0);
|
xm_rdat : IN std_logic_vector(7 downto 0);
|
ser_out : OUT std_logic;
|
ser_out : OUT std_logic;
|
Line 39... |
Line 38... |
xm_we : OUT std_logic;
|
xm_we : OUT std_logic;
|
xm_ce : OUT std_logic
|
xm_ce : OUT std_logic
|
);
|
);
|
END COMPONENT;
|
END COMPONENT;
|
|
|
signal clk : std_logic;
|
signal clk_i : std_logic;
|
signal cck : std_logic;
|
|
signal switch : std_logic_vector(9 downto 0) := "0000000000";
|
signal switch : std_logic_vector(9 downto 0) := "0000000000";
|
signal ser_in : std_logic := '0';
|
signal ser_in : std_logic := '0';
|
signal temp_spo : std_logic := '0';
|
signal temp_spo : std_logic := '0';
|
signal xm_rdat : std_logic_vector(7 downto 0) := X"33";
|
signal xm_rdat : std_logic_vector(7 downto 0) := X"33";
|
signal ser_out : std_logic;
|
signal ser_out : std_logic;
|
Line 62... |
Line 60... |
signal clk_counter : INTEGER := 0;
|
signal clk_counter : INTEGER := 0;
|
|
|
BEGIN
|
BEGIN
|
|
|
uut: cpu16 PORT MAP(
|
uut: cpu16 PORT MAP(
|
clk => clk,
|
clk_i => clk_i,
|
cck => cck,
|
|
switch => switch,
|
switch => switch,
|
ser_in => ser_in,
|
ser_in => ser_in,
|
ser_out => ser_out,
|
ser_out => ser_out,
|
temp_spo => temp_spo,
|
temp_spo => temp_spo,
|
temp_spi => temp_spi,
|
temp_spi => temp_spi,
|
Line 85... |
Line 82... |
|
|
-- *** Test Bench - User Defined Section ***
|
-- *** Test Bench - User Defined Section ***
|
PROCESS -- clock process for CLK,
|
PROCESS -- clock process for CLK,
|
BEGIN
|
BEGIN
|
CLOCK_LOOP : LOOP
|
CLOCK_LOOP : LOOP
|
CLK <= transport '0';
|
CLK_I <= transport '0';
|
WAIT FOR 1 ns;
|
WAIT FOR 1 ns;
|
CLK <= transport '1';
|
CLK_I <= transport '1';
|
WAIT FOR 1 ns;
|
WAIT FOR 1 ns;
|
WAIT FOR 11 ns;
|
WAIT FOR 11 ns;
|
CLK <= transport '0';
|
CLK_I <= transport '0';
|
WAIT FOR 12 ns;
|
WAIT FOR 12 ns;
|
END LOOP CLOCK_LOOP;
|
END LOOP CLOCK_LOOP;
|
END PROCESS;
|
END PROCESS;
|
|
|
PROCESS(CLK)
|
PROCESS(CLK_I)
|
BEGIN
|
BEGIN
|
if (rising_edge(CLK)) then
|
if (rising_edge(CLK_I)) then
|
CLK_COUNTER <= CLK_COUNTER + 1;
|
CLK_COUNTER <= CLK_COUNTER + 1;
|
|
|
case CLK_COUNTER is
|
case CLK_COUNTER is
|
when 0 => switch(9 downto 8) <= "11";
|
when 0 => switch(9 downto 8) <= "11";
|
when 1 => switch(9 downto 8) <= "00";
|
when 1 => switch(9 downto 8) <= "00";
|