w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
s7_cmt_sfs_gsim.vhd
Go to the documentation of this file.
1-- $Id: s7_cmt_sfs_gsim.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: s7_cmt_sfs - sim
7-- Description: Series-7 CMT for simple 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: xst 14.5-14.7; viv 2014.4-2018.2; ghdl 0.29-0.34
14--
15-- Revision History:
16-- Date Rev Version Comment
17-- 2018-11-03 1065 1.2 use sfs_gsim_core
18-- 2016-08-18 799 1.1.1 remove 'assert false' from report statements
19-- 2016-04-09 760 1.1 BUGFIX: correct mmcm range check boundaries
20-- 2013-09-28 535 1.0 Initial version (derived from dcm_sfs_gsim)
21------------------------------------------------------------------------------
22
23library ieee;
24use ieee.std_logic_1164.all;
25
26use work.slvtypes.all;
27use work.xlib.all;
28
29entity s7_cmt_sfs is -- 7-Series CMT for simple freq. synth.
30 generic (
31 VCO_DIVIDE : positive := 1; -- vco clock divide
32 VCO_MULTIPLY : positive := 1; -- vco clock multiply
33 OUT_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 CLKFX : out slbit; -- clock output (synthesized freq.)
41 LOCKED : out slbit -- pll/mmcm locked
42 );
43end s7_cmt_sfs;
44
45
46architecture sim of s7_cmt_sfs is
47begin
48
49 proc_init : process
50
51 -- currently frequency limits taken from Artix-7 speed grade -1
52 constant f_vcomin_pll: integer := 800;
53 constant f_vcomax_pll: integer := 1600;
54 constant f_pdmin_pll: integer := 19;
55 constant f_pdmax_pll: integer := 450;
56
57 constant f_vcomin_mmcm: integer := 600;
58 constant f_vcomax_mmcm: integer := 1200;
59 constant f_pdmin_mmcm: integer := 10;
60 constant f_pdmax_mmcm: integer := 450;
61
62 variable t_vco : Delay_length := 0 ns;
63 variable t_vcomin : Delay_length := 0 ns;
64 variable t_vcomax : Delay_length := 0 ns;
65 variable t_pd : Delay_length := 0 ns;
66 variable t_pdmin : Delay_length := 0 ns;
67 variable t_pdmax : Delay_length := 0 ns;
68
69 begin
70
71 -- validate generics
72 if not (GEN_TYPE = "PLL" or GEN_TYPE = "MMCM") then
73 report "assert(GEN_TYPE='PLL' or GEN_TYPE='MMCM')"
74 severity failure;
75 end if;
76
77 if VCO_DIVIDE/=1 or VCO_MULTIPLY/=1 or OUT_DIVIDE/=1 then
78
79 if GEN_TYPE = "PLL" then
80 -- check DIV/MULT parameter range
81 if VCO_DIVIDE<1 or VCO_DIVIDE>56 or
82 VCO_MULTIPLY<2 or VCO_MULTIPLY>64 or
83 OUT_DIVIDE<1 or OUT_DIVIDE>128
84 then
85 report
86 "assert(VCO_DIVIDE in 1:56 VCO_MULTIPLY in 2:64 OUT_DIVIDE in 1:128)"
87 severity failure;
88 end if;
89 -- setup VCO and PD range check boundaries
90 t_vcomin := (1000 ns / f_vcomax_pll) - 1 ps;
91 t_vcomax := (1000 ns / f_vcomin_pll) + 1 ps;
92 t_pdmin := (1000 ns / f_pdmax_pll) - 1 ps;
93 t_pdmax := (1000 ns / f_pdmin_pll) + 1 ps;
94
95 end if; -- GEN_TYPE = "PLL"
96
97 if GEN_TYPE = "MMCM" then
98 -- check DIV/MULT parameter range
99 if VCO_DIVIDE<1 or VCO_DIVIDE>106 or
100 VCO_MULTIPLY<2 or VCO_MULTIPLY>64 or
101 OUT_DIVIDE<1 or OUT_DIVIDE>128
102 then
103 report
104 "assert(VCO_DIVIDE in 1:106 VCO_MULTIPLY in 2:64 OUT_DIVIDE in 1:128)"
105 severity failure;
106 end if;
107 -- setup VCO and PD range check boundaries
108 t_vcomin := (1000 ns / f_vcomax_mmcm) - 1 ps;
109 t_vcomax := (1000 ns / f_vcomin_mmcm) + 1 ps;
110 t_pdmin := (1000 ns / f_pdmax_mmcm) - 1 ps;
111 t_pdmax := (1000 ns / f_pdmin_mmcm) + 1 ps;
112
113 end if; -- GEN_TYPE = "MMCM"
114
115 -- now common check whether VCO and PD frequency is in range
116 t_pd := (1 ps * (1000.0*CLKIN_PERIOD)) * VCO_DIVIDE;
117 t_vco := t_pd / VCO_MULTIPLY;
118
119 if t_vco<t_vcomin or t_vco>t_vcomax then
120 report "assert(VCO frequency out of range)"
121 severity failure;
122 end if;
123
124 if t_pd<t_pdmin or t_pd>t_pdmax then
125 report "assert(PD frequency out of range)"
126 severity failure;
127 end if;
128
129 end if; -- one factor /= 1
130
131 wait;
132 end process proc_init;
133
134 -- generate clock
135 SFS: sfs_gsim_core
136 generic map (
140 port map (
141 CLKIN => CLKIN,
142 CLKFX => CLKFX,
143 LOCKED => LOCKED
144 );
145
146end sim;
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
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