OpenCores
URL https://opencores.org/ocsvn/mlite/mlite/trunk

Subversion Repositories mlite

[/] [mlite/] [trunk/] [vhdl/] [tbench.vhd] - Blame information for rev 8

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 rhoads
---------------------------------------------------------------------
2
-- TITLE: Test Bench
3
-- AUTHOR: Steve Rhoads (rhoadss@yahoo.com)
4
-- DATE CREATED: 4/21/01
5
-- FILENAME: tbench.vhd
6
-- PROJECT: MIPS CPU core
7
-- COPYRIGHT: Software placed into the public domain by the author.
8
--    Software 'as is' without warranty.  Author liable for nothing.
9
-- DESCRIPTION:
10
--    This entity provides a test bench for testing the MIPS CPU core.
11
---------------------------------------------------------------------
12
library ieee;
13
use ieee.std_logic_1164.all;
14
use work.mips_pack.all;
15
 
16
entity tbench is
17
end; --entity tbench
18
 
19
architecture logic of tbench is
20
 
21
component mips_cpu
22
   port(clk         : in std_logic;
23
        reset_in    : in std_logic;
24
        intr_in     : in std_logic;
25
 
26
        mem_address : out std_logic_vector(31 downto 0);
27
        mem_data_w  : out std_logic_vector(31 downto 0);
28
        mem_data_r  : in std_logic_vector(31 downto 0);
29 7 rhoads
        mem_byte_sel: out std_logic_vector(3 downto 0);
30 2 rhoads
        mem_write   : out std_logic;
31 7 rhoads
        mem_pause   : in std_logic);
32 2 rhoads
end component;
33
 
34
component ram
35
   generic(load_file_name : string);
36
   port(clk          : in std_logic;
37
        mem_byte_sel : in std_logic_vector(3 downto 0);
38
        mem_write    : in std_logic;
39
        mem_address  : in std_logic_vector;
40
        mem_data_w   : in std_logic_vector(31 downto 0);
41
        mem_data_r   : out std_logic_vector(31 downto 0));
42
end component;
43
 
44 7 rhoads
   signal clk         : std_logic := '1';
45
   signal reset       : std_logic := '1';
46 2 rhoads
   signal interrupt   : std_logic := '0';
47
   signal mem_write   : std_logic;
48
   signal mem_address : std_logic_vector(31 downto 0);
49
   signal mem_data_w  : std_logic_vector(31 downto 0);
50
   signal mem_data_r  : std_logic_vector(31 downto 0);
51
   signal mem_pause   : std_logic;
52
   signal mem_byte_sel: std_logic_vector(3 downto 0);
53
begin  --architecture
54
   clk <= not clk after 50 ns;
55 7 rhoads
   reset <= '0' after 320 ns;
56 2 rhoads
   mem_pause <= '0';
57
 
58 6 rhoads
   --Uncomment the line below to test interrupts
59 7 rhoads
-- interrupt <= '1' after 10 us when interrupt = '0' else '0' after 600 ns;
60 6 rhoads
 
61 2 rhoads
   u1: mips_cpu PORT MAP (
62
        clk          => clk,
63
        reset_in     => reset,
64
        intr_in      => interrupt,
65
 
66
        mem_address  => mem_address,
67
        mem_data_w   => mem_data_w,
68
        mem_data_r   => mem_data_r,
69 7 rhoads
        mem_byte_sel => mem_byte_sel,
70 2 rhoads
        mem_write    => mem_write,
71 7 rhoads
        mem_pause    => mem_pause);
72 2 rhoads
 
73
   u2: ram generic map ("code.txt")
74
       PORT MAP (
75
        clk          => clk,
76
        mem_byte_sel => mem_byte_sel,
77
        mem_write    => mem_write,
78
        mem_address  => mem_address(15 downto 0),
79
        mem_data_w   => mem_data_w,
80
        mem_data_r   => mem_data_r);
81
 
82
end; --architecture logic
83
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.