33 if (_enabled && _model)
35 _model->skipSamples(samples);
43 LOG(Level::WARNING,
"Timing source '{}' already initialized. Skipping re-initialization.", _name);
48 _frequency =
timing->getFrequency();
52 _freq_offset =
timing->getFreqOffset().value_or(0);
55 LOG(Level::INFO,
"Timing source '{}': applying random frequency offset with stdev {} Hz.", _name,
60 _phase_offset =
timing->getPhaseOffset().value_or(0);
63 LOG(Level::INFO,
"Timing source '{}': applying random phase offset with stdev {} radians.", _name,
68 timing->copyAlphas(_alphas, _weights);
70 _model = std::make_unique<noise::ClockModelGenerator>(_rng, _alphas, _weights, _frequency, _phase_offset,
73 if (
timing->getFrequency() == 0.0)
75 LOG(Level::INFO,
"Timing source frequency not set, results could be incorrect.");
78 _sync_on_pulse =
timing->getSyncOnPulse();
84 if (_prototype ==
nullptr)
86 LOG(Level::FATAL,
"Cannot clone a Timing object that has not been initialized from a prototype.");
87 throw std::logic_error(
"Cannot clone a Timing object that has not been initialized from a prototype.");
89 auto new_timing = std::make_unique<Timing>(_name, _seed, _id);
static SimIdGenerator & instance()
Get the singleton instance of SimIdGenerator.
Manages timing properties such as frequency, offsets, and synchronization.
void initializeModel(const PrototypeTiming *timing) noexcept
Initializes the timing model.
void skipSamples(std::size_t samples) noexcept
Skips a number of samples in the timing model.
Timing(std::string name, unsigned seed, const SimId id=0) noexcept
Constructs a Timing object.
std::unique_ptr< Timing > clone() const
Creates a new Timing instance based on the same prototype.
Header file for the logging system.
Header file for the PrototypeTiming class.
uint64_t SimId
64-bit Unique Simulation ID.
Timing source for simulation objects.