w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
s7_cmt_sfs_unisim.vhd
Go to the documentation of this file.
1-- $Id: s7_cmt_sfs_unisim.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: s7_cmt_sfs - syn
7-- Description: Series-7 CMT for simple frequency synthesis
8-- Direct instantiation of Xilinx UNISIM primitives
9--
10-- Dependencies: -
11-- Test bench: -
12-- Target Devices: generic Series-7
13-- Tool versions: ise 14.5-14.7; viv 2014.4; ghdl 0.29-0.31
14--
15-- Revision History:
16-- Date Rev Version Comment
17-- 2013-09-28 535 1.0 Initial version
18------------------------------------------------------------------------------
19
20library ieee;
21use ieee.std_logic_1164.all;
22
23library unisim;
24use unisim.vcomponents.ALL;
25
26use work.slvtypes.all;
27
28entity s7_cmt_sfs is -- 7-Series CMT for simple freq. synth.
29 generic (
30 VCO_DIVIDE : positive := 1; -- vco clock divide
31 VCO_MULTIPLY : positive := 1; -- vco clock multiply
32 OUT_DIVIDE : positive := 1; -- output divide
33 CLKIN_PERIOD : real := 10.0; -- CLKIN period (def is 10.0 ns)
34 CLKIN_JITTER : real := 0.01; -- CLKIN jitter (def is 10 ps)
35 STARTUP_WAIT : boolean := false; -- hold FPGA startup till LOCKED
36 GEN_TYPE : string := "PLL"); -- PLL or MMCM
37 port (
38 CLKIN : in slbit; -- clock input
39 CLKFX : out slbit; -- clock output (synthesized freq.)
40 LOCKED : out slbit -- pll/mmcm locked
41 );
42end s7_cmt_sfs;
43
44
45architecture syn of s7_cmt_sfs is
46
47begin
48
49 assert GEN_TYPE = "PLL" or GEN_TYPE = "MMCM"
50 report "assert(GEN_TYPE='PLL' or GEN_TYPE='MMCM')"
51 severity failure;
52
53 NOGEN: if VCO_DIVIDE=1 and VCO_MULTIPLY=1 and OUT_DIVIDE=1 generate
54 CLKFX <= CLKIN;
55 LOCKED <= '1';
56 end generate NOGEN;
57
58 USEPLL: if GEN_TYPE = "PLL" and
59 not(VCO_DIVIDE=1 and VCO_MULTIPLY=1 and OUT_DIVIDE=1) generate
60
61 signal CLKFBOUT : slbit;
63 signal CLKOUT0 : slbit;
70
71 pure function bool2string (val : boolean) return string is
72 begin
73 if val then
74 return "TRUE";
75 else
76 return "FALSE";
77 end if;
78 end function bool2string;
79
80 begin
81
82 PLL : PLLE2_BASE
83 generic map (
84 BANDWIDTH => "OPTIMIZED",
85 DIVCLK_DIVIDE => VCO_DIVIDE,
86 CLKFBOUT_MULT => VCO_MULTIPLY,
87 CLKFBOUT_PHASE => 0.000,
88 CLKOUT0_DIVIDE => OUT_DIVIDE,
89 CLKOUT0_PHASE => 0.000,
90 CLKOUT0_DUTY_CYCLE => 0.500,
91 CLKIN1_PERIOD => CLKIN_PERIOD,
92 REF_JITTER1 => CLKIN_JITTER,
93 STARTUP_WAIT => bool2string(STARTUP_WAIT))
94 port map (
95 CLKFBOUT => CLKFBOUT,
96 CLKOUT0 => CLKOUT0,
97 CLKOUT1 => CLKOUT1_UNUSED,
98 CLKOUT2 => CLKOUT2_UNUSED,
99 CLKOUT3 => CLKOUT3_UNUSED,
100 CLKOUT4 => CLKOUT4_UNUSED,
101 CLKOUT5 => CLKOUT5_UNUSED,
102 CLKFBIN => CLKFBOUT_BUF,
103 CLKIN1 => CLKIN,
104 LOCKED => LOCKED,
105 PWRDWN => '0',
106 RST => '0'
107 );
108
109 BUFG_CLKFB : BUFG
110 port map (
111 I => CLKFBOUT,
112 O => CLKFBOUT_BUF
113 );
114
115 BUFG_CLKOUT : BUFG
116 port map (
117 I => CLKOUT0,
118 O => CLKFX
119 );
120
121 end generate USEPLL;
122
123 USEMMCM: if GEN_TYPE = "MMCM" and
124 not(VCO_DIVIDE=1 and VCO_MULTIPLY=1 and OUT_DIVIDE=1) generate
125
126 signal CLKFBOUT : slbit;
127 signal CLKFBOUT_BUF : slbit;
129 signal CLKOUT0 : slbit;
131 signal CLKOUT1_UNUSED : slbit;
133 signal CLKOUT2_UNUSED : slbit;
135 signal CLKOUT3_UNUSED : slbit;
137 signal CLKOUT4_UNUSED : slbit;
138 signal CLKOUT5_UNUSED : slbit;
139 signal CLKOUT6_UNUSED : slbit;
140
141 begin
142
143 MMCM : MMCME2_BASE
144 generic map (
145 BANDWIDTH => "OPTIMIZED",
146 DIVCLK_DIVIDE => VCO_DIVIDE,
147 CLKFBOUT_MULT_F => real(VCO_MULTIPLY),
148 CLKFBOUT_PHASE => 0.000,
149 CLKOUT0_DIVIDE_F => real(OUT_DIVIDE),
150 CLKOUT0_PHASE => 0.000,
151 CLKOUT0_DUTY_CYCLE => 0.500,
152 CLKIN1_PERIOD => CLKIN_PERIOD,
153 REF_JITTER1 => CLKIN_JITTER,
154 STARTUP_WAIT => STARTUP_WAIT)
155 port map (
156 CLKFBOUT => CLKFBOUT,
157 CLKFBOUTB => CLKFBOUTB_UNUSED,
158 CLKOUT0 => CLKOUT0,
159 CLKOUT0B => CLKOUT0B_UNUSED,
160 CLKOUT1 => CLKOUT1_UNUSED,
161 CLKOUT1B => CLKOUT1B_UNUSED,
162 CLKOUT2 => CLKOUT2_UNUSED,
163 CLKOUT2B => CLKOUT2B_UNUSED,
164 CLKOUT3 => CLKOUT3_UNUSED,
165 CLKOUT3B => CLKOUT3B_UNUSED,
166 CLKOUT4 => CLKOUT4_UNUSED,
167 CLKOUT5 => CLKOUT5_UNUSED,
168 CLKFBIN => CLKFBOUT_BUF,
169 CLKIN1 => CLKIN,
170 LOCKED => LOCKED,
171 PWRDWN => '0',
172 RST => '0'
173 );
174
175 BUFG_CLKFB : BUFG
176 port map (
177 I => CLKFBOUT,
178 O => CLKFBOUT_BUF
179 );
180
181 BUFG_CLKOUT : BUFG
182 port map (
183 I => CLKOUT0,
184 O => CLKFX
185 );
186
187 end generate USEMMCM;
188
189end syn;
VCO_DIVIDE positive := 1
GEN_TYPE string := "PLL"
CLKIN_PERIOD real := 10.0
OUT_DIVIDE positive := 1
in CLKIN slbit
CLKIN_JITTER real := 0.01
STARTUP_WAIT boolean := false
VCO_MULTIPLY positive := 1
out LOCKED slbit
out CLKFX slbit
std_logic slbit
Definition: slvtypes.vhd:30