sc_time.cc (13057:b1cdffff3bed) sc_time.cc (13124:538eff58fb30)
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
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
137} // anonymous namespace
138
139sc_time::sc_time() : val(0) {}
140
141sc_time::sc_time(double d, sc_time_unit tu)
142{
143 val = 0;
144 if (d != 0)
145 set(this, d, tu);
146}
147
148sc_time::sc_time(const sc_time &t)
149{
150 val = t.val;
151}
152
153sc_time::sc_time(double d, bool scale)
154{
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{
155 //XXX Assuming the time resolution is 1ps, and the default unit is 1ns.
156 set(this, d, scale ? SC_NS : SC_PS);
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);
157}
158
159sc_time::sc_time(sc_dt::uint64 v, bool scale)
160{
162}
163
164sc_time::sc_time(sc_dt::uint64 v, bool scale)
165{
161 //XXX Assuming the time resolution is 1ps, and the default unit is 1ns.
162 set(this, static_cast<double>(v), scale ? SC_NS : SC_PS);
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);
163}
164
165sc_time &
166sc_time::operator = (const sc_time &t)
167{
168 val = t.val;
169 return *this;
170}

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

365const sc_time &
366sc_max_time()
367{
368 static const sc_time MaxScTime = sc_time::from_value(MaxTick);
369 return MaxScTime;
370}
371
372void
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
373sc_set_default_time_unit(double, sc_time_unit)
381sc_set_default_time_unit(double d, sc_time_unit tu)
374{
382{
375 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
383 defaultUnit = d * TimeUnitScale[tu];
376}
377
378sc_time
379sc_get_default_time_unit()
380{
384}
385
386sc_time
387sc_get_default_time_unit()
388{
381 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
382 return *(sc_time *)nullptr;
389 return sc_time(defaultUnit, SC_SEC);
383}
384
385sc_time_tuple::sc_time_tuple(const sc_time &)
386{
387 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
388}
389
390bool

--- 35 unchanged lines hidden ---
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 ---