2 * Copyright (c) 2007 MIPS Technologies, Inc.
3 * Copyright (c) 2001-2005 The Regents of The University of Michigan
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer;
10 * redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution;
13 * neither the name of the copyright holders nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 * Authors: Korey Sewell
32 #ifndef __CPU_INORDER_INORDER_TRACE_HH__
33 #define __CPU_INORDER_INORDER_TRACE_HH__
35 #include "base/trace.hh"
36 #include "base/types.hh"
37 #include "cpu/exetrace.hh"
38 #include "cpu/static_inst.hh"
39 #include "params/InOrderTrace.hh"
40 #include "sim/insttracer.hh"
46 class InOrderTraceRecord : public ExeTracerRecord
49 InOrderTraceRecord(unsigned num_stages, bool _stage_tracing,
50 ThreadContext *_thread, TheISA::PCState _pc, bool spec = false)
51 : ExeTracerRecord(0, _thread, NULL, _pc, spec)
53 stageTrace = _stage_tracing;
54 stageCycle.resize(num_stages);
57 // Trace stage-by-stage execution of instructions.
59 std::vector<Tick> stageCycle;
61 void dumpTicks(std::ostream &outs);
64 setStageCycle(int num_stage, Tick cur_cycle)
67 stageCycle[num_stage] = cur_cycle;
74 setStaticInst(const StaticInstPtr &_staticInst)
76 staticInst = _staticInst;
79 void setPC(TheISA::PCState _pc) { pc = _pc; }
82 class InOrderTrace : public InstTracer
85 InOrderTrace(const InOrderTraceParams *p) : InstTracer(p)
89 getInstRecord(unsigned num_stages, bool stage_tracing, ThreadContext *tc);
91 InOrderTraceRecord *getInstRecord(Tick when, ThreadContext *tc,
92 const StaticInstPtr staticInst, TheISA::PCState pc,
93 const StaticInstPtr macroStaticInst = NULL);
98 #endif // __CPU_INORDER_INORDER_TRACE_HH__