2 * Copyright (c) 2003 The Regents of The University of Michigan
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.
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.
31 #include "arch/alpha/pseudo_inst.hh"
32 #include "cpu/exec_context.hh"
33 #include "sim/param.hh"
34 #include "sim/serialize.hh"
35 #include "sim/sim_exit.hh"
36 #include "sim/stat_control.hh"
37 #include "sim/stats.hh"
40 using namespace Statistics
;
44 bool doStatisticsInsts
;
45 bool doCheckpointInsts
;
51 xc
->kernelStats
.arm();
55 quiesce(ExecContext
*xc
)
61 xc
->kernelStats
.quiesce();
67 xc
->kernelStats
.ivlb();
76 m5exit_old(ExecContext
*xc
)
78 SimExit(curTick
, "m5_exit_old instruction encountered");
82 m5exit(ExecContext
*xc
)
84 Tick delay
= xc
->regs
.intRegFile
[16];
85 Tick when
= curTick
+ NS2Ticks(delay
);
86 SimExit(when
, "m5_exit instruction encountered");
90 resetstats(ExecContext
*xc
)
92 if (!doStatisticsInsts
)
95 Tick delay
= xc
->regs
.intRegFile
[16];
96 Tick period
= xc
->regs
.intRegFile
[17];
98 Tick when
= curTick
+ NS2Ticks(delay
);
99 Tick repeat
= NS2Ticks(period
);
101 using namespace Statistics
;
102 SetupEvent(Reset
, when
, repeat
);
106 dumpstats(ExecContext
*xc
)
108 if (!doStatisticsInsts
)
111 Tick delay
= xc
->regs
.intRegFile
[16];
112 Tick period
= xc
->regs
.intRegFile
[17];
114 Tick when
= curTick
+ NS2Ticks(delay
);
115 Tick repeat
= NS2Ticks(period
);
117 using namespace Statistics
;
118 SetupEvent(Dump
, when
, repeat
);
122 dumpresetstats(ExecContext
*xc
)
124 if (!doStatisticsInsts
)
127 Tick delay
= xc
->regs
.intRegFile
[16];
128 Tick period
= xc
->regs
.intRegFile
[17];
130 Tick when
= curTick
+ NS2Ticks(delay
);
131 Tick repeat
= NS2Ticks(period
);
133 using namespace Statistics
;
134 SetupEvent(Dump
|Reset
, when
, repeat
);
138 m5checkpoint(ExecContext
*xc
)
140 if (!doCheckpointInsts
)
143 Tick delay
= xc
->regs
.intRegFile
[16];
144 Tick period
= xc
->regs
.intRegFile
[17];
146 Tick when
= curTick
+ NS2Ticks(delay
);
147 Tick repeat
= NS2Ticks(period
);
149 Checkpoint::setup(when
, repeat
);
152 class Context
: public ParamContext
155 Context(const string
§ion
) : ParamContext(section
) {}
159 Context
context("PseudoInsts");
161 Param
<bool> __quiesce(&context
, "quiesce",
162 "enable quiesce instructions",
164 Param
<bool> __statistics(&context
, "statistics",
165 "enable statistics pseudo instructions",
167 Param
<bool> __checkpoint(&context
, "checkpoint",
168 "enable checkpoint pseudo instructions",
172 Context::checkParams()
174 doQuiesce
= __quiesce
;
175 doStatisticsInsts
= __statistics
;
176 doCheckpointInsts
= __checkpoint
;