gem5  v20.0.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 <string>
39 
40 #include "base/types.hh"
41 #include "sim/eventq.hh"
42 
44 inline Tick curTick() { return _curEventQueue->getCurTick(); }
45 
48 namespace SimClock {
49 extern Tick Frequency;
50 
51 namespace Float {
52 
57 extern double s;
58 extern double ms;
59 extern double us;
60 extern double ns;
61 extern double ps;
62 
67 extern double Hz;
68 extern double kHz;
69 extern double MHz;
70 extern double GHz;
71 
72 } // namespace Float
73 
79 namespace Int {
80 extern Tick s;
81 extern Tick ms;
82 extern Tick us;
83 extern Tick ns;
84 extern Tick ps;
85 
86 } // namespace Int
87 } // namespace SimClock
90 void fixClockFrequency();
91 bool clockFrequencyFixed();
92 
93 void setClockFrequency(Tick ticksPerSecond);
94 Tick getClockFrequency(); // Ticks per second.
95 
96 void setOutputDir(const std::string &dir);
97 
98 class Callback;
99 void registerExitCallback(Callback *callback);
100 void doExitCleanup();
101 
102 #endif /* __SIM_CORE_HH__ */
void doExitCleanup()
Do C++ simulator exit processing.
Definition: core.cc:150
Generic callback class.
Definition: callback.hh:39
void setClockFrequency(Tick ticksPerSecond)
Definition: core.cc:112
double GHz
GHz.
Definition: core.cc:58
double kHz
kHz
Definition: core.cc:56
double ps
picosecond
Definition: core.cc:53
double ns
nanosecond
Definition: core.cc:52
Tick curTick()
The universal simulation clock.
Definition: core.hh:44
double s
These variables equal the number of ticks in the unit of time they&#39;re named after in a double...
Definition: core.cc:49
Tick getClockFrequency()
Definition: core.cc:118
Tick Frequency
The simulated frequency of curTick(). (In ticks per second)
Definition: core.cc:46
double MHz
MHz.
Definition: core.cc:57
bool clockFrequencyFixed()
Definition: core.cc:109
void registerExitCallback(Callback *callback)
Register an exit callback.
Definition: core.cc:140
These are variables that are set based on the simulator frequency.
Definition: core.cc:44
uint64_t Tick
Tick count type.
Definition: types.hh:61
double ms
millisecond
Definition: core.cc:50
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
void fixClockFrequency()
Definition: core.cc:81
__thread EventQueue * _curEventQueue
The current event queue for the running thread.
Definition: eventq.cc:57
double Hz
These variables the inverse of above.
Definition: core.cc:55
void setOutputDir(const std::string &dir)
double us
microsecond
Definition: core.cc:51
Tick getCurTick() const
While curTick() is useful for any object assigned to this event queue, if an object that is assigned ...
Definition: eventq.hh:846

Generated on Mon Jun 8 2020 15:45:12 for gem5 by doxygen 1.8.13