void ExecUnitBase::RegisterDetectEvent( OpIterator op, const int latency ) { const LatPredResult& predResult = op->GetLatPredRsult(); // Detect events Scheduler* scheduler = op->GetScheduler(); int wakeups = predResult.GetCount(); for( int i = 0; i < wakeups - 1; i++ ){ const LatPredResult::Scheduling& sched = predResult.Get( i ); if( sched.wakeup ){ EventPtr detectLatPredMiss( OpDetectLatPredMissEvent::Construct( op, 0, sched.latency, latency ) ); op->AddEvent( detectLatPredMiss, scheduler->GetLowerPipeline(), sched.latency - 1 ); } } }
// Initialize all physical resources (method body) void SimulationSystem::InitializeResourcesBody() { PhysicalResourceArray<Core>& core = m_context->cores; PhysicalResourceArray<Thread>& thread = m_context->threads; PhysicalResourceArray<Cache>& caches = m_context->caches; m_coreResources.resize( core.GetSize() ); m_threadResources.resize( thread.GetSize() ); m_memResources.resize( caches.GetSize() ); for( int i = 0; i < thread.GetSize(); i++ ){ ThreadResources& res = m_threadResources[i]; res.memOrderManager = thread[i]->GetMemOrderManager(); } // // Register clocked resources // for( int i = 0; i < caches.GetSize(); i++ ){ m_clockedResources.push_back( caches[i] ); } for( int i = 0; i < core.GetSize(); i++ ){ CoreResources& res = m_coreResources[i]; res.core = core[i]; m_clockedResources.push_back( core[i]->GetRetirer() ); for( int j = 0; j < core[i]->GetNumScheduler(); j++ ){ Scheduler* scheduler = core[i]->GetScheduler( j ); m_clockedResources.push_back( scheduler ); } m_clockedResources.push_back( core[i]->GetDispatcher() ); m_clockedResources.push_back( core[i]->GetRenamer() ); m_clockedResources.push_back( core[i]->GetFetcher() ); m_clockedResources.push_back( core[i] ); } sort( m_clockedResources.begin(), m_clockedResources.end(), ClockedResourceBase::ComparePriority() ); // // Register time wheels // for( int i = 0; i < caches.GetSize(); i++ ){ m_timeWheels.push_back( caches[i]->GetLowerPipeline() ); } for( int i = 0; i < core.GetSize(); i++ ){ CoreResources& res = m_coreResources[i]; res.core = core[i]; m_timeWheels.push_back( core[i]->GetRetirer()->GetLowerPipeline() ); for( int j = 0; j < core[i]->GetNumScheduler(); j++ ){ Scheduler* scheduler = core[i]->GetScheduler( j ); m_timeWheels.push_back( scheduler->GetLowerPipeline() ); } m_timeWheels.push_back( core[i]->GetDispatcher()->GetLowerPipeline() ); m_timeWheels.push_back( core[i]->GetRenamer()->GetLowerPipeline() ); m_timeWheels.push_back( core[i]->GetFetcher()->GetLowerPipeline() ); } }