Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: cmp_top.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 | #define PROG_FILE | |
36 | ||
37 | // defines | |
38 | #include <vera_defines.vrh> | |
39 | #include <VeraListProgram.vrh> | |
40 | #include <ListMacros.vrh> | |
41 | ||
42 | // CPU rtl defines from ../../../../design/cpu/rtl | |
43 | #include <cpu.h> | |
44 | ||
45 | // interfaces & binds | |
46 | #include <cmp_top.if.vrh> | |
47 | #include <ccxDevices.if.vrh> | |
48 | #include <ccxDevices.binds.vrh> | |
49 | #include <MCUStub.if.vrh> | |
50 | #include <MCUStub.bind.vrh> | |
51 | #include <asmEventsToVera.if.vrh> | |
52 | #include <errorCountTasks.if.vrh> | |
53 | #include <sparcBenchUtils_if.vrh> | |
54 | ||
55 | // defines | |
56 | #include <defines.vri> | |
57 | #include <ccxDevicesDefines.vri> | |
58 | #include <plusArgMacros.vri> | |
59 | #include <std_display_defines.vri> | |
60 | ||
61 | // classes refered to in this file | |
62 | #include <std_display_class.vrh> | |
63 | #include <baseUtilsClass.vrh> | |
64 | #include <sparcBenchUtils.vrh> | |
65 | #include <utilsClass.vrh> | |
66 | #include <baseParamsClass.vrh> | |
67 | #include <sparcParams.vrh> | |
68 | #include <ccx_tag_class.vrh> | |
69 | #include <baseCCXtrans.vrh> | |
70 | #include <irritator.vrh> | |
71 | ||
72 | #include <asmEvent.vrh> | |
73 | #include <baseAsmToVeraIntf.vrh> | |
74 | #include <asmEventsToVera.vrh> | |
75 | #include <asmToVeraIntf.vrh> | |
76 | ||
77 | ||
78 | // verilog tasks/functions that vera is going to call | |
79 | #include <verilog_tasks_ncu.vri> | |
80 | #include <verilog_tasks_misc.vri> | |
81 | #include <seedingVerilogTasks.vri> | |
82 | ||
83 | // Testcase reference. | |
84 | #include <dummyTestcase.vrh> | |
85 | ||
86 | ||
87 | program cmp_test | |
88 | { | |
89 | ||
90 | ||
91 | // This is where the global 'extern declerations' are. Typedefs too. | |
92 | // Other files needing globals include this. | |
93 | #include <globals.vri> | |
94 | ||
95 | string MYNAME = "cmp_top"; | |
96 | ||
97 | TestCase testCase; | |
98 | ||
99 | // vera tasks that verilog calls, if any | |
100 | //#include "vera_tasks.vrh" | |
101 | ||
102 | ||
103 | //----------------------------------------------------------------------------- | |
104 | // You must seed the RNG from *top* *BEFORE* class instantiations and forks. | |
105 | // YES, this matters in vera > V5, see vera docs. If you don't seed before | |
106 | // instantiating a class, that class ALWAYS repeats random numbers which is | |
107 | // NOT what you want. | |
108 | //----------------------------------------------------------------------------- | |
109 | #define HDNLNAME gSeedFileHndl | |
110 | #define SEEDNAME gSeed | |
111 | #include <seeding.vri> | |
112 | ||
113 | ||
114 | //----------------------------------------------------------------------------- | |
115 | // Vars, Classes and forks (POST SEEDING!!!) | |
116 | //----------------------------------------------------------------------------- | |
117 | ||
118 | gOutOfBoot = 0; | |
119 | gClkPeriod = 100; | |
120 | ||
121 | // printmon | |
122 | gDbg = new; | |
123 | ||
124 | // Check Plusargs, knob/parameter files, config files, etc | |
125 | gParam = new(gDbg); | |
126 | ||
127 | // utils, base utils | |
128 | gUtil = new(gDbg, gClkPeriod); | |
129 | ||
130 | #ifndef CMP0 | |
131 | if (gParam.asmDiagName != null) { | |
132 | // $EVENTs | |
133 | gAsmEventsToVera = new(gDbg,gParam.coreAvilableReg,0,0); // main/common $EVENTs code | |
134 | gAsmEventsToVera.readEventFile("diag.ev"); | |
135 | } | |
136 | #endif | |
137 | ||
138 | #ifdef NOL2RTL | |
139 | gL2bfms = 1; | |
140 | gParam.enableMemBFM = 8'hff; // force on | |
141 | // Initialize bench, virtual ports, $EVENTs, etc. | |
142 | gUtil.initTB(0,1,gL2bfms,0); | |
143 | #else | |
144 | gL2bfms = 0; | |
145 | // Initialize bench, virtual ports, $EVENTs, etc. | |
146 | gUtil.initTB(1,1,gL2bfms,0); | |
147 | #endif | |
148 | ||
149 | ||
150 | // CCX traffic | |
151 | gIrritator = new(gDbg, gL2bfms); | |
152 | ||
153 | // Initialize DUT | |
154 | gUtil.initDut(0); | |
155 | gUtil.resetDut(); | |
156 | ||
157 | // possibly start these | |
158 | gUtil.sendIntrLoop(); | |
159 | if (gL2bfms) gUtil.randEvict(); | |
160 | ||
161 | gUtil.wait4termination(gParam.maxCycle); | |
162 | ||
163 | ||
164 | fork | |
165 | // simulation wrap up, verilog has finished (pass or fail) | |
166 | { | |
167 | if (gParam.asmDiagName !== null) { | |
168 | @(probe_if.sim_status); | |
169 | ||
170 | // Save coverage database on diag passing - GLOBALLY .. | |
171 | if (gParam.coverage_on && !gParam.coverage_off) { | |
172 | if (probe_if.sim_status[ASM_PASS]) { | |
173 | gDbg.dispmon(MYNAME, MON_NORMAL, "Saving Coverage Database ..\n"); | |
174 | coverage_save_database(1); | |
175 | } | |
176 | } | |
177 | ||
178 | // let vera check for errors, print pass/fail only if | |
179 | // verilog did not see an error!!! | |
180 | if (probe_if.sim_status[ASM_PASS]) gUtil.exitBench(); | |
181 | else | |
182 | // have verilog error so just kill time | |
183 | repeat (gDbg.wait_cycle_to_kill) @(posedge CLOCK); | |
184 | } | |
185 | } | |
186 | ||
187 | ||
188 | // Initalize Coverage Objects for modules | |
189 | ||
190 | //------------------- Module coverage --------------------------------- | |
191 | #ifdef TLU_COVERAGE | |
192 | { | |
193 | if (( mChkPlusarg(tlu_coverage) || gParam.coverage_on ) && | |
194 | ! gParam.coverage_off) { | |
195 | gDbg.dispmon(MYNAME, MON_NORMAL, "Instantiating tlu_coverage object\n"); | |
196 | tlu_coverage_obj = new(gDbg); | |
197 | } | |
198 | } | |
199 | #endif | |
200 | ||
201 | //------------------- End Module coverage ----------------------------- | |
202 | ||
203 | { | |
204 | if (gParam.veraDiagName != null && gParam.veraDiagName != "dummyTestcase.vr") { | |
205 | verilog_set_no_verilog_finish(); // only Vera can finish the simulation | |
206 | // Run the testcase | |
207 | testCase = new(); | |
208 | //breakpoint; | |
209 | void = testCase.start(); | |
210 | gUtil.exitBench(); | |
211 | } | |
212 | } | |
213 | ||
214 | join all // we will never actually join all in this bench. This is OK. | |
215 | ||
216 | ||
217 | } // end program |