Add CoherenceProtocol object to objects list.
[gem5.git] / src / cpu / ozone / checker_builder.cc
1 /*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Kevin Lim
29 */
30
31 #include <string>
32
33 #include "cpu/checker/cpu_impl.hh"
34 #include "cpu/inst_seq.hh"
35 #include "cpu/ozone/dyn_inst.hh"
36 #include "cpu/ozone/ozone_impl.hh"
37 #include "sim/builder.hh"
38 #include "sim/process.hh"
39 #include "sim/sim_object.hh"
40
41 class MemObject;
42
43 template
44 class Checker<RefCountingPtr<OzoneDynInst<OzoneImpl> > >;
45
46 /**
47 * Specific non-templated derived class used for SimObject configuration.
48 */
49 class OzoneChecker :
50 public Checker<RefCountingPtr<OzoneDynInst<OzoneImpl> > >
51 {
52 public:
53 OzoneChecker(Params *p)
54 : Checker<RefCountingPtr<OzoneDynInst<OzoneImpl> > >(p)
55 { }
56 };
57
58 ////////////////////////////////////////////////////////////////////////
59 //
60 // CheckerCPU Simulation Object
61 //
62 BEGIN_DECLARE_SIM_OBJECT_PARAMS(OzoneChecker)
63
64 Param<Counter> max_insts_any_thread;
65 Param<Counter> max_insts_all_threads;
66 Param<Counter> max_loads_any_thread;
67 Param<Counter> max_loads_all_threads;
68
69 #if FULL_SYSTEM
70 SimObjectParam<AlphaITB *> itb;
71 SimObjectParam<AlphaDTB *> dtb;
72 SimObjectParam<System *> system;
73 Param<int> cpu_id;
74 Param<Tick> profile;
75 #else
76 SimObjectParam<Process *> workload;
77 #endif // FULL_SYSTEM
78 Param<int> clock;
79
80 Param<bool> defer_registration;
81 Param<bool> exitOnError;
82 Param<bool> warnOnlyOnLoadError;
83 Param<bool> function_trace;
84 Param<Tick> function_trace_start;
85
86 END_DECLARE_SIM_OBJECT_PARAMS(OzoneChecker)
87
88 BEGIN_INIT_SIM_OBJECT_PARAMS(OzoneChecker)
89
90 INIT_PARAM(max_insts_any_thread,
91 "terminate when any thread reaches this inst count"),
92 INIT_PARAM(max_insts_all_threads,
93 "terminate when all threads have reached this inst count"),
94 INIT_PARAM(max_loads_any_thread,
95 "terminate when any thread reaches this load count"),
96 INIT_PARAM(max_loads_all_threads,
97 "terminate when all threads have reached this load count"),
98
99 #if FULL_SYSTEM
100 INIT_PARAM(itb, "Instruction TLB"),
101 INIT_PARAM(dtb, "Data TLB"),
102 INIT_PARAM(system, "system object"),
103 INIT_PARAM(cpu_id, "processor ID"),
104 INIT_PARAM(profile, ""),
105 #else
106 INIT_PARAM(workload, "processes to run"),
107 #endif // FULL_SYSTEM
108
109 INIT_PARAM(clock, "clock speed"),
110
111 INIT_PARAM(defer_registration, "defer system registration (for sampling)"),
112 INIT_PARAM(exitOnError, "exit on error"),
113 INIT_PARAM_DFLT(warnOnlyOnLoadError, "warn, but don't exit, if a load "
114 "result errors", false),
115 INIT_PARAM(function_trace, "Enable function trace"),
116 INIT_PARAM(function_trace_start, "Cycle to start function trace")
117
118 END_INIT_SIM_OBJECT_PARAMS(OzoneChecker)
119
120
121 CREATE_SIM_OBJECT(OzoneChecker)
122 {
123 OzoneChecker::Params *params = new OzoneChecker::Params();
124 params->name = getInstanceName();
125 params->numberOfThreads = 1;
126 params->max_insts_any_thread = 0;
127 params->max_insts_all_threads = 0;
128 params->max_loads_any_thread = 0;
129 params->max_loads_all_threads = 0;
130 params->exitOnError = exitOnError;
131 params->warnOnlyOnLoadError = warnOnlyOnLoadError;
132 params->deferRegistration = defer_registration;
133 params->functionTrace = function_trace;
134 params->functionTraceStart = function_trace_start;
135 params->clock = clock;
136 // Hack to touch all parameters. Consider not deriving Checker
137 // from BaseCPU..it's not really a CPU in the end.
138 Counter temp;
139 temp = max_insts_any_thread;
140 temp = max_insts_all_threads;
141 temp = max_loads_any_thread;
142 temp = max_loads_all_threads;
143
144 #if FULL_SYSTEM
145 params->itb = itb;
146 params->dtb = dtb;
147 params->system = system;
148 params->cpu_id = cpu_id;
149 params->profile = profile;
150 #else
151 params->process = workload;
152 #endif
153
154 OzoneChecker *cpu = new OzoneChecker(params);
155 return cpu;
156 }
157
158 REGISTER_SIM_OBJECT("OzoneChecker", OzoneChecker)