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

Subversion Repositories mips_enhanced

[/] [mips_enhanced/] [trunk/] [grlib-gpl-1.0.19-b3188/] [lib/] [gaisler/] [leon3/] [libiu.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimamali
------------------------------------------------------------------------------
2
--  This file is a part of the GRLIB VHDL IP LIBRARY
3
--  Copyright (C) 2003, Gaisler Research
4
--
5
--  This program is free software; you can redistribute it and/or modify
6
--  it under the terms of the GNU General Public License as published by
7
--  the Free Software Foundation; either version 2 of the License, or
8
--  (at your option) any later version.
9
--
10
--  This program is distributed in the hope that it will be useful,
11
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
--  GNU General Public License for more details.
14
--
15
--  You should have received a copy of the GNU General Public License
16
--  along with this program; if not, write to the Free Software
17
--  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
18
-----------------------------------------------------------------------------
19
-- Package:     libiu
20
-- File:        libiu.vhd
21
-- Author:      Jiri Gaisler Gaisler Research
22
-- Description: LEON3 IU types and components
23
------------------------------------------------------------------------------
24
 
25
library ieee;
26
use ieee.std_logic_1164.all;
27
library techmap;
28
use techmap.gencomp.all;
29
library gaisler;
30
use gaisler.leon3.all;
31
use gaisler.arith.all;
32
use gaisler.mmuconfig.all;
33
--library fpu;
34
--use fpu.libfpu.all;
35
 
36
package libiu is
37
 
38
constant RDBITS : integer := 32;
39
constant IDBITS : integer := 32;
40
 
41
subtype cword is std_logic_vector(IDBITS-1 downto 0);
42
type cdatatype is array (0 to 3) of cword;
43
 
44
 
45
--type ctagpartype is array (0 to 3) of std_logic_vector(1 downto 0);
46
--type cdatapartype is array (0 to 3) of std_logic_vector(3 downto 0);
47
--type cvalidtype is array (0 to 3) of std_logic_vector(7 downto 0);
48
type cpartype is array (0 to 3) of std_logic_vector(3 downto 0); -- byte parity
49
 
50
type iregfile_in_type is record
51
  raddr1        : std_logic_vector(4 downto 0); -- read address 1
52
  raddr2        : std_logic_vector(4 downto 0); -- read address 2
53
  waddr         : std_logic_vector(4 downto 0); -- write address
54
  wdata         : std_logic_vector(31 downto 0); -- write data
55
  ren1          : std_ulogic;                    -- read 1 enable
56
  ren2          : std_ulogic;                    -- read 2 enable
57
  wren          : std_ulogic;                    -- write enable
58
  diag          : std_logic_vector(3 downto 0); -- write data
59
end record;
60
 
61
type iregfile_out_type is record
62
  data1         : std_logic_vector(RDBITS-1 downto 0); -- read data 1
63
  data2         : std_logic_vector(RDBITS-1 downto 0); -- read data 2
64
end record;
65
 
66
type cctrltype is record
67
  burst  : std_ulogic;                          -- icache burst enable
68
  dfrz   : std_ulogic;                          -- dcache freeze enable
69
  ifrz   : std_ulogic;                          -- icache freeze enable
70
  dsnoop : std_ulogic;                          -- data cache snooping
71
  dcs    : std_logic_vector(1 downto 0); -- dcache state
72
  ics    : std_logic_vector(1 downto 0); -- icache state
73
end record;
74
 
75
type icache_in_type is record
76
  rpc              : std_logic_vector(31 downto 0); -- raw address (npc)
77
  fpc              : std_logic_vector(31 downto 0); -- latched address (fpc)
78
  dpc              : std_logic_vector(31 downto 0); -- latched address (dpc)
79
  rbranch          : std_ulogic;                        -- Instruction branch
80
  fbranch          : std_ulogic;                        -- Instruction branch
81
  inull            : std_ulogic;                        -- instruction nullify
82
  su               : std_ulogic;                        -- super-user
83
  flush            : std_ulogic;                        -- flush icache
84
  flushl           : std_ulogic;                        -- flush line
85
  fline            : std_logic_vector(31 downto 3);     -- flush line offset
86
  pnull            : std_ulogic;
87
end record;
88
 
89
type icache_out_type is record
90
  data             : cdatatype;
91
  set              : std_logic_vector(1 downto 0);
92
  mexc             : std_ulogic;
93
  hold             : std_ulogic;
94
  flush            : std_ulogic;                        -- flush in progress
95
  diagrdy          : std_ulogic;                        -- diagnostic access ready
96
  diagdata         : std_logic_vector(IDBITS-1 downto 0);-- diagnostic data
97
  mds              : std_ulogic;                        -- memory data strobe
98
  cfg              : std_logic_vector(31 downto 0);
99
  idle             : std_ulogic;                        -- idle mode
100
end record;
101
 
102
type icdiag_in_type is record
103
  addr             : std_logic_vector(31 downto 0); -- memory stage address
104
  enable           : std_ulogic;
105
  read             : std_ulogic;
106
  tag              : std_ulogic;
107
  ctx              : std_ulogic;
108
  flush            : std_ulogic;
109
  ilramen          : std_ulogic;
110
  cctrl            : cctrltype;
111
  pflush           : std_ulogic;
112
  pflushaddr       : std_logic_vector(VA_I_U downto VA_I_D);
113
  pflushtyp        : std_ulogic;
114
  ilock            : std_logic_vector(0 to 3);
115
  scanen           : std_ulogic;
116
end record;
117
 
118
type dcache_in_type is record
119
  asi              : std_logic_vector(4 downto 0);
120
  maddress         : std_logic_vector(31 downto 0);
121
  eaddress         : std_logic_vector(31 downto 0);
122
  edata            : std_logic_vector(31 downto 0);
123
  size             : std_logic_vector(1 downto 0);
124
  enaddr           : std_ulogic;
125
  eenaddr          : std_ulogic;
126
  nullify          : std_ulogic;
127
  lock             : std_ulogic;
128
  read             : std_ulogic;
129
  write            : std_ulogic;
130
  flush            : std_ulogic;
131
  flushl           : std_ulogic;                        -- flush line  
132
  dsuen            : std_ulogic;
133
  msu              : std_ulogic;                   -- memory stage supervisor
134
  esu              : std_ulogic;                   -- execution stage supervisor
135
  intack           : std_ulogic;
136
end record;
137
 
138
type dcache_out_type is record
139
  data             : cdatatype;
140
  set              : std_logic_vector(1 downto 0);
141
  mexc             : std_ulogic;
142
  hold             : std_ulogic;
143
  mds              : std_ulogic;
144
  werr             : std_ulogic;
145
  icdiag           : icdiag_in_type;
146
  cache            : std_ulogic;
147
  idle             : std_ulogic;                        -- idle mode
148
  scanen           : std_ulogic;
149
  testen           : std_ulogic;
150
end record;
151
 
152
type tracebuf_in_type is record
153
  addr             : std_logic_vector(11 downto 0);
154
  data             : std_logic_vector(127 downto 0);
155
  enable           : std_logic;
156
  write            : std_logic_vector(3 downto 0);
157
  diag             : std_logic_vector(3 downto 0);
158
end record;
159
 
160
type tracebuf_out_type is record
161
  data             : std_logic_vector(127 downto 0);
162
end record;
163
 
164
 
165
component iu3
166
  generic (
167
    nwin     : integer range 2 to 32 := 8;
168
    isets    : integer range 1 to 4 := 1;
169
    dsets    : integer range 1 to 4 := 1;
170
    fpu      : integer range 0 to 15 := 0;
171
    v8       : integer range 0 to 63 := 0;
172
    cp, mac  : integer range 0 to 1 := 0;
173
    dsu      : integer range 0 to 1 := 0;
174
    nwp      : integer range 0 to 4 := 0;
175
    pclow    : integer range 0 to 2 := 2;
176
    notag    : integer range 0 to 1 := 0;
177
    index    : integer range 0 to 15:= 0;
178
    lddel    : integer range 1 to 2 := 2;
179
    irfwt    : integer range 0 to 1 := 0;
180
    disas    : integer range 0 to 2 := 0;
181
    tbuf     : integer range 0 to 64 := 0;  -- trace buf size in kB (0 - no trace buffer)
182
    pwd      : integer range 0 to 2 := 0;   -- power-down    
183
    svt      : integer range 0 to 1 := 0;   -- single-vector trapping
184
    rstaddr  : integer              := 0;
185
    smp      : integer range 0 to 15 := 0;   -- support SMP systems
186
    fabtech  : integer range 0 to NTECH := 0;
187
    clk2x    : integer := 0
188
    );
189
  port (
190
    clk   : in  std_ulogic;
191
    rstn  : in  std_ulogic;
192
    holdn : in  std_ulogic;
193
    ici   : out icache_in_type;
194
    ico   : in  icache_out_type;
195
    dci   : out dcache_in_type;
196
    dco   : in  dcache_out_type;
197
    rfi   : out iregfile_in_type;
198
    rfo   : in  iregfile_out_type;
199
    irqi  : in  l3_irq_in_type;
200
    irqo  : out l3_irq_out_type;
201
    dbgi  : in  l3_debug_in_type;
202
    dbgo  : out l3_debug_out_type;
203
    muli  : out mul32_in_type;
204
    mulo  : in  mul32_out_type;
205
    divi  : out div32_in_type;
206
    divo  : in  div32_out_type;
207
    fpo   : in  fpc_out_type;
208
    fpi   : out fpc_in_type;
209
    cpo   : in  fpc_out_type;
210
    cpi   : out fpc_in_type;
211
    tbo   : in  tracebuf_out_type;
212
    tbi   : out tracebuf_in_type;
213
    sclk   : in  std_ulogic
214
  );
215
end component;
216
 
217
  component tbufmem
218
  generic (
219
    tech   : integer := 0;
220
    tbuf  : integer := 0
221
    );
222
  port (
223
    clk : in std_ulogic;
224
    di  : in tracebuf_in_type;
225
    do  : out tracebuf_out_type);
226
  end component;
227
 
228
-- disassembly dummy module
229
 
230
  component cpu_disasx is
231
  port (
232
    clk   : in std_ulogic;
233
    rstn  : in std_ulogic;
234
    dummy : out std_ulogic;
235
    inst  : in std_logic_vector(31 downto 0);
236
    pc    : in std_logic_vector(31 downto 2);
237
    result: in std_logic_vector(31 downto 0);
238
    index : in std_logic_vector(3 downto 0);
239
    wreg  : in std_ulogic;
240
    annul : in std_ulogic;
241
    holdn : in std_ulogic;
242
    pv    : in std_ulogic;
243
    trap  : in std_ulogic;
244
    disas : in std_ulogic);
245
  end component;
246
 
247
        component top
248
                port(
249
 
250
                          din :cdatatype;
251
                          zz_ins_i : cdatatype;
252
           clk : in  STD_LOGIC;
253
           rst :in STD_LOGIC;
254
                          qa: in  STD_LOGIC_VECTOR (31 downto 0);
255
                          qb: in  STD_LOGIC_VECTOR (31 downto 0);
256
                          iset:in std_logic_vector(1 downto 0);
257
                          dset:in std_logic_vector(1 downto 0);
258
                          alu_ur: out std_logic_vector(31 downto 0);
259
                          dmem_data_ur : out std_logic_vector(31 downto 0);
260
                          dmem_ctl_ur:out std_logic_vector (4 downto 0);
261
           zz_pc_o1 : out  STD_LOGIC_VECTOR (31 downto 0);
262
                        --  zz_pc_o2 : out  STD_LOGIC_VECTOR (31 downto 0);
263
                          iack_o:out STD_LOGIC;
264
                          size:out std_logic_vector (1 downto 0);
265
                          rdaddra_o:out STD_LOGIC_VECTOR (4 downto 0);
266
                          rdaddrb_o:out STD_LOGIC_VECTOR (4 downto 0);
267
                          wb_we_o1:out STD_LOGIC;
268
                          wb_addr_o1:out STD_LOGIC_VECTOR (4 downto 0);
269
                          wb_din_o:out STD_LOGIC_VECTOR (31 downto 0);
270
                          iflush: out std_ulogic;
271
                          iflushl: out std_ulogic;
272
           ifline: out std_logic_vector(31 downto 3);
273
                          dflush:out std_ulogic;
274
                          dflushl:out std_ulogic;
275
                          read1:out STD_LOGIC;
276
                          read2:out STD_LOGIC;
277
                          inull:out std_ulogic;
278
                          asi:out STD_LOGIC_VECTOR (7 downto 0);
279
                          nullify:out std_ulogic;
280
                          esu:out std_ulogic;
281
                          msu:out std_ulogic;
282
                          intack:out std_ulogic;
283
                          fbranch:out std_logic;
284
                          rbranch:out std_logic;
285
                          eenaddr:out std_logic;
286
                          hold:in std_logic;
287
                          dmds : in  STD_LOGIC;
288
                          imds : in  STD_LOGIC;
289
                          eaddr:out std_logic_vector(31 downto 0);
290
                          pc_next:out std_logic_vector(31 downto 0);
291
                          asi_code:out std_logic_vector(4 downto 0)
292
                          );
293
end component ;
294
 
295
end;

powered by: WebSVN 2.1.0

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