Deleted Added
sdiff udiff text old ( 13057:b1cdffff3bed ) new ( 13124:538eff58fb30 )
full compact
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 120 unchanged lines hidden (view full) ---

129 pythonReady = true;
130
131 // If time is already fixed, let python know.
132 if (timeFixed)
133 fixTime();
134 }
135} timeSetter;
136
137double defaultUnit = 1.0e-9;
138
139} // anonymous namespace
140
141sc_time::sc_time() : val(0) {}
142
143sc_time::sc_time(double d, sc_time_unit tu)
144{
145 val = 0;
146 if (d != 0)
147 set(this, d, tu);
148}
149
150sc_time::sc_time(const sc_time &t)
151{
152 val = t.val;
153}
154
155sc_time::sc_time(double d, bool scale)
156{
157 //XXX Assuming the time resolution is 1ps.
158 if (scale)
159 set(this, d * defaultUnit, SC_SEC);
160 else
161 set(this, d, SC_PS);
162}
163
164sc_time::sc_time(sc_dt::uint64 v, bool scale)
165{
166 //XXX Assuming the time resolution is 1ps.
167 if (scale)
168 set(this, static_cast<double>(v) * defaultUnit, SC_SEC);
169 else
170 set(this, static_cast<double>(v), SC_PS);
171}
172
173sc_time &
174sc_time::operator = (const sc_time &t)
175{
176 val = t.val;
177 return *this;
178}

--- 194 unchanged lines hidden (view full) ---

373const sc_time &
374sc_max_time()
375{
376 static const sc_time MaxScTime = sc_time::from_value(MaxTick);
377 return MaxScTime;
378}
379
380void
381sc_set_default_time_unit(double d, sc_time_unit tu)
382{
383 defaultUnit = d * TimeUnitScale[tu];
384}
385
386sc_time
387sc_get_default_time_unit()
388{
389 return sc_time(defaultUnit, SC_SEC);
390}
391
392sc_time_tuple::sc_time_tuple(const sc_time &)
393{
394 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
395}
396
397bool

--- 35 unchanged lines hidden ---