The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::ClockManager Class Reference

Manages building a clock tree. More...

#include <ClockManager.hpp>

Public Member Functions

 ClockManager (Scheduler *scheduler)
 
Clock::Handle makeRoot (RootTreeNode *parent=nullptr, const std::string &name="Root")
 Construct a root clock.
 
Clock::Handle getRoot () const
 
Clock::Handle makeClock (const std::string &name, const Clock::Handle &parent, const uint32_t &p_rat, const uint32_t &c_rat)
 Create a new clock with a given ratio to a parent clock.
 
Clock::Handle makeClock (const std::string &name, const Clock::Handle &parent)
 Create a new clock with a 1:1 ratio to a parent clock.
 
Clock::Handle makeClock (const std::string &name, const Clock::Handle &parent, double frequency_mhz)
 Create a new clock with a given frequency.
 
uint32_t normalize ()
 
void print (std::ostream &os) const
 

Static Public Member Functions

static uint64_t getClockPeriodFromFrequencyMhz (double frequency_mhz)
 

Detailed Description

Manages building a clock tree.

Definition at line 28 of file ClockManager.hpp.

Constructor & Destructor Documentation

◆ ClockManager()

sparta::ClockManager::ClockManager ( Scheduler scheduler)
inline

Definition at line 34 of file ClockManager.hpp.

◆ ~ClockManager()

sparta::ClockManager::~ClockManager ( )
inline

Definition at line 39 of file ClockManager.hpp.

Member Function Documentation

◆ getClockPeriodFromFrequencyMhz()

static uint64_t sparta::ClockManager::getClockPeriodFromFrequencyMhz ( double  frequency_mhz)
inlinestatic

Return the clock period given a frequency.

Parameters
frequency_mhz- Frequency in MHz to find the period for

Ideally this is the only location that a timebase is used, but I don't know if that's reality throught sparta.

Definition at line 144 of file ClockManager.hpp.

◆ getRoot()

Clock::Handle sparta::ClockManager::getRoot ( ) const
inline

Definition at line 67 of file ClockManager.hpp.

◆ makeClock() [1/3]

Clock::Handle sparta::ClockManager::makeClock ( const std::string &  name,
const Clock::Handle &  parent 
)
inline

Create a new clock with a 1:1 ratio to a parent clock.

Definition at line 86 of file ClockManager.hpp.

Here is the call graph for this function:

◆ makeClock() [2/3]

Clock::Handle sparta::ClockManager::makeClock ( const std::string &  name,
const Clock::Handle &  parent,
const uint32_t &  p_rat,
const uint32_t &  c_rat 
)
inline

Create a new clock with a given ratio to a parent clock.

Definition at line 75 of file ClockManager.hpp.

◆ makeClock() [3/3]

Clock::Handle sparta::ClockManager::makeClock ( const std::string &  name,
const Clock::Handle &  parent,
double  frequency_mhz 
)
inline

Create a new clock with a given frequency.

Definition at line 94 of file ClockManager.hpp.

◆ makeRoot()

Clock::Handle sparta::ClockManager::makeRoot ( RootTreeNode parent = nullptr,
const std::string &  name = "Root" 
)
inline

Construct a root clock.

Parameters
parentA root object representing the top of the clock tree. Because Clock is not a RootTreeNode, it must be attached to existing tree
nameName of the root clock
Precondition
Must not have already called makeRoot
Note
Clock must be part of a tree to allow sparta clients access to its instrumentation.
Todo:
Implement special case for RootClock that avoids this extra level

Definition at line 58 of file ClockManager.hpp.

◆ normalize()

uint32_t sparta::ClockManager::normalize ( )
inline

Definition at line 103 of file ClockManager.hpp.

◆ print()

void sparta::ClockManager::print ( std::ostream &  os) const
inline

Definition at line 129 of file ClockManager.hpp.


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