SystemC
3.0.0
Accellera SystemC proof-of-concept library
sysc
datatypes
int
sc_uint_inlines.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_uint_inlines.h -- This file contains inline implementations that require
23
the other "int" headers to have been included before its
24
contents can be resolved.
25
26
Original Author: Andy Goodrich, Cadence Design Systems
27
28
*****************************************************************************/
29
30
#ifndef SC_UINT_INLINES_H
31
#define SC_UINT_INLINES_H
32
33
namespace
sc_dt
{
34
35
template
<
int
W>
36
template
<
int
W1>
37
inline
38
const
sc_uint<W>
&
sc_uint<W>::operator =
(
const
sc_bigint<W1>
& source )
39
{
40
if
( W1 < 33 ) {
41
m_val = (int)*source.
digit
;
42
}
43
else
{
44
m_val = ( (
int64
)source.
digit
[1] <<
BITS_PER_DIGIT
) | *source.
digit
;
45
}
46
return
*
this
;
47
}
48
49
template
<
int
W>
50
template
<
int
W1>
51
inline
52
const
sc_uint<W>
&
sc_uint<W>::operator =
(
const
sc_biguint<W1>
& source )
53
{
54
if
( W1 < 33 ) {
55
m_val = *source.
digit
;
56
}
57
else
{
58
m_val = ( (
uint64
)source.
digit
[1] <<
BITS_PER_DIGIT
) | *source.
digit
;
59
}
60
return
*
this
;
61
}
62
63
inline
64
sc_uint_base
&
65
sc_uint_base::operator =
(
const
sc_signed_subref_r
& a )
66
{
67
m_val
= a.
to_uint64
();
68
extend_sign();
69
return
*
this
;
70
}
71
72
inline
73
sc_uint_base
&
74
sc_uint_base::operator =
(
const
sc_unsigned_subref_r
& a )
75
{
76
m_val
= a.
to_uint64
();
77
extend_sign();
78
return
*
this
;
79
}
80
81
}
// namespace sc_dt
82
83
#endif
// SC_UINT_INLINES_H
BITS_PER_DIGIT
#define BITS_PER_DIGIT
Definition:
sc_nbdefs.h:164
sc_dt
Definition:
sc_signal_ifs.h:38
sc_dt::uint64
unsigned long long uint64
Definition:
sc_nbdefs.h:216
sc_dt::int64
long long int64
Definition:
sc_nbdefs.h:215
sc_dt::sc_bigint
Definition:
sc_bigint.h:88
sc_dt::sc_biguint
Definition:
sc_biguint.h:90
sc_dt::sc_signed_subref_r
Definition:
sc_signed.h:322
sc_dt::sc_signed_subref_r::to_uint64
uint64 to_uint64() const
Definition:
sc_signed.h:1408
sc_dt::sc_signed::digit
sc_digit * digit
Definition:
sc_signed.h:1152
sc_dt::sc_uint
Definition:
sc_uint.h:92
sc_dt::sc_uint::operator=
sc_uint< W > & operator=(uint_type v)
Definition:
sc_uint.h:206
sc_dt::sc_uint_base
Definition:
sc_uint_base.h:514
sc_dt::sc_uint_base::operator=
sc_uint_base & operator=(uint_type v)
Definition:
sc_uint_base.h:590
sc_dt::sc_uint_base::m_val
uint_type m_val
Definition:
sc_uint_base.h:852
sc_dt::sc_unsigned_subref_r
Definition:
sc_unsigned.h:320
sc_dt::sc_unsigned_subref_r::to_uint64
uint64 to_uint64() const
Definition:
sc_unsigned.h:1420
sc_dt::sc_unsigned::digit
sc_digit * digit
Definition:
sc_unsigned.h:1140
Generated on Fri Aug 16 2024 16:36:33 for SystemC by
1.9.4