gem5  v21.1.0.2
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
gem5::Clocked Class Reference

Helper class for objects that need to be clocked. More...

#include <clocked_object.hh>

Inheritance diagram for gem5::Clocked:
gem5::BasePixelPump gem5::ClockedObject gem5::HDLcd::PixelPump gem5::ArmISA::TableWalker gem5::BaseCache gem5::BaseCPU gem5::BaseTags gem5::BaseTrafficGen gem5::BaseXBar gem5::Bridge gem5::ComputeUnit gem5::GarnetSyntheticTraffic gem5::LdsState gem5::MemDelay gem5::memory::AbstractMemory gem5::memory::qos::MemCtrl gem5::MemTest gem5::PioDevice gem5::prefetch::AccessMapPatternMatching gem5::prefetch::Base gem5::ProtocolTester gem5::RiscvISA::Walker gem5::ruby::AbstractController gem5::ruby::BasicRouter gem5::ruby::garnet::NetworkInterface gem5::ruby::garnet::NetworkLink gem5::ruby::Network gem5::ruby::RubyPort gem5::ruby::RubySystem gem5::RubyDirectedTester gem5::RubyTester gem5::Scp gem5::SerialLink gem5::Shader gem5::SimpleCache gem5::SMMUv3 gem5::SMMUv3DeviceInterface gem5::TesterThread gem5::ThermalModel gem5::TickedObject gem5::TLBCoalescer gem5::X86ISA::GpuTLB gem5::X86ISA::Walker

Public Member Functions

void updateClockPeriod ()
 Update the tick to the current tick. More...
 
Tick clockEdge (Cycles cycles=Cycles(0)) const
 Determine the tick when a cycle begins, by default the current one, but the argument also enables the caller to determine a future cycle. More...
 
Cycles curCycle () const
 Determine the current cycle, corresponding to a tick aligned to a clock edge. More...
 
Tick nextCycle () const
 Based on the clock of the object, determine the start tick of the first cycle that is at least one cycle in the future. More...
 
uint64_t frequency () const
 
Tick clockPeriod () const
 
double voltage () const
 
Cycles ticksToCycles (Tick t) const
 
Tick cyclesToTicks (Cycles c) const
 

Protected Member Functions

 Clocked (ClockDomain &clk_domain)
 Create a clocked object and set the clock domain based on the parameters. More...
 
 Clocked (Clocked &)=delete
 
Clockedoperator= (Clocked &)=delete
 
virtual ~Clocked ()
 Virtual destructor due to inheritance. More...
 
void resetClock () const
 Reset the object's clock using the current global tick value. More...
 
virtual void clockPeriodUpdated ()
 A hook subclasses can implement so they can do any extra work that's needed when the clock rate is changed. More...
 

Private Member Functions

void update () const
 Align cycle and tick to the next clock edge if not already done. More...
 

Private Attributes

Tick tick
 
Cycles cycle
 
ClockDomainclockDomain
 The clock domain this clocked object belongs to. More...
 

Detailed Description

Helper class for objects that need to be clocked.

Clocked objects typically inherit from this class. Objects that need SimObject functionality as well should inherit from ClockedObject.

Definition at line 62 of file clocked_object.hh.

Constructor & Destructor Documentation

◆ Clocked() [1/2]

gem5::Clocked::Clocked ( ClockDomain clk_domain)
inlineprotected

Create a clocked object and set the clock domain based on the parameters.

Definition at line 115 of file clocked_object.hh.

References clockDomain, and gem5::ClockDomain::registerWithClockDomain().

◆ Clocked() [2/2]

gem5::Clocked::Clocked ( Clocked )
protecteddelete

◆ ~Clocked()

virtual gem5::Clocked::~Clocked ( )
inlineprotectedvirtual

Virtual destructor due to inheritance.

Definition at line 129 of file clocked_object.hh.

Member Function Documentation

◆ clockEdge()

Tick gem5::Clocked::clockEdge ( Cycles  cycles = Cycles(0)) const
inline

Determine the tick when a cycle begins, by default the current one, but the argument also enables the caller to determine a future cycle.

