41#include "debug/RVCTRL.hh"
73 pkt->
setLE((uint32_t)(clk));
78 pkt->
setLE((uint32_t)(clk100));
81 pkt->
setLE<uint32_t>(0);
84 pkt->
setLE<uint32_t>(0x00001F00);
87 pkt->
setLE<uint32_t>(0x00012C5C);
90 pkt->
setLE<uint32_t>(0x00002CC0);
93 pkt->
setLE<uint32_t>(0x00002C75);
96 pkt->
setLE<uint32_t>(0x00020211);
99 pkt->
setLE<uint32_t>(0x00002C75);
111 pkt->
setLE<uint32_t>(1);
118 pkt->
setLE<uint32_t>(0);
119 DPRINTF(RVCTRL,
"Read 0 from CfgCtrl\n");
122 warn(
"Tried to read RealView I/O at offset %#x that doesn't exist\n",
124 pkt->
setLE<uint32_t>(0);
152 warn_once(
"Ignoring write to reset control\n");
167 CfgCtrlReg req = pkt->
getLE<uint32_t>();
169 DPRINTF(RVCTRL,
"SCReg: write %#x to ctrl but not starting\n",
174 auto it_dev(
devices.find(req & CFG_CTRL_ADDR_MASK));
176 warn_once(
"SCReg: Access to unknown device "
177 "dcc%d:site%d:pos%d:fn%d:dev%d\n",
178 req.dcc, req.site, req.pos, req.func, req.dev);
186 DPRINTF(RVCTRL,
"SCReg: Writing %#x (ctrlWr %#x)\n",
192 DPRINTF(RVCTRL,
"SCReg: Reading %#x (ctrlRd %#x)\n",
198 warn(
"Tried to write RVIO at offset %#x (data %#x) that doesn't exist\n",
199 daddr, pkt->
getLE<uint32_t>());
220 uint8_t
dcc, uint16_t
dev,
231 fatal(
"Platform device dcc%d:site%d:pos%d:fn%d:dev%d "
232 "already registered.",
243 p.site,
p.position,
p.dcc,
p.device)
246 fatal(
"Oscillator frequency out of range: %f\n",
247 sim_clock::as_float::s / p.freq / 1E6);
258 m->updateClockPeriod();
276 panic_if(clock_period == 0,
"%s has a clock period of zero\n",
name());
280 m->updateClockPeriod();
286 m->updateClockPeriod();
293 DPRINTF(RVCTRL,
"Reading OSC frequency: %f MHz\n", freq / 1E6);
300 DPRINTF(RVCTRL,
"Setting new OSC frequency: %f MHz\n", freq / 1E6);
310 double t =
tm->getTemperature().toCelsius();
312 warn(
"Temperature below zero!\n");
313 return fmax(0,
t) * 1000000;
Addr pioAddr
Address that the device listens to.
BasicPioDevice(const Params &p, Addr size)
Tick pioDelay
Delay that the device experinces on an access.
Addr pioSize
Size that the device's address range.
std::vector< DerivedClockDomain * > children
Pointers to potential derived clock domains so we can propagate changes.
ClockDomain(const Params &p, VoltageDomain *voltage_domain)
Tick _clockPeriod
Pre-computed clock period in ticks.
Tick clockPeriod() const
Get the clock period.
std::vector< Clocked * > members
Pointers to members of this clock domain, so that when the clock period changes, we can update each m...
virtual std::string name() const
void setLE(T v)
Set the value in the data pointer to v as little endian.
void makeAtomicResponse()
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
Device(RealViewCtrl &parent, DeviceFunc func, uint8_t site, uint8_t pos, uint8_t dcc, uint16_t dev)
void registerDevice(DeviceFunc func, uint8_t site, uint8_t pos, uint8_t dcc, uint16_t dev, Device *handler)
Tick write(PacketPtr pkt) override
All writes are simply ignored.
uint32_t scData
This register contains the result from a system control reg access.
Tick read(PacketPtr pkt) override
Handle a read to the device.
uint32_t flags
This register is used for smp booting.
RealViewCtrl(const Params &p)
The constructor for RealView just registers itself with the MMU.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void serialize(CheckpointOut &cp) const override
Serialize an object.
std::map< uint32_t, Device * > devices
void startup() override
startup() is the final initialization call before simulation.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
RealViewOsc(const RealViewOscParams &p)
void write(uint32_t freq) override
uint32_t read() const override
void serialize(CheckpointOut &cp) const override
Serialize an object.
uint32_t read() const override
System * system
The system this RV device belongs to.
#define fatal(...)
This implements a cprintf based fatal() function.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
const Params & params() const
FloatType fmax(FloatType a, FloatType b)
double s
These variables equal the number of ticks in the unit of time they're named after in a double.
Copyright (c) 2024 Arm Limited All rights reserved.
Tick curTick()
The universal simulation clock.
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint64_t Tick
Tick count type.
Declaration of the Packet class.
This implements the simple real view registers on a PBXA9.
#define UNSERIALIZE_SCALAR(scalar)
#define SERIALIZE_SCALAR(scalar)