SystemC
Recoding Infrastructure for SystemC v0.6.2 derived from Accellera SystemC 2.3.1
Accellera SystemC proof-of-concept library
Main Page
Namespaces
Classes
Files
File List
File Members
sysc
kernel
sc_module_name.h
Go to the documentation of this file.
1
/*****************************************************************************
2
3
The following code is derived, directly or indirectly, from the SystemC
4
source code Copyright (c) 1996-2014 by all Contributors.
5
All Rights reserved.
6
7
The contents of this file are subject to the restrictions and limitations
8
set forth in the SystemC Open Source License (the "License");
9
You may not use this file except in compliance with such restrictions and
10
limitations. You may obtain instructions on how to receive a copy of the
11
License at http://www.accellera.org/. Software distributed by Contributors
12
under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
13
ANY KIND, either express or implied. See the License for the specific
14
language governing rights and limitations under the License.
15
16
*****************************************************************************/
17
18
/*****************************************************************************
19
20
sc_module_name.h -- An object used to help manage object names
21
and hierarchy.
22
23
Original Author: Stan Y. Liao, Synopsys, Inc.
24
25
CHANGE LOG AT THE END OF THE FILE
26
*****************************************************************************/
27
28
// $Log: sc_module_name.h,v $
29
// Revision 1.5 2011/08/26 20:46:10 acg
30
// Andy Goodrich: moved the modification log to the end of the file to
31
// eliminate source line number skew when check-ins are done.
32
//
33
34
#ifndef SC_MODULE_NAME_H
35
#define SC_MODULE_NAME_H
36
37
38
namespace
sc_core {
39
40
class
sc_module;
41
class
sc_simcontext;
42
43
44
/**************************************************************************/
50
class
sc_module_name
51
{
52
friend
class
sc_module
;
53
54
// 04/07/2015 GL: a new sc_channel class is derived from sc_module
55
friend
class
sc_channel
;
56
57
friend
class
sc_object_manager
;
58
59
public
:
60
61
sc_module_name
(
const
char
* );
62
sc_module_name
(
const
sc_module_name
& );
63
64
~sc_module_name
();
65
66
operator
const
char
*()
const
;
67
68
protected
:
69
inline
void
clear_module
(
sc_module
* module_p );
70
inline
void
set_module
(
sc_module
* module_p );
71
72
private
:
73
74
const
char
* m_name;
75
sc_module
* m_module_p;
76
sc_module_name
* m_next;
77
sc_simcontext
* m_simc;
78
bool
m_pushed;
79
80
private
:
81
82
// disabled
83
sc_module_name
();
84
sc_module_name
& operator = (
const
sc_module_name
& );
85
};
86
87
inline
void
sc_module_name::clear_module
(
sc_module
* module_p )
88
{
89
assert( m_module_p == module_p );
90
m_module_p = 0;
91
}
92
93
inline
void
sc_module_name::set_module
(
sc_module
* module_p )
94
{
95
m_module_p = module_p;
96
}
97
98
}
// namespace sc_core
99
100
// Revision 1.4 2011/02/18 20:27:14 acg
101
// Andy Goodrich: Updated Copyrights.
102
//
103
// Revision 1.3 2011/02/13 21:47:37 acg
104
// Andy Goodrich: update copyright notice.
105
//
106
// Revision 1.2 2008/05/22 17:06:26 acg
107
// Andy Goodrich: updated copyright notice to include 2008.
108
//
109
// Revision 1.1.1.1 2006/12/15 20:20:05 acg
110
// SystemC 2.3
111
//
112
// Revision 1.4 2006/03/14 23:56:58 acg
113
// Andy Goodrich: This fixes a bug when an exception is thrown in
114
// sc_module::sc_module() for a dynamically allocated sc_module
115
// object. We are calling sc_module::end_module() on a module that has
116
// already been deleted. The scenario runs like this:
117
//
118
// a) the sc_module constructor is entered
119
// b) the exception is thrown
120
// c) the exception processor deletes the storage for the sc_module
121
// d) the stack is unrolled causing the sc_module_name instance to be deleted
122
// e) ~sc_module_name() calls end_module() with its pointer to the sc_module
123
// f) because the sc_module has been deleted its storage is corrupted,
124
// either by linking it to a free space chain, or by reuse of some sort
125
// g) the m_simc field is garbage
126
// h) the m_object_manager field is also garbage
127
// i) an exception occurs
128
//
129
// This does not happen for automatic sc_module instances since the
130
// storage for the module is not reclaimed its just part of the stack.
131
//
132
// I am fixing this by having the destructor for sc_module clear the
133
// module pointer in its sc_module_name instance. That cuts things at
134
// step (e) above, since the pointer will be null if the module has
135
// already been deleted. To make sure the module stack is okay, I call
136
// end-module() in ~sc_module in the case where there is an
137
// sc_module_name pointer lying around.
138
//
139
// Revision 1.3 2006/01/13 18:44:30 acg
140
// Added $Log to record CVS changes into the source.
141
142
#endif
sc_core::sc_module_name
Module name class.
Definition:
sc_module_name.h:50
sc_core::sc_module_name::clear_module
void clear_module(sc_module *module_p)
Definition:
sc_module_name.h:87
sc_core::sc_module_name::set_module
void set_module(sc_module *module_p)
Definition:
sc_module_name.h:93
sc_core::sc_object_manager
Definition:
sc_object_manager.h:47
sc_core::sc_simcontext
The simulation context.
Definition:
sc_simcontext.h:329
sc_core::sc_module
Base class for all structural entities.
Definition:
sc_module.h:83
sc_core::sc_channel
Base class for all hierarchical channels.
Definition:
sc_module.h:712
sc_core::sc_module_name::~sc_module_name
~sc_module_name()
Generated on Sun Sep 13 2020 16:45:51 for SystemC by
1.8.5