gem5
v19.0.0.0
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
m
n
o
p
r
s
t
u
v
w
x
+
Enumerations
a
b
c
d
e
f
i
l
m
o
p
r
s
t
v
x
+
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
+
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
w
+
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Related Functions
:
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
+
Files
File List
+
File Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
z
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
z
+
Typedefs
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
+
Enumerations
a
b
c
d
e
f
g
i
l
m
o
p
r
s
t
v
w
+
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
+
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
systemc
tlm_bridge
sc_mm.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015, University of Kaiserslautern
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are
7
* met:
8
*
9
* 1. Redistributions of source code must retain the above copyright notice,
10
* this list of conditions and the following disclaimer.
11
*
12
* 2. Redistributions in binary form must reproduce the above copyright
13
* notice, this list of conditions and the following disclaimer in the
14
* documentation and/or other materials provided with the distribution.
15
*
16
* 3. Neither the name of the copyright holder nor the names of its
17
* contributors may be used to endorse or promote products derived from
18
* this software without specific prior written permission.
19
*
20
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
24
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
*
32
* Authors:
33
* Robert Gernhardt
34
* Matthias Jung
35
*/
36
37
#include "
systemc/tlm_bridge/sc_mm.hh
"
38
39
namespace
Gem5SystemC
40
{
41
42
MemoryManager::MemoryManager
() : numberOfAllocations(0), numberOfFrees(0) {}
43
44
MemoryManager::~MemoryManager
()
45
{
46
for
(
gp
*payload:
freePayloads
) {
47
delete
payload;
48
numberOfFrees
++;
49
}
50
}
51
52
gp
*
53
MemoryManager::allocate
()
54
{
55
if
(
freePayloads
.empty()) {
56
numberOfAllocations
++;
57
return
new
gp
(
this
);
58
}
else
{
59
gp
*result =
freePayloads
.back();
60
freePayloads
.pop_back();
61
return
result;
62
}
63
}
64
65
void
66
MemoryManager::free
(
gp
*payload)
67
{
68
payload->
reset
();
// clears all extensions
69
freePayloads
.push_back(payload);
70
}
71
72
}
// namespace Gem5SystemC
Gem5SystemC::MemoryManager::MemoryManager
MemoryManager()
Definition:
sc_mm.cc:42
tlm::tlm_generic_payload
Definition:
gp.hh:116
Gem5SystemC
Definition:
sc_ext.cc:42
Gem5SystemC::MemoryManager::free
virtual void free(gp *payload)
Definition:
sc_mm.cc:66
Gem5SystemC::MemoryManager::numberOfFrees
unsigned int numberOfFrees
Definition:
sc_mm.hh:59
tlm::tlm_generic_payload::reset
void reset()
Definition:
gp.cc:117
sc_mm.hh
Gem5SystemC::MemoryManager::allocate
virtual gp * allocate()
Definition:
sc_mm.cc:53
Gem5SystemC::MemoryManager::~MemoryManager
virtual ~MemoryManager()
Definition:
sc_mm.cc:44
Gem5SystemC::MemoryManager::numberOfAllocations
unsigned int numberOfAllocations
Definition:
sc_mm.hh:58
Gem5SystemC::MemoryManager::freePayloads
std::vector< gp * > freePayloads
Definition:
sc_mm.hh:60
Gem5SystemC::gp
tlm::tlm_generic_payload gp
Definition:
sc_mm.hh:47
Generated on Fri Feb 28 2020 16:27:05 for gem5 by
doxygen
1.8.13