When curTick() is on a clock edge, the number of cycles in the parameter is added to curTick() to be returned. When curTick() is not aligned to a clock edge, the number of cycles in the parameter is added to the next clock edge.

Parameters
cyclesThe number of cycles into the future
Returns
The start tick when the requested clock edge occurs. Precisely, this tick can be curTick() + [0, clockPeriod()) + clockPeriod() * cycles

Definition at line 177 of file clocked_object.hh.

References clockPeriod(), tick, and update().

Referenced by gem5::BaseCache::access(), gem5::BaseKvmCPU::activateContext(), gem5::MinorCPU::activateContext(), gem5::AtomicSimpleCPU::activateContext(), gem5::TimingSimpleCPU::activateContext(), gem5::TimingSimpleCPU::advanceInst(), gem5::BasePixelPump::beginLine(), gem5::BaseXBar::calcPacketTiming(), gem5::ruby::garnet::SwitchAllocator::check_for_wakeup(), gem5::TraceCPU::ElasticDataGen::checkAndIssue(), gem5::ruby::garnet::NetworkInterface::checkReschedule(), gem5::ruby::garnet::NetworkInterface::checkStallQueue(), gem5::HDLcd::cmdEnable(), gem5::TraceCPU::ElasticDataGen::completeMemAccess(), gem5::MemTest::completeRequest(), gem5::ruby::garnet::NetworkInterface::dequeueCallback(), gem5::Pl111::dmaDone(), gem5::SMMUProcess::doDelay(), gem5::Cache::doTimingSupplyResponse(), gem5::TimingSimpleCPU::drain(), gem5::TraceCPU::ElasticDataGen::execute(), gem5::o3::Fetch::finishTranslation(), gem5::o3::Commit::generateTrapEvent(), gem5::BaseCache::handleFill(), gem5::TimingSimpleCPU::handleReadPacket(), gem5::SimpleCache::handleRequest(), gem5::Cache::handleSnoop(), gem5::BaseCache::handleUncacheableWriteResp(), gem5::TimingSimpleCPU::handleWritePacket(), gem5::ruby::garnet::InputUnit::increment_credit(), gem5::ruby::garnet::OutputUnit::insert_flit(), gem5::ruby::Sequencer::insertRequest(), gem5::ruby::VIPERCoalescer::invTCP(), gem5::ruby::DMASequencer::issueNext(), gem5::SMMUTranslationProcess::issuePrefetch(), gem5::ruby::VIPERCoalescer::issueRequest(), gem5::ruby::Sequencer::issueRequest(), gem5::ruby::DMASequencer::makeRequest(), nextCycle(), gem5::ArmISA::TableWalker::nextWalk(), gem5::ruby::PerfectSwitch::operateMessageBuffer(), gem5::ruby::Throttle::operateVnet(), gem5::WaitClass::prerdy(), gem5::WaitClass::preset(), gem5::LdsState::process(), gem5::ruby::Consumer::processCurrentEvent(), gem5::prefetch::AccessMapPatternMatching::processEpochEvent(), gem5::SparcISA::ISA::processHSTickCompare(), gem5::SparcISA::ISA::processSTickCompare(), gem5::pseudo_inst::quiesceCycles(), gem5::WaitClass::rdy(), gem5::o3::LSQUnit::read(), gem5::Pl111::readFramebuffer(), gem5::MemTest::recvRetry(), gem5::HMCController::recvTimingReq(), gem5::NoncoherentXBar::recvTimingReq(), gem5::CoherentXBar::recvTimingReq(), gem5::BaseCache::recvTimingReq(), gem5::ruby::AbstractController::recvTimingResp(), gem5::NoncoherentXBar::recvTimingResp(), gem5::X86ISA::Walker::recvTimingResp(), gem5::RiscvISA::Walker::recvTimingResp(), gem5::TimingSimpleCPU::IcachePort::recvTimingResp(), gem5::TimingSimpleCPU::DcachePort::recvTimingResp(), gem5::CoherentXBar::recvTimingResp(), gem5::BaseCache::recvTimingResp(), gem5::Cache::recvTimingSnoopResp(), gem5::CoherentXBar::recvTimingSnoopResp(), gem5::BasePixelPump::renderPixels(), gem5::IGbE::restartClock(), gem5::Sp805::restartCounter(), gem5::Gicv3Its::runProcessTiming(), gem5::NSGigE::rxKick(), gem5::TraceCPU::schedDcacheNext(), gem5::MipsISA::ISA::scheduleCP0Update(), gem5::ruby::Consumer::scheduleEvent(), gem5::ruby::garnet::NetworkBridge::scheduleFlit(), gem5::ruby::garnet::NetworkInterface::scheduleFlit(), gem5::ruby::Consumer::scheduleNextWakeup(), gem5::ruby::garnet::NetworkInterface::scheduleOutputPort(), gem5::BaseCPU::schedulePowerGatingEvent(), gem5::o3::InstructionQueue::scheduleReadyInsts(), gem5::o3::CPU::scheduleTickEvent(), gem5::ruby::AbstractController::serviceMemoryQueue(), gem5::NoncoherentCache::serviceMSHRTargets(), gem5::Cache::serviceMSHRTargets(), gem5::WaitClass::set(), gem5::SparcISA::ISA::setFSReg(), gem5::BasePixelPump::start(), gem5::prefetch::AccessMapPatternMatching::startup(), gem5::memory::DRAMSim2::startup(), gem5::memory::DRAMsim3::startup(), gem5::BaseCPU::suspendContext(), gem5::GarnetSyntheticTraffic::tick(), gem5::AtomicSimpleCPU::tick(), gem5::MemTest::tick(), gem5::o3::CPU::tick(), gem5::BaseKvmCPU::tick(), gem5::sinic::Device::transferDone(), gem5::NSGigE::transferDone(), gem5::DmaPort::trySendTimingReq(), gem5::NSGigE::txKick(), gem5::o3::CPU::wakeCPU(), gem5::ruby::garnet::CrossbarSwitch::wakeup(), gem5::ruby::garnet::InputUnit::wakeup(), gem5::ruby::garnet::NetworkLink::wakeup(), gem5::ruby::garnet::Router::wakeup(), gem5::ruby::garnet::NetworkInterface::wakeup(), gem5::ruby::Sequencer::wakeup(), gem5::ruby::AbstractController::wakeUpAllBuffers(), gem5::ruby::AbstractController::wakeUpBuffer(), and gem5::ruby::AbstractController::wakeUpBuffers().

