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

Subversion Repositories core_arm

[/] [core_arm/] [trunk/] [vhdl/] [sparc/] [leon_pci.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:      leon_pci
19
-- File:        leon_pci.vhd
20
-- Author:      Jiri Gaisler - ESA/ESTEC
21
-- Description: Complete processor with PCI pads
22
------------------------------------------------------------------------------
23
 
24
library IEEE;
25
use IEEE.std_logic_1164.all;
26
use work.leon_target.all;
27
use work.leon_config.all;
28
use work.leon_iface.all;
29
use work.tech_map.all;
30
-- pragma translate_off
31
use work.debug.all;
32
-- pragma translate_on
33
 
34
entity leon_pci is
35
  port (
36
    resetn   : in    std_logic;                         -- system signals
37
    clk      : in    std_logic;
38
    pllref   : in    std_logic;
39
    plllock  : out   std_logic;
40
 
41
    errorn   : out   std_logic;
42
    address  : out   std_logic_vector(27 downto 0);      -- memory bus
43
 
44
    data     : inout std_logic_vector(31 downto 0);
45
 
46
    ramsn    : out   std_logic_vector(4 downto 0);
47
    ramoen   : out   std_logic_vector(4 downto 0);
48
    rwen     : inout std_logic_vector(3 downto 0);
49
    romsn    : out   std_logic_vector(1 downto 0);
50
    iosn     : out   std_logic;
51
    oen      : out   std_logic;
52
    read     : out   std_logic;
53
    writen   : inout std_logic;
54
 
55
    brdyn    : in    std_logic;
56
    bexcn    : in    std_logic;
57
-- sdram i/f
58
    sdcke    : out std_logic_vector ( 1 downto 0);  -- clk en
59
    sdcsn    : out std_logic_vector ( 1 downto 0);  -- chip sel
60
    sdwen    : out std_logic;                       -- write en
61
    sdrasn   : out std_logic;                       -- row addr stb
62
    sdcasn   : out std_logic;                       -- col addr stb
63
    sddqm    : out std_logic_vector ( 3 downto 0);  -- data i/o mask
64
    sdclk    : out std_logic;
65
    pio      : inout std_logic_vector(15 downto 0);      -- I/O port
66
 
67
    wdogn    : out   std_logic;                         -- watchdog output
68
 
69
    dsuen    : in    std_logic;
70
    dsutx    : out   std_logic;
71
    dsurx    : in    std_logic;
72
    dsubre   : in    std_logic;
73
    dsuact   : out   std_logic;
74
    test     : in    std_logic;
75
 
76
    pci_rst_in_n   : in std_logic;              -- PCI bus
77
    pci_clk_in     : in std_logic;
78
    pci_gnt_in_n   : in std_logic;
79
    pci_idsel_in   : in std_logic;  -- ignored in host bridge core
80
    pci_lock_n     : inout std_logic;  -- Phoenix core: input only
81
    pci_ad         : inout std_logic_vector(31 downto 0);
82
    pci_cbe_n      : inout std_logic_vector(3 downto 0);
83
    pci_frame_n    : inout std_logic;
84
    pci_irdy_n     : inout std_logic;
85
    pci_trdy_n     : inout std_logic;
86
    pci_devsel_n   : inout std_logic;
87
    pci_stop_n     : inout std_logic;
88
    pci_perr_n     : inout std_logic;
89
    pci_par        : inout std_logic;
90
    pci_req_n      : inout std_logic;  -- tristate pad but never read
91
    pci_serr_n     : inout std_logic;  -- open drain output
92
    pci_host       : in std_logic;
93
    pci_66         : in std_logic;
94
 
95
    pci_arb_req_n  : in  std_logic_vector(0 to 3);
96
    pci_arb_gnt_n  : out std_logic_vector(0 to 3);
97
 
98
    power_state    : out std_logic_vector(1 downto 0);
99
    pme_enable     : out std_logic;
100
    pme_clear      : out std_logic;
101
    pme_status     : in  std_logic
102
 
103
  );
104
end;
105
 
106
architecture rtl of leon_pci is
107
 
108
component mcore
109
  port (
110
    resetn   : in  std_logic;
111
    clk      : in  clk_type;
112
    clkn     : in  clk_type;
113
    pciclk   : in  clk_type;
114
    memi     : in  memory_in_type;
115
    memo     : out memory_out_type;
116
    ioi      : in  io_in_type;
117
    ioo      : out io_out_type;
118
    pcii     : in  pci_in_type;
119
    pcio     : out pci_out_type;
120
    dsi      : in  dsuif_in_type;
121
    dso      : out dsuif_out_type;
122
    sdo      : out sdram_out_type;
123
    ethi     : in  eth_in_type;
124
    etho     : out eth_out_type;
125
    cgo      : in  clkgen_out_type;
126
 
127
    test     : in    std_logic
128
);
129
end component;
130
 
131
signal gnd, clko, sdclkl, resetno : std_logic;
132
signal clkm, clkn, pciclk : clk_type;
133
signal memi     : memory_in_type;
134
signal memo     : memory_out_type;
135
signal ioi      : io_in_type;
136
signal ioo      : io_out_type;
137
signal pcii     : pci_in_type;
138
signal pcio     : pci_out_type;
139
signal dsi      : dsuif_in_type;
140
signal dso      : dsuif_out_type;
141
signal sdo      : sdram_out_type;
142
signal pllctrl  : std_logic_vector(1 downto 0);
143
signal ethi     : eth_in_type;
144
signal etho     : eth_out_type;
145
signal cgi      : clkgen_in_type;
146
signal cgo      : clkgen_out_type;
147
 
148
signal pci_aden         : std_logic_vector(31 downto 0);
149
signal pci_cbeen        : std_logic_vector(3 downto 0);
150
signal pci_frame_en     : std_logic;
151
signal pci_irdy_en      : std_logic;
152
signal pci_trdy_en      : std_logic;
153
signal pci_devsel_en    : std_logic;
154
signal pci_stop_en      : std_logic;
155
signal pci_perr_en      : std_logic;
156
signal pci_par_en       : std_logic;
157
signal pci_req_en       : std_logic;
158
signal pci_serr_en      : std_logic;
159
signal pci_lock_en      : std_logic;
160
signal pci_lock_out     : std_logic;
161
signal pci_req_in_dummy : std_logic;
162
signal pci_clk          : std_logic;
163
 
164
begin
165
 
166
  gnd <= '0';
167
  cgi.pllctrl <= "00"; cgi.pllrst <= resetno; cgi.pllref <= pllref;
168
 
169
-- main processor core
170
 
171
  mcore0  : mcore
172
  port map (
173
    resetn => resetno, clk => clkm, clkn => clkn, pciclk => pciclk,
174
    memi => memi, memo => memo, ioi => ioi, ioo => ioo,
175
    pcii => pcii, pcio => pcio, dsi => dsi, dso => dso, sdo => sdo,
176
    ethi => ethi, etho => etho, cgo => cgo, test => test);
177
 
178
-- clock generator
179
 
180
  clkgen0 : clkgen
181
  port map ( clko, pci_clk, clkm, clkn, sdclkl, pciclk, cgi, cgo);
182
 
183
-- pads
184
 
185
--  clk_pad   : inpad port map (clk, clko);     -- clock
186
  clko <= clk;                                  -- avoid buffering during synthesis
187
  reset_pad   : smpad port map (resetn, resetno);       -- reset
188
  brdyn_pad   : inpad port map (brdyn, memi.brdyn);     -- bus ready
189
  bexcn_pad   : inpad port map (bexcn, memi.bexcn);     -- bus exception
190
 
191
  ds : if DEBUG_UNIT generate
192
    dsuen_pad   : inpad port map (dsuen, dsi.dsui.dsuen);       -- DSU enable
193
    dsutx_pad   : outpad generic map (1) port map (dso.dcomo.dsutx, dsutx);
194
    dsurx_pad   : inpad port map (dsurx, dsi.dcomi.dsurx);      -- DSU receive data
195
    dsubre_pad  : inpad port map (dsubre, dsi.dsui.dsubre);     -- DSU break
196
    dsuact_pad  : outpad generic map (1) port map (dso.dsuo.dsuact, dsuact);
197
  end generate;
198
 
199
  sd : if SDRAMEN generate
200
    cs_pads: for i in 0 to 1 generate
201
      sdcke_pad  : outpad generic map (2) port map (sdo.sdcke(i), sdcke(i));
202
      sdcsn_pad  : outpad generic map (2) port map (sdo.sdcsn(i), sdcsn(i));
203
    end generate;
204
    sdwen_pad  : outpad generic map (2) port map (sdo.sdwen, sdwen);
205
    sdrasn_pad : outpad generic map (2) port map (sdo.rasn, sdrasn);
206
    sdcasn_pad : outpad generic map (2) port map (sdo.casn, sdcasn);
207
    dqm_pads: for i in 0 to 3 generate
208
      sddqm_pad   : outpad generic map (2) port map (sdo.dqm(i), sddqm(i));
209
    end generate;
210
--      sdclk_pad : outpad generic map (2) port map (sdclkl, sdclk);
211
    sdclk <= sdclkl;  -- disable pad for simulation
212
  end generate;
213
 
214
    error_pad   : odpad generic map (2) port map (ioo.errorn, errorn);  -- cpu error mode
215
 
216
    d_pads: for i in 0 to 31 generate                    -- data bus
217
      d_pad : iopad generic map (3) port map (memo.data(i), memo.bdrive((31-i)/8), memi.data(i), data(i));
218
    end generate;
219
 
220
 
221
    pio_pads : for i in 0 to 15 generate         -- parallel I/O port
222
      pio_pad : smiopad generic map (2) port map (ioo.piol(i), ioo.piodir(i), ioi.piol(i), pio(i));
223
    end generate;
224
 
225
    rwen_pads : for i in 0 to 3 generate                 -- ram write strobe
226
      rwen_pad : iopad generic map (2) port map (memo.wrn(i), gnd, memi.wrn(i), rwen(i));
227
    end generate;
228
 
229
                                                        -- I/O write strobe
230
    writen_pad : iopad generic map (2) port map (memo.writen, gnd, memi.writen, writen);
231
 
232
    a_pads : for i in 0 to 27 generate                   -- memory address
233
      a_pads : outpad generic map (3) port map (memo.address(i), address(i));
234
    end generate;
235
 
236
    ramsn_pads : for i in 0 to 4 generate                -- ram oen/rasn
237
      ramsn_pad : outpad generic map (2) port map (memo.ramsn(i), ramsn(i));
238
    end generate;
239
 
240
    ramoen_pads : for i in 0 to 4 generate               -- ram chip select
241
      ramoen_pad : outpad generic map (2) port map (memo.ramoen(i), ramoen(i));
242
    end generate;
243
 
244
    romsn_pads : for i in 0 to 1 generate                        -- rom chip select
245
      romsn_pad : outpad generic map (2) port map (memo.romsn(i), romsn(i));
246
    end generate;
247
 
248
    read_pad : outpad generic map (2) port map (memo.read, read);       -- memory read
249
    oen_pad  : outpad generic map (2) port map (memo.oen, oen); -- memory oen
250
    iosn_pad : outpad generic map (2) port map (memo.iosn, iosn);       -- I/O select
251
 
252
    wd : if WDOGEN generate
253
      wdogn_pad : odpad generic map (2) port map (ioo.wdog, wdogn);     -- watchdog output
254
    end generate;
255
 
256
    pl : if TARGET_CLK /= gen generate
257
      plllock_pad : outpad generic map (2) port map (cgo.clklock, plllock);
258
    end generate;
259
 
260
      pcictrl0 : if PCICORE /= opencores generate
261
        pci_trdy_en   <= pcio.pci_ctrl_en_n;
262
        pci_devsel_en <= pcio.pci_ctrl_en_n;
263
        pci_stop_en   <= pcio.pci_ctrl_en_n;
264
      end generate;
265
 
266
      pcictrl1 : if PCICORE = opencores generate
267
        pci_trdy_en   <= pcio.pci_trdy_en_n;
268
        pci_devsel_en <= pcio.pci_devsel_en_n;
269
        pci_stop_en   <= pcio.pci_stop_en_n;
270
 
271
      end generate;
272
 
273
      pcictrl2 : if PCIEN generate
274
        pci_aden     <= pcio.pci_aden_n;
275
        pci_cbeen(0) <= pcio.pci_cbe0_en_n;
276
        pci_cbeen(1) <= pcio.pci_cbe1_en_n;
277
        pci_cbeen(2) <= pcio.pci_cbe2_en_n;
278
        pci_cbeen(3) <= pcio.pci_cbe3_en_n;
279
        pci_frame_en <= pcio.pci_frame_en_n;
280
        pci_irdy_en  <= pcio.pci_irdy_en_n;
281
        pci_perr_en  <= pcio.pci_perr_en_n;
282
        pci_par_en   <= pcio.pci_par_en_n;
283
        pci_req_en   <= pcio.pci_req_en_n;
284
        pci_serr_en  <= pcio.pci_serr_out_n;  -- open drain pad!
285
        pci_lock_en  <= '1'; -- is-core has no lock output -> deactivate
286
        pci_lock_out <= '0';            -- dont care this output
287
      end generate;
288
 
289
      pci_rst_in_n_pad : pciinpad port map(pci_rst_in_n, pcii.pci_rst_in_n);
290
--      pci_clk_in_pad : pciinpad port map(pci_clk_in, pci_clk);
291
      pci_clk <= pci_clk_in;
292
      pci_gnt_in_n_pad : pciinpad port map(pci_gnt_in_n, pcii.pci_gnt_in_n);
293
      pci_idsel_in_pad : pciinpad port map(pci_idsel_in, pcii.pci_idsel_in);  -- ignored in host bridge core
294
--      pci_lock_in_n_pad : pciinpad port map(pci_lock_in_n, pcii.pci_lock_in_n);  -- Phoenix core: input only
295
      pci_lock_n_pad : pciiopad port map(pci_lock_out, pci_lock_en, pcii.pci_lock_in_n, pci_lock_n);
296
 
297
 
298
 
299
      pci_ad_pads : for i in 0 to 31 generate
300
        pci_adio_pad : pciiopad
301
            port map(pcio.pci_adout(i), pci_aden(i), pcii.pci_adin(i), pci_ad(i));
302
      end generate pci_ad_pads;
303
 
304
      pci_cbe_n_pads : for i in 0 to 3 generate
305
        pci_cbeio_n_pad : pciiopad
306
            port map(pcio.pci_cbeout_n(i), pci_cbeen(i), pcii.pci_cbein_n(i), pci_cbe_n(i));
307
      end generate pci_cbe_n_pads;
308
 
309
      pci_frame_io_n_pad : pciiopad port map
310
        (pcio.pci_frame_out_n, pci_frame_en, pcii.pci_frame_in_n, pci_frame_n);
311
 
312
      pci_irdy_io_n_pad : pciiopad port map
313
        (pcio.pci_irdy_out_n, pci_irdy_en, pcii.pci_irdy_in_n, pci_irdy_n);
314
 
315
      pci_trdy_io_n_pad : pciiopad port map
316
        (pcio.pci_trdy_out_n, pci_trdy_en, pcii.pci_trdy_in_n, pci_trdy_n);
317
      pci_devsel_io_n_pad : pciiopad port map
318
        (pcio.pci_devsel_out_n, pci_devsel_en, pcii.pci_devsel_in_n, pci_devsel_n);
319
      pci_stop_io_n_pad : pciiopad port map
320
        (pcio.pci_stop_out_n, pci_stop_en, pcii.pci_stop_in_n, pci_stop_n);
321
 
322
      pci_perr_io_n_pad : pciiopad port map
323
        (pcio.pci_perr_out_n, pci_perr_en, pcii.pci_perr_in_n, pci_perr_n);
324
 
325
      pci_par_io_pad : pciiopad port map
326
        (pcio.pci_par_out, pci_par_en, pcii.pci_par_in, pci_par);
327
 
328
      pci_req_io_n_pad : pciiopad port map      -- tristate pad but never read
329
        (pcio.pci_req_out_n, pci_req_en, pci_req_in_dummy, pci_req_n);
330
 
331
    -- open drain bidir
332
      pci_serr_n_pad   : pciiodpad port map (pci_serr_en, pcii.pci_serr_in_n, pci_serr_n);
333
 
334
    -- PCI host select
335
      pci_host_pad : inpad port map (pci_host, pcii.pci_host);
336
 
337
    -- Optional PCI arbiter
338
 
339
      parb1 : if PCIARBEN generate
340
        pgnt : for i in 0 to 3 generate
341
          pcignt : pcioutpad port map (ioo.pci_arb_gnt_n(i), pci_arb_gnt_n(i));
342
        end generate;
343
      end generate;
344
 
345
      parb2 : if PCIARBEN generate
346
        preq : for i in 0 to 3 generate
347
          pcireq : inpad port map (pci_arb_req_n(i), ioi.pci_arb_req_n(i));
348
        end generate;
349
      end generate;
350
    -- Optional 66 MHz pad
351
      p66  : if PCI66PADEN generate
352
        pci_66_pad : inpad port map(pci_66, pcii.pci_66);
353
      end generate;
354
      np66  : if not PCI66PADEN generate
355
        pcii.pci_66 <= '0';
356
      end generate;
357
 
358
    -- Optional power control pads
359
 
360
      pme  : if PCIPMEEN generate
361
        pmes : for i in 1 downto 0 generate
362
          power_state_pad : pcioutpad port map (pcio.power_state(i), power_state(i));
363
        end generate;
364
        pme_enable_pad : pcioutpad port map (pcio.pme_enable, pme_enable);
365
        pme_clear_pad  : pcioutpad port map (pcio.pme_clear, pme_clear);
366
        pme_status_pad : inpad port map(pme_status, pcii.pme_status);
367
      end generate;
368
      npme  : if not PCIPMEEN generate
369
        pcii.pme_status <= '0';
370
      end generate;
371
 
372
end ;
373
 

powered by: WebSVN 2.1.0

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