Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: ccu_clk_packet.vr | |
4 | // Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved | |
5 | // 4150 Network Circle, Santa Clara, California 95054, U.S.A. | |
6 | // | |
7 | // * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
8 | // | |
9 | // This program is free software; you can redistribute it and/or modify | |
10 | // it under the terms of the GNU General Public License as published by | |
11 | // the Free Software Foundation; version 2 of the License. | |
12 | // | |
13 | // This program is distributed in the hope that it will be useful, | |
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | // GNU General Public License for more details. | |
17 | // | |
18 | // You should have received a copy of the GNU General Public License | |
19 | // along with this program; if not, write to the Free Software | |
20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | // | |
22 | // For the avoidance of doubt, and except that if any non-GPL license | |
23 | // choice is available it will apply instead, Sun elects to use only | |
24 | // the General Public License version 2 (GPLv2) at this time for any | |
25 | // software where a choice of GPL license versions is made | |
26 | // available with the language indicating that GPLv2 or any later version | |
27 | // may be used, or where a choice of which version of the GPL is applied is | |
28 | // otherwise unspecified. | |
29 | // | |
30 | // Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
31 | // CA 95054 USA or visit www.sun.com if you need additional information or | |
32 | // have any questions. | |
33 | // | |
34 | // ========== Copyright Header End ============================================ | |
35 | #include <vera_defines.vrh> | |
36 | ||
37 | // type of operational mode | |
38 | enum ccu_operation_mode_e { CCU_FUNC_MODE, CCU_ATPG_MODE, CCU_DTM_MODE, CCU_BYPASS_MODE, CCU_PLLTEST_MODE, | |
39 | CCU_EXTCLK_MODE, CCU_CHAR_MODE, CCU_ILLEGAL_MODE} ; | |
40 | ||
41 | class CCU_clk_packet { | |
42 | string name; | |
43 | ccu_operation_mode_e mode; | |
44 | //----CCU CSRs---- | |
45 | bit [63:0] pll_ctl; // effective value of PLL_CTL | |
46 | //--- pll input---- | |
47 | integer sys_clk_per; // sys clk period | |
48 | //----effective multipliers and ratios--- | |
49 | integer cmp2io_ratio; // cmp-to-io clk ratio | |
50 | integer cmp2io2x_ratio; // cmp-to-io2x clk ratio | |
51 | integer cmp_mult; // integral part. ie. cmp_clk_freq = sys_clk_freq * cmp_mult | |
52 | bit cmp_mult_frac; // fractional part. 0 means 0.0 and 1 means 0.5 | |
53 | integer dr_mult; // integral part. ie. dr_clk_freq = sys_clk_freq * dr_mult; | |
54 | bit dr_mult_frac; // fractional part. 0: means 0.0, 1 means 0.5 | |
55 | //---user-defined limits/deviations--- | |
56 | integer cmp_per_dev, cmp_pw_dev; // deviation of cmp clk period and duty cycle (in %) | |
57 | integer dr_per_dev, dr_pw_dev; // deviation of dr clk period and duty cycle (in %) | |
58 | integer iox_per_dev, iox_pw_dev; // deviation of IO and io2X clk period and duty cycle (in %) | |
59 | //---expected values of clock periods--- | |
60 | integer cmp_clk_per_nom, cmp_clk_per_min, cmp_clk_per_max; // nominal, min, max | |
61 | integer dr_clk_per_nom, dr_clk_per_min, dr_clk_per_max; | |
62 | integer io_out_per_nom, io_out_per_min, io_out_per_max; | |
63 | integer io2x_out_per_nom, io2x_out_per_min, io2x_out_per_max; | |
64 | //--- dr_sync pulse locations at cluster header outputs --- | |
65 | integer dr_sync_loc[4]; // 4 DR clks in one PLL ref clk cycle | |
66 | ||
67 | //---public tasks--- | |
68 | task new(string name="CCU_clk_packet"); | |
69 | function string get_mode_name(); | |
70 | } | |
71 | ||
72 | //######################################################### | |
73 | //#### implementations of subroutines ######## | |
74 | //######################################################### | |
75 | ||
76 | task CCU_clk_packet::new(string name="CCU_clk_packet") { | |
77 | integer i; | |
78 | ||
79 | this.name = name; | |
80 | mode = CCU_ILLEGAL_MODE; | |
81 | //---initialize to illegal values--- | |
82 | pll_ctl = 64'h0; | |
83 | sys_clk_per = -1; | |
84 | cmp2io_ratio = -1; | |
85 | cmp2io2x_ratio = -1; | |
86 | cmp_mult = -1; | |
87 | cmp_mult_frac = 1'b0; | |
88 | dr_mult = -1; | |
89 | dr_mult_frac = 1'b0; | |
90 | cmp_per_dev = -1; | |
91 | cmp_pw_dev = -1; | |
92 | dr_per_dev = -1; | |
93 | dr_pw_dev = -1; | |
94 | iox_per_dev = -1; | |
95 | iox_pw_dev = -1; | |
96 | cmp_clk_per_nom = -1; cmp_clk_per_min = -1; cmp_clk_per_max = -1; | |
97 | dr_clk_per_nom = -1; dr_clk_per_min = -1; dr_clk_per_max = -1; | |
98 | io_out_per_nom = -1; io_out_per_min = -1; io_out_per_max = -1; | |
99 | io2x_out_per_nom = -1; io2x_out_per_min = -1; io2x_out_per_max = -1; | |
100 | for (i = 0; i < 4; i++) | |
101 | dr_sync_loc[i] = -1; | |
102 | } | |
103 | ||
104 | // WHAT: convert "mode" from enumerated type into string | |
105 | // | |
106 | function string CCU_clk_packet::get_mode_name() { | |
107 | case (this.mode) { | |
108 | CCU_FUNC_MODE : get_mode_name = "FUNC_MODE"; | |
109 | CCU_ATPG_MODE : get_mode_name = "ATPG_MODE"; | |
110 | CCU_DTM_MODE : get_mode_name = "DTM_MODE"; | |
111 | CCU_BYPASS_MODE : get_mode_name = "BYPASS_MODE"; | |
112 | CCU_PLLTEST_MODE : get_mode_name = "PLLTEST_MODE"; | |
113 | CCU_EXTCLK_MODE : get_mode_name = "EXTCLK_MODE"; | |
114 | CCU_CHAR_MODE : get_mode_name = "CHAR_MODE"; | |
115 | CCU_ILLEGAL_MODE : get_mode_name = "ILLEGAL_MODE"; | |
116 | default: get_mode_name = "UNKNOWN_MODE"; | |
117 | } | |
118 | } |