w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
s7_cmt_sfs_2_unisim.vhd
Go to the documentation of this file.
1-- $Id: s7_cmt_sfs_2_unisim.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2018- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: s7_cmt_sfs_2 - syn
7-- Description: Series-7 CMT for dual frequency synthesis
8-- Direct instantiation of Xilinx UNISIM primitives
9--
10-- Dependencies: -
11-- Test bench: -
12-- Target Devices: generic Series-7
13-- Tool versions: viv 2017.2; ghdl 0.34
14--
15-- Revision History:
16-- Date Rev Version Comment
17-- 2018-11-18 1072 1.0 Initial version (derived from s7_cmt_sfs_3_unisim)
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_2 is -- 7-Series CMT for dual freq. synth.
29 generic (
30 VCO_DIVIDE : positive := 1; -- vco clock divide
31 VCO_MULTIPLY : positive := 1; -- vco clock multiply
32 OUT0_DIVIDE : positive := 1; -- output divide
33 OUT1_DIVIDE : positive := 1; -- output divide
34 CLKIN_PERIOD : real := 10.0; -- CLKIN period (def is 10.0 ns)
35 CLKIN_JITTER : real := 0.01; -- CLKIN jitter (def is 10 ps)
36 STARTUP_WAIT : boolean := false; -- hold FPGA startup till LOCKED
37 GEN_TYPE : string := "PLL"); -- PLL or MMCM
38 port (
39 CLKIN : in slbit; -- clock input
40 CLKOUT0 : out slbit; -- clock output 0
41 CLKOUT1 : out slbit; -- clock output 1
42 LOCKED : out slbit -- pll/mmcm locked
43 );
44end s7_cmt_sfs_2;
45
46
47architecture syn of s7_cmt_sfs_2 is
48
49begin
50
51 assert GEN_TYPE = "PLL" or GEN_TYPE = "MMCM"
52 report "assert(GEN_TYPE='PLL' or GEN_TYPE='MMCM')"
53 severity failure;
54
55 NOGEN: if VCO_DIVIDE=1 and VCO_MULTIPLY=1 and
56 OUT0_DIVIDE=1 and OUT1_DIVIDE=1 generate
57 CLKOUT0 <= CLKIN;
58 CLKOUT1 <= CLKIN;
59 LOCKED <= '1';
60 end generate NOGEN;
61
62 USEPLL: if GEN_TYPE = "PLL" and
63 not (VCO_DIVIDE=1 and VCO_MULTIPLY=1 and
64 OUT0_DIVIDE=1 and OUT1_DIVIDE=1) generate
65
66 signal CLKFBOUT : slbit;
75
76 pure function bool2string (val : boolean) return string is
77 begin
78 if val then
79 return "TRUE";
80 else
81 return "FALSE";
82 end if;
83 end function bool2string;
84
85 begin
86
87 PLL : PLLE2_BASE
88 generic map (
89 BANDWIDTH => "OPTIMIZED",
90 DIVCLK_DIVIDE => VCO_DIVIDE,
91 CLKFBOUT_MULT => VCO_MULTIPLY,
92 CLKFBOUT_PHASE => 0.000,
93 CLKOUT0_DIVIDE => OUT0_DIVIDE,
94 CLKOUT0_PHASE => 0.000,
95 CLKOUT0_DUTY_CYCLE => 0.500,
96 CLKOUT1_DIVIDE => OUT1_DIVIDE,
97 CLKOUT1_PHASE => 0.000,
98 CLKOUT1_DUTY_CYCLE => 0.500,
99 CLKIN1_PERIOD => CLKIN_PERIOD,
100 REF_JITTER1 => CLKIN_JITTER,
101 STARTUP_WAIT => bool2string(STARTUP_WAIT))
102 port map (
103 CLKFBOUT => CLKFBOUT,
104 CLKOUT0 => CLKOUT0_PLL,
105 CLKOUT1 => CLKOUT1_PLL,
106 CLKOUT2 => CLKOUT2_UNUSED,
107 CLKOUT3 => CLKOUT3_UNUSED,
108 CLKOUT4 => CLKOUT4_UNUSED,
109 CLKOUT5 => CLKOUT5_UNUSED,
110 CLKFBIN => CLKFBOUT_BUF,
111 CLKIN1 => CLKIN,
112 LOCKED => LOCKED,
113 PWRDWN => '0',
114 RST => '0'
115 );
116
117 BUFG_CLKFB : BUFG
118 port map (
119 I => CLKFBOUT,
120 O => CLKFBOUT_BUF
121 );
122
123 BUFG_CLKOUT0 : BUFG
124 port map (
125 I => CLKOUT0_PLL,
126 O => CLKOUT0
127 );
128 BUFG_CLKOUT1 : BUFG
129 port map (
130 I => CLKOUT1_PLL,
131 O => CLKOUT1
132 );
133
134 end generate USEPLL;
135
136 USEMMCM: if GEN_TYPE = "MMCM" and
137 not (VCO_DIVIDE=1 and VCO_MULTIPLY=1 and
138 OUT0_DIVIDE=1 and OUT1_DIVIDE=1) generate
139
140 signal CLKFBOUT : slbit;
141 signal CLKFBOUT_BUF : slbit;
147 signal CLKOUT2_UNUSED : slbit;
149 signal CLKOUT3_UNUSED : slbit;
151 signal CLKOUT4_UNUSED : slbit;
152 signal CLKOUT5_UNUSED : slbit;
153 signal CLKOUT6_UNUSED : slbit;
154
155 begin
156
157 MMCM : MMCME2_BASE
158 generic map (
159 BANDWIDTH => "OPTIMIZED",
160 DIVCLK_DIVIDE => VCO_DIVIDE,
161 CLKFBOUT_MULT_F => real(VCO_MULTIPLY),
162 CLKFBOUT_PHASE => 0.000,
163 CLKOUT0_DIVIDE_F => real(OUT0_DIVIDE),
164 CLKOUT0_PHASE => 0.000,
165 CLKOUT0_DUTY_CYCLE => 0.500,
166 CLKOUT1_DIVIDE => OUT1_DIVIDE,
167 CLKOUT1_PHASE => 0.000,
168 CLKOUT1_DUTY_CYCLE => 0.500,
169 CLKIN1_PERIOD => CLKIN_PERIOD,
170 REF_JITTER1 => CLKIN_JITTER,
171 STARTUP_WAIT => STARTUP_WAIT)
172 port map (
173 CLKFBOUT => CLKFBOUT,
174 CLKFBOUTB => CLKFBOUTB_UNUSED,
175 CLKOUT0 => CLKOUT0_MMCM,
176 CLKOUT0B => CLKOUT0B_UNUSED,
177 CLKOUT1 => CLKOUT1_MMCM,
178 CLKOUT1B => CLKOUT1B_UNUSED,
179 CLKOUT2 => CLKOUT2_UNUSED,
180 CLKOUT2B => CLKOUT2B_UNUSED,
181 CLKOUT3 => CLKOUT3_UNUSED,
182 CLKOUT3B => CLKOUT3B_UNUSED,
183 CLKOUT4 => CLKOUT4_UNUSED,
184 CLKOUT5 => CLKOUT5_UNUSED,
185 CLKFBIN => CLKFBOUT_BUF,
186 CLKIN1 => CLKIN,
187 LOCKED => LOCKED,
188 PWRDWN => '0',
189 RST => '0'
190 );
191
192 BUFG_CLKFB : BUFG
193 port map (
194 I => CLKFBOUT,
195 O => CLKFBOUT_BUF
196 );
197
198 BUFG_CLKOUT0 : BUFG
199 port map (
200 I => CLKOUT0_MMCM,
201 O => CLKOUT0
202 );
203 BUFG_CLKOUT1 : BUFG
204 port map (
205 I => CLKOUT1_MMCM,
206 O => CLKOUT1
207 );
208
209 end generate USEMMCM;
210
211end syn;
VCO_DIVIDE positive := 1
GEN_TYPE string := "PLL"
out CLKOUT1 slbit
CLKIN_PERIOD real := 10.0
OUT1_DIVIDE positive := 1
out CLKOUT0 slbit
CLKIN_JITTER real := 0.01
OUT0_DIVIDE positive := 1
STARTUP_WAIT boolean := false
VCO_MULTIPLY positive := 1
out LOCKED slbit
std_logic slbit
Definition: slvtypes.vhd:30