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

Subversion Repositories core_arm

[/] [core_arm/] [trunk/] [vhdl/] [sparc/] [mcore.vhd] - Blame information for rev 5

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tarookumic
 
2
 
3
 
4
 
5
----------------------------------------------------------------------------
6
--  This file is a part of the LEON VHDL model
7
--  Copyright (C) 1999  European Space Agency (ESA)
8
--
9
--  This library is free software; you can redistribute it and/or
10
--  modify it under the terms of the GNU Lesser General Public
11
--  License as published by the Free Software Foundation; either
12
--  version 2 of the License, or (at your option) any later version.
13
--
14
--  See the file COPYING.LGPL for the full details of the license.
15
 
16
 
17
-----------------------------------------------------------------------------
18
-- Entity:      mcore
19
-- File:        mcore.vhd
20
-- Author:      Jiri Gaisler - Gaisler Reserch
21
-- Description: Module containing the processor, caches, memory controller
22
--              and standard peripherals
23
------------------------------------------------------------------------------
24
 
25
library IEEE;
26
use IEEE.std_logic_1164.all;
27
use work.leon_target.all;
28
use work.leon_config.all;
29
use work.leon_iface.all;
30
use work.amba.all;
31
use work.ambacomp.all;
32
use work.peri_io_comp.all;
33
use work.peri_mem_comp.all;
34
use work.peri_serial_comp.all;
35
 
36
-- pragma translate_off
37
use work.debug.all;
38
-- pragma translate_on
39
 
40
entity mcore is
41
  port (
42
    resetn   : in  std_logic;
43
    clk      : in  clk_type;
44
    clkn     : in  clk_type;
45
    pciclk   : in  clk_type;
46
    memi     : in  memory_in_type;
47
    memo     : out memory_out_type;
48
    ioi      : in  io_in_type;
49
    ioo      : out io_out_type;
50
    pcii     : in  pci_in_type;
51
    pcio     : out pci_out_type;
52
    dsi      : in  dsuif_in_type;
53
    dso      : out dsuif_out_type;
54
    sdo      : out sdram_out_type;
55
    ethi     : in eth_in_type;
56
    etho     : out eth_out_type;
57
    cgo      : in  clkgen_out_type;
58
 
59
    test     : in    std_logic
60
  );
61
end;
62
 
63
architecture rtl of mcore is
64
 
65
component rstgen
66
port (
67
    rstin     : in  std_logic;
68
    pcirstin  : in  std_logic;
69
    clk       : in  clk_type;
70
    pciclk    : in  clk_type;
71
    rstout    : out std_logic;
72
    pcirstout : out std_logic;
73
    cgo       : in  clkgen_out_type
74
);
75
end component;
76
 
77
component dsu_mem
78
  port (
79
    clk    : in  clk_type;
80
    dmi    : in  dsumem_in_type;
81
    dmo    : out dsumem_out_type
82
  );
83
end component;
84
 
85
 
86
 
87
 
88
signal rst   : std_logic;
89
signal iui   : iu_in_type;
90
signal iuo   : iu_out_type;
91
signal ahbsto: ahbstat_out_type;
92
signal mctrlo: mctrl_out_type;
93
signal wpo   : wprot_out_type;
94
signal apbi  : apb_slv_in_vector(0 to APB_SLV_MAX-1);
95
signal apbo  : apb_slv_out_vector(0 to APB_SLV_MAX-1);
96
signal ahbmi : ahb_mst_in_vector(0 to AHB_MST_MAX-1);
97
signal ahbmo : ahb_mst_out_vector(0 to AHB_MST_MAX-1);
98
signal ahbsi : ahb_slv_in_vector(0 to AHB_SLV_MAX-1);
99
signal ahbso : ahb_slv_out_vector(0 to AHB_SLV_MAX);
100
signal dsuo  : dsu_out_type;
101
signal dcomo : dcom_out_type;
102
 
103
signal irqi   : irq_in_type;
104
signal irqo   : irq_out_type;
105
signal irq2i  : irq2_in_type;
106
signal irq2o  : irq2_out_type;
107
signal timo   : timers_out_type;
108
signal pioo   : pio_out_type;
109
signal uart1i, uart2i  : uart_in_type;
110
signal uart1o, uart2o  : uart_out_type;
111
signal dmi    : dsumem_in_type;
112
signal dmo    : dsumem_out_type;
113
signal pciirq : std_logic;
114
signal ethirq : std_logic;
115
signal pcirst : std_logic;
116
signal pciahb2: ahb_mst_out_type;
117
signal mctrlo_pioh             : std_logic_vector(15 downto 0);
118
 
119
begin
120
 
121
-- reset generator
122
 
123
  reset0 : rstgen port map (resetn, pcii.pci_rst_in_n, clk,
124
           pciclk, rst, pcirst, cgo);
125
 
126
 
127
----------------------------------------------------------------------
128
-- AHB bus                                                          --
129
----------------------------------------------------------------------
130
 
131
-- AHB arbiter/decoder
132
 
133
  ahb0 : ahbarb
134
         generic map (masters => AHB_MASTERS, defmast => AHB_DEFMST)
