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

Subversion Repositories minimips

[/] [minimips/] [trunk/] [miniMIPS/] [bench/] [bench_minimips.vhd] - Blame information for rev 17

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 poppy
------------------------------------------------------------------------------------
2
--                                                                                --
3
--    Copyright (c) 2004, Hangouet Samuel                                         --
4
--                  , Jan Sebastien                                               --
5
--                  , Mouton Louis-Marie                                          --
6
--                  , Schneider Olivier     all rights reserved                   --
7
--                                                                                --
8
--    This file is part of miniMIPS.                                              --
9
--                                                                                --
10
--    miniMIPS is free software; you can redistribute it and/or modify            --
11 6 poppy
--    it under the terms of the GNU Lesser General Public License as published by --
12
--    the Free Software Foundation; either version 2.1 of the License, or         --
13 2 poppy
--    (at your option) any later version.                                         --
14
--                                                                                --
15
--    miniMIPS is distributed in the hope that it will be useful,                 --
16
--    but WITHOUT ANY WARRANTY; without even the implied warranty of              --
17
--    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               --
18 6 poppy
--    GNU Lesser General Public License for more details.                         --
19 2 poppy
--                                                                                --
20 6 poppy
--    You should have received a copy of the GNU Lesser General Public License    --
21 2 poppy
--    along with miniMIPS; if not, write to the Free Software                     --
22
--    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   --
23
--                                                                                --
24
------------------------------------------------------------------------------------
25
 
26
 
27
-- If you encountered any problem, please contact :
28
--
29
--   lmouton@enserg.fr
30
--   oschneid@enserg.fr
31
--   shangoue@enserg.fr
32
--
33
 
34
 
35
library IEEE;
36
use IEEE.std_logic_1164.all;
37
 
38
library std;
39
use std.textio.all;
40
 
41
library work;
42
use work.pack_mips.all;
43
 
44
entity sim_minimips is
45
end;
46
 
47
architecture bench of sim_minimips is
48
 
49
  component minimips is
50
  port (
51
      clock    : in std_logic;
52
      reset    : in std_logic;
53
 
54
      ram_req  : out std_logic;
55
      ram_adr  : out bus32;
56
      ram_r_w  : out std_logic;
57
      ram_data : inout bus32;
58
      ram_ack  : in std_logic;
59
 
60
      it_mat   : in std_logic
61
  );
62
  end component;
63
 
64
 
65
  component ram is
66
    generic (mem_size : natural := 256;
67
             latency : time := 10 ns);
68
    port(
69
        req        : in std_logic;
70
        adr        : in bus32;
71
        data_inout : inout bus32;
72
        r_w        : in std_logic;
73
        ready      : out std_logic
74
  );
75
  end component;
76
 
77
  component rom is
78
  generic (mem_size : natural := 256;
79
           start : natural := 0;
80
           latency : time := 10 ns);
81
  port(
82
          adr : in bus32;
83
          donnee : out bus32;
84
          ack : out std_logic;
85
          load : in std_logic;
86
          fname : in string
87
  );
88
  end component;
89
 
90
  signal clock : std_logic := '0';
91
  signal reset : std_logic;
92
 
93
  signal it_mat : std_logic := '0';
94
 
95
  -- Connexion with the code memory
96
  signal load : std_logic;
97
  signal fichier : string(1 to 7);
98
 
99
  -- Connexion with the Ram
100
  signal ram_req : std_logic;
101
  signal ram_adr : bus32;
102
  signal ram_r_w : std_logic;
103
  signal ram_data : bus32;
104
  signal ram_rdy : std_logic;
105
 
106
begin
107
 
108
    U_minimips : minimips port map (
109
        clock => clock,
110
        reset => reset,
111
        ram_req => ram_req,
112
        ram_adr => ram_adr,
113
        ram_r_w => ram_r_w,
114
        ram_data => ram_data,
115
        ram_ack => ram_rdy,
116
        it_mat => it_mat
117
    );
118
 
119
    U_ram : ram port map (
120
        req => ram_req,
121
        adr => ram_adr,
122
        data_inout => ram_data,
123
        r_w => ram_r_w,
124
        ready => ram_rdy
125
    );
126
 
127
    U_rom : rom port map (
128
        adr => ram_adr,
129
        donnee => ram_data,
130
        ack => ram_rdy,
131
        load => load,
132
        fname => fichier
133
    );
134
 
135
    clock <= not clock after 20 ns;
136
    reset <= '0', '1' after 5 ns, '0' after 70 ns;
137
    ram_data <= (others => 'L');
138
 
139
    process
140
        variable command : line;
141
        variable nomfichier : string(1 to 3);
142
    begin
143
        write (output, "Enter the filename : ");
144
        readline(input, command);
145
        read(command, nomfichier);
146
 
147
        fichier <= nomfichier & ".bin";
148
 
149
        load <= '1';
150
        wait;
151
    end process;
152
 
153
    -- Memory Mapping
154
    -- 0000 - 00FF      ROM
155
 
156
    process (ram_adr, ram_r_w, ram_data)
157
    begin -- Emulation of an I/O controller
158
        ram_data <= (others => 'Z');
159
 
160
        case ram_adr is
161 17 louismarie
            when X"00001000" => -- program an interrupt after 1000ns
162 2 poppy
                                it_mat <= '1' after 1000 ns;
163
                                ram_rdy <= '1' after 5 ns;
164 17 louismarie
            when X"00001001" => -- clear interrupt line on cpu
165 2 poppy
                                it_mat <= '0';
166
                                ram_data <= X"FFFFFFFF";
167
                                ram_rdy <= '1' after 5 ns;
168
            when others      => ram_rdy <= 'L';
169
        end case;
170
    end process;
171
 
172
end bench;
173
 
174
 
175
 

powered by: WebSVN 2.1.0

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