◆ clockPeriod()

Tick gem5::Clocked::clockPeriod ( ) const
inline

Definition at line 217 of file clocked_object.hh.

References clockDomain, and gem5::ClockDomain::clockPeriod().

Referenced by gem5::BaseXBar::calcPacketTiming(), gem5::TesterThread::checkDeadlock(), clockEdge(), gem5::Iris::BaseCPU::clockPeriodUpdated(), cyclesToTicks(), gem5::GPUDispatcher::dispatch(), gem5::SMMUProcess::doDelay(), gem5::BaseKvmCPU::doMMIOAccess(), gem5::ArmISA::TableWalker::fetchDescriptor(), gem5::ArmISA::TableWalker::Stage2Walk::finish(), frequency(), gem5::MathExprPowerModel::getStatValue(), gem5::ComputeUnit::init(), gem5::prefetch::Queued::insert(), gem5::ruby::VIPERCoalescer::issueRequest(), gem5::BaseKvmCPU::kvmRun(), gem5::GPUDispatcher::notifyWgCompl(), gem5::ruby::GPUCoalescer::printRequestTable(), gem5::CPUProgressEvent::process(), gem5::BaseCache::recvAtomic(), gem5::CoherentXBar::recvAtomicBackdoor(), gem5::Cache::recvAtomicSnoop(), gem5::CoherentXBar::recvAtomicSnoop(), gem5::HMCController::recvTimingReq(), gem5::TLBCoalescer::CpuSidePort::recvTimingReq(), gem5::NoncoherentXBar::recvTimingReq(), gem5::CoherentXBar::recvTimingReq(), gem5::ruby::RubyPort::MemRequestPort::recvTimingResp(), gem5::ruby::RubyPort::PioRequestPort::recvTimingResp(), gem5::NoncoherentXBar::recvTimingResp(), gem5::CoherentXBar::recvTimingResp(), gem5::Cache::recvTimingSnoopReq(), gem5::CoherentXBar::recvTimingSnoopReq(), gem5::CoherentXBar::recvTimingSnoopResp(), gem5::ruby::BankedArray::reserve(), resetClock(), gem5::TraceCPU::schedDcacheNext(), gem5::GPUDispatcher::scheduleDispatch(), gem5::ruby::Consumer::scheduleEventAbsolute(), gem5::VectorRegisterFile::scheduleWriteOperandsFromLoad(), gem5::ScalarRegisterFile::scheduleWriteOperandsFromLoad(), gem5::BaseCache::sendMSHRQueuePacket(), gem5::AtomicSimpleCPU::tick(), gem5::IGbE::tick(), ticksToCycles(), gem5::prefetch::Queued::translationComplete(), update(), gem5::GPUDispatcher::updateInvCounter(), gem5::Sp805::value(), gem5::ruby::HTMSequencer::wakeup(), gem5::ruby::garnet::NetworkInterface::wakeup(), gem5::ruby::Sequencer::wakeup(), and gem5::ruby::GPUCoalescer::wakeup().

