10#include "sparta/memory/AddressTypes.hpp"
18 class DMIBlockingMemoryIF;
122 const void *in_supplement=
nullptr,
123 void *out_supplement=
nullptr) {
132 return tryRead_(addr, size, buf, in_supplement, out_supplement);
156 const void *in_supplement=
nullptr,
157 void *out_supplement=
nullptr) {
158 if(!
tryRead(addr, size, buf, in_supplement, out_supplement)){
189 const void *in_supplement=
nullptr,
190 void *out_supplement=
nullptr) {
199 return tryWrite_(addr, size, buf, in_supplement, out_supplement);
224 const void *in_supplement=
nullptr,
225 void *out_supplement=
nullptr) {
226 if(!
tryWrite(addr, size, buf, in_supplement, out_supplement)){
256 std::stringstream ss;
257 ss <<
"<BlockingMemoryIF size:0x" << std::hex <<
total_range_ <<
" bytes>";
279 const void *in_supplement,
280 void *out_supplement) = 0;
293 const void *in_supplement,
294 void *out_supplement) = 0;
306 const uint8_t *buf)
override {
307 return tryWrite_(addr, size, buf,
nullptr,
nullptr);
std::ostream & operator<<(std::ostream &out, const sparta::memory::BlockingMemoryIF &mi)
BlockingMemoryIF stream operator.
File that contains DebugMemoryIF.
File that contains some exception types related to memory interfaces.
Pure-virtual memory interface which represents a simple, immediately accessible (blocking) address-sp...
std::string stringize(bool pretty=false) const
Render description of this BlockingMemoryIF as a string.
virtual bool tryRead_(addr_t addr, addr_t size, uint8_t *buf, const void *in_supplement, void *out_supplement)=0
Implements tryRead.
virtual bool tryRead(addr_t addr, addr_t size, uint8_t *buf, const void *in_supplement=nullptr, void *out_supplement=nullptr)
Attempt to read memory of size size at address addr.
virtual void invalidateAllDMI()
Invalidate all DMI's.
virtual bool tryWrite_(addr_t addr, addr_t size, const uint8_t *buf, const void *in_supplement, void *out_supplement)=0
Implements tryWrite.
BlockingMemoryIF(const std::string &desc, addr_t block_size, const DebugMemoryIF::AccessWindow &window, TranslationIF *transif=nullptr)
Construct a blocking memory interface.
virtual DMIBlockingMemoryIF * getDMI(addr_t addr, addr_t size)
Get a DMI blocking interface to access the given address/size.
void read(addr_t addr, addr_t size, uint8_t *buf, const void *in_supplement=nullptr, void *out_supplement=nullptr)
Attempts to read memory.
virtual bool tryWrite(addr_t addr, addr_t size, const uint8_t *buf, const void *in_supplement=nullptr, void *out_supplement=nullptr)
Attempt to write memory of size size at address addr.
virtual bool tryPoke_(addr_t addr, addr_t size, const uint8_t *buf) override
Override of DebugMemoryIF::tryPoke_ which forwards the call to tryWrite_.
void write(addr_t addr, addr_t size, const uint8_t *buf, const void *in_supplement=nullptr, void *out_supplement=nullptr)
Attempts to write memory.
Class that provides a BlockingMemoryIF over a raw pointer.
Memory interface which represents a simple, immediately accessible (blocking) address-space with supp...
bool doesAccessSpan(addr_t addr, addr_t size) const noexcept
Determines if the given address spans block boundaries defined for this interface....
bool isInAccessWindows(addr_t addr, addr_t size) const
Determines if the range [addr, addr+size) is within the access windows for this interface.
addr_t total_range_
Range of addresses from highest accessible to lowest.
void verifyNoBlockSpan(addr_t addr, addr_t size) const
Verifies that the given address does not span block boundaries defined for this interface.
void verifyInAccessWindows(addr_t addr, addr_t size) const
Verifies that the range [addr, addr+size) is within the access windows for this interface.
Error while attempting to read some memory object or interface.
Blocking translation interface with 1:1 translation unless subclassed.
uint64_t addr_t
Type for generic address representation in generic interfaces, errors and printouts within SPARTA.
Macros for handling exponential backoff.
Defines an access window within this interface. Accesses through a memory interface are constrained t...