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/] [proasic3/] [clkgen_proasic3.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:      various
20
-- File:        clkgen_proasic3.vhd
21
-- Author:      Jiri Gaisler, Gaisler Research
22
-- Description: Clock generators for Proasic3
23
------------------------------------------------------------------------------
24
 
25
library ieee;
26
use ieee.std_logic_1164.all;
27
library grlib;
28
use grlib.stdlib.all;
29
-- pragma translate_off
30
library proasic3;
31
use proasic3.PLL;
32
use proasic3.PLLINT;
33
-- pragma translate_on
34
library techmap;
35
use techmap.gencomp.all;
36
 
37
------------------------------------------------------------------
38
-- Proasic3 clock generator --------------------------------------
39
------------------------------------------------------------------
40
 
41
entity clkgen_proasic3 is
42
  generic (
43
    clk_mul  : integer := 1;
44
    clk_div  : integer := 1;
45
    clk_odiv : integer := 1;
46
    pcien    : integer := 0;
47
    pcisysclk: integer := 0;
48
    freq     : integer := 25000);       -- clock frequency in KHz
49
  port (
50
    clkin   : in  std_ulogic;
51
    pciclkin: in  std_ulogic;
52
    clk     : out std_ulogic;                   -- main clock
53
    sdclk   : out std_ulogic;                   -- SDRAM clock
54
    pciclk  : out std_ulogic;
55
    cgi     : in clkgen_in_type;
56
    cgo     : out clkgen_out_type
57
  );
58
end;
59
 
60
architecture struct of clkgen_proasic3 is
61
 
62
constant VERSION : integer := 0;
63
 
64
    component PLL
65
    generic (VCOFREQUENCY:real := 0.0);
66
 
67
        port(CLKA, EXTFB, POWERDOWN : in std_logic := 'U'; GLA,
68
        LOCK, GLB, YB, GLC, YC : out std_logic;  OADIV0, OADIV1,
69
        OADIV2, OADIV3, OADIV4, OAMUX0, OAMUX1, OAMUX2, DLYGLA0,
70
        DLYGLA1, DLYGLA2, DLYGLA3, DLYGLA4, OBDIV0, OBDIV1,
71
        OBDIV2, OBDIV3, OBDIV4, OBMUX0, OBMUX1, OBMUX2, DLYYB0,
72
        DLYYB1, DLYYB2, DLYYB3, DLYYB4, DLYGLB0, DLYGLB1, DLYGLB2,
73
        DLYGLB3, DLYGLB4, OCDIV0, OCDIV1, OCDIV2, OCDIV3, OCDIV4,
74
        OCMUX0, OCMUX1, OCMUX2, DLYYC0, DLYYC1, DLYYC2, DLYYC3,
75
        DLYYC4, DLYGLC0, DLYGLC1, DLYGLC2, DLYGLC3, DLYGLC4,
76
        FINDIV0, FINDIV1, FINDIV2, FINDIV3, FINDIV4, FINDIV5,
77
        FINDIV6, FBDIV0, FBDIV1, FBDIV2, FBDIV3, FBDIV4, FBDIV5,
78
        FBDIV6, FBDLY0, FBDLY1, FBDLY2, FBDLY3, FBDLY4, FBSEL0,
79
        FBSEL1, XDLYSEL, VCOSEL0, VCOSEL1, VCOSEL2 : in std_logic :=
80
        'U') ;
81
    end component;
82
 
83
    component PLLINT port( A : in std_logic; Y :out std_logic); end component;
84
 
85
    signal VCC_1_net, GND_1_net, clkint : std_logic ;
86
    signal M, N : std_logic_vector(6 downto 0) ;
87
    signal O : std_logic_vector(4 downto 0) ;
88
    signal vcosel : std_logic_vector(2 downto 0) ;
89
 
90
    constant vcomhz : integer := (((freq * clk_mul)/clk_div)/1000);
91
    constant glamhz : integer := vcomhz / clk_odiv;
92
    constant vcofreq : real := real(vcomhz);
93
 
94
    begin
95
 
96
    VCC_1_net <= '1'; GND_1_net <= '0';
97
 
98
--  GLA = M / (N * U)
99
 
100
    M <= conv_std_logic_vector((clk_mul)-1, 7);
101
    N <= conv_std_logic_vector(clk_div-1, 7);
102
    O <= conv_std_logic_vector(clk_odiv-1, 5);
103
    vcosel <= "000" when vcomhz < 44 else
104
              "010" when vcomhz < 88 else
105
              "100" when vcomhz < 175 else "110";
106
 
107
    c0: if (pcisysclk = 0) or (pcien = 0) generate
108
      pllint0 : pllint port map (a => clkin, y => clkint);
109
    end generate;
110
 
111
    c1: if (pcien /= 0) generate
112
      d0: if pcisysclk = 1 generate
113
        pllint0 : pllint port map (a => pciclkin, y => clkint);
114
      end generate d0;
115
      pciclk <= pciclkin;
116
    end generate;
117
 
118
    c3 : if pcien = 0 generate
119
      pciclk <= '0';
120
    end generate;
121
 
122
    cgo.pcilock <= '1';
123
 
124
    Core : PLL
125
      generic map(VCOFREQUENCY => vcofreq)
126
 
127
      port map(CLKA => clkint, EXTFB => GND_1_net, POWERDOWN =>
128
        VCC_1_net, GLA => clk, LOCK => cgo.clklock, GLB => OPEN , YB =>
129
        OPEN , GLC => OPEN , YC => OPEN ,
130
        OADIV0 => O(0),
131
        OADIV1 => O(1),
132
        OADIV2 => O(2),
133
        OADIV3 => O(3),
134
        OADIV4 => O(4),
135
        OAMUX0 => GND_1_net,
136
        OAMUX1 => GND_1_net,
137
        OAMUX2 => VCC_1_net,
138
        DLYGLA0 => GND_1_net,
139
        DLYGLA1 => GND_1_net,
140
        DLYGLA2 => GND_1_net,
141
        DLYGLA3 => GND_1_net,
142
        DLYGLA4 => GND_1_net,
143
        OBDIV0 => GND_1_net,
144
        OBDIV1 => GND_1_net,
145
        OBDIV2 => GND_1_net,
146
        OBDIV3 => GND_1_net,
147
        OBDIV4 => GND_1_net,
148
        OBMUX0 => GND_1_net,
149
        OBMUX1 => GND_1_net,
150
        OBMUX2 => GND_1_net,
151
        DLYYB0 => GND_1_net,
152
        DLYYB1 => GND_1_net,
153
        DLYYB2 => GND_1_net,
154
        DLYYB3 => GND_1_net,
155
        DLYYB4 => GND_1_net,
156
        DLYGLB0 => GND_1_net,
157
        DLYGLB1 => GND_1_net,
158
        DLYGLB2 => GND_1_net,
159
        DLYGLB3 => GND_1_net,
160
        DLYGLB4 => GND_1_net,
161
        OCDIV0 => GND_1_net,
162
        OCDIV1 => GND_1_net,
163
        OCDIV2 => GND_1_net,
164
        OCDIV3 => GND_1_net,
165
        OCDIV4 => GND_1_net,
166
        OCMUX0 => GND_1_net,
167
        OCMUX1 => GND_1_net,
168
        OCMUX2 => GND_1_net,
169
        DLYYC0 => GND_1_net,
170
        DLYYC1 => GND_1_net,
171
        DLYYC2 => GND_1_net,
172
        DLYYC3 => GND_1_net,
173
        DLYYC4 => GND_1_net,
174
        DLYGLC0 => GND_1_net,
175
        DLYGLC1 => GND_1_net,
176
        DLYGLC2 => GND_1_net,
177
        DLYGLC3 => GND_1_net,
178
        DLYGLC4 => GND_1_net,
179
        FINDIV0 => N(0),
180
        FINDIV1 => N(1),
181
        FINDIV2 => N(2),
182
        FINDIV3 => N(3),
183
        FINDIV4 => N(4),
184
        FINDIV5 => N(5),
185
        FINDIV6 => N(6),
186
        FBDIV0 => M(0),
187
        FBDIV1 => M(1),
188
        FBDIV2 => M(2),
189
        FBDIV3 => M(3),
190
        FBDIV4 => M(4),
191
        FBDIV5 => M(5),
192
        FBDIV6 => M(6),
193
        FBDLY0 => GND_1_net,
194
        FBDLY1 => GND_1_net,
195
        FBDLY2 => GND_1_net,
196
        FBDLY3 => GND_1_net,
197
        FBDLY4 => GND_1_net,
198
        FBSEL0 => VCC_1_net,
199
        FBSEL1 => GND_1_net,
200
        XDLYSEL => GND_1_net,
201
        VCOSEL0 => vcosel(0),
202
        VCOSEL1 => vcosel(1),
203
        VCOSEL2 => vcosel(2));
204
 
205
-- pragma translate_off
206
  bootmsg : report_version
207
  generic map (
208
    "clkgen_proasic3" & ": proasic3 clock generator, input clock " &  tost(freq/1000) & " MHz",
209
    "clkgen_proasic3" & ": output clock " & tost(glamhz) & " MHz, mul/div/odiv " & tost(clk_mul)
210
        & "/" & tost(clk_div) & "/" & tost(clk_odiv)
211
        & ", VCO " & tost(vcomhz) & " MHz");
212
-- pragma translate_on
213
 
214
end ;
215
 

powered by: WebSVN 2.1.0

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