ETISS 0.11.2
ExtendableTranslatingInstructionSetSimulator(version0.11.2)
Loading...
Searching...
No Matches
PTEFormatBuilder.h
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
2//
3// This file is part of ETISS. It is licensed under the BSD 3-Clause License; you may not use this file except in
4// compliance with the License. You should have received a copy of the license along with this project. If not, see the
5// LICENSE file.
6
7#ifndef ETISS_INCLUDE_MM_PTEFORMATBUILDER_H_
8#define ETISS_INCLUDE_MM_PTEFORMATBUILDER_H_
9
10#include <iostream>
11#include <map>
12#include <memory>
13
14#include "etiss/mm/PTEFormat.h"
15
16namespace etiss
17{
18namespace mm
19{
20
25{
26 public:
31 {
32 static std::shared_ptr<PTEFormatBuilder> builder(new PTEFormatBuilder((PTEFormat::Instance())));
33 return *builder;
34 }
35
40 {
41 format_.AddBitField("PPN", begin, end);
42 return *this;
43 }
44
50 {
51 format_.AddBitField("PAGEOFFSET", begin, end);
52 return *this;
53 }
54
58 PTEFormatBuilder &AddFlag(std::string name, uint32_t begin, uint32_t end)
59 {
60 format_.AddBitField(name, begin, end);
61 return *this;
62 }
63
67 PTEFormatBuilder &AddFlag(std::string name, uint32_t pos)
68 {
69 format_.AddBitField(name, pos, pos);
70 return *this;
71 }
72
73 private:
74 PTEFormatBuilder(PTEFormat &format) : format_(format) {}
75
77
78 friend class PTEFormat;
79};
80
81} // namespace mm
82} // namespace etiss
83
84#endif
static __inline__ uint32_t
Definition arm_cde.h:25
Sigleton builder utility to build up customized PTE format.
PTEFormatBuilder & AddPageOffset(uint32_t begin, uint32_t end)
Add mandatory bit field for page size offset (Not included in PTE neither in PTE format)
static PTEFormatBuilder & Instance()
Get the singleton instance.
PTEFormatBuilder & AddPPNBitField(uint32_t begin, uint32_t end)
Add mandatory bit field, Physical Page Number (PPN), for PTE.
PTEFormatBuilder & AddFlag(std::string name, uint32_t pos)
Add optional bit field for protection flag in PTE.
PTEFormatBuilder(PTEFormat &format)
PTEFormatBuilder & AddFlag(std::string name, uint32_t begin, uint32_t end)
Add optional bit field for protection flag in PTE.
static PTEFormat & Instance()
Get the singleton instance.
Definition PTEFormat.h:34
void AddBitField(std::string name, uint32_t begin, uint32_t end)
Called only by PTEFormatBuilder.
Definition PTEFormat.cpp:19
forwards: include/jit/*
Definition Benchmark.h:17