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

Subversion Repositories mips_enhanced

[/] [mips_enhanced/] [trunk/] [grlib-gpl-1.0.19-b3188/] [designs/] [leon3-ge-hpe-mini-lattice/] [clkgen_lattice_ea.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) 2004 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
--  See the file COPYING for the full details of the license.
11
--
12
-----------------------------------------------------------------------------
13
-- Entity:  clkgen_lattice
14
-- File: clkgen_lattice.vhd
15
-- Author: Nils-Johan Wessman - Gaisler Research  
16
-- Description:   Clock generators for Lattice fpgas
17
------------------------------------------------------------------------------
18
 
19
library ieee;
20
use ieee.std_logic_1164.all;
21
-- pragma translate_off
22
library grlib;
23
use grlib.stdlib.all;
24
--library unisim;
25
-- pragma translate_on
26
library techmap;
27
use techmap.gencomp.all;
28
 
29
library ec;
30
use ec.components.all;
31
 
32
------------------------------------------------------------------
33
-- LEC clock generator ---------------------------------------
34
------------------------------------------------------------------
35
 
36
entity clkgen_lattice is
37
   generic (
38
      clk_mul  : string := "2";
39
      clk_div  : string := "1";
40
      freq     : string := "25"; -- clock frequency in MHz
41
      ddrclk_mul  : string := "4";
42
      ddrclk_div  : string := "1");
43
   port (
44
      clkin    : in  std_logic;
45
      clk0     : out std_logic;        -- main clock
46
      clk180   : out std_logic;       -- main clock phase 180
47
      clk270   : out std_logic;       -- main clock phase 270
48
 
49
      ddrclk   : out std_logic;
50
      ddrclkb  : out std_logic;
51
 
52
      clkm     : out std_logic;
53
 
54
      cgi      : in clkgen_in_type;
55
      cgo      : out clkgen_out_type);
56
end;
57
 
58
architecture struct of clkgen_lattice is
59
constant VERSION : integer := 1;
60
signal clkin200, clkin_fb, clk0_fb, clkm_fb, clk180_fb, clk_270 : std_logic;
61
signal pllinlock, pll0lock, pll1lock, pll2lock : std_logic;
62
signal pllinrst, pllrst : std_logic_vector(0 to 5);
63
 
64
attribute FB_MODE : string;
65
attribute FB_MODE of pllm : label is "INTERNAL"; -- INTERNAL CLOCKTREE
66
attribute FB_MODE of pllddr1 : label is "INTERNAL";
67
attribute FB_MODE of pllddr2 : label is "INTERNAL";
68
 
69
begin
70
pllm : EHXPLLB
71
   generic map(
72
      FIN => freq, CLKI_DIV => clk_div, CLKOP_DIV => "16",
73
      CLKFB_DIV => clk_mul, FDEL => "0", CLKOK_DIV => "2",
74
      WAKE_ON_LOCK => "off", DELAY_CNTL => "STATIC", PHASEADJ => "0", DUTY => "4")
75
   port map(
76
      CLKI => clkin, CLKFB => clkm_fb, RST => pllrst(0),
77
      CLKOP => clkm_fb, CLKOS => clkm, CLKOK => open, LOCK => pll0lock,
78
 
79
      -- Static
80
      DDAMODE  => '0', DDAIZR => '0', DDAILAG   => '0', DDAIDEL0  => '0', DDAIDEL1  => '0', DDAIDEL2  => '0',
81
      DDAOZR   => open, DDAOLAG  => open, DDAODEL0 => open, DDAODEL1 => open, DDAODEL2 => open
82
   );
83
 
84
pllddr1 : EHXPLLB
85
   generic map(
86
      FIN => freq, CLKI_DIV => ddrclk_div, CLKOP_DIV => "8",
87
      CLKFB_DIV => ddrclk_mul, FDEL => "0", CLKOK_DIV => "2",
88
      WAKE_ON_LOCK => "off", DELAY_CNTL => "STATIC", PHASEADJ => "180", DUTY => "4")
89
   port map(
90
      CLKI => clkin, CLKFB => clk180_fb, RST => pllrst(0),
91
      CLKOP => clk180_fb, CLKOS => clk180, CLKOK => open, LOCK => pll1lock,
92
 
93
      -- Static
94
      DDAMODE  => '0', DDAIZR => '0', DDAILAG   => '0', DDAIDEL0  => '0', DDAIDEL1  => '0', DDAIDEL2  => '0',
95
      DDAOZR   => open, DDAOLAG  => open, DDAODEL0 => open, DDAODEL1 => open, DDAODEL2 => open
96
   );
97
 
98
pllddr2 : EHXPLLB
99
   generic map(
100
      FIN => freq, CLKI_DIV => ddrclk_div, CLKOP_DIV => "8",
101
      CLKFB_DIV => ddrclk_mul, FDEL => "0", CLKOK_DIV => "2",
102
      WAKE_ON_LOCK => "off", DELAY_CNTL => "STATIC", PHASEADJ => "270", DUTY => "4")
103
   port map(
104
      CLKI => clkin, CLKFB => clk0_fb, RST => pllrst(0),
105
      CLKOP => clk0_fb, CLKOS => clk_270, CLKOK => open, LOCK => pll2lock,
106
 
107
      -- Static
108
      DDAMODE  => '0', DDAIZR => '0', DDAILAG   => '0', DDAIDEL0  => '0', DDAIDEL1  => '0', DDAIDEL2  => '0',
109
      DDAOZR   => open, DDAOLAG  => open, DDAODEL0 => open, DDAODEL1 => open, DDAODEL2 => open
110
   );
111
 
112
-- ddrclk_reg : ODDRXB 
113
-- port map(DA => '1', DB => '0', CLK => clk_270, LSR => '0', Q => ddrclk);
114
-- ddrclkb_reg : ODDRXB 
115
-- port map(DA => '0', DB => '1', CLK => clk_270, LSR => '0', Q => ddrclkb);
116
   -- invert DDR memory clock
117
   ddrclk_reg : ODDRXB
118
   port map(DA => '0', DB => '1', CLK => clk_270, LSR => '0', Q => ddrclk);
119
   ddrclkb_reg : ODDRXB
120
   port map(DA => '1', DB => '0', CLK => clk_270, LSR => '0', Q => ddrclkb);
121
 
122
 
123
   clk0 <= clk0_fb;
124
   clk270 <= clk_270;
125
-- pllinrst <= cgi.pllrst;
126
 
127
   rstdel : process (clkin, cgi.pllrst)
128
   begin
129
      if cgi.pllrst = '1' then pllrst <= (others => '1');
130
      elsif rising_edge(clkin) then
131
         pllrst <= pllrst(1 to 5) & '0';
132
      end if;
133
   end process;
134
 
135
   cgo.clklock <= pll0lock and pll1lock and pll2lock;
136
 
137
  -- cgo.pcilock <= dll2lock;
138
 
139
-- pragma translate_off
140
  bootmsg : report_version
141
  generic map (
142
    "clkgen_lattice" & ": lattice  clock generator, version " & tost(VERSION),
143
    "clkgen_lattice" & ": Frequency " &  freq & " MHz, PLL divisor " & clk_mul & "/" & clk_div & ddrclk_mul & "/" & ddrclk_div);
144
-- pragma translate_on
145
 
146
end;
147
 

powered by: WebSVN 2.1.0

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