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/annotation.hh"
34 #include "sim/param.hh"
35 #include "sim/serialize.hh"
36 #include "sim/sim_exit.hh"
37 #include "sim/stat_control.hh"
38 #include "sim/stats.hh"
41 using namespace Statistics
;
45 bool doStatisticsInsts
;
46 bool doCheckpointInsts
;
50 quiesce(ExecContext
*xc
)
55 Annotate::QUIESCE(xc
);
57 xc
->kernelStats
.quiesce();
61 m5exit_old(ExecContext
*xc
)
63 SimExit(curTick
, "m5_exit_old instruction encountered");
67 m5exit(ExecContext
*xc
)
69 Tick delay
= xc
->regs
.intRegFile
[16];
70 Tick when
= curTick
+ NS2Ticks(delay
);
71 SimExit(when
, "m5_exit instruction encountered");
75 resetstats(ExecContext
*xc
)
77 if (!doStatisticsInsts
)
80 Tick delay
= xc
->regs
.intRegFile
[16];
81 Tick period
= xc
->regs
.intRegFile
[17];
83 Tick when
= curTick
+ NS2Ticks(delay
);
84 Tick repeat
= NS2Ticks(period
);
86 using namespace Statistics
;
87 SetupEvent(Reset
, when
, repeat
);
91 dumpstats(ExecContext
*xc
)
93 if (!doStatisticsInsts
)
96 Tick delay
= xc
->regs
.intRegFile
[16];
97 Tick period
= xc
->regs
.intRegFile
[17];
99 Tick when
= curTick
+ NS2Ticks(delay
);
100 Tick repeat
= NS2Ticks(period
);
102 using namespace Statistics
;
103 SetupEvent(Dump
, when
, repeat
);
107 dumpresetstats(ExecContext
*xc
)
109 if (!doStatisticsInsts
)
112 Tick delay
= xc
->regs
.intRegFile
[16];
113 Tick period
= xc
->regs
.intRegFile
[17];
115 Tick when
= curTick
+ NS2Ticks(delay
);
116 Tick repeat
= NS2Ticks(period
);
118 using namespace Statistics
;
119 SetupEvent(Dump
|Reset
, when
, repeat
);
123 m5checkpoint(ExecContext
*xc
)
125 if (!doCheckpointInsts
)
128 Tick delay
= xc
->regs
.intRegFile
[16];
129 Tick period
= xc
->regs
.intRegFile
[17];
131 Tick when
= curTick
+ NS2Ticks(delay
);
132 Tick repeat
= NS2Ticks(period
);
134 Checkpoint::setup(when
, repeat
);
137 class Context
: public ParamContext
140 Context(const string
§ion
) : ParamContext(section
) {}
144 Context
context("PseudoInsts");
146 Param
<bool> __quiesce(&context
, "quiesce",
147 "enable quiesce instructions",
149 Param
<bool> __statistics(&context
, "statistics",
150 "enable statistics pseudo instructions",
152 Param
<bool> __checkpoint(&context
, "checkpoint",
153 "enable checkpoint pseudo instructions",
157 Context::checkParams()
159 doQuiesce
= __quiesce
;
160 doStatisticsInsts
= __statistics
;
161 doCheckpointInsts
= __checkpoint
;