41#ifndef __ARCH_GENERIC_MEMHELPERS_HH__
42#define __ARCH_GENERIC_MEMHELPERS_HH__
59 return xc->initiateMemRead(
addr, size,
flags, byte_enable);
65template <
class XC,
class MemT>
76template <ByteOrder Order,
class MemT>
80 mem = pkt->
get<MemT>(Order);
106 return xc->readMem(
addr,
mem, size,
flags, byte_enable);
110template <ByteOrder Order,
class XC,
class MemT>
115 memset(&
mem, 0,
sizeof(
mem));
118 sizeof(MemT),
flags, byte_enable);
128template <ByteOrder Order,
class XC,
class MemT>
133 memset(&
mem, 0, size);
136 size,
flags, byte_enable);
145template <
class XC,
class MemT>
154template <
class XC,
class MemT>
164template <
class XC,
class MemT>
179 return xc->writeMem(
mem, size,
addr,
flags, res, byte_enable);
182template <ByteOrder Order,
class XC,
class MemT>
193 sizeof(MemT),
flags, res, byte_enable);
196template <ByteOrder Order,
class XC,
class MemT>
207 size,
flags, res, byte_enable);
210template <
class XC,
class MemT>
219template <
class XC,
class MemT>
228template <
class XC,
class MemT>
244 return xc->writeMem(
mem, size,
addr,
flags, res, byte_enable);
247template <ByteOrder Order,
class XC,
class MemT>
255 MemT host_mem =
htog(
mem, Order);
258 addr,
sizeof(MemT),
flags, res, byte_enable);
259 if (fault ==
NoFault && res != NULL) {
261 *(MemT *)res =
gtoh(*(MemT *)res, Order);
263 *res =
gtoh(*res, Order);
268template <ByteOrder Order,
class XC,
class MemT>
276 MemT host_mem =
htog(
mem, Order);
280 if (fault ==
NoFault && res != NULL) {
282 *(MemT *)res =
gtoh(*(MemT *)res, Order);
284 *res =
gtoh(*res, Order);
289template <
class XC,
class MemT>
298template <
class XC,
class MemT>
307template <
class XC,
class MemT>
317template <ByteOrder Order,
class XC,
class MemT>
325 memset(&
mem, 0,
sizeof(
mem));
339template <
class XC,
class MemT>
348template <
class XC,
class MemT>
358template <
class XC,
class MemT>
365 return xc->initiateMemAMO(
addr,
sizeof(MemT),
flags, std::move(amo_op));
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
T get(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness.
@ MEM_SWAP
This request is for a memory swap.
void setData(std::array< T, N > d)
std::unique_ptr< AtomicOpFunctor > AtomicOpFunctorPtr
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Fault readMemAtomicBE(XC *xc, trace::InstRecord *traceData, Addr addr, MemT &mem, Request::Flags flags)
std::shared_ptr< FaultBase > Fault
void getMemLE(PacketPtr pkt, MemT &mem, trace::InstRecord *traceData)
Fault initiateMemRead(XC *xc, Addr addr, std::size_t size, Request::Flags flags, const std::vector< bool > &byte_enable)
Fault amoMemAtomicBE(XC *xc, trace::InstRecord *traceData, MemT &mem, Addr addr, Request::Flags flags, AtomicOpFunctor *_amo_op)
Fault writeMemTimingLE(XC *xc, trace::InstRecord *traceData, MemT mem, Addr addr, Request::Flags flags, uint64_t *res)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
T gtoh(T value, ByteOrder guest_byte_order)
Fault writeMemAtomicBE(XC *xc, trace::InstRecord *traceData, const MemT &mem, Addr addr, Request::Flags flags, uint64_t *res)
void getMemBE(PacketPtr pkt, MemT &mem, trace::InstRecord *traceData)
Fault writeMemAtomic(XC *xc, uint8_t *mem, Addr addr, std::size_t size, Request::Flags flags, uint64_t *res, const std::vector< bool > &byte_enable)
Write to memory in atomic mode.
Fault writeMemTiming(XC *xc, uint8_t *mem, Addr addr, std::size_t size, Request::Flags flags, uint64_t *res, const std::vector< bool > &byte_enable)
Write to memory in timing mode.
Fault amoMemAtomic(XC *xc, trace::InstRecord *traceData, MemT &mem, Addr addr, Request::Flags flags, AtomicOpFunctor *_amo_op)
Do atomic read-modify-write (AMO) in atomic mode.
Fault readMemAtomicLE(XC *xc, trace::InstRecord *traceData, Addr addr, MemT &mem, Request::Flags flags)
Fault initiateMemAMO(XC *xc, trace::InstRecord *traceData, Addr addr, MemT &mem, Request::Flags flags, AtomicOpFunctor *_amo_op)
Do atomic read-modify-wrote (AMO) in timing mode.
Fault writeMemAtomicLE(XC *xc, trace::InstRecord *traceData, const MemT &mem, Addr addr, Request::Flags flags, uint64_t *res)
T htog(T value, ByteOrder guest_byte_order)
Fault writeMemTimingBE(XC *xc, trace::InstRecord *traceData, MemT mem, Addr addr, Request::Flags flags, uint64_t *res)
void getMem(PacketPtr pkt, MemT &mem, trace::InstRecord *traceData)
Extract the data returned from a timing mode read.
Fault amoMemAtomicLE(XC *xc, trace::InstRecord *traceData, MemT &mem, Addr addr, Request::Flags flags, AtomicOpFunctor *_amo_op)
constexpr decltype(nullptr) NoFault
Fault readMemAtomic(XC *xc, Addr addr, uint8_t *mem, std::size_t size, Request::Flags flags, const std::vector< bool > &byte_enable)
Read from memory in atomic mode.
Declaration of the Packet class.
Declaration of a request, the overall memory request consisting of the parts of the request that are ...