◆ clockPeriodUpdated()

virtual void gem5::Clocked::clockPeriodUpdated ( )
inlineprotectedvirtual

A hook subclasses can implement so they can do any extra work that's needed when the clock rate is changed.

Reimplemented in gem5::Iris::BaseCPU.

Definition at line 148 of file clocked_object.hh.

Referenced by updateClockPeriod().

◆ curCycle()

Cycles gem5::Clocked::curCycle ( ) const
inline

Determine the current cycle, corresponding to a tick aligned to a clock edge.

Returns
When curTick() is on a clock edge, return the Cycle corresponding to that clock edge. When curTick() is not on a clock edge, return the Cycle corresponding to the next clock edge.

Definition at line 195 of file clocked_object.hh.

References cycle, and update().

Referenced by gem5::o3::CPU::activateContext(), gem5::TesterThread::addOutstandingReqs(), gem5::minor::FUPipeline::advance(), gem5::ruby::garnet::SwitchAllocator::arbitrate_outports(), gem5::minor::FUPipeline::canInsert(), gem5::TesterThread::checkDeadlock(), gem5::RubyTester::checkForDeadlock(), gem5::BaseCache::clearBlocked(), gem5::ruby::GPUCoalescer::coalescePacket(), gem5::ruby::Throttle::collateStats(), gem5::ruby::garnet::GarnetNetwork::collateStats(), gem5::minor::Execute::commit(), gem5::minor::FUPipeline::cyclesBeforeInsert(), gem5::ruby::garnet::OutputUnit::decrement_credit(), gem5::minor::Execute::evaluate(), gem5::o3::CPU::haltContext(), gem5::DmaThread::hitCallback(), gem5::GpuWavefront::hitCallback(), gem5::RubyTester::hitCallback(), gem5::ruby::garnet::OutputUnit::increment_credit(), gem5::ruby::RubyPrefetcher::initializeStream(), gem5::ruby::HTMSequencer::insertRequest(), gem5::ruby::Sequencer::insertRequest(), gem5::minor::Execute::issue(), gem5::TesterThread::issueNextAction(), gem5::ruby::RubyPrefetcher::issueNextPrefetch(), gem5::ruby::Throttle::operateVnet(), gem5::TesterThread::printOutstandingReqs(), gem5::ruby::GPUCoalescer::printRequestTable(), gem5::X86ISA::ISA::readMiscReg(), gem5::RiscvISA::ISA::readMiscReg(), gem5::ruby::Sequencer::recordMissLatency(), gem5::ruby::RubySystem::resetStats(), gem5::BaseCache::setBlocked(), gem5::X86ISA::ISA::setMiscReg(), gem5::o3::CPU::suspendContext(), gem5::o3::CPU::takeOverFrom(), gem5::TimingSimpleCPU::takeOverFrom(), gem5::o3::CPU::tick(), gem5::BaseCPU::updateCycleCounters(), gem5::TimingSimpleCPU::updateCycleCounts(), gem5::o3::CPU::wakeCPU(), gem5::ruby::garnet::CrossbarSwitch::wakeup(), gem5::ruby::HTMSequencer::wakeup(), gem5::ruby::Sequencer::wakeup(), and gem5::ruby::GPUCoalescer::wakeup().

