Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- ENTITY cputest IS
- END cputest;
- ARCHITECTURE behavior OF cputest IS
- -- Component Declaration for the Unit Under Test (UUT)
- COMPONENT CPU
- PORT(
- Ext_Data_Bus : inout STD_LOGIC_VECTOR (31 downto 0);
- Ext_Address_Bus : out STD_LOGIC_VECTOR (31 downto 0);
- Ext_Address_Read : out STD_LOGIC;
- Ext_Address_Write : out STD_LOGIC);
- END COMPONENT;
- --Inputs
- signal databus : STD_LOGIC_VECTOR (31 downto 0) := (others => '0');
- --Outputs
- signal addressbus : STD_LOGIC_VECTOR (31 downto 0) := (others => '0');
- signal addressread : STD_LOGIC_VECTOR (31 downto 0) := (others => '0');
- signal addresswrite : STD_LOGIC_VECTOR (31 downto 0) := (others => '0');
- -- No clocks detected in port list. Replace <clock> below with
- -- appropriate port name
- -- constant <clock>_period : time := 10 ns;
- BEGIN
- -- Instantiate the Unit Under Test (UUT)
- uut: CPU PORT MAP (
- Ext_Data_Bus => databus;
- Ext_Address_Bus => addressbus;
- Ext_Address_Read => addressread;
- Ext_Address_Write => addresswrite;
- );
- -- Clock process definitions
- -- <clock>_process :process
- -- begin
- -- <clock> <= '0';
- -- wait for <clock>_period/2;
- -- <clock> <= '1';
- -- wait for <clock>_period/2;
- -- end process;
- -- Stimulus process
- stim_proc: process
- begin
- while ('1' = '1') loop
- if (addressbus = "00000000000000000000000000000000") then--0
- databus <= "10001110010010110000000100101100";--LW $t3, 300($s2)
- elsif (addressbus = "00000000000000000000000000000100") then--4
- databus <= "10101110111011100000000110010000";--SW $t6, 400($s7)
- elsif (addressbus = "00000000000000000000000000001000") then--8
- databus <= "00000001011100010110100000100000";--add $t5, $t3, $s1)
- elsif (addressbus = "00000000000000000000000000001100") then--12
- databus <= "00010110110011010000000000110001";--bne $s6, $t5, 200
- elsif (addressbus = "00000000000000000000000000010000") then--16
- databus <= "00010010111110000000000000011000";--beq $s7, $t8, 100
- elsif (addressbus = "00000000000000000000000000010100") then--20
- databus <= "00110101001100100000000010100001";--ori $s2, $t1, 0xA1
- end if;
- end loop;
- end process;
- END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement