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

Subversion Repositories mlite

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

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 7 rhoads
   port(clk_out : out std_logic);
18 2 rhoads
end; --entity tbench
19
 
20
architecture logic of tbench is
21
 
22
component mips_cpu
23
   port(clk         : in std_logic;
24
        reset_in    : in std_logic;
25
        intr_in     : in std_logic;
26
 
27
        mem_address : out std_logic_vector(31 downto 0);
28
        mem_data_w  : out std_logic_vector(31 downto 0);
29
        mem_data_r  : in std_logic_vector(31 downto 0);
30 7 rhoads
        mem_byte_sel: out std_logic_vector(3 downto 0);
31 2 rhoads
        mem_write   : out std_logic;
32 7 rhoads
        mem_pause   : in std_logic);
33 2 rhoads
end component;
34
 
35
component ram
36
   generic(load_file_name : string);
37
   port(clk          : in std_logic;
38
        mem_byte_sel : in std_logic_vector(3 downto 0);
39
        mem_write    : in std_logic;
40
        mem_address  : in std_logic_vector;
41
        mem_data_w   : in std_logic_vector(31 downto 0);
42
        mem_data_r   : out std_logic_vector(31 downto 0));
43
end component;
44
 
45 7 rhoads
   signal clk         : std_logic := '1';
46
   signal reset       : std_logic := '1';
47 2 rhoads
   signal interrupt   : std_logic := '0';
48
   signal mem_write   : std_logic;
49
   signal mem_address : std_logic_vector(31 downto 0);
50
   signal mem_data_w  : std_logic_vector(31 downto 0);
51
   signal mem_data_r  : std_logic_vector(31 downto 0);
52
   signal mem_pause   : std_logic;
53
   signal mem_byte_sel: std_logic_vector(3 downto 0);
54
begin  --architecture
55
   clk <= not clk after 50 ns;
56 7 rhoads
   reset <= '0' after 320 ns;
57 2 rhoads
   mem_pause <= '0';
58
 
59 6 rhoads
   --Uncomment the line below to test interrupts
60 7 rhoads
-- interrupt <= '1' after 10 us when interrupt = '0' else '0' after 600 ns;
61 6 rhoads
 
62 2 rhoads
   u1: mips_cpu PORT MAP (
63
        clk          => clk,
64
        reset_in     => reset,
65
        intr_in      => interrupt,
66
 
67
        mem_address  => mem_address,
68
        mem_data_w   => mem_data_w,
69
        mem_data_r   => mem_data_r,
70 7 rhoads
        mem_byte_sel => mem_byte_sel,
71 2 rhoads
        mem_write    => mem_write,
72 7 rhoads
        mem_pause    => mem_pause);
73 2 rhoads
 
74
   u2: ram generic map ("code.txt")
75
       PORT MAP (
76
        clk          => clk,
77
        mem_byte_sel => mem_byte_sel,
78
        mem_write    => mem_write,
79
        mem_address  => mem_address(15 downto 0),
80
        mem_data_w   => mem_data_w,
81
        mem_data_r   => mem_data_r);
82
 
83
   clk_out <= clk;
84
 
85
end; --architecture logic
86
 

powered by: WebSVN 2.1.0

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