◆ cyclesToTicks()

Tick gem5::Clocked::cyclesToTicks ( Cycles  c) const
inline

◆ frequency()

uint64_t gem5::Clocked::frequency ( ) const
inline

Definition at line 215 of file clocked_object.hh.

References clockPeriod(), and gem5::sim_clock::Frequency.

◆ nextCycle()

Tick gem5::Clocked::nextCycle ( ) const
inline

Based on the clock of the object, determine the start tick of the first cycle that is at least one cycle in the future.

When curTick() is at the current cycle edge, this returns the next clock edge. When calling this during the middle of a cycle, this returns 2 clock edges in the future.

Returns
The start tick of the first cycle that is at least one cycle in the future. Precisely, the returned tick can be in the range curTick() + [clockPeriod(), 2 * clockPeriod())

Definition at line 213 of file clocked_object.hh.

References clockEdge().

Referenced by gem5::ComputeUnit::dispWorkgroup(), gem5::BaseKvmCPU::drainResume(), gem5::AtomicSimpleCPU::drainResume(), gem5::o3::CPU::drainResume(), gem5::TimingSimpleCPU::drainResume(), gem5::ComputeUnit::exec(), gem5::BaseKvmCPU::finishMMIOPending(), gem5::pseudo_inst::quiesceSkip(), gem5::SMMUv3DeviceInterface::schedAtsTimingResp(), gem5::SMMUv3DeviceInterface::schedTimingResp(), gem5::TesterThread::scheduleDeadlockCheckEvent(), gem5::SMMUv3DeviceInterface::scheduleDeviceRetry(), gem5::o3::CPU::scheduleThreadExitEvent(), gem5::TesterThread::scheduleWakeup(), and gem5::SMMUv3::writeControl().

◆ operator=()

Clocked& gem5::Clocked::operator= ( Clocked )
protecteddelete

◆ resetClock()

void gem5::Clocked::resetClock ( ) const
inlineprotected

Reset the object's clock using the current global tick value.

Likely to be used only when the global clock is reset. Currently, this done only when Ruby is done warming up the memory system.

Definition at line 137 of file clocked_object.hh.

References clockPeriod(), gem5::curTick(), cycle, gem5::divCeil(), and tick.

Referenced by gem5::ruby::RubySystem::startup().

◆ ticksToCycles()

Cycles gem5::Clocked::ticksToCycles ( Tick  t) const
inline

◆ update()

void gem5::Clocked::update ( ) const
inlineprivate

Align cycle and tick to the next clock edge if not already done.

When complete, tick must be at least curTick().

Definition at line 79 of file clocked_object.hh.

References clockPeriod(), gem5::curTick(), cycle, gem5::divCeil(), and tick.

Referenced by clockEdge(), curCycle(), gem5::prefetch::PIF::CompactorEntry::inSameSpatialRegion(), and updateClockPeriod().

◆ updateClockPeriod()

void gem5::Clocked::updateClockPeriod ( )
inline

Update the tick to the current tick.

Definition at line 156 of file clocked_object.hh.

References clockPeriodUpdated(), and update().

◆ voltage()

double gem5::Clocked::voltage ( ) const
inline

Member Data Documentation

◆ clockDomain

ClockDomain& gem5::Clocked::clockDomain
private

The clock domain this clocked object belongs to.

Definition at line 107 of file clocked_object.hh.

Referenced by Clocked(), clockPeriod(), and voltage().

◆ cycle

Cycles gem5::Clocked::cycle
mutableprivate

◆ tick

Tick gem5::Clocked::tick
mutableprivate

The documentation for this class was generated from the following file:

Generated on Tue Sep 21 2021 12:27:24 for gem5 by doxygen 1.8.17