ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
MemMappedPeriph.h
Go to the documentation of this file.
1 
2 
3 #ifndef ETISS_PLUGIN_MEMMAPPEDPERIPH_H
4 #define ETISS_PLUGIN_MEMMAPPEDPERIPH_H
5 
7 
8 namespace etiss
9 {
10 
11 namespace plugin
12 {
13 
14 static inline etiss_uint8 unimpl_read()
15 {
16  etiss::log(etiss::WARNING, "Unimplemented MemMappedPeriph read");
17  return 0;
18 }
19 static inline void unimpl_write()
20 {
21  etiss::log(etiss::WARNING, "Unimplemented MemMappedPeriph write");
22 }
23 
26 {
28  size_t size = 0;
29 };
30 
33 {
34  public:
35  struct CustomHandle
36  {
37  ETISS_System *origSys = nullptr;
38  MemMappedPeriph *mmp = nullptr;
41  };
42 
43  public:
47  virtual MappedMemory getMappedMem() const = 0;
48 
49  virtual etiss_uint8 read8(etiss_uint64 addr) { return unimpl_read(); }
50  virtual etiss_uint16 read16(etiss_uint64 addr) { return unimpl_read(); }
51  virtual etiss_uint32 read32(etiss_uint64 addr) { return unimpl_read(); }
52  virtual etiss_uint64 read64(etiss_uint64 addr) { return unimpl_read(); }
53  virtual void write8(etiss_uint64 addr, etiss_uint8 val) { unimpl_write(); }
54  virtual void write16(etiss_uint64 addr, etiss_uint16 val) { unimpl_write(); }
55  virtual void write32(etiss_uint64 addr, etiss_uint32 val) { unimpl_write(); }
56  virtual void write64(etiss_uint64 addr, etiss_uint64 val) { unimpl_write(); }
57 
58  ETISS_System getWrapInfo(ETISS_System *origSystem) final;
59 
60  private:
62 };
63 
64 } // namespace plugin
65 
66 } // namespace etiss
67 
68 #endif
uint64_t etiss_uint64
Definition: types.h:96
uint32_t etiss_uint32
Definition: types.h:93
uint8_t etiss_uint8
Definition: types.h:87
uint16_t etiss_uint16
Definition: types.h:90
SystemWrapperPlugin to redirect data reads and writes to custom callbacks.
virtual etiss_uint8 read8(etiss_uint64 addr)
virtual void write64(etiss_uint64 addr, etiss_uint64 val)
virtual void write16(etiss_uint64 addr, etiss_uint16 val)
virtual MappedMemory getMappedMem() const =0
Defines in which memory region to map this peripheral.
virtual etiss_uint16 read16(etiss_uint64 addr)
virtual void write8(etiss_uint64 addr, etiss_uint8 val)
virtual etiss_uint64 read64(etiss_uint64 addr)
virtual etiss_uint32 read32(etiss_uint64 addr)
virtual void write32(etiss_uint64 addr, etiss_uint32 val)
ETISS_System getWrapInfo(ETISS_System *origSystem) final
Defines which System functions to wrap.
SystemWrapperPlugin that only wraps some of the System calls.
static void unimpl_write()
static etiss_uint8 unimpl_read()
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
Definition: Benchmark.h:53
@ WARNING
Definition: Misc.h:128
void log(Verbosity level, std::string msg)
write log message at the given level.
Definition: Misc.cpp:125
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Definition: opencl-c-base.h:62
memory access and time synchronization functions.
Definition: System.h:78
Represents a memory region that is associated with a MemMappedPeriph.