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

Subversion Repositories minimips_superscalar

[/] [minimips_superscalar/] [tags/] [P1/] [bench/] [bench_minimips.vhd] - Blame information for rev 27

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 mcafruni
------------------------------------------------------------------------------------
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
--    it under the terms of the GNU General Public License as published by        --
12
--    the Free Software Foundation; either version 2 of the License, or           --
13
--    (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
--    GNU General Public License for more details.                                --
19
--                                                                                --
20
--    You should have received a copy of the GNU General Public License           --
21
--    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
      clock2   : in std_logic;
53
      reset    : in std_logic;
54
 
55
      ram_req  : out std_logic;
56
      ram_adr  : out bus32;
57
      ram_r_w  : out std_logic;
58
      ram_data : inout bus32;
59
      ram_ack  : in std_logic;
60
 
61
      ram_req2  : out std_logic;
62
      ram_adr2  : out bus32;
63
      ram_r_w2  : out std_logic;
64
      ram_data2 : inout bus32;
65
      ram_ack2  : in std_logic;
66
 
67
      it_mat   : in std_logic
68
  );
69
  end component;
70
 
71
 
72
  component ram is
73
    generic (mem_size : natural := 256;
74
             latency : time := 10 ns);
75
    port(
76
        req        : in std_logic;
77
        adr        : in bus32;
78
        data_inout : inout bus32;
79
        r_w        : in std_logic;
80
        ready      : out std_logic;
81
 
82
        req2        : in std_logic;
83
        adr2        : in bus32;
84
        data_inout2 : inout bus32;
85
        r_w2        : in std_logic;
86
        ready2      : out std_logic
87
  );
88
  end component;
89
 
90
  component rom is
91
  generic (mem_size : natural := 256;
92
           start : natural := 0;
93
           latency : time := 10 ns);
94
  port(
95
          adr : in bus32;
96
          donnee : out bus32;
97
          ack : out std_logic;
98
 
99
          adr2 : in bus32;
100
          donnee2 : out bus32;
101
          ack2 : out std_logic;
102
 
103
          load : in std_logic;
104
          fname : in string
105
  );
106
  end component;
107
 
108
  signal clock : std_logic := '0';
109
  signal clock2 : std_logic := '0';
110
  signal clock3 : std_logic := '0';
111
  signal clock4 : std_logic := '0';
112
  signal reset : std_logic;
113
 
114
  signal it_mat : std_logic := '0';
115
 
116
  -- Connexion with the code memory
117
  signal load : std_logic;
118
  signal fichier : string(1 to 7);
119
 
120
  -- Connexion with the Ram
121
  signal ram_req : std_logic;
122
  signal ram_adr : bus32;
123
  signal ram_r_w : std_logic;
124
  signal ram_data : bus32;
125
  signal ram_rdy : std_logic;
126
 
127
  signal ram_req2 : std_logic;
128
  signal ram_adr2 : bus32;
129
  signal ram_r_w2 : std_logic;
130
  signal ram_data2 : bus32;
131
  signal ram_rdy2 : std_logic;
132
  constant PERIOD : time := 20 ns;
133
  constant DUTY_CYCLE : real := 0.35;
134
begin
135
 
136
    U_minimips : minimips port map (
137
        clock => clock,
138
        clock2 => clock2,
139
        reset => reset,
140
        ram_req => ram_req,
141
        ram_adr => ram_adr,
142
        ram_r_w => ram_r_w,
143
        ram_data => ram_data,
144
        ram_ack => ram_rdy,
145
 
146
        ram_req2 => ram_req2,
147
        ram_adr2 => ram_adr2,
148
        ram_r_w2 => ram_r_w2,
149
        ram_data2 => ram_data2,
150
        ram_ack2 => ram_rdy2,
151
 
152
        it_mat => it_mat
153
    );
154
 
155
    U_ram : ram port map (
156
        req => ram_req,
157
        adr => ram_adr,
158
        data_inout => ram_data,
159
        r_w => ram_r_w,
160
        ready => ram_rdy,
161
 
162
        req2 => ram_req2,
163
        adr2 => ram_adr2,
164
        data_inout2 => ram_data2,
165
        r_w2 => ram_r_w2,
166
        ready2 => ram_rdy2
167
    );
168
 
169
    U_rom : rom port map (
170
        adr => ram_adr,
171
        donnee => ram_data,
172
        ack => ram_rdy,
173
 
174
        adr2 => ram_adr2,
175
        donnee2 => ram_data2,
176
        ack2 => ram_rdy2,
177
 
178
        load => load,
179
        fname => fichier
180
    );
181
 
182
 
183
 
184
 clock <= '1' after (PERIOD - (PERIOD * DUTY_CYCLE)) when clock = '0'
185
  else '0' after (PERIOD * DUTY_CYCLE);
186
 
187
 clock3 <= '1', '0' after 10 ns;
188
 
189
 clock4 <= '1' after (PERIOD - (PERIOD * DUTY_CYCLE)) when clock2 = '0'
190
  else '0' after (PERIOD * DUTY_CYCLE);
191
 
192
 clock2 <= clock3 xor clock4;
193
 
194
    reset <= '0', '1' after 5 ns, '0' after 25 ns;
195
    ram_data <= (others => 'L');
196
    ram_data2 <= (others => 'L');
197
    process
198
        variable command : line;
199
        variable nomfichier : string(1 to 3);
200
    begin
201
        --write (output, "Enter the filename : ");
202
        --readline(input, command);
203
        --read(command, nomfichier);
204
 
205
        fichier <= "m6x.bin";
206
 
207
        load <= '1';
208
        wait;
209
    end process;
210
 
211
    -- Memory Mapping --
212
    -- 0000 - 00FF      ROM
213
 
214
    process (ram_adr, ram_r_w, ram_data)
215
    begin -- Emulation of an I/O controller
216
        ram_data <= (others => 'Z');
217
 
218
        case ram_adr is
219
            when X"00001000" => -- declenche une lecture avec interruption
220
                                it_mat <= '1' after 1000 ns;
221
                                ram_rdy <= '1' after 5 ns;
222
            when X"00001001" => -- fournit la donnee et lache l'it
223
                                it_mat <= '0';
224
                                ram_data <= X"FFFFFFFF";
225
                                ram_rdy <= '1' after 5 ns;
226
            when others      => ram_rdy <= 'L';
227
        end case;
228
    end process;
229
 
230
end bench;

powered by: WebSVN 2.1.0

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