ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
VirtualStructMemory.h
Go to the documentation of this file.
1/*
2
3 @copyright
4
5 <pre>
6
7 Copyright 2018 Infineon Technologies AG
8
9 This file is part of ETISS tool, see <https://github.com/tum-ei-eda/etiss>.
10
11 The initial version of this software has been created with the funding support by the German Federal
12 Ministry of Education and Research (BMBF) in the project EffektiV under grant 01IS13022.
13
14 Redistribution and use in source and binary forms, with or without modification, are permitted
15 provided that the following conditions are met:
16
17 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
18 the following disclaimer.
19
20 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
21 and the following disclaimer in the documentation and/or other materials provided with the distribution.
22
23 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse
24 or promote products derived from this software without specific prior written permission.
25
26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
27 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
28 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
29 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE.
34
35 </pre>
36
37 @author Chair of Electronic Design Automation, TUM
38
39 @version 0.1
40
41*/
42
43#ifndef ETISS_PLUGIN_VIRTUALSTRUCTMEMORY_H
44#define ETISS_PLUGIN_VIRTUALSTRUCTMEMORY_H
45
46#include "etiss/System.h"
47#include "etiss/VirtualStruct.h"
48
49namespace etiss
50{
51namespace plugin
52{
53
59{
60 public:
62 std::function<uint64_t(etiss::VirtualStruct::Field *, bool & /*dontMount*/)> mountPoint,
63 bool littleendian = true);
64 virtual ~VirtualStructMemory();
65
69 virtual bool read(bool debug, ETISS_CPU *cpu, etiss::uint64 addr, etiss::uint8 *buf, etiss::uint32 len);
73 virtual bool write(bool debug, ETISS_CPU *cpu, etiss::uint64 addr, etiss::uint8 *buf, etiss::uint32 len);
74
76
77 typedef std::map<uint64_t, std::pair<etiss::VirtualStruct::Field * /*field*/, size_t /*offset*/>> mapping_t;
81 inline const mapping_t &getMapping()
82 {
83 return memmap_;
84 }
85 std::set<etiss::VirtualStruct::Field *> getMappedFields();
86
87 inline uint64_t startAddr() { return startaddr_; }
88 inline uint64_t endAddr() { return endaddr_; }
89
90 protected:
91 private:
96 std::list<std::shared_ptr<VirtualStruct::Field>> references;
97};
98
99} // namespace plugin
100} // namespace etiss
101
102#endif // ETISS_PLUGIN_VIRTUALSTRUCTMEMORY_H
static __inline__ uint64_t
Definition arm_cde.h:31
A simple system, that implements the etiss::System interface.
Definition System.h:221
a Field instance represents e.g.
abstract representation of an module of a simulation which could be a embedded device of the cpu of a...
allows to read/write to a virtual structure as if it is a memory.
virtual bool read(bool debug, ETISS_CPU *cpu, etiss::uint64 addr, etiss::uint8 *buf, etiss::uint32 len)
virtual bool write(bool debug, ETISS_CPU *cpu, etiss::uint64 addr, etiss::uint8 *buf, etiss::uint32 len)
const etiss::VirtualStruct & mem_
std::list< std::shared_ptr< VirtualStruct::Field > > references
const mapping_t & getMapping()
returns the internal mapping
std::map< uint64_t, std::pair< etiss::VirtualStruct::Field *, size_t > > mapping_t
std::set< etiss::VirtualStruct::Field * > getMappedFields()
conatins a convinience class that can be wrapped as a ETISS_System structure
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
Definition Benchmark.h:53
basic cpu state structure needed for execution of any cpu architecture.
Definition CPU.h:89