56 volatile double tmp =
d *
scale + 0.5;
60double defaultUnit = 1.0e-9;
98 set(
this, d * scaler, SC_SEC);
104 set(
this,
static_cast<double>(v) * scaler, SC_SEC);
123 return static_cast<double>(
val);
134 std::ostringstream
ss;
192 val =
static_cast<int64_t
>(
static_cast<double>(
val) * d + 0.5);
199 val =
static_cast<int64_t
>(
static_cast<double>(
val) / d + 0.5);
232 double d = str ? std::strtod(str, &end) : 0.0;
233 if (str == end || d < 0.0) {
238 while (*end && std::isspace(*end))
259 volatile double tmp =
static_cast<double>(t.value()) * d + 0.5;
266 volatile double tmp = d *
static_cast<double>(t.value()) + 0.5;
273 volatile double tmp =
static_cast<double>(t.value()) / d + 0.5;
280 return t1.to_double() / t2.to_double();
299 if (modf(log10(d), &dummy) != 0.0) {
301 "value not a power of ten");
306 static bool specified =
false;
314 "sc_time object(s) constructed");
319 SC_REPORT_ERROR(SC_ID_SET_TIME_RESOLUTION_,
"value smaller than 1 fs");
321 if (seconds > defaultUnit) {
323 defaultUnit = seconds;
327 while (d < 1.0 && tu > SC_FS) {
358 if (modf(log10(d), &dummy) != 0.0) {
360 "value not a power of ten");
365 static bool specified =
false;
373 "sc_time object(s) constructed");
381 if (resolution == 0.0)
383 if (defaultUnit < resolution) {
385 "value smaller than time resolution");
392 return sc_time(defaultUnit, SC_SEC);
396 _value(), _unit(SC_SEC), _set(true)
405 while (
_unit > 1 && (frequency % 1000 == 0)) {
414 period = 1000 / frequency;
420 _value = t.value() * period;
449 std::ostringstream
ss;
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
sc_dt::uint64 value() const
const char * unit_symbol() const
std::string to_string() const
bool operator!=(const sc_time &) const
static sc_time from_seconds(double)
sc_time & operator-=(const sc_time &)
bool operator>=(const sc_time &) const
bool operator==(const sc_time &) const
void print(std::ostream &=std::cout) const
bool operator>(const sc_time &) const
static sc_time from_value(sc_dt::uint64)
static sc_time from_string(const char *str)
sc_time & operator+=(const sc_time &)
double to_seconds() const
const std::string to_string() const
sc_time & operator=(const sc_time &)
sc_time & operator/=(double)
bool operator<(const sc_time &) const
bool operator<=(const sc_time &) const
sc_time & operator*=(double)
sc_dt::uint64 value() const
double Hz
These variables the inverse of above.
double s
These variables equal the number of ticks in the unit of time they're named after in a double.
Tick Frequency
The simulated frequency of curTick(). (In ticks per second)
bool clockFrequencyFixed()
uint64_t Tick
Tick count type.
void setClockFrequency(Tick tps)
const sc_time operator/(const sc_time &t, double d)
void sc_set_time_resolution(double d, sc_time_unit tu)
const sc_time SC_ZERO_TIME
const sc_time operator+(const sc_time &a, const sc_time &b)
void sc_set_default_time_unit(double d, sc_time_unit tu)
const sc_time operator*(const sc_time &t, double d)
std::ostream & operator<<(std::ostream &os, sc_status s)
sc_time sc_get_default_time_unit()
sc_time sc_get_time_resolution()
const sc_time operator-(const sc_time &a, const sc_time &b)
const sc_time & sc_max_time()
const char * TimeUnitNames[]
gem5::Tick TimeUnitFrequency[]
const char * TimeUnitConstantNames[]
#define SC_REPORT_WARNING(msg_type, msg)
#define SC_REPORT_ERROR(msg_type, msg)