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/sim_stats.hh"
40 using namespace Statistics
;
44 bool doStatisticsInsts
;
45 bool doCheckpointInsts
;
49 quiesce(ExecContext
*xc
)
54 Annotate::QUIESCE(xc
);
56 xc
->kernelStats
.quiesce();
60 m5exit_old(ExecContext
*xc
)
62 SimExit(curTick
, "m5_exit_old instruction encountered");
66 m5exit(ExecContext
*xc
)
68 Tick delay
= xc
->regs
.intRegFile
[16];
69 Tick when
= curTick
+ NS2Ticks(delay
);
70 SimExit(when
, "m5_exit instruction encountered");
74 resetstats(ExecContext
*xc
)
76 if (!doStatisticsInsts
)
79 Tick delay
= xc
->regs
.intRegFile
[16];
80 Tick period
= xc
->regs
.intRegFile
[17];
82 Tick when
= curTick
+ NS2Ticks(delay
);
83 Tick repeat
= NS2Ticks(period
);
85 SetupEvent(Reset
, when
, repeat
);
89 dumpstats(ExecContext
*xc
)
91 if (!doStatisticsInsts
)
94 Tick delay
= xc
->regs
.intRegFile
[16];
95 Tick period
= xc
->regs
.intRegFile
[17];
97 Tick when
= curTick
+ NS2Ticks(delay
);
98 Tick repeat
= NS2Ticks(period
);
100 SetupEvent(Dump
, when
, repeat
);
104 dumpresetstats(ExecContext
*xc
)
106 if (!doStatisticsInsts
)
109 Tick delay
= xc
->regs
.intRegFile
[16];
110 Tick period
= xc
->regs
.intRegFile
[17];
112 Tick when
= curTick
+ NS2Ticks(delay
);
113 Tick repeat
= NS2Ticks(period
);
115 SetupEvent(Dump
|Reset
, when
, repeat
);
119 m5checkpoint(ExecContext
*xc
)
121 if (!doCheckpointInsts
)
124 Tick delay
= xc
->regs
.intRegFile
[16];
125 Tick period
= xc
->regs
.intRegFile
[17];
127 Tick when
= curTick
+ NS2Ticks(delay
);
128 Tick repeat
= NS2Ticks(period
);
130 Checkpoint::setup(when
, repeat
);
133 class Context
: public ParamContext
136 Context(const string
§ion
) : ParamContext(section
) {}
140 Context
context("PseudoInsts");
142 Param
<bool> __quiesce(&context
, "quiesce",
143 "enable quiesce instructions",
145 Param
<bool> __statistics(&context
, "statistics",
146 "enable statistics pseudo instructions",
148 Param
<bool> __checkpoint(&context
, "checkpoint",
149 "enable checkpoint pseudo instructions",
153 Context::checkParams()
155 doQuiesce
= __quiesce
;
156 doStatisticsInsts
= __statistics
;
157 doCheckpointInsts
= __checkpoint
;