2005-02-26 00:00:49 +01:00
|
|
|
/*
|
2006-08-02 18:05:34 +02:00
|
|
|
* Copyright (c) 2006 The Regents of The University of Michigan
|
2005-02-26 00:00:49 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met: redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer;
|
|
|
|
* redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution;
|
|
|
|
* neither the name of the copyright holders nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2006-06-01 01:26:56 +02:00
|
|
|
*
|
|
|
|
* Authors: Kevin Lim
|
2005-02-26 00:00:49 +01:00
|
|
|
*/
|
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
#ifndef __CPU_OZONE_CPU_HH__
|
|
|
|
#define __CPU_OZONE_CPU_HH__
|
|
|
|
|
|
|
|
#include <set>
|
2005-02-26 00:00:49 +01:00
|
|
|
|
|
|
|
#include "base/statistics.hh"
|
2005-08-30 19:18:54 +02:00
|
|
|
#include "config/full_system.hh"
|
2009-09-23 17:34:21 +02:00
|
|
|
#include "config/the_isa.hh"
|
2006-04-23 00:45:01 +02:00
|
|
|
#include "cpu/ozone/rename_table.hh"
|
|
|
|
#include "cpu/ozone/thread_state.hh"
|
2011-04-15 19:44:06 +02:00
|
|
|
#include "cpu/base.hh"
|
|
|
|
#include "cpu/inst_seq.hh"
|
2005-02-26 00:00:49 +01:00
|
|
|
#include "cpu/pc_event.hh"
|
|
|
|
#include "cpu/static_inst.hh"
|
2011-04-15 19:44:06 +02:00
|
|
|
#include "cpu/thread_context.hh"
|
|
|
|
#include "cpu/timebuf.hh"
|
2006-06-23 05:33:26 +02:00
|
|
|
#include "mem/page_table.hh"
|
2005-02-26 00:00:49 +01:00
|
|
|
#include "sim/eventq.hh"
|
|
|
|
|
|
|
|
// forward declarations
|
2005-08-30 19:18:54 +02:00
|
|
|
#if FULL_SYSTEM
|
2006-04-23 00:45:01 +02:00
|
|
|
#include "arch/alpha/tlb.hh"
|
|
|
|
|
2006-11-01 22:44:45 +01:00
|
|
|
namespace TheISA
|
|
|
|
{
|
2009-04-09 07:21:27 +02:00
|
|
|
class TLB;
|
2006-11-01 22:44:45 +01:00
|
|
|
}
|
2005-02-26 00:00:49 +01:00
|
|
|
class PhysicalMemory;
|
2006-04-23 00:45:01 +02:00
|
|
|
class MemoryController;
|
2005-02-26 00:00:49 +01:00
|
|
|
|
2006-11-07 11:36:54 +01:00
|
|
|
namespace TheISA {
|
|
|
|
namespace Kernel {
|
|
|
|
class Statistics;
|
|
|
|
};
|
2006-05-23 22:51:16 +02:00
|
|
|
};
|
|
|
|
|
2005-02-26 00:00:49 +01:00
|
|
|
#else
|
|
|
|
|
|
|
|
class Process;
|
|
|
|
|
|
|
|
#endif // FULL_SYSTEM
|
|
|
|
|
|
|
|
class Checkpoint;
|
2006-05-16 20:09:04 +02:00
|
|
|
class EndQuiesceEvent;
|
2006-06-23 05:33:26 +02:00
|
|
|
class MemObject;
|
2006-06-03 00:15:20 +02:00
|
|
|
class Request;
|
2005-02-26 00:00:49 +01:00
|
|
|
|
|
|
|
namespace Trace {
|
|
|
|
class InstRecord;
|
|
|
|
}
|
|
|
|
|
Fixes for ozone CPU to successfully boot and run linux.
cpu/base_dyn_inst.hh:
Remove snoop function (did not mean to commit it).
cpu/ozone/back_end_impl.hh:
Set instruction as having its result ready, not completed.
cpu/ozone/cpu.hh:
Fixes for store conditionals. Use an additional lock addr list to make sure that the access is valid. I don't know if this is fully necessary, but it gives me a peace of mind (at some performance cost).
Make sure to schedule for cycles(1) and not just 1 cycle in the future as tick = 1ps.
Also support the new Checker.
cpu/ozone/cpu_builder.cc:
Add parameter for maxOutstandingMemOps so it can be set through the config.
Also add in the checker. Right now it's a BaseCPU simobject, but that may change in the future.
cpu/ozone/cpu_impl.hh:
Add support for the checker. For now there's a dynamic cast to convert the simobject passed back from the builder to the proper Checker type. It's ugly, but only happens at startup, and is probably a justified use of dynamic cast.
Support switching out/taking over from other CPUs.
Correct indexing problem for float registers.
cpu/ozone/dyn_inst.hh:
Add ability for instructions to wait on memory instructions in addition to source register instructions. This is needed for memory dependence predictors and memory barriers.
cpu/ozone/dyn_inst_impl.hh:
Support waiting on memory operations.
Use "resultReady" to differentiate an instruction having its registers produced vs being totally completed.
cpu/ozone/front_end.hh:
Support switching out.
Also record if an interrupt is pending.
cpu/ozone/front_end_impl.hh:
Support switching out. Also support stalling the front end if an interrupt is pending.
cpu/ozone/lw_back_end.hh:
Add checker in.
Support switching out.
Support memory barriers.
cpu/ozone/lw_back_end_impl.hh:
Lots of changes to get things to work right.
Faults, traps, interrupts all wait until all stores have written back (important).
Memory barriers are supported, as is the general ability for instructions to be dependent on other memory instructions.
cpu/ozone/lw_lsq.hh:
Support switching out.
Also use store writeback events in all cases, not just dcache misses.
cpu/ozone/lw_lsq_impl.hh:
Support switching out.
Also use store writeback events in all cases, not just dcache misses.
Support the checker CPU. Marks instructions as completed once the functional access is done (which has to be done for the checker to be able to verify results).
cpu/ozone/simple_params.hh:
Add max outstanding mem ops parameter.
python/m5/objects/OzoneCPU.py:
Add max outstanding mem ops, checker.
--HG--
extra : convert_revision : f4d408e1bb1f25836a097b6abe3856111e950c59
2006-05-12 01:18:36 +02:00
|
|
|
template <class>
|
|
|
|
class Checker;
|
|
|
|
|
2005-02-26 00:00:49 +01:00
|
|
|
/**
|
2006-08-02 18:05:34 +02:00
|
|
|
* Light weight out of order CPU model that approximates an out of
|
|
|
|
* order CPU. It is separated into a front end and a back end, with
|
|
|
|
* the template parameter Impl describing the classes used for each.
|
|
|
|
* The goal is to be able to specify through the Impl the class to use
|
|
|
|
* for the front end and back end, with different classes used to
|
|
|
|
* model different levels of detail.
|
2005-02-26 00:00:49 +01:00
|
|
|
*/
|
|
|
|
template <class Impl>
|
2006-04-23 00:45:01 +02:00
|
|
|
class OzoneCPU : public BaseCPU
|
2005-02-26 00:00:49 +01:00
|
|
|
{
|
|
|
|
private:
|
2006-04-23 00:45:01 +02:00
|
|
|
typedef typename Impl::FrontEnd FrontEnd;
|
|
|
|
typedef typename Impl::BackEnd BackEnd;
|
|
|
|
typedef typename Impl::DynInst DynInst;
|
2005-02-26 00:00:49 +01:00
|
|
|
typedef typename Impl::DynInstPtr DynInstPtr;
|
|
|
|
|
2006-06-03 00:15:20 +02:00
|
|
|
typedef TheISA::FloatReg FloatReg;
|
|
|
|
typedef TheISA::FloatRegBits FloatRegBits;
|
2006-04-23 00:45:01 +02:00
|
|
|
typedef TheISA::MiscReg MiscReg;
|
|
|
|
|
|
|
|
public:
|
2006-06-06 23:32:21 +02:00
|
|
|
class OzoneTC : public ThreadContext {
|
2006-04-23 00:45:01 +02:00
|
|
|
public:
|
|
|
|
OzoneCPU<Impl> *cpu;
|
|
|
|
|
|
|
|
OzoneThreadState<Impl> *thread;
|
|
|
|
|
|
|
|
BaseCPU *getCpuPtr();
|
|
|
|
|
2009-04-09 07:21:27 +02:00
|
|
|
TheISA::TLB *getITBPtr() { return cpu->itb; }
|
2007-08-27 05:24:18 +02:00
|
|
|
|
2009-04-09 07:21:27 +02:00
|
|
|
TheISA::TLB * getDTBPtr() { return cpu->dtb; }
|
2007-08-27 05:24:18 +02:00
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
#if FULL_SYSTEM
|
|
|
|
System *getSystemPtr() { return cpu->system; }
|
|
|
|
|
|
|
|
PhysicalMemory *getPhysMemPtr() { return cpu->physmem; }
|
|
|
|
|
2006-11-07 11:36:54 +01:00
|
|
|
TheISA::Kernel::Statistics *getKernelStats()
|
2006-06-23 05:33:26 +02:00
|
|
|
{ return thread->getKernelStats(); }
|
2006-06-08 22:58:50 +02:00
|
|
|
|
|
|
|
FunctionalPort *getPhysPort() { return thread->getPhysPort(); }
|
|
|
|
|
2008-07-01 16:25:07 +02:00
|
|
|
VirtualPort *getVirtPort()
|
|
|
|
{ return thread->getVirtPort(); }
|
2006-04-23 00:45:01 +02:00
|
|
|
#else
|
2006-06-23 05:33:26 +02:00
|
|
|
TranslatingPort *getMemPort() { return thread->getMemPort(); }
|
2006-06-08 22:58:50 +02:00
|
|
|
|
2006-06-23 05:33:26 +02:00
|
|
|
Process *getProcessPtr() { return thread->getProcessPtr(); }
|
2006-04-23 00:45:01 +02:00
|
|
|
#endif
|
|
|
|
|
2006-06-23 05:33:26 +02:00
|
|
|
Status status() const { return thread->status(); }
|
2006-04-23 00:45:01 +02:00
|
|
|
|
|
|
|
void setStatus(Status new_status);
|
|
|
|
|
|
|
|
/// Set the status to Active. Optional delay indicates number of
|
|
|
|
/// cycles to wait before beginning execution.
|
|
|
|
void activate(int delay = 1);
|
|
|
|
|
|
|
|
/// Set the status to Suspended.
|
|
|
|
void suspend();
|
|
|
|
|
|
|
|
/// Set the status to Halted.
|
|
|
|
void halt();
|
|
|
|
|
|
|
|
#if FULL_SYSTEM
|
|
|
|
void dumpFuncProfile();
|
|
|
|
#endif
|
|
|
|
|
2006-06-06 23:32:21 +02:00
|
|
|
void takeOverFrom(ThreadContext *old_context);
|
2006-04-23 00:45:01 +02:00
|
|
|
|
|
|
|
void regStats(const std::string &name);
|
|
|
|
|
|
|
|
void serialize(std::ostream &os);
|
|
|
|
void unserialize(Checkpoint *cp, const std::string §ion);
|
|
|
|
|
|
|
|
#if FULL_SYSTEM
|
2006-05-16 20:09:04 +02:00
|
|
|
EndQuiesceEvent *getQuiesceEvent();
|
2006-04-23 00:45:01 +02:00
|
|
|
|
|
|
|
Tick readLastActivate();
|
|
|
|
Tick readLastSuspend();
|
|
|
|
|
|
|
|
void profileClear();
|
|
|
|
void profileSample();
|
|
|
|
#endif
|
|
|
|
|
2008-11-04 17:35:42 +01:00
|
|
|
int threadId();
|
2006-04-23 00:45:01 +02:00
|
|
|
|
2006-06-06 23:32:21 +02:00
|
|
|
void copyArchRegs(ThreadContext *tc);
|
2006-04-23 00:45:01 +02:00
|
|
|
|
|
|
|
void clearArchRegs();
|
|
|
|
|
|
|
|
uint64_t readIntReg(int reg_idx);
|
|
|
|
|
2006-06-03 00:15:20 +02:00
|
|
|
FloatReg readFloatReg(int reg_idx);
|
2006-04-23 00:45:01 +02:00
|
|
|
|
2006-06-03 00:15:20 +02:00
|
|
|
FloatRegBits readFloatRegBits(int reg_idx);
|
2006-04-23 00:45:01 +02:00
|
|
|
|
|
|
|
void setIntReg(int reg_idx, uint64_t val);
|
|
|
|
|
2006-06-03 00:15:20 +02:00
|
|
|
void setFloatReg(int reg_idx, FloatReg val);
|
2006-04-23 00:45:01 +02:00
|
|
|
|
2006-06-03 00:15:20 +02:00
|
|
|
void setFloatRegBits(int reg_idx, FloatRegBits val);
|
2006-04-23 00:45:01 +02:00
|
|
|
|
|
|
|
uint64_t readPC() { return thread->PC; }
|
|
|
|
void setPC(Addr val);
|
|
|
|
|
|
|
|
uint64_t readNextPC() { return thread->nextPC; }
|
|
|
|
void setNextPC(Addr val);
|
|
|
|
|
2006-06-03 00:15:20 +02:00
|
|
|
uint64_t readNextNPC()
|
|
|
|
{
|
2006-12-28 20:27:45 +01:00
|
|
|
#if ISA_HAS_DELAY_SLOT
|
|
|
|
panic("Ozone needs to support nextNPC");
|
|
|
|
#else
|
|
|
|
return thread->nextPC + sizeof(TheISA::MachInst);
|
|
|
|
#endif
|
2006-06-03 00:15:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void setNextNPC(uint64_t val)
|
2006-12-28 20:27:45 +01:00
|
|
|
{
|
|
|
|
#if ISA_HAS_DELAY_SLOT
|
|
|
|
panic("Ozone needs to support nextNPC");
|
|
|
|
#endif
|
|
|
|
}
|
2006-06-03 00:15:20 +02:00
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
public:
|
|
|
|
// ISA stuff:
|
2007-03-07 21:04:31 +01:00
|
|
|
MiscReg readMiscRegNoEffect(int misc_reg);
|
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
MiscReg readMiscReg(int misc_reg);
|
|
|
|
|
2007-03-07 21:04:31 +01:00
|
|
|
void setMiscRegNoEffect(int misc_reg, const MiscReg &val);
|
2006-04-23 00:45:01 +02:00
|
|
|
|
2006-11-01 22:44:45 +01:00
|
|
|
void setMiscReg(int misc_reg, const MiscReg &val);
|
2006-04-23 00:45:01 +02:00
|
|
|
|
|
|
|
unsigned readStCondFailures()
|
|
|
|
{ return thread->storeCondFailures; }
|
|
|
|
|
|
|
|
void setStCondFailures(unsigned sc_failures)
|
|
|
|
{ thread->storeCondFailures = sc_failures; }
|
|
|
|
|
|
|
|
bool misspeculating() { return false; }
|
|
|
|
|
|
|
|
#if !FULL_SYSTEM
|
|
|
|
Counter readFuncExeInst() { return thread->funcExeInst; }
|
|
|
|
|
|
|
|
void setFuncExeInst(Counter new_val)
|
|
|
|
{ thread->funcExeInst = new_val; }
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2006-06-06 23:32:21 +02:00
|
|
|
// Ozone specific thread context
|
|
|
|
OzoneTC ozoneTC;
|
|
|
|
// Thread context to be used
|
|
|
|
ThreadContext *tc;
|
|
|
|
// Checker thread context; will wrap the OzoneTC if a checker is
|
|
|
|
// being used.
|
|
|
|
ThreadContext *checkerTC;
|
2006-04-23 00:45:01 +02:00
|
|
|
|
|
|
|
typedef OzoneThreadState<Impl> ImplState;
|
|
|
|
|
|
|
|
private:
|
2006-08-02 18:05:34 +02:00
|
|
|
// Committed thread state for the OzoneCPU.
|
2006-04-23 00:45:01 +02:00
|
|
|
OzoneThreadState<Impl> thread;
|
2006-05-23 22:51:16 +02:00
|
|
|
|
2005-02-26 00:00:49 +01:00
|
|
|
public:
|
|
|
|
// main simulation loop (one cycle)
|
|
|
|
void tick();
|
|
|
|
|
2008-11-10 20:51:18 +01:00
|
|
|
#ifndef NDEBUG
|
|
|
|
/** Count of total number of dynamic instructions in flight. */
|
|
|
|
int instcount;
|
|
|
|
#endif
|
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
std::set<InstSeqNum> snList;
|
Fixes for ozone CPU to successfully boot and run linux.
cpu/base_dyn_inst.hh:
Remove snoop function (did not mean to commit it).
cpu/ozone/back_end_impl.hh:
Set instruction as having its result ready, not completed.
cpu/ozone/cpu.hh:
Fixes for store conditionals. Use an additional lock addr list to make sure that the access is valid. I don't know if this is fully necessary, but it gives me a peace of mind (at some performance cost).
Make sure to schedule for cycles(1) and not just 1 cycle in the future as tick = 1ps.
Also support the new Checker.
cpu/ozone/cpu_builder.cc:
Add parameter for maxOutstandingMemOps so it can be set through the config.
Also add in the checker. Right now it's a BaseCPU simobject, but that may change in the future.
cpu/ozone/cpu_impl.hh:
Add support for the checker. For now there's a dynamic cast to convert the simobject passed back from the builder to the proper Checker type. It's ugly, but only happens at startup, and is probably a justified use of dynamic cast.
Support switching out/taking over from other CPUs.
Correct indexing problem for float registers.
cpu/ozone/dyn_inst.hh:
Add ability for instructions to wait on memory instructions in addition to source register instructions. This is needed for memory dependence predictors and memory barriers.
cpu/ozone/dyn_inst_impl.hh:
Support waiting on memory operations.
Use "resultReady" to differentiate an instruction having its registers produced vs being totally completed.
cpu/ozone/front_end.hh:
Support switching out.
Also record if an interrupt is pending.
cpu/ozone/front_end_impl.hh:
Support switching out. Also support stalling the front end if an interrupt is pending.
cpu/ozone/lw_back_end.hh:
Add checker in.
Support switching out.
Support memory barriers.
cpu/ozone/lw_back_end_impl.hh:
Lots of changes to get things to work right.
Faults, traps, interrupts all wait until all stores have written back (important).
Memory barriers are supported, as is the general ability for instructions to be dependent on other memory instructions.
cpu/ozone/lw_lsq.hh:
Support switching out.
Also use store writeback events in all cases, not just dcache misses.
cpu/ozone/lw_lsq_impl.hh:
Support switching out.
Also use store writeback events in all cases, not just dcache misses.
Support the checker CPU. Marks instructions as completed once the functional access is done (which has to be done for the checker to be able to verify results).
cpu/ozone/simple_params.hh:
Add max outstanding mem ops parameter.
python/m5/objects/OzoneCPU.py:
Add max outstanding mem ops, checker.
--HG--
extra : convert_revision : f4d408e1bb1f25836a097b6abe3856111e950c59
2006-05-12 01:18:36 +02:00
|
|
|
std::set<Addr> lockAddrList;
|
2005-02-26 00:00:49 +01:00
|
|
|
private:
|
|
|
|
struct TickEvent : public Event
|
|
|
|
{
|
2006-04-23 00:45:01 +02:00
|
|
|
OzoneCPU *cpu;
|
2005-02-26 00:00:49 +01:00
|
|
|
int width;
|
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
TickEvent(OzoneCPU *c, int w);
|
2005-02-26 00:00:49 +01:00
|
|
|
void process();
|
2008-02-06 22:32:40 +01:00
|
|
|
const char *description() const;
|
2005-02-26 00:00:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
TickEvent tickEvent;
|
|
|
|
|
|
|
|
/// Schedule tick event, regardless of its current state.
|
|
|
|
void scheduleTickEvent(int delay)
|
|
|
|
{
|
|
|
|
if (tickEvent.squashed())
|
2011-01-08 06:50:29 +01:00
|
|
|
tickEvent.reschedule(curTick() + ticks(delay));
|
2005-02-26 00:00:49 +01:00
|
|
|
else if (!tickEvent.scheduled())
|
2011-01-08 06:50:29 +01:00
|
|
|
tickEvent.schedule(curTick() + ticks(delay));
|
2005-02-26 00:00:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Unschedule tick event, regardless of its current state.
|
|
|
|
void unscheduleTickEvent()
|
|
|
|
{
|
|
|
|
if (tickEvent.scheduled())
|
|
|
|
tickEvent.squash();
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum Status {
|
|
|
|
Running,
|
|
|
|
Idle,
|
|
|
|
SwitchedOut
|
|
|
|
};
|
|
|
|
|
|
|
|
Status _status;
|
|
|
|
|
|
|
|
public:
|
2009-01-24 16:27:21 +01:00
|
|
|
void wakeup();
|
2005-02-26 00:00:49 +01:00
|
|
|
|
|
|
|
void zero_fill_64(Addr addr) {
|
|
|
|
static int warned = 0;
|
|
|
|
if (!warned) {
|
|
|
|
warn ("WH64 is not implemented");
|
|
|
|
warned = 1;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
typedef typename Impl::Params Params;
|
2005-02-26 00:00:49 +01:00
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
OzoneCPU(Params *params);
|
2005-02-26 00:00:49 +01:00
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
virtual ~OzoneCPU();
|
2005-02-26 00:00:49 +01:00
|
|
|
|
2005-05-03 16:56:47 +02:00
|
|
|
void init();
|
|
|
|
|
2005-02-26 00:00:49 +01:00
|
|
|
public:
|
2006-04-23 00:45:01 +02:00
|
|
|
BaseCPU *getCpuPtr() { return this; }
|
|
|
|
|
2006-07-06 03:14:36 +02:00
|
|
|
void switchOut();
|
2006-05-16 20:09:04 +02:00
|
|
|
void signalSwitched();
|
2005-02-26 00:00:49 +01:00
|
|
|
void takeOverFrom(BaseCPU *oldCPU);
|
|
|
|
|
2006-05-16 20:09:04 +02:00
|
|
|
int switchCount;
|
|
|
|
|
2005-08-30 19:18:54 +02:00
|
|
|
#if FULL_SYSTEM
|
2005-02-26 00:00:49 +01:00
|
|
|
Addr dbg_vtophys(Addr addr);
|
|
|
|
|
|
|
|
bool interval_stats;
|
2006-04-23 00:45:01 +02:00
|
|
|
|
2009-04-09 07:21:27 +02:00
|
|
|
TheISA::TLB *itb;
|
|
|
|
TheISA::TLB *dtb;
|
2006-04-23 00:45:01 +02:00
|
|
|
System *system;
|
|
|
|
PhysicalMemory *physmem;
|
2005-02-26 00:00:49 +01:00
|
|
|
#endif
|
|
|
|
|
2006-07-08 00:24:13 +02:00
|
|
|
virtual Port *getPort(const std::string &name, int idx);
|
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
FrontEnd *frontEnd;
|
2005-05-03 16:56:47 +02:00
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
BackEnd *backEnd;
|
2006-08-02 18:05:34 +02:00
|
|
|
|
2005-05-03 16:56:47 +02:00
|
|
|
private:
|
2005-02-26 00:00:49 +01:00
|
|
|
Status status() const { return _status; }
|
2006-04-23 00:45:01 +02:00
|
|
|
void setStatus(Status new_status) { _status = new_status; }
|
|
|
|
|
2005-02-26 00:00:49 +01:00
|
|
|
virtual void activateContext(int thread_num, int delay);
|
|
|
|
virtual void suspendContext(int thread_num);
|
2006-07-10 22:31:42 +02:00
|
|
|
virtual void deallocateContext(int thread_num, int delay);
|
2005-02-26 00:00:49 +01:00
|
|
|
virtual void haltContext(int thread_num);
|
|
|
|
|
|
|
|
// statistics
|
|
|
|
virtual void regStats();
|
|
|
|
virtual void resetStats();
|
|
|
|
|
|
|
|
// number of simulated instructions
|
2006-04-23 00:45:01 +02:00
|
|
|
public:
|
2005-02-26 00:00:49 +01:00
|
|
|
Counter numInst;
|
|
|
|
Counter startNumInst;
|
|
|
|
|
|
|
|
virtual Counter totalInstructions() const
|
|
|
|
{
|
|
|
|
return numInst - startNumInst;
|
|
|
|
}
|
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
private:
|
2005-02-26 00:00:49 +01:00
|
|
|
// number of simulated loads
|
|
|
|
Counter numLoad;
|
|
|
|
Counter startNumLoad;
|
|
|
|
|
|
|
|
// number of idle cycles
|
2009-03-06 04:09:53 +01:00
|
|
|
Stats::Average notIdleFraction;
|
2005-02-26 00:00:49 +01:00
|
|
|
Stats::Formula idleFraction;
|
2005-05-03 16:56:47 +02:00
|
|
|
|
2006-08-02 18:05:34 +02:00
|
|
|
public:
|
2005-02-26 00:00:49 +01:00
|
|
|
virtual void serialize(std::ostream &os);
|
|
|
|
virtual void unserialize(Checkpoint *cp, const std::string §ion);
|
|
|
|
|
2008-02-27 05:38:51 +01:00
|
|
|
void demapPage(Addr vaddr, uint64_t asn)
|
|
|
|
{
|
2009-02-25 19:15:34 +01:00
|
|
|
cpu->itb->demap(vaddr, asn);
|
|
|
|
cpu->dtb->demap(vaddr, asn);
|
2008-02-27 05:38:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void demapInstPage(Addr vaddr, uint64_t asn)
|
|
|
|
{
|
2009-02-25 19:15:34 +01:00
|
|
|
cpu->itb->demap(vaddr, asn);
|
2008-02-27 05:38:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void demapDataPage(Addr vaddr, uint64_t asn)
|
|
|
|
{
|
2009-02-25 19:15:34 +01:00
|
|
|
cpu->dtb->demap(vaddr, asn);
|
2008-02-27 05:38:51 +01:00
|
|
|
}
|
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
/** CPU read function, forwards read to LSQ. */
|
2005-02-26 00:00:49 +01:00
|
|
|
template <class T>
|
2006-06-03 00:15:20 +02:00
|
|
|
Fault read(Request *req, T &data, int load_idx)
|
2006-04-23 00:45:01 +02:00
|
|
|
{
|
|
|
|
return backEnd->read(req, data, load_idx);
|
|
|
|
}
|
2005-02-26 00:00:49 +01:00
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
/** CPU write function, forwards write to LSQ. */
|
2005-02-26 00:00:49 +01:00
|
|
|
template <class T>
|
2006-06-03 00:15:20 +02:00
|
|
|
Fault write(Request *req, T &data, int store_idx)
|
2006-04-23 00:45:01 +02:00
|
|
|
{
|
|
|
|
return backEnd->write(req, data, store_idx);
|
|
|
|
}
|
2005-02-26 00:00:49 +01:00
|
|
|
|
|
|
|
public:
|
2006-06-06 23:32:21 +02:00
|
|
|
void squashFromTC();
|
2005-02-26 00:00:49 +01:00
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
void dumpInsts() { frontEnd->dumpInsts(); }
|
2005-02-26 00:00:49 +01:00
|
|
|
|
2005-08-30 19:18:54 +02:00
|
|
|
#if FULL_SYSTEM
|
2008-10-20 22:22:59 +02:00
|
|
|
Fault hwrei();
|
|
|
|
bool simPalCheck(int palFunc);
|
2006-04-23 01:10:39 +02:00
|
|
|
void processInterrupts();
|
2005-02-26 00:00:49 +01:00
|
|
|
#else
|
2006-06-23 05:33:26 +02:00
|
|
|
void syscall(uint64_t &callnum);
|
2005-02-26 00:00:49 +01:00
|
|
|
#endif
|
|
|
|
|
2006-06-06 23:32:21 +02:00
|
|
|
ThreadContext *tcBase() { return tc; }
|
2005-02-26 00:00:49 +01:00
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
struct CommStruct {
|
|
|
|
InstSeqNum doneSeqNum;
|
|
|
|
InstSeqNum nonSpecSeqNum;
|
|
|
|
bool uncached;
|
|
|
|
unsigned lqIdx;
|
2005-02-26 00:00:49 +01:00
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
bool stall;
|
|
|
|
};
|
2006-08-02 18:05:34 +02:00
|
|
|
|
|
|
|
InstSeqNum globalSeqNum;
|
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
TimeBuffer<CommStruct> comm;
|
2006-04-24 23:10:06 +02:00
|
|
|
|
2006-08-02 18:05:34 +02:00
|
|
|
bool decoupledFrontEnd;
|
|
|
|
|
2006-04-24 23:10:06 +02:00
|
|
|
bool lockFlag;
|
2006-04-24 23:40:00 +02:00
|
|
|
|
2009-03-06 04:09:53 +01:00
|
|
|
Stats::Scalar quiesceCycles;
|
Fixes for ozone CPU to successfully boot and run linux.
cpu/base_dyn_inst.hh:
Remove snoop function (did not mean to commit it).
cpu/ozone/back_end_impl.hh:
Set instruction as having its result ready, not completed.
cpu/ozone/cpu.hh:
Fixes for store conditionals. Use an additional lock addr list to make sure that the access is valid. I don't know if this is fully necessary, but it gives me a peace of mind (at some performance cost).
Make sure to schedule for cycles(1) and not just 1 cycle in the future as tick = 1ps.
Also support the new Checker.
cpu/ozone/cpu_builder.cc:
Add parameter for maxOutstandingMemOps so it can be set through the config.
Also add in the checker. Right now it's a BaseCPU simobject, but that may change in the future.
cpu/ozone/cpu_impl.hh:
Add support for the checker. For now there's a dynamic cast to convert the simobject passed back from the builder to the proper Checker type. It's ugly, but only happens at startup, and is probably a justified use of dynamic cast.
Support switching out/taking over from other CPUs.
Correct indexing problem for float registers.
cpu/ozone/dyn_inst.hh:
Add ability for instructions to wait on memory instructions in addition to source register instructions. This is needed for memory dependence predictors and memory barriers.
cpu/ozone/dyn_inst_impl.hh:
Support waiting on memory operations.
Use "resultReady" to differentiate an instruction having its registers produced vs being totally completed.
cpu/ozone/front_end.hh:
Support switching out.
Also record if an interrupt is pending.
cpu/ozone/front_end_impl.hh:
Support switching out. Also support stalling the front end if an interrupt is pending.
cpu/ozone/lw_back_end.hh:
Add checker in.
Support switching out.
Support memory barriers.
cpu/ozone/lw_back_end_impl.hh:
Lots of changes to get things to work right.
Faults, traps, interrupts all wait until all stores have written back (important).
Memory barriers are supported, as is the general ability for instructions to be dependent on other memory instructions.
cpu/ozone/lw_lsq.hh:
Support switching out.
Also use store writeback events in all cases, not just dcache misses.
cpu/ozone/lw_lsq_impl.hh:
Support switching out.
Also use store writeback events in all cases, not just dcache misses.
Support the checker CPU. Marks instructions as completed once the functional access is done (which has to be done for the checker to be able to verify results).
cpu/ozone/simple_params.hh:
Add max outstanding mem ops parameter.
python/m5/objects/OzoneCPU.py:
Add max outstanding mem ops, checker.
--HG--
extra : convert_revision : f4d408e1bb1f25836a097b6abe3856111e950c59
2006-05-12 01:18:36 +02:00
|
|
|
|
|
|
|
Checker<DynInstPtr> *checker;
|
2006-04-23 00:45:01 +02:00
|
|
|
};
|
2005-02-26 00:00:49 +01:00
|
|
|
|
2006-04-23 00:45:01 +02:00
|
|
|
#endif // __CPU_OZONE_CPU_HH__
|