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 <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45435
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Maintainer: Gabe Black <gabe.black@gmail.com>
This commit is contained in:
Daniel R. Carvalho
2021-05-07 15:54:51 -03:00
committed by Daniel Carvalho
parent d5ad966da5
commit c487767cff
12 changed files with 39 additions and 35 deletions

View File

@@ -44,7 +44,9 @@ namespace sim_clock
/// 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 Hz;
double kHz;
double MHz;
double GHz;
} // namespace Float
} // namespace as_float
namespace Int {
Tick s;
@@ -63,7 +65,7 @@ Tick ms;
Tick us;
Tick ns;
Tick ps;
} // namespace Float
} // namespace as_float
} // namespace sim_clock
@@ -84,16 +86,16 @@ fixClockFrequency()
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;

View File

@@ -51,7 +51,9 @@ namespace sim_clock
{
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 kHz; ///< kHz
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.