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/] [leon3s.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
-- Entity:      leon3s
20
-- File:        leon3s.vhd
21
-- Author:      Jiri Gaisler, Edvin Catovic, Gaisler Research
22
-- Description: Top-level LEON3 component
23
------------------------------------------------------------------------------
24
 
25
library ieee;
26
use ieee.std_logic_1164.all;
27
library grlib;
28
use grlib.amba.all;
29
use grlib.stdlib.all;
30
library gaisler;
31
library techmap;
32
use techmap.gencomp.all;
33
use gaisler.leon3.all;
34
use gaisler.libiu.all;
35
use gaisler.libcache.all;
36
use gaisler.libproc3.all;
37
use gaisler.arith.all;
38
--library fpu;
39
--use fpu.libfpu.all;
40
 
41
entity leon3s is
42
  generic (
43
    hindex    : integer               := 0;
44
    fabtech   : integer range 0 to NTECH  := DEFFABTECH;
45
    memtech   : integer range 0 to NTECH  := DEFMEMTECH;
46
    nwindows  : integer range 2 to 32 := 8;
47
    dsu       : integer range 0 to 1  := 0;
48
    fpu       : integer range 0 to 31 := 0;
49
    v8        : integer range 0 to 63 := 0;
50
    cp        : integer range 0 to 1  := 0;
51
    mac       : integer range 0 to 1  := 0;
52
    pclow     : integer range 0 to 2  := 2;
53
    notag     : integer range 0 to 1  := 0;
54
    nwp       : integer range 0 to 4  := 0;
55
    icen      : integer range 0 to 1  := 0;
56
    irepl     : integer range 0 to 2  := 2;
57
    isets     : integer range 1 to 4  := 1;
58
    ilinesize : integer range 4 to 8  := 4;
59
    isetsize  : integer range 1 to 256 := 1;
60
    isetlock  : integer range 0 to 1  := 0;
61
    dcen      : integer range 0 to 1  := 0;
62
    drepl     : integer range 0 to 2  := 2;
63
    dsets     : integer range 1 to 4  := 1;
64
    dlinesize : integer range 4 to 8  := 4;
65
    dsetsize  : integer range 1 to 256 := 1;
66
    dsetlock  : integer range 0 to 1  := 0;
67
    dsnoop    : integer range 0 to 6  := 0;
68
    ilram      : integer range 0 to 1 := 0;
69
    ilramsize  : integer range 1 to 512 := 1;
70
    ilramstart : integer range 0 to 255 := 16#8e#;
71
    dlram      : integer range 0 to 1 := 0;
72
    dlramsize  : integer range 1 to 512 := 1;
73
    dlramstart : integer range 0 to 255 := 16#8f#;
74
    mmuen     : integer range 0 to 1  := 0;
75
    itlbnum   : integer range 2 to 64 := 8;
76
    dtlbnum   : integer range 2 to 64 := 8;
77
    tlb_type  : integer range 0 to 3  := 1;
78
    tlb_rep   : integer range 0 to 1  := 0;
79
    lddel     : integer range 1 to 2  := 2;
80
    disas     : integer range 0 to 2  := 0;
81
    tbuf      : integer range 0 to 64 := 0;
82
    pwd       : integer range 0 to 2  := 2;     -- power-down
83
    svt       : integer range 0 to 1  := 1;     -- single vector trapping
84
    rstaddr   : integer               := 0;
85
    smp       : integer range 0 to 15 := 0;     -- support SMP systems
86
    cached    : integer               := 0;      -- cacheability table
87
    scantest  : integer               := 0
88
  );
89
  port (
90
    clk    : in  std_ulogic;
91
    rstn   : in  std_ulogic;
92
    ahbi   : in  ahb_mst_in_type;
93
    ahbo   : out ahb_mst_out_type;
94
    ahbsi  : in  ahb_slv_in_type;
95
    ahbso  : in  ahb_slv_out_vector;
96
    irqi   : in  l3_irq_in_type;
97
    irqo   : out l3_irq_out_type;
98
    dbgi   : in  l3_debug_in_type;
99
    dbgo   : out l3_debug_out_type
100
  );
101
end;
102
 
103
architecture rtl of leon3s is
104
 
105
--constant IRFBITS  : integer range 6 to 10 := log2(NWINDOWS+1) + 4;
106
--constant IREGNUM  : integer := NWINDOWS * 16 + 8;
107
 
108
 
109
constant IREGNUM  : integer := 32;
110
constant IRFBITS  : integer := log2(IREGNUM);
111
 
112
signal holdn : std_logic;
113
signal rfi   : iregfile_in_type;
114
signal rfo   : iregfile_out_type;
115
signal crami : cram_in_type;
116
signal cramo : cram_out_type;
117
signal tbi   : tracebuf_in_type;
118
signal tbo   : tracebuf_out_type;
119
signal rst   : std_ulogic;
120
signal fpi   : fpc_in_type;
121
signal fpo   : fpc_out_type;
122
signal cpi   : fpc_in_type;
123
signal cpo   : fpc_out_type;
124
signal cpodb : fpc_debug_out_type;
125
 
126
signal rd1, rd2, wd : std_logic_vector(35 downto 0);
127
signal gnd, vcc : std_logic;
128
 
129
constant FPURFHARD : integer := 1; --1-is_fpga(memtech);
130
constant fpuarch   : integer := fpu mod 16;
131
constant fpunet    : integer := fpu / 16;
132
 
133
attribute sync_set_reset : string;
134
attribute sync_set_reset of rst : signal is "true";
135
 
136
begin
137
 
138
   gnd <= '0'; vcc <= '1';
139
 
140
-- leon3 processor core (iu, caches & mul/div)
141
 
142
  p0 : proc3
143
  generic map (hindex, fabtech, memtech, nwindows, dsu, fpuarch, v8, cp, mac,
144
    pclow, notag, nwp, icen, irepl, isets, ilinesize, isetsize, isetlock,
145
    dcen, drepl, dsets, dlinesize, dsetsize, dsetlock, dsnoop, ilram,
146
    ilramsize, ilramstart, dlram, dlramsize, dlramstart, mmuen, itlbnum, dtlbnum,
147
    tlb_type, tlb_rep, lddel, disas, tbuf, pwd, svt, rstaddr, smp, cached, 0, scantest)
148
  port map (clk, rst, holdn, ahbi, ahbo, ahbsi, ahbso, rfi, rfo, crami, cramo,
149
    tbi, tbo, fpi, fpo, cpi, cpo, irqi, irqo, dbgi, dbgo, gnd, clk, vcc);
150
 
151
-- IU register file
152
 
153
    rf0 : regfile_3p generic map (memtech, IRFBITS, 32, 1, IREGNUM)
154
        port map (clk, rfi.waddr( (IRFBITS-1) downto 0), rfi.wdata, rfi.wren,
155
                  clk, rfi.raddr1((IRFBITS-1) downto 0),rfi.ren1 , rfo.data1,
156
                  rfi.raddr2((IRFBITS-1) downto 0), rfi.ren2, rfo.data2, rfi.diag);
157
 
158
-- cache memory
159
 
160
    cmem0 : cachemem
161
    generic map (memtech, icen, irepl, isets, ilinesize, isetsize, isetlock, dcen,
162
                 drepl, dsets,  dlinesize, dsetsize, dsetlock, dsnoop, ilram,
163
                 ilramsize, dlram, dlramsize, mmuen)
164
    port map (clk, crami, cramo, clk);
165
 
166
-- instruction trace buffer memory
167
 
168
  tbmem_gen : if (tbuf /= 0) generate
169
    tbmem0 : tbufmem
170
      generic map (tech => memtech, tbuf => tbuf)
171
      port map (clk, tbi, tbo);
172
  end generate;
173
 
174
-- FPU
175
 
176
  fpu0 : if (fpu = 0) generate fpo.ldlock <= '0'; fpo.ccv <= '1'; fpo.holdn <= '1'; end generate;
177
 
178
  grfpw0gen : if (fpuarch > 0) and (fpuarch < 8) generate
179
    fpu0: grfpwx
180
      generic map (fabtech, FPURFHARD*memtech, (fpuarch-1), pclow, dsu, disas, fpunet, 0)
181
      port map (rst, clk, holdn, fpi, fpo);
182
  end generate;
183
 
184
  mfpw0gen : if (fpuarch = 15) generate
185
    fpu0 : mfpwx
186
      generic map (FPURFHARD*memtech, pclow, dsu, disas)
187
      port map (rst, clk, holdn, fpi, fpo);
188
  end generate;
189
 
190
   grlfpc0gen : if (fpuarch >= 8) and (fpuarch < 15) generate
191
     fpu0 : grlfpwx
192
       generic map (FPURFHARD*memtech, pclow, dsu, disas, (fpuarch-8), fpunet)
193
       port map (rst, clk, holdn, fpi, fpo);
194
   end generate;
195
 
196
-- Default Co-Proc drivers
197
 
198
  cpodb.data <= zero32;
199
  cpo <= (zero32, '0', "00", '0', '0', '0', cpodb);
200
 
201
-- 1-clock reset delay
202
 
203
  rstreg : process(clk)
204
  begin if rising_edge(clk) then rst <= rstn; end if; end process;
205
 
206
-- pragma translate_off
207
  bootmsg : report_version
208
  generic map (
209
    "leon3_" & tost(hindex) & ": LEON3 SPARC V8 processor rev " & tost(LEON3_VERSION),
210
    "leon3_" & tost(hindex) & ": icache " & tost(isets*icen) & "*" & tost(isetsize*icen) &
211
        " kbyte, dcache "  & tost(dsets*dcen) & "*" & tost(dsetsize*dcen) & " kbyte"
212
  );
213
-- pragma translate_on
214
 
215
 
216
end;

powered by: WebSVN 2.1.0

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