56 volatile double tmp = d * scale + 0.5;
60 double 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;
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");
318 if (seconds < sc_gem5::TimeUnitScale[
SC_FS])
321 if (seconds > defaultUnit) {
323 defaultUnit = seconds;
327 while (d < 1.0 && tu > SC_FS) {
332 Tick ticks_per_second =
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)
382 resolution = sc_gem5::TimeUnitScale[
SC_PS];
383 if (defaultUnit < resolution) {
385 "value smaller than time resolution");
396 _value(), _unit(
SC_SEC), _set(true)
405 while (
_unit > 1 && (frequency % 1000 == 0)) {
414 period = 1000 / frequency;
449 std::ostringstream
ss;
bool operator<(const sc_time &) const
void print(std::ostream &=std::cout) const
sc_time & operator+=(const sc_time &)
bool operator!=(const sc_time &) const
const sc_time operator/(const sc_time &t, double d)
bool operator==(const sc_time &) const
sc_time & operator*=(double)
void setClockFrequency(Tick tps)
double s
These variables equal the number of ticks in the unit of time they're named after in a double...
sc_time & operator/=(double)
static sc_time from_string(const char *str)
std::ostream & operator<<(std::ostream &os, sc_status s)
Tick Frequency
The simulated frequency of curTick(). (In ticks per second)
#define SC_REPORT_WARNING(msg_type, msg)
static sc_time from_value(sc_dt::uint64)
sc_dt::uint64 value() const
const char SC_ID_TIME_CONVERSION_FAILED_[]
const char * unit_symbol() const
sc_time & operator=(const sc_time &)
uint64_t Tick
Tick count type.
const char SC_ID_SET_DEFAULT_TIME_UNIT_[]
sc_time & operator-=(const sc_time &)
bool clockFrequencyFixed()
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
double to_seconds() const
const char SC_ID_SET_TIME_RESOLUTION_[]
bool operator>(const sc_time &) const
const sc_time SC_ZERO_TIME
const sc_time operator*(const sc_time &t, double d)
static sc_time from_seconds(double)
sc_dt::uint64 value() const
const char * TimeUnitConstantNames[]
const char SC_ID_DEFAULT_TIME_UNIT_CHANGED_[]
const sc_time & sc_max_time()
sc_time sc_get_time_resolution()
#define SC_REPORT_ERROR(msg_type, msg)
const sc_time operator+(const sc_time &a, const sc_time &b)
const std::string to_string() const
double Hz
These variables the inverse of above.
void sc_set_time_resolution(double d, sc_time_unit tu)
bool operator>=(const sc_time &) const
bool operator<=(const sc_time &) const
sc_time sc_get_default_time_unit()
const char * TimeUnitNames[]
std::string to_string() const
void sc_set_default_time_unit(double d, sc_time_unit tu)
const sc_time operator-(const sc_time &a, const sc_time &b)