Update Virtual and Physical ports.

src/cpu/o3/alpha/cpu_impl.hh:
    Handle the PhysicalPort and VirtualPort in the ThreadState.
src/cpu/o3/cpu.cc:
    Initialize the thread context.
src/cpu/o3/thread_context.hh:
    Add new function to initialize thread context.
src/cpu/o3/thread_context_impl.hh:
    Use code now put into function.
src/cpu/simple_thread.cc:
    Move code to ThreadState and use the new helper function.
src/cpu/simple_thread.hh:
    Remove init() in this derived class; use init() from ThreadState base class.
src/cpu/thread_state.cc:
    Move setting up of Physical and Virtual ports here.  Change getMemFuncPort() to connectToMemFunc(), which connects a port to a functional port of the memory object below the CPU.
src/cpu/thread_state.hh:
    Update functions.

--HG--
extra : convert_revision : ff254715ef0b259dc80d08f13543b63e4024ca8d
This commit is contained in:
Kevin Lim 2006-11-19 17:43:03 -05:00
parent a00e13b1fe
commit a2113fd3dc
8 changed files with 43 additions and 57 deletions

View file

@ -116,24 +116,6 @@ AlphaO3CPU<Impl>::AlphaO3CPU(Params *params)
#if FULL_SYSTEM
// Setup quiesce event.
this->thread[i]->quiesceEvent = new EndQuiesceEvent(tc);
Port *mem_port;
FunctionalPort *phys_port;
VirtualPort *virt_port;
phys_port = new FunctionalPort(csprintf("%s-%d-funcport",
name(), i));
mem_port = this->system->physmem->getPort("functional");
mem_port->setPeer(phys_port);
phys_port->setPeer(mem_port);
virt_port = new VirtualPort(csprintf("%s-%d-vport",
name(), i));
mem_port = this->system->physmem->getPort("functional");
mem_port->setPeer(virt_port);
virt_port->setPeer(mem_port);
this->thread[i]->setPhysPort(phys_port);
this->thread[i]->setVirtPort(virt_port);
#endif
// Give the thread the TC.
this->thread[i]->tc = tc;

View file

@ -497,6 +497,8 @@ FullO3CPU<Impl>::init()
}
#if FULL_SYSTEM
src_tc->init();
TheISA::initCPU(src_tc, src_tc->readCpuId());
#endif
}

View file

@ -91,6 +91,8 @@ class O3ThreadContext : public ThreadContext
virtual VirtualPort *getVirtPort(ThreadContext *src_tc = NULL);
void delVirtPort(VirtualPort *vp);
virtual void init() { thread->init(); }
#else
virtual TranslatingPort *getMemPort() { return thread->getMemPort(); }

View file

@ -41,12 +41,9 @@ O3ThreadContext<Impl>::getVirtPort(ThreadContext *src_tc)
return thread->getVirtPort();
VirtualPort *vp;
Port *mem_port;
vp = new VirtualPort("tc-vport", src_tc);
mem_port = cpu->system->physmem->getPort("functional");
mem_port->setPeer(vp);
vp->setPeer(mem_port);
thread->connectToMemFunc(vp);
return vp;
}

View file

@ -104,25 +104,6 @@ SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num,
#endif
#if FULL_SYSTEM
void
SimpleThread::init()
{
Port *mem_port;
physPort = new FunctionalPort(csprintf("%s-%d-funcport",
cpu->name(), tid));
mem_port = getMemFuncPort();
mem_port->setPeer(physPort);
physPort->setPeer(mem_port);
virtPort = new VirtualPort(csprintf("%s-%d-vport",
cpu->name(), tid));
mem_port = getMemFuncPort();
mem_port->setPeer(virtPort);
virtPort->setPeer(mem_port);
}
#endif
SimpleThread::SimpleThread()
#if FULL_SYSTEM
: ThreadState(NULL, -1, -1)
@ -316,10 +297,7 @@ SimpleThread::getVirtPort(ThreadContext *src_tc)
return virtPort;
VirtualPort *vp = new VirtualPort("tc-vport", src_tc);
Port *mem_port = getMemFuncPort();
mem_port->setPeer(vp);
vp->setPeer(mem_port);
connectToMemFunc(vp);
return vp;
}

View file

@ -118,8 +118,6 @@ class SimpleThread : public ThreadState
SimpleThread(BaseCPU *_cpu, int _thread_num, System *_system,
TheISA::ITB *_itb, TheISA::DTB *_dtb,
bool use_kernel_stats = true);
void init();
#else
SimpleThread(BaseCPU *_cpu, int _thread_num, Process *_process, int _asid);
#endif

View file

@ -39,6 +39,7 @@
#if FULL_SYSTEM
#include "arch/kernel_stats.hh"
#include "cpu/quiesce_event.hh"
#include "mem/vport.hh"
#endif
#if FULL_SYSTEM
@ -111,6 +112,28 @@ ThreadState::unserialize(Checkpoint *cp, const std::string &section)
}
#if FULL_SYSTEM
void
ThreadState::init()
{
initPhysPort();
initVirtPort();
}
void
ThreadState::initPhysPort()
{
physPort = new FunctionalPort(csprintf("%s-%d-funcport",
baseCpu->name(), tid));
connectToMemFunc(physPort);
}
void
ThreadState::initVirtPort()
{
virtPort = new VirtualPort(csprintf("%s-%d-vport",
baseCpu->name(), tid));
connectToMemFunc(virtPort);
}
void
ThreadState::profileClear()
@ -138,17 +161,14 @@ ThreadState::getMemPort()
baseCpu->name(), tid),
process->pTable, false);
Port *func_port = getMemFuncPort();
func_port->setPeer(port);
port->setPeer(func_port);
connectToMemFunc(port);
return port;
}
#endif
Port *
ThreadState::getMemFuncPort()
void
ThreadState::connectToMemFunc(Port *port)
{
Port *dcache_port, *func_mem_port;
@ -161,5 +181,6 @@ ThreadState::getMemFuncPort()
func_mem_port = mem_object->getPort("functional");
assert(func_mem_port != NULL);
return func_mem_port;
func_mem_port->setPeer(port);
port->setPeer(func_mem_port);
}

View file

@ -91,6 +91,12 @@ struct ThreadState {
Tick readLastSuspend() { return lastSuspend; }
#if FULL_SYSTEM
void init();
void initPhysPort();
void initVirtPort();
void dumpFuncProfile();
EndQuiesceEvent *getQuiesceEvent() { return quiesceEvent; }
@ -142,9 +148,9 @@ struct ThreadState {
void setStatus(Status new_status) { _status = new_status; }
public:
/** Gets a functional port from the memory object that's connected
* to the CPU. */
Port *getMemFuncPort();
/** Connects port to the functional port of the memory object
* below the CPU. */
void connectToMemFunc(Port *port);
/** Number of instructions committed. */
Counter numInst;