exetrace.hh revision 8232
12SN/A/*
21762SN/A * Copyright (c) 2001-2005 The Regents of The University of Michigan
32SN/A * All rights reserved.
42SN/A *
52SN/A * Redistribution and use in source and binary forms, with or without
62SN/A * modification, are permitted provided that the following conditions are
72SN/A * met: redistributions of source code must retain the above copyright
82SN/A * notice, this list of conditions and the following disclaimer;
92SN/A * redistributions in binary form must reproduce the above copyright
102SN/A * notice, this list of conditions and the following disclaimer in the
112SN/A * documentation and/or other materials provided with the distribution;
122SN/A * neither the name of the copyright holders nor the names of its
132SN/A * contributors may be used to endorse or promote products derived from
142SN/A * this software without specific prior written permission.
152SN/A *
162SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Steve Reinhardt
292665Ssaidi@eecs.umich.edu *          Nathan Binkert
302SN/A */
312SN/A
326216Snate@binkert.org#ifndef __CPU_EXETRACE_HH__
336216Snate@binkert.org#define __CPU_EXETRACE_HH__
342SN/A
354046Sbinkertn@umich.edu#include "base/trace.hh"
366216Snate@binkert.org#include "base/types.hh"
374046Sbinkertn@umich.edu#include "cpu/static_inst.hh"
387680Sgblack@eecs.umich.edu#include "cpu/thread_context.hh"
398232Snate@binkert.org#include "debug/ExecEnable.hh"
408232Snate@binkert.org#include "debug/ExecSpeculative.hh"
416216Snate@binkert.org#include "params/ExeTracer.hh"
424776Sgblack@eecs.umich.edu#include "sim/insttracer.hh"
432SN/A
443064Sgblack@eecs.umich.educlass ThreadContext;
452SN/A
462SN/Anamespace Trace {
472SN/A
484776Sgblack@eecs.umich.educlass ExeTracerRecord : public InstRecord
492SN/A{
502SN/A  public:
514776Sgblack@eecs.umich.edu    ExeTracerRecord(Tick _when, ThreadContext *_thread,
527720Sgblack@eecs.umich.edu               const StaticInstPtr _staticInst, TheISA::PCState _pc,
537720Sgblack@eecs.umich.edu               bool spec, const StaticInstPtr _macroStaticInst = NULL)
545784Sgblack@eecs.umich.edu        : InstRecord(_when, _thread, _staticInst, _pc, spec,
557720Sgblack@eecs.umich.edu                _macroStaticInst)
562SN/A    {
572SN/A    }
582SN/A
595784Sgblack@eecs.umich.edu    void traceInst(StaticInstPtr inst, bool ran);
605784Sgblack@eecs.umich.edu
614046Sbinkertn@umich.edu    void dump();
625866Sksewell@umich.edu    virtual void dumpTicks(std::ostream &outs);
632SN/A};
642SN/A
654776Sgblack@eecs.umich.educlass ExeTracer : public InstTracer
664776Sgblack@eecs.umich.edu{
674776Sgblack@eecs.umich.edu  public:
685034Smilesck@eecs.umich.edu    typedef ExeTracerParams Params;
695034Smilesck@eecs.umich.edu    ExeTracer(const Params *params) : InstTracer(params)
704776Sgblack@eecs.umich.edu    {}
712SN/A
724776Sgblack@eecs.umich.edu    InstRecord *
734776Sgblack@eecs.umich.edu    getInstRecord(Tick when, ThreadContext *tc,
747720Sgblack@eecs.umich.edu            const StaticInstPtr staticInst, TheISA::PCState pc,
757720Sgblack@eecs.umich.edu            const StaticInstPtr macroStaticInst = NULL)
764776Sgblack@eecs.umich.edu    {
778232Snate@binkert.org        if (!Debug::ExecEnable)
784776Sgblack@eecs.umich.edu            return NULL;
792SN/A
804776Sgblack@eecs.umich.edu        if (!Trace::enabled)
814776Sgblack@eecs.umich.edu            return NULL;
822SN/A
838232Snate@binkert.org        if (!Debug::ExecSpeculative && tc->misspeculating())
844776Sgblack@eecs.umich.edu            return NULL;
854074Sbinkertn@umich.edu
864776Sgblack@eecs.umich.edu        return new ExeTracerRecord(when, tc,
877720Sgblack@eecs.umich.edu                staticInst, pc, tc->misspeculating(), macroStaticInst);
884776Sgblack@eecs.umich.edu    }
894776Sgblack@eecs.umich.edu};
902SN/A
917811Ssteve.reinhardt@amd.com} // namespace Trace
922SN/A
936216Snate@binkert.org#endif // __CPU_EXETRACE_HH__
94