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

@@ -66,12 +66,12 @@ RealViewCtrl::read(PacketPtr pkt)
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 @@ RealViewOsc::RealViewOsc(const RealViewOscParams &p)
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 @@ RealViewOsc::clockPeriod(Tick clock_period)
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 @@ void
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

View File

@@ -271,7 +271,7 @@ Intel8254Timer::Counter::startup()
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;
}