gem5 v24.0.0.0
Loading...
Searching...
No Matches
mm.h
Go to the documentation of this file.
1
2// *******************************************************************
3// User-defined memory manager, which maintains a pool of transactions
4// *******************************************************************
5
6#include "tlm.h"
7
8class mm: public tlm::tlm_mm_interface
9{
11
12public:
13 mm() : free_list(0), empties(0) {}
14
15 virtual ~mm()
16 {
17 gp_t* ptr;
18
19 while (free_list)
20 {
21 ptr = free_list->trans;
22
23 // Delete generic payload and all extensions
24 sc_assert(ptr);
25 delete ptr;
26
28 }
29
30 while (empties)
31 {
32 access* x = empties;
34
35 // Delete free list access struct
36 delete x;
37 }
38 }
39
41 void free(gp_t* trans);
42
43private:
44 struct access
45 {
46 gp_t* trans;
47 access* next;
48 access* prev;
49 };
50
53};
54
56{
57 gp_t* ptr;
58 if (free_list)
59 {
60 ptr = free_list->trans;
63 }
64 else
65 {
66 ptr = new gp_t(this);
67 }
68 return ptr;
69}
70
71void mm::free(gp_t* trans)
72{
73 trans->reset(); // Delete auto extensions
74 if (!empties)
75 {
76 empties = new access;
78 empties->prev = 0;
79 if (free_list)
81 }
83 free_list->trans = trans;
85}
Definition mm.h:9
gp_t * allocate()
access * free_list
Definition mm.h:51
tlm::tlm_generic_payload gp_t
Definition mm.h:10
mm()
Definition mm.h:13
gp_t * allocate()
Definition mm.h:55
virtual ~mm()
Definition mm.h:15
void free(gp_t *trans)
access * empties
Definition mm.h:52
#define sc_assert(expr)
gp_t * trans
Definition mm.h:46
access * next
Definition mm.h:47
access * prev
Definition mm.h:48

Generated on Tue Jun 18 2024 16:24:07 for gem5 by doxygen 1.11.0