135
         port map (rst, clk, ahbmi(0 to AHB_MASTERS-1),
136
              ahbmo(0 to AHB_MASTERS-1), ahbsi, ahbso);
137
 
138
-- AHB/APB bridge
139
 
140
  apb0 : apbmst
141
         port map (rst, clk, ahbsi(1), ahbso(1), apbi, apbo);
142
 
143
-- processor and cache sub-system
144
 
145
  proc0 : proc port map (
146
        rst, clk, clkn, apbi(2), apbo(2), ahbmi(0), ahbmo(0),
147
        ahbsi(0), iui, iuo);
148
 
149
-- debug support unit
150
  dsugen : if DEBUG_UNIT generate
151
    dsu0 : dsu port map ( rst, clk, ahbmi(0), ahbsi(2), ahbso(2),
152
                      dsi.dsui, dsuo, iuo.debug, iui.debug, irqo, dmi, dmo);
153
    dso.dsuo <= dsuo;
154
    dsum0 : dsu_mem port map ( clk, dmi, dmo);
155
  end generate;
156
  dcomgen : if DEBUG_UNIT generate
157
    dcom0 : dcom
158
            port map ( rst, clk, dsi.dcomi, dcomo, dsuo, apbi(11),
159
            apbo(11), ahbmi(AHB_MASTERS-1), ahbmo(AHB_MASTERS-1) );
160
    dso.dcomo <= dcomo;
161
  end generate;
162
 
163
-- sram/prom/sdram memory controller
164
 
165
  mctrl0 : mctrl port map (
166
        rst => rst, clk=> clk, memi => memi, memo => memo,
167
        ahbsi => ahbsi(0), ahbso => ahbso(0), apbi => apbi(0), apbo => apbo(0),
168
        pioo => pioo, wpo => wpo, sdo => sdo, mctrlo => mctrlo);
169
 
170
-- AHB ram
171
  aram0 : if AHBRAMEN generate
172
    aram : ahbram generic map (AHBRAM_BITS)
173
           port map (rst, clk, ahbsi(4), ahbso(4));
174
  end generate;
175
 
176
-- AHB write protection
177
 
178
  wp0 : if WPROTEN generate
179
    wpm :  wprot port map (
180
        rst => rst, clk => clk, wpo => wpo,  ahbsi => ahbsi(0),
181
        apbi => apbi(3), apbo => apbo(3));
182
  end generate;
183
  wp1 : if not WPROTEN generate apbo(3).prdata <= (others => '0'); end generate;
184
 
185
-- AHB status register
186
 
187
  as0 : if AHBSTATEN generate
188
    asm :  ahbstat port map (
189
        rst => rst, clk => clk, ahbmi => ahbmi(0), ahbsi => ahbsi(0),
190
        apbi => apbi(1), apbo => apbo(1), ahbsto => ahbsto);
191
  end generate;
192
 
193
  as1 : if not AHBSTATEN generate
194
    apbo(1).prdata <= (others => '0'); ahbsto.ahberr <= '0';
195
  end generate;
196
 
197
-- Optional PCI core
198
 
199
  pci0 : if PCIEN generate
200
    pci0 : pci
201
      port map ( resetn => rst, clk => clk, pciclk => pciclk,
202
        pcirst => pcirst, pcii => pcii, pcio => pcio,
203
        ahbmi1 => ahbmi(1), ahbmo1 => ahbmo(1),
204
        ahbmi2 => ahbmi(2), ahbmo2 => pciahb2,
205
        ahbsi => ahbsi(3), ahbso => ahbso(3),
206
        apbi => apbi(12), apbo => apbo(12), irq => pciirq);
207
    ahbmd2 : if PCIMASTERS = 2 generate ahbmo(2) <= pciahb2; end generate;
208
  end generate;
209
  nopci : if not PCIEN generate pciirq <= '0'; end generate;
210
 
211
  eth0 : if ETHEN generate
212
    eth0 : eth_oc
213
    port map ( rst => rst, clk => clk,
214
               ahbsi => ahbsi(5), ahbso => ahbso(5),
215
               ahbmi  => ahbmi(PCIMASTERS+1), ahbmo => ahbmo(PCIMASTERS+1),
216
               eneti => ethi, eneto  => etho,
217
               irq => ethirq);
218
  end generate;
219
  noeth : if not ETHEN generate ethirq <= '0'; end generate;
220
 
221
-- drive unused part of the AHB bus to stop some stupid synthesis tools
222
-- from inserting tri-state buffers (!)  DISABLED
223
 
224
--  ahbdrv : for i in 0 to AHB_SLV_MAX-1 generate
225
--    u0 : if not AHB_SLVTABLE(i).enable and (AHB_SLVTABLE(i).index /= 0) generate
226
--      ahbso(AHB_SLVTABLE(i).index).hready <= '0'; 
227
--      ahbso(AHB_SLVTABLE(i).index).hresp  <= "--";
228
--      ahbso(AHB_SLVTABLE(i).index).hrdata <= (others => '-'); 
229
--      ahbso(AHB_SLVTABLE(i).index).hsplit <= (others => '-');
230
--    end generate;
231
--  end generate;
232
 
