w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
s7_cmt_sfs_2_gsim.vhd
Go to the documentation of this file.
1-- $Id: s7_cmt_sfs_2_gsim.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 - sim
7-- Description: Series-7 CMT for dual-channel frequency synthesis
8-- simple vhdl model, without 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_gsim)
18------------------------------------------------------------------------------
19
20library ieee;
21use ieee.std_logic_1164.all;
22
23use work.slvtypes.all;
24use work.xlib.all;
25
26entity s7_cmt_sfs_2 is -- 7-Series CMT for dual freq. synth.
27 generic (
28 VCO_DIVIDE : positive := 1; -- vco clock divide
29 VCO_MULTIPLY : positive := 1; -- vco clock multiply
30 OUT0_DIVIDE : positive := 1; -- output 0 divide
31 OUT1_DIVIDE : positive := 1; -- output 1 divide
32 CLKIN_PERIOD : real := 10.0; -- CLKIN period (def is 10.0 ns)
33 CLKIN_JITTER : real := 0.01; -- CLKIN jitter (def is 10 ps)
34 STARTUP_WAIT : boolean := false; -- hold FPGA startup till LOCKED
35 GEN_TYPE : string := "PLL"); -- PLL or MMCM
36 port (
37 CLKIN : in slbit; -- clock input
38 CLKOUT0 : out slbit; -- clock output 0
39 CLKOUT1 : out slbit; -- clock output 1
40 LOCKED : out slbit -- pll/mmcm locked
41 );
42end s7_cmt_sfs_2;
43
44
45architecture sim of s7_cmt_sfs_2 is
46 signal LOCKED0 : slbit := '1';
47 signal LOCKED1 : slbit := '1';
48begin
49
50 proc_init : process
51
52 -- currently frequency limits taken from Artix-7 speed grade -1
53 constant f_vcomin_pll: integer := 800;
54 constant f_vcomax_pll: integer := 1600;
55 constant f_pdmin_pll: integer := 19;
56 constant f_pdmax_pll: integer := 450;
57
58 constant f_vcomin_mmcm: integer := 600;
59 constant f_vcomax_mmcm: integer := 1200;
60 constant f_pdmin_mmcm: integer := 10;
61 constant f_pdmax_mmcm: integer := 450;
62
63 variable t_vco : Delay_length := 0 ns;
64 variable t_vcomin : Delay_length := 0 ns;
65 variable t_vcomax : Delay_length := 0 ns;
66 variable t_pd : Delay_length := 0 ns;
67 variable t_pdmin : Delay_length := 0 ns;
68 variable t_pdmax : Delay_length := 0 ns;
69
70 begin
71
72 -- validate generics
73 if not (GEN_TYPE = "PLL" or GEN_TYPE = "MMCM") then
74 report "assert(GEN_TYPE='PLL' or GEN_TYPE='MMCM')"
75 severity failure;
76 end if;
77
78 if VCO_DIVIDE/=1 or VCO_MULTIPLY/=1 or
79 OUT0_DIVIDE/=1 or OUT1_DIVIDE/=1 then
80
81 if GEN_TYPE = "PLL" then
82 -- check DIV/MULT parameter range
83 if VCO_DIVIDE<1 or VCO_DIVIDE>56 or
84 VCO_MULTIPLY<2 or VCO_MULTIPLY>64 or
85 OUT0_DIVIDE<1 or OUT0_DIVIDE>128 or
87 then
88 report
89 "assert(VCO_DIVIDE in 1:56 VCO_MULTIPLY in 2:64 OUTx_DIVIDE in 1:128)"
90 severity failure;
91 end if;
92 -- setup VCO and PD range check boundaries
93 t_vcomin := (1000 ns / f_vcomax_pll) - 1 ps;
94 t_vcomax := (1000 ns / f_vcomin_pll) + 1 ps;
95 t_pdmin := (1000 ns / f_pdmax_pll) - 1 ps;
96 t_pdmax := (1000 ns / f_pdmin_pll) + 1 ps;
97
98 end if; -- GEN_TYPE = "PLL"
99
100 if GEN_TYPE = "MMCM" then
101 -- check DIV/MULT parameter range
102 if VCO_DIVIDE<1 or VCO_DIVIDE>106 or
103 VCO_MULTIPLY<2 or VCO_MULTIPLY>64 or
104 OUT0_DIVIDE<1 or OUT0_DIVIDE>128 or
105 OUT1_DIVIDE<1 or OUT1_DIVIDE>128
106 then
107 report
108 "assert(VCO_DIVIDE in 1:106 VCO_MULTIPLY in 2:64 OUTx_DIVIDE in 1:128)"
109 severity failure;
110 end if;
111 -- setup VCO and PD range check boundaries
112 t_vcomin := (1000 ns / f_vcomax_mmcm) - 1 ps;
113 t_vcomax := (1000 ns / f_vcomin_mmcm) + 1 ps;
114 t_pdmin := (1000 ns / f_pdmax_mmcm) - 1 ps;
115 t_pdmax := (1000 ns / f_pdmin_mmcm) + 1 ps;
116
117 end if; -- GEN_TYPE = "MMCM"
118
119 -- now common check whether VCO and PD frequency is in range
120 t_pd := (1 ps * (1000.0*CLKIN_PERIOD)) * VCO_DIVIDE;
121 t_vco := t_pd / VCO_MULTIPLY;
122
123 if t_vco<t_vcomin or t_vco>t_vcomax then
124 report "assert(VCO frequency out of range)"
125 severity failure;
126 end if;
127
128 if t_pd<t_pdmin or t_pd>t_pdmax then
129 report "assert(PD frequency out of range)"
130 severity failure;
131 end if;
132
133 end if; -- one factor /= 1
134
135 wait;
136 end process proc_init;
137
138 -- generate clock
139 SFS0: sfs_gsim_core
140 generic map (
144 port map (
145 CLKIN => CLKIN,
146 CLKFX => CLKOUT0,
147 LOCKED => LOCKED0
148 );
149
150 SFS1: sfs_gsim_core
151 generic map (
155 port map (
156 CLKIN => CLKIN,
157 CLKFX => CLKOUT1,
158 LOCKED => LOCKED1
159 );
160
161 LOCKED <= LOCKED0 and LOCKED1;
162
163end sim;
slbit := '1' LOCKED0
slbit := '1' LOCKED1
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
VCO_DIVIDE positive := 1
OUT_DIVIDE positive := 1
in CLKIN slbit
VCO_MULTIPLY positive := 1
out LOCKED slbit
out CLKFX slbit
std_logic slbit
Definition: slvtypes.vhd:30
Definition: xlib.vhd:35