gem5  v20.1.0.0
core.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006 The Regents of The University of Michigan
3  * Copyright (c) 2013 Advanced Micro Devices, Inc.
4  * Copyright (c) 2013 Mark D. Hill and David A. Wood
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are
9  * met: redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer;
11  * redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution;
14  * neither the name of the copyright holders nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef __SIM_CORE_HH__
32 #define __SIM_CORE_HH__
33 
38 #include <functional>
39 #include <string>
40 
41 #include "base/types.hh"
42 #include "sim/eventq.hh"
43 
45 inline Tick curTick() { return _curEventQueue->getCurTick(); }
46 
49 namespace SimClock {
50 extern Tick Frequency;
51 
52 namespace Float {
53 
58 extern double s;
59 extern double ms;
60 extern double us;
61 extern double ns;
62 extern double ps;
63 
68 extern double Hz;
69 extern double kHz;
70 extern double MHz;
71 extern double GHz;
72 
73 } // namespace Float
74 
80 namespace Int {
81 extern Tick s;
82 extern Tick ms;
83 extern Tick us;
84 extern Tick ns;
85 extern Tick ps;
86 
87 } // namespace Int
88 } // namespace SimClock
91 void fixClockFrequency();
92 bool clockFrequencyFixed();
93 
94 void setClockFrequency(Tick ticksPerSecond);
95 Tick getClockFrequency(); // Ticks per second.
96 
97 void setOutputDir(const std::string &dir);
98 
99 void registerExitCallback(const std::function<void()> &callback);
100 void doExitCleanup();
101 
102 #endif /* __SIM_CORE_HH__ */
SimClock::Float::ps
double ps
picosecond
Definition: core.cc:53
curTick
Tick curTick()
The universal simulation clock.
Definition: core.hh:45
SimClock::Float::s
double s
These variables equal the number of ticks in the unit of time they're named after in a double.
Definition: core.cc:49
SimClock::Int::ns
Tick ns
nanosecond
Definition: core.cc:65
getClockFrequency
Tick getClockFrequency()
Definition: core.cc:118
SimClock::Float::MHz
double MHz
MHz.
Definition: core.cc:57
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
SimClock::Float::kHz
double kHz
kHz
Definition: core.cc:56
SimClock::Int::us
Tick us
microsecond
Definition: core.cc:64
clockFrequencyFixed
bool clockFrequencyFixed()
Definition: core.cc:109
SimClock::Float::us
double us
microsecond
Definition: core.cc:51
doExitCleanup
void doExitCleanup()
Do C++ simulator exit processing.
Definition: core.cc:150
SimClock::Frequency
Tick Frequency
The simulated frequency of curTick(). (In ticks per second)
Definition: core.cc:46
EventQueue::getCurTick
Tick getCurTick() const
While curTick() is useful for any object assigned to this event queue, if an object that is assigned ...
Definition: eventq.hh:850
SimClock::Float::Hz
double Hz
These variables the inverse of above.
Definition: core.cc:55
SimClock::Float::ns
double ns
nanosecond
Definition: core.cc:52
setClockFrequency
void setClockFrequency(Tick ticksPerSecond)
Definition: core.cc:112
SimClock::Int::s
Tick s
second
Definition: core.cc:62
SimClock::Int::ms
Tick ms
millisecond
Definition: core.cc:63
setOutputDir
void setOutputDir(const std::string &dir)
SimClock::Int::ps
Tick ps
picosecond
Definition: core.cc:66
SimClock
These are variables that are set based on the simulator frequency.
Definition: core.cc:44
registerExitCallback
void registerExitCallback(const std::function< void()> &callback)
Register an exit callback.
Definition: core.cc:140
SimClock::Float::ms
double ms
millisecond
Definition: core.cc:50
types.hh
fixClockFrequency
void fixClockFrequency()
Definition: core.cc:81
_curEventQueue
__thread EventQueue * _curEventQueue
The current event queue for the running thread.
Definition: eventq.cc:57
SimClock::Float::GHz
double GHz
GHz.
Definition: core.cc:58
eventq.hh

Generated on Wed Sep 30 2020 14:02:14 for gem5 by doxygen 1.8.17