233
----------------------------------------------------------------------
234
-- APB bus                                                          --
235
----------------------------------------------------------------------
236
 
237
  pci_arb0 : if PCIARBEN generate
238
    pciarb : pci_arb
239
       port map (
240
         clk => pciclk, rst_n => rst,
241
         req_n => ioi.pci_arb_req_n, frame_n => pcii.pci_frame_in_n,
242
         gnt_n => ioo.pci_arb_gnt_n, pclk => clk,
243
         prst_n => pcirst, pbi => apbi(13), pbo => apbo(13)
244
       );
245
  end generate;
246
 
247
-- LEON configuration register
248
 
249
  lc0 : if CFGREG generate
250
    lcm : lconf port map (rst => rst, apbo => apbo(4));
251
  end generate;
252
 
253
-- timers (and watchdog)
254
 
255
  timers0 : timers
256
  port map (rst => rst, clk => clk, apbi => apbi(5),
257
            apbo => apbo(5), timo => timo, dsuo => dsuo);
258
 
259
-- UARTS
260
-- This stupidity exists because synopsys DC is not capable of
261
-- handling record elements in port maps. Sad really ...
262
 
263
  uart1i.rxd     <= pioo.rxd(0); uart1i.ctsn    <= pioo.ctsn(0);
264
  uart2i.rxd     <= pioo.rxd(1); uart2i.ctsn    <= pioo.ctsn(1);
265
  uart1i.scaler  <= pioo.io8lsb; uart2i.scaler  <= pioo.io8lsb;
266
 
267
  uart1 : uart port map (
268
    rst => rst, clk => clk, apbi => apbi(6), apbo => apbo(6),
269
    uarti => uart1i, uarto => uart1o);
270
 
271
  uart2 : uart port map (
272
    rst => rst, clk => clk, apbi => apbi(7), apbo => apbo(7),
273
    uarti => uart2i, uarto => uart2o);
274
 
275
-- interrupt controller
276
 
277
  irqctrl0 : irqctrl
278
  port map (rst  => rst, clk  => clk, apbi => apbi(8),
279
            apbo => apbo(8), irqi => irqi, irqo => irqo);
280
  irqi.intack <= iuo.intack; irqi.irl <= iuo.irqvec; iui.irl <= irqo.irl;
281
 
282
-- optional secondary interrupt controller
283
 
284
  i2 : if IRQ2EN generate
285
    irqctrl1 : irqctrl2
286
    port map (rst  => rst, clk  => clk, apbi => apbi(10),
287
              apbo => apbo(10), irqi => irq2i, irqo => irq2o);
288
  end generate;
289
 
290
-- parallel I/O port
291
 
292
  ioport0 : ioport
293
  port map (rst => rst, clk  => clk, apbi => apbi(9), apbo => apbo(9),
294
            uart1o => uart1o, uart2o => uart2o, mctrlo_pioh => mctrlo_pioh,
295
            ioi => ioi, pioo => pioo);
296
 
297
  mctrlo_pioh <= mctrlo.pioh;
298
 
299
-- drive unused part of the APB bus to stop some stupid synthesis tools
300
-- from inserting tri-state buffers (!) DISABLED
301
 
302
--  apbdrv : for i in 0 to APB_SLV_MAX-1 generate
303
--    u0 : if not APB_TABLE(i).enable and (APB_TABLE(i).index /= 0) generate
304
--      apbo( APB_TABLE(i).index).prdata <= (others => '-');
305
--    end generate;
306
--  end generate;
307
 
308
-- IRQ assignments, add you mapping below
309
 
310
  irqi.irq(15) <= '0';             -- unmaskable irq
311
  irqi.irq(14) <= pciirq;
312
  irqi.irq(13) <= '0';
313
  irqi.irq(12) <= ethirq;
314
  irqi.irq(11) <= dsuo.ntrace when DEBUG_UNIT else '0';
315
  irqi.irq(10) <= irq2o.irq when IRQ2EN else '0';
316
  irqi.irq(9) <=  timo.irq(1);               -- timer 2
317
  irqi.irq(8) <=  timo.irq(0);                -- timer 1
318
  irqi.irq(7 downto 4) <= pioo.irq;          -- I/O port interrupts
319
  irqi.irq(3) <= uart1o.irq;                 -- UART 1
320
  irqi.irq(2) <= uart2o.irq;                 -- UART 2
321
  irqi.irq(1) <= ahbsto.ahberr;              -- AHB error
322
 
323
  -- additional 32 interrupts for secondary interrupt controller
324
  irq2i.irq <= (others => '0');
325
 
326
-- drive outputs
327
 
328
  ioo.piol      <= pioo.piol(15 downto 0);
329
  ioo.piodir    <= pioo.piodir(15 downto 0);
330
  ioo.wdog      <= timo.wdog;
331
  ioo.errorn    <= iuo.error;
332
 
333
 
334
 
335
 
336
-- disassambler
337
 
338
-- pragma translate_off
339
  trace0 : trace(iuo.debug, (test = '1'));
340
-- pragma translate_on
341
 
342
 
343
end ;
344
 

powered by: WebSVN 2.1.0

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