gem5  v20.0.0.3
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 
46 const Tick retryTime = 1000;
47 
50 namespace SimClock {
51 extern Tick Frequency;
52 
53 namespace Float {
54 
59 extern double s;
60 extern double ms;
61 extern double us;
62 extern double ns;
63 extern double ps;
64 
69 extern double Hz;
70 extern double kHz;
71 extern double MHz;
72 extern double GHz;
73 
74 } // namespace Float
75 
81 namespace Int {
82 extern Tick s;
83 extern Tick ms;
84 extern Tick us;
85 extern Tick ns;
86 extern Tick ps;
87 
88 } // namespace Int
89 } // namespace SimClock
92 void fixClockFrequency();
93 bool clockFrequencyFixed();
94 
95 void setClockFrequency(Tick ticksPerSecond);
96 Tick getClockFrequency(); // Ticks per second.
97 
98 void setOutputDir(const std::string &dir);
99 
100 class Callback;
101 void registerExitCallback(Callback *callback);
102 void doExitCleanup();
103 
104 #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:56
const Tick retryTime
Definition: core.hh:46
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:782

Generated on Fri Jul 3 2020 15:53:04 for gem5 by doxygen 1.8.13