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

Subversion Repositories plasma

[/] [plasma/] [trunk/] [vhdl/] [tbench.vhd] - Blame information for rev 6

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

powered by: WebSVN 2.1.0

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