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/] [leon3cg.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:      leon3cg
20
-- File:        leon3cg.vhd
21
-- Author:      Jiri Gaisler, Edvin Catovic, Gaisler Research
22
-- Description: Top-level LEON3 component with clock gating
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 leon3cg 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;    -- AHB clock (free-running)
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
    gclk   : in  std_ulogic     -- gated clock
101
  );
102
end;
103
 
104
architecture rtl of leon3cg is
105
 
106
constant fpuarch   : integer := fpu mod 16;
107
constant fpunet    : integer := fpu / 16;
108
 
109
constant IRFBITS  : integer range 6 to 10 := log2(NWINDOWS+1) + 4;
110
constant IREGNUM  : integer := NWINDOWS * 16 + 8;
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
 
125
signal rd1, rd2, wd : std_logic_vector(35 downto 0);
126
signal gnd, vcc : std_logic;
127
 
128
attribute sync_set_reset : string;
129
attribute sync_set_reset of rst : signal is "true";
130
 
131
constant FPURFHARD : integer := 1-is_fpga(memtech);
132
begin
133
 
134
   gnd <= '0'; vcc <= '1';
135
 
136
-- leon3 processor core (iu, caches & mul/div)
137
 
138
  p0 : proc3
139
  generic map (hindex, fabtech, memtech, nwindows, dsu, fpuarch, v8, cp, mac,
140
    pclow, notag, nwp, icen, irepl, isets, ilinesize, isetsize, isetlock,
141
    dcen, drepl, dsets, dlinesize, dsetsize, dsetlock, dsnoop, ilram,
142
    ilramsize, ilramstart, dlram, dlramsize, dlramstart, mmuen, itlbnum, dtlbnum,
143
    tlb_type, tlb_rep, lddel, disas, tbuf, pwd, svt, rstaddr, smp, cached, 0, scantest)
144
  port map (gclk, rst, holdn, ahbi, ahbo, ahbsi, ahbso, rfi, rfo, crami, cramo,
145
    tbi, tbo, fpi, fpo, cpi, cpo, irqi, irqo, dbgi, dbgo, gnd, clk, vcc);
146
 
147
-- IU register file
148
 
149
    rf0 : regfile_3p generic map (memtech, IRFBITS, 32, 1, IREGNUM)
150
        port map (gclk, rfi.waddr(IRFBITS-1 downto 0), rfi.wdata, rfi.wren,
151
                  gclk, rfi.raddr1(IRFBITS-1 downto 0), rfi.ren1, rfo.data1,
152
                  rfi.raddr2(IRFBITS-1 downto 0), rfi.ren2, rfo.data2);
153
 
154
-- cache memory
155
 
156
    cmem0 : cachemem
157
    generic map (memtech, icen, irepl, isets, ilinesize, isetsize, isetlock, dcen,
158
                 drepl, dsets,  dlinesize, dsetsize, dsetlock, dsnoop, ilram,
159
                 ilramsize, dlram, dlramsize, mmuen)
160
    port map (gclk, crami, cramo, clk);
161
 
162
-- instruction trace buffer memory
163
 
164
  tbmem_gen : if (tbuf /= 0) generate
165
    tbmem0 : tbufmem
166
      generic map (tech => memtech, tbuf => tbuf)
167
      port map (gclk, tbi, tbo);
168
  end generate;
169
 
170
-- FPU
171
 
172
  fpu0 : if (fpu = 0) generate fpo.ldlock <= '0'; fpo.ccv <= '1'; fpo.holdn <= '1'; end generate;
173
 
174
  grfpw0gen : if (fpuarch > 0) and (fpuarch < 8) generate
175
    fpu0: grfpwx
176
      generic map (FPURFHARD*fabtech, FPURFHARD*memtech, (fpuarch-1), pclow, dsu, disas, fpunet)
177
      port map (rst, gclk, holdn, fpi, fpo);
178
  end generate;
179
 
180
  mfpw0gen : if (fpuarch = 15) generate
181
    fpu0 : mfpwx
182
      generic map (FPURFHARD*memtech, pclow, dsu, disas)
183
      port map (rst, gclk, holdn, fpi, fpo);
184
  end generate;
185
 
186
   grlfpc0gen : if (fpuarch >= 8) and (fpuarch < 15) generate
187
     fpu0 : grlfpwx
188
       generic map (FPURFHARD*memtech, pclow, dsu, disas, (fpuarch-8))
189
       port map (rst, gclk, holdn, fpi, fpo);
190
   end generate;
191
 
192
-- 1-clock reset delay
193
 
194
  rstreg : process(gclk)
195
  begin if rising_edge(gclk) then rst <= rstn; end if; end process;
196
 
197
-- pragma translate_off
198
  bootmsg : report_version
199
  generic map (
200
    "leon3_" & tost(hindex) & ": LEON3CG SPARC V8 processor rev " & tost(LEON3_VERSION),
201
    "leon3_" & tost(hindex) & ": icache " & tost(isets*icen) & "*" & tost(isetsize*icen) &
202
        " kbyte, dcache "  & tost(dsets*dcen) & "*" & tost(dsetsize*dcen) & " kbyte"
203
  );
204
-- pragma translate_on
205
 
206
 
207
end;

powered by: WebSVN 2.1.0

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