Deleted Added
sdiff udiff text old ( 12983:fb1f462ae89e ) new ( 12986:761e57785c6a )
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

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

23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * Authors: Gabe Black
28 */
29
30#include "base/logging.hh"
31#include "systemc/ext/core/sc_time.hh"
32
33namespace sc_core
34{
35
36namespace
37{
38

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

49 [SC_FS] = 1.0e-15,
50 [SC_PS] = 1.0e-12,
51 [SC_NS] = 1.0e-9,
52 [SC_US] = 1.0e-6,
53 [SC_MS] = 1.0e-3,
54 [SC_SEC] = 1.0
55};
56
57} // anonymous namespace
58
59sc_time::sc_time() : val(0) {}
60
61sc_time::sc_time(double d, sc_time_unit tu)
62{
63 val = 0;
64 if (d != 0) {
65 //XXX Assuming the time resolution is 1ps.
66 double scale = TimeUnitScale[tu] / TimeUnitScale[SC_PS];
67 // Accellera claims there is a linux bug, and that these next two
68 // lines work around them.
69 volatile double tmp = d * scale + 0.5;
70 val = static_cast<uint64_t>(tmp);
71 }
72}

--- 278 unchanged lines hidden ---