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/] [techmap/] [maps/] [clkgen.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:      clkgen
20
-- File:        clkgen.vhd
21
-- Author:      Jiri Gaisler Gaisler Research
22
-- Description: Clock generator with tech selection
23
------------------------------------------------------------------------------
24
 
25
library ieee;
26
use ieee.std_logic_1164.all;
27
library techmap;
28
use techmap.gencomp.all;
29
use techmap.allclkgen.all;
30
 
31
entity clkgen is
32
  generic (
33
    tech     : integer := DEFFABTECH;
34
    clk_mul  : integer := 1;
35
    clk_div  : integer := 1;
36
    sdramen  : integer := 0;
37
    noclkfb  : integer := 1;
38
    pcien    : integer := 0;
39
    pcidll   : integer := 0;
40
    pcisysclk: integer := 0;
41
    freq     : integer := 25000;        -- clock frequency in KHz
42
    clk2xen  : integer := 0;
43
    clksel   : integer := 0;             -- enable clock select         
44
    clk_odiv : integer := 0);             -- Proasic3 output divider
45
  port (
46
    clkin   : in  std_logic;
47
    pciclkin: in  std_logic;
48
    clk     : out std_logic;                    -- main clock
49
    clkn    : out std_logic;                    -- inverted main clock
50
    clk2x   : out std_logic;                    -- 2x clock
51
    sdclk   : out std_logic;                    -- SDRAM clock
52
    pciclk  : out std_logic;                    -- PCI clock
53
    cgi     : in clkgen_in_type;
54
    cgo     : out clkgen_out_type;
55
    clk4x   : out std_logic;                    -- 4x clock
56
    clk1xu  : out std_logic;                    -- unscaled 1X clock
57
    clk2xu  : out std_logic);                   -- unscaled 2X clock
58
end;
59
 
60
architecture struct of clkgen is
61
signal intclk, sdintclk : std_ulogic;
62
begin
63
  gen : if (tech /= virtex) and (tech /= virtex2) and (tech /= virtex4) and
64
        (tech /= altera) and (tech /= stratix1) and (tech /= apa3) and
65
        (tech /= stratix2) and (tech /= stratix3) and
66
        (tech /= cyclone3) and (tech /= virtex5) and
67
        (tech /= spartan3) and (tech /= spartan3e) and (tech /= axcel) and
68
        (tech /= proasic) and (tech /= rhlib18t) and
69
        (tech /= rhumc)
70
  generate
71
    sdintclk <= pciclkin when (PCISYSCLK = 1 and PCIEN /= 0) else clkin;
72
    sdclk <= sdintclk; intclk <= sdintclk
73
-- pragma translate_off
74
        after 1 ns      -- create 1 ns skew between clk and sdclk
75
-- pragma translate_on
76
    ;
77
    clk1xu <= intclk; pciclk <= pciclkin; clk <= intclk; clkn <= not intclk;
78
    cgo.clklock <= '1'; cgo.pcilock <= '1'; clk2x <= '0';
79
  end generate;
80
  xcv : if tech = virtex generate
81
    v : clkgen_virtex
82
    generic map (clk_mul, clk_div, sdramen, noclkfb, pcien, pcidll, pcisysclk)
83
    port map (clkin, pciclkin, clk, clkn, clk2x, sdclk, pciclk, cgi, cgo);
84
  end generate;
85
  xc2v : if (tech = virtex2) or (tech = virtex4) generate
86
    v : clkgen_virtex2
87
    generic map (clk_mul, clk_div, sdramen, noclkfb, pcien, pcidll, pcisysclk, freq, clk2xen, clksel)
88
    port map (clkin, pciclkin, clk, clkn, clk2x, sdclk, pciclk, cgi, cgo, clk1xu, clk2xu);
89
  end generate;
90
  xc5l : if (tech = virtex5) generate
91
    v : clkgen_virtex5
92
    generic map (clk_mul, clk_div, sdramen, noclkfb, pcien, pcidll, pcisysclk, freq, clk2xen, clksel)
93
    port map (clkin, pciclkin, clk, clkn, clk2x, sdclk, pciclk, cgi, cgo, clk1xu, clk2xu);
94
  end generate;
95
  xc3s : if (tech = spartan3) or (tech = spartan3e) generate
96
    v : clkgen_spartan3
97
    generic map (clk_mul, clk_div, sdramen, noclkfb, pcien, pcidll, pcisysclk, freq, clk2xen, clksel)
98
    port map (clkin, pciclkin, clk, clkn, clk2x, sdclk, pciclk, cgi, cgo, clk1xu, clk2xu);
99
  end generate;
100
  alt : if (tech = altera) or (tech = stratix1) or (tech = stratix2) generate
101
   v : clkgen_altera_mf
102
   generic map (clk_mul, clk_div, sdramen, noclkfb, pcien, pcidll, pcisysclk, freq, clk2xen)
103
   port map (clkin, pciclkin, clk, clkn, clk2x, sdclk, pciclk, cgi, cgo);
104
  end generate;
105
  cyc3 : if (tech = cyclone3)  generate
106
   v : clkgen_cycloneiii
107
   generic map (clk_mul, clk_div, sdramen, noclkfb, pcien, pcidll, pcisysclk, freq, clk2xen)
108
   port map (clkin, pciclkin, clk, clkn, clk2x, sdclk, pciclk, cgi, cgo);
109
  end generate;
110
  stra3 : if (tech = stratix3) generate
111
   v : clkgen_stratixiii
112
   generic map (clk_mul, clk_div, sdramen, noclkfb, pcien, pcidll, pcisysclk, freq, clk2xen)
113
   port map (clkin, pciclkin, clk, clkn, clk2x, sdclk, pciclk, cgi, cgo);
114
  end generate;
115
  act : if (tech = axcel) or (tech = proasic) generate
116
    intclk <= pciclkin when (PCISYSCLK = 1 and PCIEN /= 0) else clkin;
117
    sdclk <= '0'; pciclk <= pciclkin; clk <= intclk; clkn <= '0';
118
    cgo.clklock <= '1'; cgo.pcilock <= '1'; clk2x <= '0';
119
  end generate;
120
  lib18t : if (tech = rhlib18t) generate
121
    v : clkgen_rh_lib18t
122
    generic map (clk_mul, clk_div)
123
    port map (cgi.pllrst, intclk, clk, sdclk, clk2x, clk4x);
124
    intclk <= pciclkin when (PCISYSCLK = 1 and PCIEN /= 0) else clkin;
125
    pciclk <= pciclkin; clkn <= '0';
126
    cgo.clklock <= '1'; cgo.pcilock <= '1';
127
  end generate;
128
  ap3 : if tech = apa3 generate
129
    v : clkgen_proasic3
130
    generic map (clk_mul, clk_div, clk_odiv, pcien, pcisysclk, freq)
131
    port map (clkin, pciclkin, clk, sdclk, pciclk, cgi, cgo);
132
  end generate;
133
  dr : if (tech = rhumc)  generate
134
   v : clkgen_dare
135
   port map (clkin, clk, clk2x, sdclk, pciclk,
136
        cgi, cgo, clk4x, clk1xu, clk2xu);
137
  end generate;
138
 
139
end;

powered by: WebSVN 2.1.0

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