Daniel Carvalho has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/45435 )
Change subject: sim,misc: Rename Float namespace as as_float
......................................................................
sim,misc: Rename Float namespace as as_float
As part of recent decisions regarding namespace
naming conventions, all namespaces will be changed
to snake case.
sim_clock::Float became sim_clock::as_float.
"as_float" was chosen because "float" is a reserved
keywords, and this namespace acts as a selector of
how to read the internal variables. Another
possibility to resolve this would be to remove the
namespaces "Float" and "Int" and use unions instead.
Change-Id: I7b3d9c6e9ab547493d5596c7eda080a25509a730
Signed-off-by: Daniel R. Carvalho <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45435
Tested-by: kokoro <[email protected]>
Reviewed-by: Hoa Nguyen <[email protected]>
Maintainer: Gabe Black <[email protected]>
---
M src/arch/arm/semihosting.cc
M src/base/time.cc
M src/cpu/kvm/timer.hh
M src/cpu/kvm/x86_cpu.cc
M src/dev/arm/rv_ctrl.cc
M src/dev/intel_8254_timer.cc
M src/mem/comm_monitor.cc
M src/mem/qos/mem_ctrl.cc
M src/sim/core.cc
M src/sim/core.hh
M src/systemc/core/sc_time.cc
M src/systemc/utils/vcd.cc
12 files changed, 39 insertions(+), 35 deletions(-)
Approvals:
Hoa Nguyen: Looks good to me, approved
Gabe Black: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/arch/arm/semihosting.cc b/src/arch/arm/semihosting.cc
index e0f49ad..4ccf328 100644
--- a/src/arch/arm/semihosting.cc
+++ b/src/arch/arm/semihosting.cc
@@ -506,7 +506,7 @@
ArmSemihosting::RetErrno
ArmSemihosting::callTime(ThreadContext *tc)
{
- return retOK(timeBase + round(curTick() / sim_clock::Float::s));
+ return retOK(timeBase + round(curTick() / sim_clock::as_float::s));
}
ArmSemihosting::RetErrno
diff --git a/src/base/time.cc b/src/base/time.cc
index 35e1260..080c43d 100644
--- a/src/base/time.cc
+++ b/src/base/time.cc
@@ -55,7 +55,7 @@
{
uint64_t secs = ticks / sim_clock::Frequency;
ticks -= secs * sim_clock::Frequency;
- uint64_t nsecs = static_cast<uint64_t>(ticks * sim_clock::Float::GHz);
+ uint64_t nsecs = static_cast<uint64_t>(ticks *
sim_clock::as_float::GHz);
set(secs, nsecs);
}
@@ -63,7 +63,7 @@
Time::getTick() const
{
return sec() * sim_clock::Frequency +
- static_cast<uint64_t>(nsec() * sim_clock::Float::ns);
+ static_cast<uint64_t>(nsec() * sim_clock::as_float::ns);
}
std::string
diff --git a/src/cpu/kvm/timer.hh b/src/cpu/kvm/timer.hh
index cbfc9e4..0f69849 100644
--- a/src/cpu/kvm/timer.hh
+++ b/src/cpu/kvm/timer.hh
@@ -129,7 +129,7 @@
* @return Nanoseconds executed in VM converted to simulation ticks
*/
Tick ticksFromHostNs(uint64_t ns) {
- return ns * hostFactor * sim_clock::Float::ns;
+ return ns * hostFactor * sim_clock::as_float::ns;
}
protected:
@@ -147,7 +147,7 @@
* @return Simulation ticks converted into nanoseconds on the host
*/
uint64_t hostNs(Tick ticks) {
- return ticks / (sim_clock::Float::ns * hostFactor);
+ return ticks / (sim_clock::as_float::ns * hostFactor);
}
/**
diff --git a/src/cpu/kvm/x86_cpu.cc b/src/cpu/kvm/x86_cpu.cc
index aae75fe..870b293 100644
--- a/src/cpu/kvm/x86_cpu.cc
+++ b/src/cpu/kvm/x86_cpu.cc
@@ -1248,7 +1248,7 @@
// Limit the run to 1 millisecond. That is hopefully enough to
// reach an interrupt window. Otherwise, we'll just try again
// later.
- return BaseKvmCPU::kvmRun(1 * sim_clock::Float::ms);
+ return BaseKvmCPU::kvmRun(1 * sim_clock::as_float::ms);
} else {
DPRINTF(Drain, "kvmRunDrain: Delivering pending IO\n");
diff --git a/src/dev/arm/rv_ctrl.cc b/src/dev/arm/rv_ctrl.cc
index 63000bf..054a796 100644
--- a/src/dev/arm/rv_ctrl.cc
+++ b/src/dev/arm/rv_ctrl.cc
@@ -66,12 +66,12 @@
break;
case Clock24:
Tick clk;
- clk = sim_clock::Float::MHz * curTick() * 24;
+ clk = sim_clock::as_float::MHz * curTick() * 24;
pkt->setLE((uint32_t)(clk));
break;
case Clock100:
Tick clk100;
- clk100 = sim_clock::Float::MHz * curTick() * 100;
+ clk100 = sim_clock::as_float::MHz * curTick() * 100;
pkt->setLE((uint32_t)(clk100));
break;
case Flash:
@@ -239,9 +239,9 @@
RealViewCtrl::Device(*p.parent, RealViewCtrl::FUNC_OSC,
p.site, p.position, p.dcc, p.device)
{
- if (sim_clock::Float::s / p.freq > UINT32_MAX) {
+ if (sim_clock::as_float::s / p.freq > UINT32_MAX) {
fatal("Oscillator frequency out of range: %f\n",
- sim_clock::Float::s / p.freq / 1E6);
+ sim_clock::as_float::s / p.freq / 1E6);
}
_clockPeriod = p.freq;
@@ -286,7 +286,7 @@
uint32_t
RealViewOsc::read() const
{
- const uint32_t freq(sim_clock::Float::s / _clockPeriod);
+ const uint32_t freq(sim_clock::as_float::s / _clockPeriod);
DPRINTF(RVCTRL, "Reading OSC frequency: %f MHz\n", freq / 1E6);
return freq;
}
@@ -295,7 +295,7 @@
RealViewOsc::write(uint32_t freq)
{
DPRINTF(RVCTRL, "Setting new OSC frequency: %f MHz\n", freq / 1E6);
- clockPeriod(sim_clock::Float::s / freq);
+ clockPeriod(sim_clock::as_float::s / freq);
}
uint32_t
diff --git a/src/dev/intel_8254_timer.cc b/src/dev/intel_8254_timer.cc
index 6035639..44f266e 100644
--- a/src/dev/intel_8254_timer.cc
+++ b/src/dev/intel_8254_timer.cc
@@ -271,7 +271,7 @@
Intel8254Timer::Counter::CounterEvent::CounterEvent(Counter* c_ptr)
{
- interval = (Tick)(sim_clock::Float::s / 1193180.0);
+ interval = (Tick)(sim_clock::as_float::s / 1193180.0);
counter = c_ptr;
}
diff --git a/src/mem/comm_monitor.cc b/src/mem/comm_monitor.cc
index f33f00d..34e403c 100644
--- a/src/mem/comm_monitor.cc
+++ b/src/mem/comm_monitor.cc
@@ -49,7 +49,7 @@
cpuSidePort(name() + "-cpu_side_port", *this),
samplePeriodicEvent([this]{ samplePeriodic(); }, name()),
samplePeriodTicks(params.sample_period),
- samplePeriod(params.sample_period / sim_clock::Float::s),
+ samplePeriod(params.sample_period / sim_clock::as_float::s),
stats(this, params)
{
DPRINTF(CommMonitor,
diff --git a/src/mem/qos/mem_ctrl.cc b/src/mem/qos/mem_ctrl.cc
index 9f8faf0..8de78cb 100644
--- a/src/mem/qos/mem_ctrl.cc
+++ b/src/mem/qos/mem_ctrl.cc
@@ -184,7 +184,7 @@
}
// Compute latency
double latency = (double) (curTick() + delay - requestTime)
- / sim_clock::Float::s;
+ / sim_clock::as_float::s;
if (latency > 0) {
// Record per-priority latency stats
diff --git a/src/sim/core.cc b/src/sim/core.cc
index 1ef67b4..a870868 100644
--- a/src/sim/core.cc
+++ b/src/sim/core.cc
@@ -44,7 +44,9 @@
/// The simulated frequency of curTick(). (In ticks per second)
Tick Frequency;
-namespace Float {
+GEM5_DEPRECATED_NAMESPACE(Float, as_float);
+namespace as_float
+{
double s;
double ms;
double us;
@@ -55,7 +57,7 @@
double kHz;
double MHz;
double GHz;
-} // namespace Float
+} // namespace as_float
namespace Int {
Tick s;
@@ -63,7 +65,7 @@
Tick us;
Tick ns;
Tick ps;
-} // namespace Float
+} // namespace as_float
} // namespace sim_clock
@@ -84,16 +86,16 @@
using namespace sim_clock;
Frequency = _ticksPerSecond;
- Float::s = static_cast<double>(Frequency);
- Float::ms = Float::s / 1.0e3;
- Float::us = Float::s / 1.0e6;
- Float::ns = Float::s / 1.0e9;
- Float::ps = Float::s / 1.0e12;
+ as_float::s = static_cast<double>(Frequency);
+ as_float::ms = as_float::s / 1.0e3;
+ as_float::us = as_float::s / 1.0e6;
+ as_float::ns = as_float::s / 1.0e9;
+ as_float::ps = as_float::s / 1.0e12;
- Float::Hz = 1.0 / Float::s;
- Float::kHz = 1.0 / Float::ms;
- Float::MHz = 1.0 / Float::us;
- Float::GHz = 1.0 / Float::ns;
+ as_float::Hz = 1.0 / as_float::s;
+ as_float::kHz = 1.0 / as_float::ms;
+ as_float::MHz = 1.0 / as_float::us;
+ as_float::GHz = 1.0 / as_float::ns;
Int::s = Frequency;
Int::ms = Int::s / 1000;
diff --git a/src/sim/core.hh b/src/sim/core.hh
index 96cb58c..df47727 100644
--- a/src/sim/core.hh
+++ b/src/sim/core.hh
@@ -51,7 +51,9 @@
{
extern Tick Frequency; ///< The number of ticks that equal one second
-namespace Float {
+GEM5_DEPRECATED_NAMESPACE(Float, as_float);
+namespace as_float
+{
/** These variables equal the number of ticks in the unit of time they're
* named after in a double.
@@ -72,7 +74,7 @@
extern double MHz; ///< MHz
extern double GHz; ///< GHz
/** @}*/
-} // namespace Float
+} // namespace as_float
/** These variables equal the number of ticks in the unit of time they're
* named after in a 64 bit integer.
diff --git a/src/systemc/core/sc_time.cc b/src/systemc/core/sc_time.cc
index 0c7e3a5..4c620e1 100644
--- a/src/systemc/core/sc_time.cc
+++ b/src/systemc/core/sc_time.cc
@@ -50,7 +50,7 @@
if (d != 0)
fixClockFrequency();
- double scale = sc_gem5::TimeUnitScale[tu] * sim_clock::Float::s;
+ double scale = sc_gem5::TimeUnitScale[tu] * sim_clock::as_float::s;
// Accellera claims there is a linux bug, and that these next two
// lines work around them.
volatile double tmp = d * scale + 0.5;
@@ -94,13 +94,13 @@
sc_time::sc_time(double d, bool scale)
{
- double scaler = scale ? defaultUnit : sim_clock::Float::Hz;
+ double scaler = scale ? defaultUnit : sim_clock::as_float::Hz;
set(this, d * scaler, SC_SEC);
}
sc_time::sc_time(sc_dt::uint64 v, bool scale)
{
- double scaler = scale ? defaultUnit : sim_clock::Float::Hz;
+ double scaler = scale ? defaultUnit : sim_clock::as_float::Hz;
set(this, static_cast<double>(v) * scaler, SC_SEC);
}
@@ -125,7 +125,7 @@
double
sc_time::to_seconds() const
{
- return to_double() * sim_clock::Float::Hz;
+ return to_double() * sim_clock::as_float::Hz;
}
const std::string
@@ -377,7 +377,7 @@
defaultUnit = d * sc_gem5::TimeUnitScale[tu];
specified = true;
- double resolution = sim_clock::Float::Hz;
+ double resolution = sim_clock::as_float::Hz;
if (resolution == 0.0)
resolution = sc_gem5::TimeUnitScale[SC_PS];
if (defaultUnit < resolution) {
diff --git a/src/systemc/utils/vcd.cc b/src/systemc/utils/vcd.cc
index 7fd9ba1..827e1a1 100644
--- a/src/systemc/utils/vcd.cc
+++ b/src/systemc/utils/vcd.cc
@@ -254,7 +254,7 @@
std::string timedump_comment =
csprintf("All initial values are dumped below at time "
"%g sec = %g timescale units.",
- static_cast<double>(now) / sim_clock::Float::s,
+ static_cast<double>(now) / sim_clock::as_float::s,
static_cast<double>(now / timeUnitTicks));
writeComment(timedump_comment);
6 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the
submitted one.
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/45435
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I7b3d9c6e9ab547493d5596c7eda080a25509a730
Gerrit-Change-Number: 45435
Gerrit-PatchSet: 9
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Hoa Nguyen <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s