SystemC
3.0.0
Accellera SystemC proof-of-concept library
sysc
datatypes
misc
sc_value_base.h
Go to the documentation of this file.
1
/*****************************************************************************
2
3
Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4
more contributor license agreements. See the NOTICE file distributed
5
with this work for additional information regarding copyright ownership.
6
Accellera licenses this file to you under the Apache License, Version 2.0
7
(the "License"); you may not use this file except in compliance with the
8
License. You may obtain a copy of the License at
9
10
http://www.apache.org/licenses/LICENSE-2.0
11
12
Unless required by applicable law or agreed to in writing, software
13
distributed under the License is distributed on an "AS IS" BASIS,
14
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15
implied. See the License for the specific language governing
16
permissions and limitations under the License.
17
18
*****************************************************************************/
19
20
/*****************************************************************************
21
22
sc_value_base.h -- Base class for SystemC bit values.
23
24
Original Author: Andy Goodrich, Forte Design Systems
25
26
*****************************************************************************/
27
28
/*****************************************************************************
29
30
MODIFICATION LOG - modifiers, enter your name, affiliation, date and
31
changes you are making here.
32
33
Name, Affiliation, Date:
34
Description of Modification:
35
36
*****************************************************************************/
37
38
// $Log: sc_value_base.h,v $
39
// Revision 1.4 2011/08/29 18:04:32 acg
40
// Philipp A. Hartmann: miscellaneous clean ups.
41
//
42
// Revision 1.3 2011/08/24 22:05:48 acg
43
// Torsten Maehne: initialization changes to remove warnings.
44
//
45
// Revision 1.2 2011/06/28 21:23:04 acg
46
// Andy Goodrich: merging of SCV tree.
47
//
48
// Revision 1.1.1.1 2006/12/15 20:20:05 acg
49
// SystemC 2.3
50
//
51
// Revision 1.3 2006/01/13 18:54:01 acg
52
// Andy Goodrich: added $Log command so that CVS comments are reproduced in
53
// the source.
54
//
55
56
#ifndef SC_VALUE_BASE_H
57
#define SC_VALUE_BASE_H
58
59
60
#include "
sysc/datatypes/int/sc_nbdefs.h
"
61
62
namespace
sc_dt
63
{
64
65
class
sc_signed;
66
class
sc_unsigned;
67
68
// ----------------------------------------------------------------------------
69
// CLASS : sc_value_base
70
//
71
// Abstract base class of all SystemC native variables. It provides
72
// support for concatenation operations via a set of virtual methods.
73
// A general description of the methods appear with their default
74
// definitions in sc_object.cpp.
75
// ----------------------------------------------------------------------------
76
77
class
SC_API
sc_value_base
78
{
79
friend
class
sc_concatref
;
80
private
:
81
virtual
void
concat_clear_data(
bool
to_ones=
false
);
82
virtual
bool
concat_get_ctrl(
sc_digit
* dst_p,
int
low_i )
const
;
83
virtual
bool
concat_get_data(
sc_digit
* dst_p,
int
low_i )
const
;
84
virtual
uint64
concat_get_uint64()
const
;
85
virtual
int
concat_length(
bool
* xz_present_p=0)
const
;
86
virtual
void
concat_set(
int64
src,
int
low_i );
87
virtual
void
concat_set(
const
sc_signed
& src,
int
low_i );
88
virtual
void
concat_set(
const
sc_unsigned
& src,
int
low_i );
89
virtual
void
concat_set(
uint64
src,
int
low_i );
90
public
:
91
virtual
~sc_value_base
() {}
92
};
93
94
95
// ----------------------------------------------------------------------------
96
// CLASS : sc_generic_base
97
//
98
// Proxy class for user-defined value classes and other classes that
99
// are defined outside of SystemC.
100
// The class is utilized as a base class for the arbitrary class:
101
//
102
// class my_class : public sc_generic_base<my_class>
103
//
104
// The purpose of the class is to allow to_XXXX methods defined within that
105
// class so that assignments and casts from the arbitrary class to native
106
// SystemC types are possible. To interact correctly with the SystemC library
107
// the class derived from sc_generic_base must implement the following
108
// methods:
109
// (1) uint64 to_uint64() const
110
// (2) int64 to_int64() const
111
// (3) void to_sc_unsigned( sc_unsigned& ) const
112
// (4) void to_sc_signed( sc_signed& ) const
113
// ----------------------------------------------------------------------------
114
template
<
class
T >
115
class
sc_generic_base
{
116
public
:
117
inline
const
T*
operator->
()
const
118
{
119
return
(
const
T*)
this
;
120
}
121
inline
T*
operator->
()
122
{
123
return
(T*)
this
;
124
}
125
};
126
127
}
// namespace sc_dt
128
129
#endif
sc_nbdefs.h
SC_API
#define SC_API
Definition:
sc_cmnhdr.h:148
sc_dt
Definition:
sc_signal_ifs.h:38
sc_dt::uint64
unsigned long long uint64
Definition:
sc_nbdefs.h:216
sc_dt::sc_digit
unsigned int sc_digit
Definition:
sc_nbdefs.h:161
sc_dt::int64
long long int64
Definition:
sc_nbdefs.h:215
sc_dt::sc_signed
Definition:
sc_signed.h:552
sc_dt::sc_unsigned
Definition:
sc_unsigned.h:545
sc_dt::sc_concatref
Definition:
sc_concatref.h:108
sc_dt::sc_value_base
Definition:
sc_value_base.h:78
sc_dt::sc_value_base::~sc_value_base
virtual ~sc_value_base()
Definition:
sc_value_base.h:91
sc_dt::sc_generic_base
Definition:
sc_value_base.h:115
sc_dt::sc_generic_base::operator->
const T * operator->() const
Definition:
sc_value_base.h:117
Generated on Fri Aug 16 2024 16:36:33 for SystemC by
1.9.4