112853Sgabeblack@google.com/*****************************************************************************
212853Sgabeblack@google.com
312853Sgabeblack@google.com  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
412853Sgabeblack@google.com  more contributor license agreements.  See the NOTICE file distributed
512853Sgabeblack@google.com  with this work for additional information regarding copyright ownership.
612853Sgabeblack@google.com  Accellera licenses this file to you under the Apache License, Version 2.0
712853Sgabeblack@google.com  (the "License"); you may not use this file except in compliance with the
812853Sgabeblack@google.com  License.  You may obtain a copy of the License at
912853Sgabeblack@google.com
1012853Sgabeblack@google.com    http://www.apache.org/licenses/LICENSE-2.0
1112853Sgabeblack@google.com
1212853Sgabeblack@google.com  Unless required by applicable law or agreed to in writing, software
1312853Sgabeblack@google.com  distributed under the License is distributed on an "AS IS" BASIS,
1412853Sgabeblack@google.com  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1512853Sgabeblack@google.com  implied.  See the License for the specific language governing
1612853Sgabeblack@google.com  permissions and limitations under the License.
1712853Sgabeblack@google.com
1812853Sgabeblack@google.com *****************************************************************************/
1912853Sgabeblack@google.com
2012853Sgabeblack@google.com/*****************************************************************************
2112853Sgabeblack@google.com
2212853Sgabeblack@google.com  sc_uint_base.h -- An unsigned integer whose length is less than 64 bits.
2312853Sgabeblack@google.com
2412853Sgabeblack@google.com               Unlike arbitrary precision, arithmetic and bitwise operations
2512853Sgabeblack@google.com               are performed using the native types (hence capped at 64 bits).
2612853Sgabeblack@google.com               The sc_uint integer is useful when the user does not need
2712853Sgabeblack@google.com               arbitrary precision and the performance is superior to
2812853Sgabeblack@google.com               sc_bigint/sc_biguint.
2912853Sgabeblack@google.com
3012853Sgabeblack@google.com  Original Author: Amit Rao, Synopsys, Inc.
3112853Sgabeblack@google.com
3212853Sgabeblack@google.com *****************************************************************************/
3312853Sgabeblack@google.com
3412853Sgabeblack@google.com/*****************************************************************************
3512853Sgabeblack@google.com
3612853Sgabeblack@google.com  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
3712853Sgabeblack@google.com  changes you are making here.
3812853Sgabeblack@google.com
3912853Sgabeblack@google.com      Name, Affiliation, Date: Ali Dasdan, Synopsys, Inc.
4012853Sgabeblack@google.com  Description of Modification: - Resolved ambiguity with sc_(un)signed.
4112853Sgabeblack@google.com                               - Merged the code for 64- and 32-bit versions
4212853Sgabeblack@google.com                                 via the constants in sc_nbdefs.h.
4312853Sgabeblack@google.com                               - Eliminated redundant file inclusions.
4412853Sgabeblack@google.com
4512853Sgabeblack@google.com      Name, Affiliation, Date:
4612853Sgabeblack@google.com  Description of Modification:
4712853Sgabeblack@google.com
4812853Sgabeblack@google.com *****************************************************************************/
4912853Sgabeblack@google.com
5012853Sgabeblack@google.com// $Log: sc_uint_base.h,v $
5112853Sgabeblack@google.com// Revision 1.3  2011/08/24 22:05:46  acg
5212853Sgabeblack@google.com//  Torsten Maehne: initialization changes to remove warnings.
5312853Sgabeblack@google.com//
5412853Sgabeblack@google.com// Revision 1.2  2011/02/18 20:19:15  acg
5512853Sgabeblack@google.com//  Andy Goodrich: updating Copyright notice.
5612853Sgabeblack@google.com//
5712853Sgabeblack@google.com// Revision 1.1.1.1  2006/12/15 20:20:05  acg
5812853Sgabeblack@google.com// SystemC 2.3
5912853Sgabeblack@google.com//
6012853Sgabeblack@google.com// Revision 1.4  2006/05/08 17:50:02  acg
6112853Sgabeblack@google.com//   Andy Goodrich: Added David Long's declarations for friend operators,
6212853Sgabeblack@google.com//   functions, and methods, to keep the Microsoft compiler happy.
6312853Sgabeblack@google.com//
6412853Sgabeblack@google.com// Revision 1.3  2006/01/13 18:49:32  acg
6512853Sgabeblack@google.com// Added $Log command so that CVS check in comments are reproduced in the
6612853Sgabeblack@google.com// source.
6712853Sgabeblack@google.com//
6812853Sgabeblack@google.com
6912853Sgabeblack@google.com#ifndef __SYSTEMC_EXT_DT_INT_SC_UINT_BASE_HH__
7012853Sgabeblack@google.com#define __SYSTEMC_EXT_DT_INT_SC_UINT_BASE_HH__
7112853Sgabeblack@google.com
7212853Sgabeblack@google.com#include <iostream>
7312853Sgabeblack@google.com
7412853Sgabeblack@google.com#include "../fx/scfx_ieee.hh"
7512853Sgabeblack@google.com#include "../misc/sc_value_base.hh"
7612853Sgabeblack@google.com#include "../sc_temporary.hh"
7712853Sgabeblack@google.com#include "sc_length_param.hh"
7812853Sgabeblack@google.com#include "sc_nbdefs.hh"
7912853Sgabeblack@google.com
8012853Sgabeblack@google.comnamespace sc_dt
8112853Sgabeblack@google.com{
8212853Sgabeblack@google.com
8312853Sgabeblack@google.comclass sc_concatref;
8412853Sgabeblack@google.com
8512853Sgabeblack@google.com// classes defined in this module
8612853Sgabeblack@google.comclass sc_uint_bitref_r;
8712853Sgabeblack@google.comclass sc_uint_bitref;
8812853Sgabeblack@google.comclass sc_uint_subref_r;
8912853Sgabeblack@google.comclass sc_uint_subref;
9012853Sgabeblack@google.comclass sc_uint_base;
9112853Sgabeblack@google.com
9212853Sgabeblack@google.com// forward class declarations
9312853Sgabeblack@google.comclass sc_bv_base;
9412853Sgabeblack@google.comclass sc_lv_base;
9512853Sgabeblack@google.comclass sc_int_subref_r;
9612853Sgabeblack@google.comclass sc_signed_subref_r;
9712853Sgabeblack@google.comclass sc_unsigned_subref_r;
9812853Sgabeblack@google.comclass sc_signed;
9912853Sgabeblack@google.comclass sc_unsigned;
10012853Sgabeblack@google.comclass sc_fxval;
10112853Sgabeblack@google.comclass sc_fxval_fast;
10212853Sgabeblack@google.comclass sc_fxnum;
10312853Sgabeblack@google.comclass sc_fxnum_fast;
10412853Sgabeblack@google.com
10512853Sgabeblack@google.com} // namespace sc_dt
10612853Sgabeblack@google.com
10712853Sgabeblack@google.com// extern template instantiations
10812853Sgabeblack@google.comnamespace sc_core
10912853Sgabeblack@google.com{
11012853Sgabeblack@google.com
11112853Sgabeblack@google.comextern template class sc_vpool<sc_dt::sc_uint_bitref>;
11212853Sgabeblack@google.comextern template class sc_vpool<sc_dt::sc_uint_subref>;
11312853Sgabeblack@google.com
11412853Sgabeblack@google.com} // namespace sc_core
11512853Sgabeblack@google.com
11612853Sgabeblack@google.comnamespace sc_dt
11712853Sgabeblack@google.com{
11812853Sgabeblack@google.com
11912853Sgabeblack@google.comextern const uint_type mask_int[SC_INTWIDTH][SC_INTWIDTH];
12012853Sgabeblack@google.com
12112853Sgabeblack@google.com// friend operator declarations
12212853Sgabeblack@google.cominline bool operator == (const sc_uint_base &a, const sc_uint_base &b);
12312853Sgabeblack@google.cominline bool operator != (const sc_uint_base &a, const sc_uint_base &b);
12412853Sgabeblack@google.cominline bool operator < (const sc_uint_base &a, const sc_uint_base &b);
12512853Sgabeblack@google.cominline bool operator <= (const sc_uint_base &a, const sc_uint_base &b);
12612853Sgabeblack@google.cominline bool operator > (const sc_uint_base &a, const sc_uint_base &b);
12712853Sgabeblack@google.cominline bool operator >= (const sc_uint_base &a, const sc_uint_base &b);
12812853Sgabeblack@google.com
12912853Sgabeblack@google.com
13012853Sgabeblack@google.com// ----------------------------------------------------------------------------
13112853Sgabeblack@google.com//  CLASS : sc_uint_bitref_r
13212853Sgabeblack@google.com//
13312853Sgabeblack@google.com//  Proxy class for sc_uint bit selection (r-value only).
13412853Sgabeblack@google.com// ----------------------------------------------------------------------------
13512853Sgabeblack@google.com
13612853Sgabeblack@google.comclass sc_uint_bitref_r : public sc_value_base
13712853Sgabeblack@google.com{
13812853Sgabeblack@google.com    friend class sc_uint_base;
13912853Sgabeblack@google.com    friend class sc_uint_signal;
14012853Sgabeblack@google.com
14112853Sgabeblack@google.com    // constructors
14212853Sgabeblack@google.com  public:
14312853Sgabeblack@google.com    sc_uint_bitref_r(const sc_uint_bitref_r &init) :
14412853Sgabeblack@google.com         sc_value_base(init), m_index(init.m_index), m_obj_p(init.m_obj_p)
14512853Sgabeblack@google.com    {}
14612853Sgabeblack@google.com
14712853Sgabeblack@google.com  protected:
14812853Sgabeblack@google.com    sc_uint_bitref_r() : sc_value_base(), m_index(0), m_obj_p(0) {}
14912853Sgabeblack@google.com
15012853Sgabeblack@google.com    // initializer for sc_core::sc_vpool:
15112853Sgabeblack@google.com    void
15212853Sgabeblack@google.com    initialize(const sc_uint_base* obj_p, int index_)
15312853Sgabeblack@google.com    {
15412853Sgabeblack@google.com        m_obj_p = (sc_uint_base *)obj_p;
15512853Sgabeblack@google.com        m_index = index_;
15612853Sgabeblack@google.com    }
15712853Sgabeblack@google.com
15812853Sgabeblack@google.com  public:
15912853Sgabeblack@google.com    // destructor
16012853Sgabeblack@google.com    virtual ~sc_uint_bitref_r() {}
16112853Sgabeblack@google.com
16212853Sgabeblack@google.com    // concatenation support
16312853Sgabeblack@google.com    virtual int
16412853Sgabeblack@google.com    concat_length(bool *xz_present_p) const
16512853Sgabeblack@google.com    {
16612853Sgabeblack@google.com        if (xz_present_p)
16712853Sgabeblack@google.com            *xz_present_p = false;
16812853Sgabeblack@google.com        return 1;
16912853Sgabeblack@google.com    }
17012853Sgabeblack@google.com    virtual bool
17112853Sgabeblack@google.com    concat_get_ctrl(sc_digit *dst_p, int low_i) const
17212853Sgabeblack@google.com    {
17312853Sgabeblack@google.com        int  bit_mask = 1 << (low_i % BITS_PER_DIGIT);
17412853Sgabeblack@google.com        int  word_i = low_i / BITS_PER_DIGIT;
17512853Sgabeblack@google.com
17612853Sgabeblack@google.com        dst_p[word_i] &= ~bit_mask;
17712853Sgabeblack@google.com        return false;
17812853Sgabeblack@google.com    }
17912853Sgabeblack@google.com    virtual bool
18012853Sgabeblack@google.com    concat_get_data(sc_digit *dst_p, int low_i) const
18112853Sgabeblack@google.com    {
18212853Sgabeblack@google.com        int  bit_mask = 1 << (low_i % BITS_PER_DIGIT);
18312853Sgabeblack@google.com        bool result;             // True is non-zero.
18412853Sgabeblack@google.com        int  word_i = low_i / BITS_PER_DIGIT;
18512853Sgabeblack@google.com
18612853Sgabeblack@google.com        if (operator uint64()) {
18712853Sgabeblack@google.com            dst_p[word_i] |= bit_mask;
18812853Sgabeblack@google.com            result = true;
18912853Sgabeblack@google.com        } else {
19012853Sgabeblack@google.com            dst_p[word_i] &= ~bit_mask;
19112853Sgabeblack@google.com            result = false;
19212853Sgabeblack@google.com        }
19312853Sgabeblack@google.com        return result;
19412853Sgabeblack@google.com    }
19512853Sgabeblack@google.com    virtual uint64 concat_get_uint64() const { return operator uint64(); }
19612853Sgabeblack@google.com
19712853Sgabeblack@google.com    // capacity
19812853Sgabeblack@google.com    int length() const { return 1; }
19912853Sgabeblack@google.com
20012853Sgabeblack@google.com    // implicit conversion to uint64
20112853Sgabeblack@google.com    operator uint64 () const;
20212853Sgabeblack@google.com    bool operator ! () const;
20312853Sgabeblack@google.com    bool operator ~ () const;
20412853Sgabeblack@google.com
20512853Sgabeblack@google.com    // explicit conversions
20612853Sgabeblack@google.com    uint64 value() const { return operator uint64 (); }
20712853Sgabeblack@google.com    bool to_bool() const { return operator uint64 (); }
20812853Sgabeblack@google.com
20912853Sgabeblack@google.com    // other methods
21012853Sgabeblack@google.com    void print(::std::ostream &os=::std::cout) const { os << to_bool(); }
21112853Sgabeblack@google.com
21212853Sgabeblack@google.com  protected:
21312853Sgabeblack@google.com    int m_index;
21412853Sgabeblack@google.com    sc_uint_base *m_obj_p;
21512853Sgabeblack@google.com
21612853Sgabeblack@google.com  private:
21712853Sgabeblack@google.com    // Disabled
21812853Sgabeblack@google.com    sc_uint_bitref_r &operator = (const sc_uint_bitref_r &);
21912853Sgabeblack@google.com};
22012853Sgabeblack@google.com
22112853Sgabeblack@google.cominline ::std::ostream &operator << (
22212853Sgabeblack@google.com        ::std::ostream &, const sc_uint_bitref_r &);
22312853Sgabeblack@google.com
22412853Sgabeblack@google.com
22512853Sgabeblack@google.com// ----------------------------------------------------------------------------
22612853Sgabeblack@google.com//  CLASS : sc_uint_bitref
22712853Sgabeblack@google.com//
22812853Sgabeblack@google.com//  Proxy class for sc_uint bit selection (r-value and l-value).
22912853Sgabeblack@google.com// ----------------------------------------------------------------------------
23012853Sgabeblack@google.com
23112853Sgabeblack@google.comclass sc_uint_bitref : public sc_uint_bitref_r
23212853Sgabeblack@google.com{
23312853Sgabeblack@google.com    friend class sc_uint_base;
23412853Sgabeblack@google.com    friend class sc_core::sc_vpool<sc_uint_bitref>;
23512853Sgabeblack@google.com
23612853Sgabeblack@google.com    // constructors
23712853Sgabeblack@google.com  protected:
23812853Sgabeblack@google.com    sc_uint_bitref() : sc_uint_bitref_r() {}
23912853Sgabeblack@google.com
24012853Sgabeblack@google.com  public:
24112853Sgabeblack@google.com    sc_uint_bitref(const sc_uint_bitref &init) : sc_uint_bitref_r(init) {}
24212853Sgabeblack@google.com
24312853Sgabeblack@google.com  public:
24412853Sgabeblack@google.com    // assignment operators
24512853Sgabeblack@google.com    sc_uint_bitref &operator = (const sc_uint_bitref_r &b);
24612853Sgabeblack@google.com    sc_uint_bitref &operator = (const sc_uint_bitref &b);
24712853Sgabeblack@google.com    sc_uint_bitref &operator = (bool b);
24812853Sgabeblack@google.com
24912853Sgabeblack@google.com    sc_uint_bitref &operator &= (bool b);
25012853Sgabeblack@google.com    sc_uint_bitref &operator |= (bool b);
25112853Sgabeblack@google.com    sc_uint_bitref &operator ^= (bool b);
25212853Sgabeblack@google.com
25312853Sgabeblack@google.com    // concatenation methods
25412853Sgabeblack@google.com    virtual void concat_set(int64 src, int low_i);
25512853Sgabeblack@google.com    virtual void concat_set(const sc_signed &src, int low_i);
25612853Sgabeblack@google.com    virtual void concat_set(const sc_unsigned &src, int low_i);
25712853Sgabeblack@google.com    virtual void concat_set(uint64 src, int low_i);
25812853Sgabeblack@google.com
25912853Sgabeblack@google.com    // other methods
26012853Sgabeblack@google.com    void scan(::std::istream &is=::std::cin);
26112853Sgabeblack@google.com
26212853Sgabeblack@google.com  protected:
26312853Sgabeblack@google.com    static sc_core::sc_vpool<sc_uint_bitref> m_pool;
26412853Sgabeblack@google.com};
26512853Sgabeblack@google.com
26612853Sgabeblack@google.cominline ::std::istream &operator >> (::std::istream &, sc_uint_bitref &);
26712853Sgabeblack@google.com
26812853Sgabeblack@google.com
26912853Sgabeblack@google.com// ----------------------------------------------------------------------------
27012853Sgabeblack@google.com//  CLASS : sc_uint_subref_r
27112853Sgabeblack@google.com//
27212853Sgabeblack@google.com//  Proxy class for sc_uint part selection (r-value only).
27312853Sgabeblack@google.com// ----------------------------------------------------------------------------
27412853Sgabeblack@google.com
27512853Sgabeblack@google.comclass sc_uint_subref_r : public sc_value_base
27612853Sgabeblack@google.com{
27712853Sgabeblack@google.com    friend class sc_uint_base;
27812853Sgabeblack@google.com    friend class sc_uint_subref;
27912853Sgabeblack@google.com
28012853Sgabeblack@google.com    // constructors
28112853Sgabeblack@google.com  public:
28212853Sgabeblack@google.com    sc_uint_subref_r( const sc_uint_subref_r& init ) :
28312853Sgabeblack@google.com        sc_value_base(init), m_left(init.m_left), m_obj_p(init.m_obj_p),
28412853Sgabeblack@google.com        m_right(init.m_right)
28512853Sgabeblack@google.com    {}
28612853Sgabeblack@google.com
28712853Sgabeblack@google.com  protected:
28812853Sgabeblack@google.com    sc_uint_subref_r() : sc_value_base(), m_left(0), m_obj_p(0), m_right(0) {}
28912853Sgabeblack@google.com
29012853Sgabeblack@google.com    // initializer for sc_core::sc_vpool:
29112853Sgabeblack@google.com    void
29212853Sgabeblack@google.com    initialize(const sc_uint_base *obj_p, int left_i, int right_i)
29312853Sgabeblack@google.com    {
29412853Sgabeblack@google.com        m_obj_p = (sc_uint_base *)obj_p;
29512853Sgabeblack@google.com        m_left = left_i;
29612853Sgabeblack@google.com        m_right = right_i;
29712853Sgabeblack@google.com    }
29812853Sgabeblack@google.com
29912853Sgabeblack@google.com  public:
30012853Sgabeblack@google.com    // destructor
30112853Sgabeblack@google.com    virtual ~sc_uint_subref_r() {}
30212853Sgabeblack@google.com
30312853Sgabeblack@google.com    // capacity
30412853Sgabeblack@google.com    int length() const { return (m_left - m_right + 1); }
30512853Sgabeblack@google.com
30612853Sgabeblack@google.com    // concatenation support
30712853Sgabeblack@google.com    virtual int
30812853Sgabeblack@google.com    concat_length(bool *xz_present_p) const
30912853Sgabeblack@google.com    {
31012853Sgabeblack@google.com        if (xz_present_p)
31112853Sgabeblack@google.com            *xz_present_p = false;
31212853Sgabeblack@google.com        return length();
31312853Sgabeblack@google.com    }
31412853Sgabeblack@google.com    virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const;
31512853Sgabeblack@google.com    virtual bool concat_get_data(sc_digit *dst_p, int low_i) const;
31612853Sgabeblack@google.com    virtual uint64
31712853Sgabeblack@google.com    concat_get_uint64() const
31812853Sgabeblack@google.com    {
31912853Sgabeblack@google.com        return (uint64)operator uint_type();
32012853Sgabeblack@google.com    }
32112853Sgabeblack@google.com
32212853Sgabeblack@google.com    // reduce methods
32312853Sgabeblack@google.com    bool and_reduce() const;
32412853Sgabeblack@google.com    bool nand_reduce() const { return !and_reduce(); }
32512853Sgabeblack@google.com    bool or_reduce() const;
32612853Sgabeblack@google.com    bool nor_reduce() const { return !or_reduce(); }
32712853Sgabeblack@google.com    bool xor_reduce() const;
32812853Sgabeblack@google.com    bool xnor_reduce() const { return !xor_reduce(); }
32912853Sgabeblack@google.com
33012853Sgabeblack@google.com    // implicit conversion to uint_type
33112853Sgabeblack@google.com    operator uint_type() const;
33212853Sgabeblack@google.com
33312853Sgabeblack@google.com    // explicit conversions
33412853Sgabeblack@google.com    uint_type value() const { return operator uint_type(); }
33512853Sgabeblack@google.com
33612853Sgabeblack@google.com    int to_int() const;
33712853Sgabeblack@google.com    unsigned int to_uint() const;
33812853Sgabeblack@google.com    long to_long() const;
33912853Sgabeblack@google.com    unsigned long to_ulong() const;
34012853Sgabeblack@google.com    int64 to_int64() const;
34112853Sgabeblack@google.com    uint64 to_uint64() const;
34212853Sgabeblack@google.com    double to_double() const;
34312853Sgabeblack@google.com
34412853Sgabeblack@google.com    // explicit conversion to character string
34512853Sgabeblack@google.com    const std::string to_string(sc_numrep numrep=SC_DEC) const;
34612853Sgabeblack@google.com    const std::string to_string(sc_numrep numrep, bool w_prefix) const;
34712853Sgabeblack@google.com
34812853Sgabeblack@google.com    // other methods
34912853Sgabeblack@google.com    void
35012853Sgabeblack@google.com    print(::std::ostream &os=::std::cout) const
35112853Sgabeblack@google.com    {
35212853Sgabeblack@google.com        os << to_string(sc_io_base(os, SC_DEC), sc_io_show_base(os));
35312853Sgabeblack@google.com    }
35412853Sgabeblack@google.com
35512853Sgabeblack@google.com  protected:
35612853Sgabeblack@google.com    int m_left;
35712853Sgabeblack@google.com    sc_uint_base *m_obj_p;
35812853Sgabeblack@google.com    int m_right;
35912853Sgabeblack@google.com
36012853Sgabeblack@google.com  private:
36112853Sgabeblack@google.com    // Disabled
36212853Sgabeblack@google.com    sc_uint_subref_r &operator = (const sc_uint_subref_r &);
36312853Sgabeblack@google.com};
36412853Sgabeblack@google.com
36512853Sgabeblack@google.cominline ::std::ostream &operator << (
36612853Sgabeblack@google.com        ::std::ostream &, const sc_uint_subref_r &);
36712853Sgabeblack@google.com
36812853Sgabeblack@google.com
36912853Sgabeblack@google.com// ----------------------------------------------------------------------------
37012853Sgabeblack@google.com//  CLASS : sc_uint_subref
37112853Sgabeblack@google.com//
37212853Sgabeblack@google.com//  Proxy class for sc_uint part selection (r-value and l-value).
37312853Sgabeblack@google.com// ----------------------------------------------------------------------------
37412853Sgabeblack@google.com
37512853Sgabeblack@google.comclass sc_uint_subref : public sc_uint_subref_r
37612853Sgabeblack@google.com{
37712853Sgabeblack@google.com    friend class sc_uint_base;
37812853Sgabeblack@google.com    friend class sc_core::sc_vpool<sc_uint_subref>;
37912853Sgabeblack@google.com
38012853Sgabeblack@google.com    // constructors
38112853Sgabeblack@google.com  protected:
38212853Sgabeblack@google.com    sc_uint_subref() : sc_uint_subref_r() {}
38312853Sgabeblack@google.com
38412853Sgabeblack@google.com  public:
38512853Sgabeblack@google.com    sc_uint_subref(const sc_uint_subref &init) : sc_uint_subref_r(init) {}
38612853Sgabeblack@google.com
38712853Sgabeblack@google.com  public:
38812853Sgabeblack@google.com    // assignment operators
38912853Sgabeblack@google.com    sc_uint_subref &operator = (uint_type v);
39012853Sgabeblack@google.com    sc_uint_subref &operator = (const sc_uint_base &a);
39112853Sgabeblack@google.com    sc_uint_subref &
39212853Sgabeblack@google.com    operator = (const sc_uint_subref_r &a)
39312853Sgabeblack@google.com    {
39412853Sgabeblack@google.com        return operator = (a.operator uint_type());
39512853Sgabeblack@google.com    }
39612853Sgabeblack@google.com    sc_uint_subref &
39712853Sgabeblack@google.com    operator = (const sc_uint_subref &a)
39812853Sgabeblack@google.com    {
39912853Sgabeblack@google.com        return operator = (a.operator uint_type());
40012853Sgabeblack@google.com    }
40112853Sgabeblack@google.com    template<class T>
40212853Sgabeblack@google.com    sc_uint_subref &
40312853Sgabeblack@google.com    operator = (const sc_generic_base<T> &a)
40412853Sgabeblack@google.com    {
40512853Sgabeblack@google.com        return operator = (a->to_uint64());
40612853Sgabeblack@google.com    }
40712853Sgabeblack@google.com    sc_uint_subref &operator = (const char *a);
40812853Sgabeblack@google.com    sc_uint_subref &
40912853Sgabeblack@google.com    operator = (unsigned long a)
41012853Sgabeblack@google.com    {
41112853Sgabeblack@google.com        return operator = ((uint_type)a);
41212853Sgabeblack@google.com    }
41312853Sgabeblack@google.com    sc_uint_subref &
41412853Sgabeblack@google.com    operator = (long a)
41512853Sgabeblack@google.com    {
41612853Sgabeblack@google.com        return operator = ((uint_type)a);
41712853Sgabeblack@google.com    }
41812853Sgabeblack@google.com    sc_uint_subref &
41912853Sgabeblack@google.com    operator = (unsigned int a)
42012853Sgabeblack@google.com    {
42112853Sgabeblack@google.com        return operator = ((uint_type)a);
42212853Sgabeblack@google.com    }
42312853Sgabeblack@google.com    sc_uint_subref &
42412853Sgabeblack@google.com    operator = (int a)
42512853Sgabeblack@google.com    {
42612853Sgabeblack@google.com        return operator = ((uint_type)a);
42712853Sgabeblack@google.com    }
42812853Sgabeblack@google.com    sc_uint_subref &
42912853Sgabeblack@google.com    operator = (int64 a)
43012853Sgabeblack@google.com    {
43112853Sgabeblack@google.com        return operator = ((uint_type)a);
43212853Sgabeblack@google.com    }
43312853Sgabeblack@google.com    sc_uint_subref &
43412853Sgabeblack@google.com    operator = (double a)
43512853Sgabeblack@google.com    {
43612853Sgabeblack@google.com        return operator = ((uint_type)a);
43712853Sgabeblack@google.com    }
43812853Sgabeblack@google.com    sc_uint_subref &operator = (const sc_signed &);
43912853Sgabeblack@google.com    sc_uint_subref &operator = (const sc_unsigned &);
44012853Sgabeblack@google.com    sc_uint_subref &operator = (const sc_bv_base &);
44112853Sgabeblack@google.com    sc_uint_subref &operator = (const sc_lv_base &);
44212853Sgabeblack@google.com
44312853Sgabeblack@google.com    // concatenation methods
44412853Sgabeblack@google.com    virtual void concat_set(int64 src, int low_i);
44512853Sgabeblack@google.com    virtual void concat_set(const sc_signed &src, int low_i);
44612853Sgabeblack@google.com    virtual void concat_set(const sc_unsigned &src, int low_i);
44712853Sgabeblack@google.com    virtual void concat_set(uint64 src, int low_i);
44812853Sgabeblack@google.com
44912853Sgabeblack@google.com    // other methods
45012853Sgabeblack@google.com    void scan(::std::istream &is=::std::cin);
45112853Sgabeblack@google.com
45212853Sgabeblack@google.com  protected:
45312853Sgabeblack@google.com    static sc_core::sc_vpool<sc_uint_subref> m_pool;
45412853Sgabeblack@google.com};
45512853Sgabeblack@google.com
45612853Sgabeblack@google.cominline ::std::istream &operator >> (::std::istream &, sc_uint_subref &);
45712853Sgabeblack@google.com
45812853Sgabeblack@google.com
45912853Sgabeblack@google.com// ----------------------------------------------------------------------------
46012853Sgabeblack@google.com//  CLASS : sc_uint_base
46112853Sgabeblack@google.com//
46212853Sgabeblack@google.com//  Base class for sc_uint.
46312853Sgabeblack@google.com// ----------------------------------------------------------------------------
46412853Sgabeblack@google.com
46512853Sgabeblack@google.comclass sc_uint_base : public sc_value_base
46612853Sgabeblack@google.com{
46712853Sgabeblack@google.com    friend class sc_uint_bitref_r;
46812853Sgabeblack@google.com    friend class sc_uint_bitref;
46912853Sgabeblack@google.com    friend class sc_uint_subref_r;
47012853Sgabeblack@google.com    friend class sc_uint_subref;
47112853Sgabeblack@google.com
47212853Sgabeblack@google.com    // support methods
47312853Sgabeblack@google.com    void invalid_length() const;
47412853Sgabeblack@google.com    void invalid_index(int i) const;
47512853Sgabeblack@google.com    void invalid_range(int l, int r) const;
47612853Sgabeblack@google.com
47712853Sgabeblack@google.com    void
47812853Sgabeblack@google.com    check_length() const
47912853Sgabeblack@google.com    {
48012853Sgabeblack@google.com        if (m_len <= 0 || m_len > SC_INTWIDTH) {
48112853Sgabeblack@google.com            invalid_length();
48212853Sgabeblack@google.com        }
48312853Sgabeblack@google.com    }
48412853Sgabeblack@google.com
48512853Sgabeblack@google.com    void
48612853Sgabeblack@google.com    check_index(int i) const
48712853Sgabeblack@google.com    {
48812853Sgabeblack@google.com        if (i < 0 || i >= m_len) {
48912853Sgabeblack@google.com            invalid_index( i );
49012853Sgabeblack@google.com        }
49112853Sgabeblack@google.com    }
49212853Sgabeblack@google.com
49312853Sgabeblack@google.com    void
49412853Sgabeblack@google.com    check_range(int l, int r) const
49512853Sgabeblack@google.com    {
49612853Sgabeblack@google.com        if (r < 0 || l >= m_len || l < r) {
49712853Sgabeblack@google.com            invalid_range( l, r );
49812853Sgabeblack@google.com        }
49912853Sgabeblack@google.com    }
50012853Sgabeblack@google.com
50112853Sgabeblack@google.com    void check_value() const;
50212853Sgabeblack@google.com
50312853Sgabeblack@google.com    void
50412853Sgabeblack@google.com    extend_sign()
50512853Sgabeblack@google.com    {
50612853Sgabeblack@google.com#ifdef DEBUG_SYSTEMC
50712853Sgabeblack@google.com        check_value();
50812853Sgabeblack@google.com#endif
50912853Sgabeblack@google.com        m_val &= (~UINT_ZERO >> m_ulen);
51012853Sgabeblack@google.com    }
51112853Sgabeblack@google.com
51212853Sgabeblack@google.com  public:
51312853Sgabeblack@google.com    // constructors
51412853Sgabeblack@google.com    explicit sc_uint_base(int w=sc_length_param().len()) :
51512853Sgabeblack@google.com            m_val(0), m_len(w), m_ulen(SC_INTWIDTH - m_len)
51612853Sgabeblack@google.com    {
51712853Sgabeblack@google.com        check_length();
51812853Sgabeblack@google.com    }
51912853Sgabeblack@google.com
52012853Sgabeblack@google.com    sc_uint_base(uint_type v, int w) :
52112853Sgabeblack@google.com        m_val(v), m_len(w), m_ulen(SC_INTWIDTH - m_len)
52212853Sgabeblack@google.com    {
52312853Sgabeblack@google.com        check_length();
52412853Sgabeblack@google.com        extend_sign();
52512853Sgabeblack@google.com    }
52612853Sgabeblack@google.com
52712853Sgabeblack@google.com    sc_uint_base(const sc_uint_base &a) :
52812853Sgabeblack@google.com            sc_value_base(a), m_val(a.m_val), m_len(a.m_len), m_ulen(a.m_ulen)
52912853Sgabeblack@google.com    {}
53012853Sgabeblack@google.com
53112853Sgabeblack@google.com    explicit sc_uint_base(const sc_uint_subref_r &a) :
53212853Sgabeblack@google.com            m_val(a), m_len(a.length()), m_ulen(SC_INTWIDTH - m_len)
53312853Sgabeblack@google.com    {
53412853Sgabeblack@google.com        extend_sign();
53512853Sgabeblack@google.com    }
53612853Sgabeblack@google.com
53712853Sgabeblack@google.com    template<class T>
53812853Sgabeblack@google.com    explicit sc_uint_base(const sc_generic_base<T> &a) :
53912853Sgabeblack@google.com            m_val(a->to_uint64()), m_len(a->length()),
54012853Sgabeblack@google.com            m_ulen(SC_INTWIDTH - m_len)
54112853Sgabeblack@google.com    {
54212853Sgabeblack@google.com        check_length();
54312853Sgabeblack@google.com        extend_sign();
54412853Sgabeblack@google.com    }
54512853Sgabeblack@google.com
54612853Sgabeblack@google.com    explicit sc_uint_base(const sc_bv_base &v);
54712853Sgabeblack@google.com    explicit sc_uint_base(const sc_lv_base &v);
54812853Sgabeblack@google.com    explicit sc_uint_base(const sc_int_subref_r &v);
54912853Sgabeblack@google.com    explicit sc_uint_base(const sc_signed_subref_r &v);
55012853Sgabeblack@google.com    explicit sc_uint_base(const sc_unsigned_subref_r &v);
55112853Sgabeblack@google.com    explicit sc_uint_base(const sc_signed &a);
55212853Sgabeblack@google.com    explicit sc_uint_base(const sc_unsigned &a);
55312853Sgabeblack@google.com
55412853Sgabeblack@google.com    // destructor
55512853Sgabeblack@google.com    virtual ~sc_uint_base() {}
55612853Sgabeblack@google.com
55712853Sgabeblack@google.com    // assignment operators
55812853Sgabeblack@google.com    sc_uint_base &
55912853Sgabeblack@google.com    operator = (uint_type v)
56012853Sgabeblack@google.com    {
56112853Sgabeblack@google.com        m_val = v;
56212853Sgabeblack@google.com        extend_sign();
56312853Sgabeblack@google.com        return *this;
56412853Sgabeblack@google.com    }
56512853Sgabeblack@google.com    sc_uint_base &
56612853Sgabeblack@google.com    operator = (const sc_uint_base &a)
56712853Sgabeblack@google.com    {
56812853Sgabeblack@google.com        m_val = a.m_val;
56912853Sgabeblack@google.com        extend_sign();
57012853Sgabeblack@google.com        return *this;
57112853Sgabeblack@google.com    }
57212853Sgabeblack@google.com    sc_uint_base &
57312853Sgabeblack@google.com    operator = (const sc_uint_subref_r &a)
57412853Sgabeblack@google.com    {
57512853Sgabeblack@google.com        m_val = a;
57612853Sgabeblack@google.com        extend_sign();
57712853Sgabeblack@google.com        return *this;
57812853Sgabeblack@google.com    }
57912853Sgabeblack@google.com    template<class T>
58012853Sgabeblack@google.com    sc_uint_base &
58112853Sgabeblack@google.com    operator = (const sc_generic_base<T> &a)
58212853Sgabeblack@google.com    {
58312853Sgabeblack@google.com        m_val = a->to_uint64();
58412853Sgabeblack@google.com        extend_sign();
58512853Sgabeblack@google.com        return *this;
58612853Sgabeblack@google.com    }
58712853Sgabeblack@google.com    sc_uint_base &operator = (const sc_signed &a);
58812853Sgabeblack@google.com    sc_uint_base &operator = (const sc_unsigned &a);
58912853Sgabeblack@google.com    sc_uint_base &operator = (const sc_fxval &a);
59012853Sgabeblack@google.com    sc_uint_base &operator = (const sc_fxval_fast &a);
59112853Sgabeblack@google.com    sc_uint_base &operator = (const sc_fxnum &a);
59212853Sgabeblack@google.com    sc_uint_base &operator = (const sc_fxnum_fast &a);
59312853Sgabeblack@google.com    sc_uint_base &operator = (const sc_bv_base &a);
59412853Sgabeblack@google.com    sc_uint_base &operator = (const sc_lv_base &a);
59512853Sgabeblack@google.com    sc_uint_base &operator = (const char *a);
59612853Sgabeblack@google.com    sc_uint_base &
59712853Sgabeblack@google.com    operator = (unsigned long a)
59812853Sgabeblack@google.com    {
59912853Sgabeblack@google.com        m_val = a;
60012853Sgabeblack@google.com        extend_sign();
60112853Sgabeblack@google.com        return *this;
60212853Sgabeblack@google.com    }
60312853Sgabeblack@google.com    sc_uint_base &
60412853Sgabeblack@google.com    operator = (long a)
60512853Sgabeblack@google.com    {
60612853Sgabeblack@google.com        m_val = a;
60712853Sgabeblack@google.com        extend_sign();
60812853Sgabeblack@google.com        return *this;
60912853Sgabeblack@google.com    }
61012853Sgabeblack@google.com    sc_uint_base &
61112853Sgabeblack@google.com    operator = (unsigned int a)
61212853Sgabeblack@google.com    {
61312853Sgabeblack@google.com        m_val = a;
61412853Sgabeblack@google.com        extend_sign();
61512853Sgabeblack@google.com        return *this;
61612853Sgabeblack@google.com    }
61712853Sgabeblack@google.com    sc_uint_base &
61812853Sgabeblack@google.com    operator = (int a)
61912853Sgabeblack@google.com    {
62012853Sgabeblack@google.com        m_val = a;
62112853Sgabeblack@google.com        extend_sign();
62212853Sgabeblack@google.com        return *this;
62312853Sgabeblack@google.com    }
62412853Sgabeblack@google.com    sc_uint_base &
62512853Sgabeblack@google.com    operator = (int64 a)
62612853Sgabeblack@google.com    {
62712853Sgabeblack@google.com        m_val = a;
62812853Sgabeblack@google.com        extend_sign();
62912853Sgabeblack@google.com        return *this;
63012853Sgabeblack@google.com    }
63112853Sgabeblack@google.com    sc_uint_base &
63212853Sgabeblack@google.com    operator = (double a)
63312853Sgabeblack@google.com    {
63412853Sgabeblack@google.com        m_val = (uint_type)a;
63512853Sgabeblack@google.com        extend_sign();
63612853Sgabeblack@google.com        return *this;
63712853Sgabeblack@google.com    }
63812853Sgabeblack@google.com
63912853Sgabeblack@google.com    // arithmetic assignment operators
64012853Sgabeblack@google.com    sc_uint_base &
64112853Sgabeblack@google.com    operator += (uint_type v)
64212853Sgabeblack@google.com    {
64312853Sgabeblack@google.com        m_val += v;
64412853Sgabeblack@google.com        extend_sign();
64512853Sgabeblack@google.com        return *this;
64612853Sgabeblack@google.com    }
64712853Sgabeblack@google.com    sc_uint_base &
64812853Sgabeblack@google.com    operator -= (uint_type v)
64912853Sgabeblack@google.com    {
65012853Sgabeblack@google.com        m_val -= v;
65112853Sgabeblack@google.com        extend_sign();
65212853Sgabeblack@google.com        return *this;
65312853Sgabeblack@google.com    }
65412853Sgabeblack@google.com    sc_uint_base &
65512853Sgabeblack@google.com    operator *= (uint_type v)
65612853Sgabeblack@google.com    {
65712853Sgabeblack@google.com        m_val *= v;
65812853Sgabeblack@google.com        extend_sign();
65912853Sgabeblack@google.com        return *this;
66012853Sgabeblack@google.com    }
66112853Sgabeblack@google.com    sc_uint_base &
66212853Sgabeblack@google.com    operator /= (uint_type v)
66312853Sgabeblack@google.com    {
66412853Sgabeblack@google.com        m_val /= v;
66512853Sgabeblack@google.com        extend_sign();
66612853Sgabeblack@google.com        return *this;
66712853Sgabeblack@google.com    }
66812853Sgabeblack@google.com    sc_uint_base &
66912853Sgabeblack@google.com    operator %= (uint_type v)
67012853Sgabeblack@google.com    {
67112853Sgabeblack@google.com        m_val %= v;
67212853Sgabeblack@google.com        extend_sign();
67312853Sgabeblack@google.com        return *this;
67412853Sgabeblack@google.com    }
67512853Sgabeblack@google.com
67612853Sgabeblack@google.com    // bitwise assignment operators
67712853Sgabeblack@google.com    sc_uint_base &
67812853Sgabeblack@google.com    operator &= (uint_type v)
67912853Sgabeblack@google.com    {
68012853Sgabeblack@google.com        m_val &= v;
68112853Sgabeblack@google.com        extend_sign();
68212853Sgabeblack@google.com        return *this;
68312853Sgabeblack@google.com    }
68412853Sgabeblack@google.com    sc_uint_base &
68512853Sgabeblack@google.com    operator |= (uint_type v)
68612853Sgabeblack@google.com    {
68712853Sgabeblack@google.com        m_val |= v;
68812853Sgabeblack@google.com        extend_sign();
68912853Sgabeblack@google.com        return *this;
69012853Sgabeblack@google.com    }
69112853Sgabeblack@google.com    sc_uint_base &
69212853Sgabeblack@google.com    operator ^= (uint_type v)
69312853Sgabeblack@google.com    {
69412853Sgabeblack@google.com        m_val ^= v;
69512853Sgabeblack@google.com        extend_sign();
69612853Sgabeblack@google.com        return *this;
69712853Sgabeblack@google.com    }
69812853Sgabeblack@google.com    sc_uint_base &
69912853Sgabeblack@google.com    operator <<= (uint_type v)
70012853Sgabeblack@google.com    {
70112853Sgabeblack@google.com        m_val <<= v;
70212853Sgabeblack@google.com        extend_sign();
70312853Sgabeblack@google.com        return *this;
70412853Sgabeblack@google.com    }
70512853Sgabeblack@google.com    sc_uint_base &
70612853Sgabeblack@google.com    operator >>= (uint_type v)
70712853Sgabeblack@google.com    {
70812853Sgabeblack@google.com        m_val >>= v;
70912853Sgabeblack@google.com        /* no sign extension needed */
71012853Sgabeblack@google.com        return *this;
71112853Sgabeblack@google.com    }
71212853Sgabeblack@google.com
71312853Sgabeblack@google.com    // prefix and postfix increment and decrement operators
71412853Sgabeblack@google.com    sc_uint_base &
71512853Sgabeblack@google.com    operator ++ () // prefix
71612853Sgabeblack@google.com    {
71712853Sgabeblack@google.com        ++m_val;
71812853Sgabeblack@google.com        extend_sign();
71912853Sgabeblack@google.com        return *this;
72012853Sgabeblack@google.com    }
72112853Sgabeblack@google.com    const sc_uint_base
72212853Sgabeblack@google.com    operator ++ (int) // postfix
72312853Sgabeblack@google.com    {
72412853Sgabeblack@google.com        sc_uint_base tmp(*this);
72512853Sgabeblack@google.com        ++m_val;
72612853Sgabeblack@google.com        extend_sign();
72712853Sgabeblack@google.com        return tmp;
72812853Sgabeblack@google.com    }
72912853Sgabeblack@google.com
73012853Sgabeblack@google.com    sc_uint_base &
73112853Sgabeblack@google.com    operator -- () // prefix
73212853Sgabeblack@google.com    {
73312853Sgabeblack@google.com        --m_val;
73412853Sgabeblack@google.com        extend_sign();
73512853Sgabeblack@google.com        return *this;
73612853Sgabeblack@google.com    }
73712853Sgabeblack@google.com    const sc_uint_base
73812853Sgabeblack@google.com    operator -- (int) // postfix
73912853Sgabeblack@google.com    {
74012853Sgabeblack@google.com        sc_uint_base tmp(*this);
74112853Sgabeblack@google.com        --m_val;
74212853Sgabeblack@google.com        extend_sign();
74312853Sgabeblack@google.com        return tmp;
74412853Sgabeblack@google.com    }
74512853Sgabeblack@google.com
74612853Sgabeblack@google.com    // relational operators
74712853Sgabeblack@google.com    friend bool
74812853Sgabeblack@google.com    operator == (const sc_uint_base &a, const sc_uint_base &b)
74912853Sgabeblack@google.com    {
75012853Sgabeblack@google.com        return a.m_val == b.m_val;
75112853Sgabeblack@google.com    }
75212853Sgabeblack@google.com    friend bool
75312853Sgabeblack@google.com    operator != (const sc_uint_base &a, const sc_uint_base &b)
75412853Sgabeblack@google.com    {
75512853Sgabeblack@google.com        return a.m_val != b.m_val;
75612853Sgabeblack@google.com    }
75712853Sgabeblack@google.com    friend bool
75812853Sgabeblack@google.com    operator <  (const sc_uint_base &a, const sc_uint_base &b)
75912853Sgabeblack@google.com    {
76012853Sgabeblack@google.com        return a.m_val < b.m_val;
76112853Sgabeblack@google.com    }
76212853Sgabeblack@google.com    friend bool
76312853Sgabeblack@google.com    operator <= (const sc_uint_base &a, const sc_uint_base &b)
76412853Sgabeblack@google.com    {
76512853Sgabeblack@google.com        return a.m_val <= b.m_val;
76612853Sgabeblack@google.com    }
76712853Sgabeblack@google.com    friend bool
76812853Sgabeblack@google.com    operator >  (const sc_uint_base &a, const sc_uint_base &b)
76912853Sgabeblack@google.com    {
77012853Sgabeblack@google.com        return a.m_val > b.m_val;
77112853Sgabeblack@google.com    }
77212853Sgabeblack@google.com    friend bool
77312853Sgabeblack@google.com    operator >= (const sc_uint_base &a, const sc_uint_base &b)
77412853Sgabeblack@google.com    {
77512853Sgabeblack@google.com        return a.m_val >= b.m_val;
77612853Sgabeblack@google.com    }
77712853Sgabeblack@google.com
77812853Sgabeblack@google.com    // bit selection
77912853Sgabeblack@google.com    sc_uint_bitref &operator [] (int i);
78012853Sgabeblack@google.com    const sc_uint_bitref_r &operator [] (int i) const;
78112853Sgabeblack@google.com
78212853Sgabeblack@google.com    sc_uint_bitref &bit(int i);
78312853Sgabeblack@google.com    const sc_uint_bitref_r &bit(int i) const;
78412853Sgabeblack@google.com
78512853Sgabeblack@google.com    // part selection
78612853Sgabeblack@google.com    sc_uint_subref &operator () (int left, int right);
78712853Sgabeblack@google.com    const sc_uint_subref_r &operator () (int left, int right) const;
78812853Sgabeblack@google.com
78912853Sgabeblack@google.com    sc_uint_subref &range(int left, int right);
79012853Sgabeblack@google.com    const sc_uint_subref_r &range(int left, int right) const;
79112853Sgabeblack@google.com
79212853Sgabeblack@google.com    // bit access, without bounds checking or sign extension
79312853Sgabeblack@google.com    bool test(int i) const { return (0 != (m_val & (UINT_ONE << i))); }
79412853Sgabeblack@google.com
79512853Sgabeblack@google.com    void set(int i) { m_val |= (UINT_ONE << i); }
79612853Sgabeblack@google.com    void
79712853Sgabeblack@google.com    set(int i, bool v)
79812853Sgabeblack@google.com    {
79912853Sgabeblack@google.com        v ? m_val |= (UINT_ONE << i) : m_val &= ~(UINT_ONE << i);
80012853Sgabeblack@google.com    }
80112853Sgabeblack@google.com
80212853Sgabeblack@google.com    // capacity
80312853Sgabeblack@google.com    int length() const { return m_len; }
80412853Sgabeblack@google.com
80512853Sgabeblack@google.com    // concatenation support
80612853Sgabeblack@google.com    virtual int
80712853Sgabeblack@google.com    concat_length(bool *xz_present_p) const
80812853Sgabeblack@google.com    {
80912853Sgabeblack@google.com        if (xz_present_p)
81012853Sgabeblack@google.com            *xz_present_p = false;
81112853Sgabeblack@google.com        return length();
81212853Sgabeblack@google.com    }
81312853Sgabeblack@google.com    virtual bool concat_get_ctrl(sc_digit *dst_p, int low_i) const;
81412853Sgabeblack@google.com    virtual bool concat_get_data( sc_digit *dst_p, int low_i) const;
81512853Sgabeblack@google.com    virtual uint64 concat_get_uint64() const { return m_val; }
81612853Sgabeblack@google.com    virtual void concat_set(int64 src, int low_i);
81712853Sgabeblack@google.com    virtual void concat_set(const sc_signed &src, int low_i);
81812853Sgabeblack@google.com    virtual void concat_set(const sc_unsigned &src, int low_i);
81912853Sgabeblack@google.com    virtual void concat_set(uint64 src, int low_i);
82012853Sgabeblack@google.com
82112853Sgabeblack@google.com    // reduce methods
82212853Sgabeblack@google.com    bool and_reduce() const;
82312853Sgabeblack@google.com    bool nand_reduce() const { return !and_reduce(); }
82412853Sgabeblack@google.com    bool or_reduce() const;
82512853Sgabeblack@google.com    bool nor_reduce() const { return !or_reduce(); }
82612853Sgabeblack@google.com    bool xor_reduce() const;
82712853Sgabeblack@google.com    bool xnor_reduce() const { return !xor_reduce(); }
82812853Sgabeblack@google.com
82912853Sgabeblack@google.com    // implicit conversion to uint_type
83012853Sgabeblack@google.com    operator uint_type() const { return m_val; }
83112853Sgabeblack@google.com
83212853Sgabeblack@google.com    // explicit conversions
83312853Sgabeblack@google.com    uint_type value() const { return operator uint_type(); }
83412853Sgabeblack@google.com
83512853Sgabeblack@google.com    int to_int() const { return (int) m_val; }
83612853Sgabeblack@google.com    unsigned int to_uint() const { return (unsigned int)m_val; }
83712853Sgabeblack@google.com    long to_long() const { return (long)m_val; }
83812853Sgabeblack@google.com    unsigned long to_ulong() const { return (unsigned long)m_val; }
83912853Sgabeblack@google.com    int64 to_int64() const { return (int64)m_val; }
84012853Sgabeblack@google.com    uint64 to_uint64() const { return (uint64)m_val; }
84112853Sgabeblack@google.com    double to_double() const { return uint64_to_double(m_val); }
84212853Sgabeblack@google.com
84312853Sgabeblack@google.com    long long_low() const { return (long)(m_val & UINT64_32ONES); }
84412853Sgabeblack@google.com    long long_high() const { return (long)((m_val >> 32) & UINT64_32ONES); }
84512853Sgabeblack@google.com
84612853Sgabeblack@google.com    // explicit conversion to character string
84712853Sgabeblack@google.com    const std::string to_string(sc_numrep numrep=SC_DEC) const;
84812853Sgabeblack@google.com    const std::string to_string(sc_numrep numrep, bool w_prefix) const;
84912853Sgabeblack@google.com
85012853Sgabeblack@google.com    // other methods
85112853Sgabeblack@google.com    void
85212853Sgabeblack@google.com    print(::std::ostream &os=::std::cout) const
85312853Sgabeblack@google.com    {
85412853Sgabeblack@google.com        os << to_string(sc_io_base(os, SC_DEC), sc_io_show_base(os));
85512853Sgabeblack@google.com    }
85612853Sgabeblack@google.com
85712853Sgabeblack@google.com    void scan(::std::istream &is=::std::cin);
85812853Sgabeblack@google.com
85912853Sgabeblack@google.com  protected:
86012853Sgabeblack@google.com    uint_type m_val; // value
86112853Sgabeblack@google.com    int m_len; // length
86212853Sgabeblack@google.com    int m_ulen; // unused length
86312853Sgabeblack@google.com};
86412853Sgabeblack@google.com
86512853Sgabeblack@google.cominline ::std::ostream &operator << (::std::ostream &, const sc_uint_base &);
86612853Sgabeblack@google.cominline ::std::istream &operator >> (::std::istream &, sc_uint_base &);
86712853Sgabeblack@google.com
86812853Sgabeblack@google.com
86912853Sgabeblack@google.com// ----------------------------------------------------------------------------
87012853Sgabeblack@google.com//  CLASS : sc_uint_bitref_r
87112853Sgabeblack@google.com//
87212853Sgabeblack@google.com//  Proxy class for sc_uint bit selection (r-value only).
87312853Sgabeblack@google.com// ----------------------------------------------------------------------------
87412853Sgabeblack@google.com
87512853Sgabeblack@google.com// implicit conversion to bool
87612853Sgabeblack@google.com
87712853Sgabeblack@google.cominline sc_uint_bitref_r::operator uint64 () const
87812853Sgabeblack@google.com{
87912853Sgabeblack@google.com    return m_obj_p->test(m_index);
88012853Sgabeblack@google.com}
88112853Sgabeblack@google.com
88212853Sgabeblack@google.cominline bool
88312853Sgabeblack@google.comsc_uint_bitref_r::operator ! () const
88412853Sgabeblack@google.com{
88512853Sgabeblack@google.com    return !m_obj_p->test(m_index);
88612853Sgabeblack@google.com}
88712853Sgabeblack@google.com
88812853Sgabeblack@google.cominline bool
88912853Sgabeblack@google.comsc_uint_bitref_r::operator ~ () const
89012853Sgabeblack@google.com{
89112853Sgabeblack@google.com    return !m_obj_p->test(m_index);
89212853Sgabeblack@google.com}
89312853Sgabeblack@google.com
89412853Sgabeblack@google.cominline ::std::ostream &
89512853Sgabeblack@google.comoperator << (::std::ostream &os, const sc_uint_bitref_r &a)
89612853Sgabeblack@google.com{
89712853Sgabeblack@google.com    a.print(os);
89812853Sgabeblack@google.com    return os;
89912853Sgabeblack@google.com}
90012853Sgabeblack@google.com
90112853Sgabeblack@google.com
90212853Sgabeblack@google.com// ----------------------------------------------------------------------------
90312853Sgabeblack@google.com//  CLASS : sc_uint_bitref
90412853Sgabeblack@google.com//
90512853Sgabeblack@google.com//  Proxy class for sc_uint bit selection (r-value and l-value).
90612853Sgabeblack@google.com// ----------------------------------------------------------------------------
90712853Sgabeblack@google.com
90812853Sgabeblack@google.com// assignment operators
90912853Sgabeblack@google.com
91012853Sgabeblack@google.cominline sc_uint_bitref &
91112853Sgabeblack@google.comsc_uint_bitref::operator = (const sc_uint_bitref_r &b)
91212853Sgabeblack@google.com{
91312853Sgabeblack@google.com    m_obj_p->set(m_index, b.to_bool());
91412853Sgabeblack@google.com    return *this;
91512853Sgabeblack@google.com}
91612853Sgabeblack@google.com
91712853Sgabeblack@google.cominline sc_uint_bitref &
91812853Sgabeblack@google.comsc_uint_bitref::operator = (const sc_uint_bitref &b)
91912853Sgabeblack@google.com{
92012853Sgabeblack@google.com    m_obj_p->set(m_index, b.to_bool());
92112853Sgabeblack@google.com    return *this;
92212853Sgabeblack@google.com}
92312853Sgabeblack@google.com
92412853Sgabeblack@google.cominline sc_uint_bitref &
92512853Sgabeblack@google.comsc_uint_bitref::operator = (bool b)
92612853Sgabeblack@google.com{
92712853Sgabeblack@google.com    m_obj_p->set(m_index, b);
92812853Sgabeblack@google.com    return *this;
92912853Sgabeblack@google.com}
93012853Sgabeblack@google.com
93112853Sgabeblack@google.cominline sc_uint_bitref &
93212853Sgabeblack@google.comsc_uint_bitref::operator &= (bool b)
93312853Sgabeblack@google.com{
93412853Sgabeblack@google.com    if (!b) {
93512853Sgabeblack@google.com        m_obj_p->set(m_index, b);
93612853Sgabeblack@google.com    }
93712853Sgabeblack@google.com    return *this;
93812853Sgabeblack@google.com}
93912853Sgabeblack@google.com
94012853Sgabeblack@google.cominline sc_uint_bitref &
94112853Sgabeblack@google.comsc_uint_bitref::operator |= (bool b)
94212853Sgabeblack@google.com{
94312853Sgabeblack@google.com    if (b) {
94412853Sgabeblack@google.com        m_obj_p->set(m_index, b);
94512853Sgabeblack@google.com    }
94612853Sgabeblack@google.com    return *this;
94712853Sgabeblack@google.com}
94812853Sgabeblack@google.com
94912853Sgabeblack@google.cominline sc_uint_bitref &
95012853Sgabeblack@google.comsc_uint_bitref::operator ^= (bool b)
95112853Sgabeblack@google.com{
95212853Sgabeblack@google.com    if (b) {
95312853Sgabeblack@google.com        m_obj_p->m_val ^= (UINT_ONE << m_index);
95412853Sgabeblack@google.com    }
95512853Sgabeblack@google.com    return *this;
95612853Sgabeblack@google.com}
95712853Sgabeblack@google.com
95812853Sgabeblack@google.cominline ::std::istream &
95912853Sgabeblack@google.comoperator >> (::std::istream &is, sc_uint_bitref &a)
96012853Sgabeblack@google.com{
96112853Sgabeblack@google.com    a.scan(is);
96212853Sgabeblack@google.com    return is;
96312853Sgabeblack@google.com}
96412853Sgabeblack@google.com
96512853Sgabeblack@google.com
96612853Sgabeblack@google.com// ----------------------------------------------------------------------------
96712853Sgabeblack@google.com//  CLASS : sc_uint_subref_r
96812853Sgabeblack@google.com//
96912853Sgabeblack@google.com//  Proxy class for sc_uint part selection (r-value only).
97012853Sgabeblack@google.com// ----------------------------------------------------------------------------
97112853Sgabeblack@google.com
97212853Sgabeblack@google.com// implicit conversion to uint_type
97312853Sgabeblack@google.com
97412853Sgabeblack@google.cominline sc_uint_subref_r::operator uint_type() const
97512853Sgabeblack@google.com{
97612853Sgabeblack@google.com    uint_type val = m_obj_p->m_val;
97712853Sgabeblack@google.com    int uleft = SC_INTWIDTH - (m_left + 1);
97812853Sgabeblack@google.com    return ((val & (~UINT_ZERO >> uleft)) >> m_right);
97912853Sgabeblack@google.com}
98012853Sgabeblack@google.com
98112853Sgabeblack@google.com
98212853Sgabeblack@google.com// reduce methods
98312853Sgabeblack@google.cominline bool
98412853Sgabeblack@google.comsc_uint_subref_r::and_reduce() const
98512853Sgabeblack@google.com{
98612853Sgabeblack@google.com    sc_uint_base a(*this);
98712853Sgabeblack@google.com    return a.and_reduce();
98812853Sgabeblack@google.com}
98912853Sgabeblack@google.cominline bool
99012853Sgabeblack@google.comsc_uint_subref_r::or_reduce() const
99112853Sgabeblack@google.com{
99212853Sgabeblack@google.com    sc_uint_base a(*this);
99312853Sgabeblack@google.com    return a.or_reduce();
99412853Sgabeblack@google.com}
99512853Sgabeblack@google.cominline bool
99612853Sgabeblack@google.comsc_uint_subref_r::xor_reduce() const
99712853Sgabeblack@google.com{
99812853Sgabeblack@google.com    sc_uint_base a(*this);
99912853Sgabeblack@google.com    return a.xor_reduce();
100012853Sgabeblack@google.com}
100112853Sgabeblack@google.com
100212853Sgabeblack@google.com// explicit conversions
100312853Sgabeblack@google.cominline int
100412853Sgabeblack@google.comsc_uint_subref_r::to_int() const
100512853Sgabeblack@google.com{
100612853Sgabeblack@google.com    sc_uint_base a(*this);
100712853Sgabeblack@google.com    return a.to_int();
100812853Sgabeblack@google.com}
100912853Sgabeblack@google.cominline unsigned int
101012853Sgabeblack@google.comsc_uint_subref_r::to_uint() const
101112853Sgabeblack@google.com{
101212853Sgabeblack@google.com    sc_uint_base a(*this);
101312853Sgabeblack@google.com    return a.to_uint();
101412853Sgabeblack@google.com}
101512853Sgabeblack@google.cominline long
101612853Sgabeblack@google.comsc_uint_subref_r::to_long() const
101712853Sgabeblack@google.com{
101812853Sgabeblack@google.com    sc_uint_base a(*this);
101912853Sgabeblack@google.com    return a.to_long();
102012853Sgabeblack@google.com}
102112853Sgabeblack@google.cominline unsigned long
102212853Sgabeblack@google.comsc_uint_subref_r::to_ulong() const
102312853Sgabeblack@google.com{
102412853Sgabeblack@google.com    sc_uint_base a(*this);
102512853Sgabeblack@google.com    return a.to_ulong();
102612853Sgabeblack@google.com}
102712853Sgabeblack@google.cominline int64
102812853Sgabeblack@google.comsc_uint_subref_r::to_int64() const
102912853Sgabeblack@google.com{
103012853Sgabeblack@google.com    sc_uint_base a(*this);
103112853Sgabeblack@google.com    return a.to_int64();
103212853Sgabeblack@google.com}
103312853Sgabeblack@google.cominline uint64
103412853Sgabeblack@google.comsc_uint_subref_r::to_uint64() const
103512853Sgabeblack@google.com{
103612853Sgabeblack@google.com    sc_uint_base a(*this);
103712853Sgabeblack@google.com    return a.to_uint64();
103812853Sgabeblack@google.com}
103912853Sgabeblack@google.cominline double
104012853Sgabeblack@google.comsc_uint_subref_r::to_double() const
104112853Sgabeblack@google.com{
104212853Sgabeblack@google.com    sc_uint_base a(*this);
104312853Sgabeblack@google.com    return a.to_double();
104412853Sgabeblack@google.com}
104512853Sgabeblack@google.com
104612853Sgabeblack@google.com// explicit conversion to character string
104712853Sgabeblack@google.cominline const std::string
104812853Sgabeblack@google.comsc_uint_subref_r::to_string(sc_numrep numrep) const
104912853Sgabeblack@google.com{
105012853Sgabeblack@google.com    sc_uint_base a(*this);
105112853Sgabeblack@google.com    return a.to_string(numrep);
105212853Sgabeblack@google.com}
105312853Sgabeblack@google.com
105412853Sgabeblack@google.cominline const std::string
105512853Sgabeblack@google.comsc_uint_subref_r::to_string(sc_numrep numrep, bool w_prefix) const
105612853Sgabeblack@google.com{
105712853Sgabeblack@google.com    sc_uint_base a(*this);
105812853Sgabeblack@google.com    return a.to_string(numrep, w_prefix);
105912853Sgabeblack@google.com}
106012853Sgabeblack@google.com
106112853Sgabeblack@google.com// functional notation for the reduce methods
106212853Sgabeblack@google.cominline bool
106312853Sgabeblack@google.comand_reduce(const sc_uint_subref_r &a)
106412853Sgabeblack@google.com{
106512853Sgabeblack@google.com    return a.and_reduce();
106612853Sgabeblack@google.com}
106712853Sgabeblack@google.cominline bool
106812853Sgabeblack@google.comnand_reduce(const sc_uint_subref_r &a)
106912853Sgabeblack@google.com{
107012853Sgabeblack@google.com    return a.nand_reduce();
107112853Sgabeblack@google.com}
107212853Sgabeblack@google.cominline bool
107312853Sgabeblack@google.comor_reduce(const sc_uint_subref_r &a)
107412853Sgabeblack@google.com{
107512853Sgabeblack@google.com    return a.or_reduce();
107612853Sgabeblack@google.com}
107712853Sgabeblack@google.cominline bool
107812853Sgabeblack@google.comnor_reduce(const sc_uint_subref_r &a)
107912853Sgabeblack@google.com{
108012853Sgabeblack@google.com    return a.nor_reduce();
108112853Sgabeblack@google.com}
108212853Sgabeblack@google.cominline bool
108312853Sgabeblack@google.comxor_reduce(const sc_uint_subref_r &a)
108412853Sgabeblack@google.com{
108512853Sgabeblack@google.com    return a.xor_reduce();
108612853Sgabeblack@google.com}
108712853Sgabeblack@google.cominline bool
108812853Sgabeblack@google.comxnor_reduce(const sc_uint_subref_r &a)
108912853Sgabeblack@google.com{
109012853Sgabeblack@google.com    return a.xnor_reduce();
109112853Sgabeblack@google.com}
109212853Sgabeblack@google.com
109312853Sgabeblack@google.cominline ::std::ostream &
109412853Sgabeblack@google.comoperator << (::std::ostream &os, const sc_uint_subref_r &a)
109512853Sgabeblack@google.com{
109612853Sgabeblack@google.com    a.print(os);
109712853Sgabeblack@google.com    return os;
109812853Sgabeblack@google.com}
109912853Sgabeblack@google.com
110012853Sgabeblack@google.com
110112853Sgabeblack@google.com// ----------------------------------------------------------------------------
110212853Sgabeblack@google.com//  CLASS : sc_uint_subref
110312853Sgabeblack@google.com//
110412853Sgabeblack@google.com//  Proxy class for sc_uint part selection (r-value and l-value).
110512853Sgabeblack@google.com// ----------------------------------------------------------------------------
110612853Sgabeblack@google.com
110712853Sgabeblack@google.com// assignment operators
110812853Sgabeblack@google.com
110912853Sgabeblack@google.cominline sc_uint_subref &
111012853Sgabeblack@google.comsc_uint_subref::operator = (const sc_uint_base &a)
111112853Sgabeblack@google.com{
111212853Sgabeblack@google.com    return operator = (a.operator uint_type());
111312853Sgabeblack@google.com}
111412853Sgabeblack@google.com
111512853Sgabeblack@google.cominline sc_uint_subref &
111612853Sgabeblack@google.comsc_uint_subref::operator = (const char *a)
111712853Sgabeblack@google.com{
111812853Sgabeblack@google.com    sc_uint_base aa(length());
111912853Sgabeblack@google.com    return (*this = aa = a);
112012853Sgabeblack@google.com}
112112853Sgabeblack@google.com
112212853Sgabeblack@google.cominline ::std::istream &
112312853Sgabeblack@google.comoperator >> (::std::istream &is, sc_uint_subref &a)
112412853Sgabeblack@google.com{
112512853Sgabeblack@google.com    a.scan(is);
112612853Sgabeblack@google.com    return is;
112712853Sgabeblack@google.com}
112812853Sgabeblack@google.com
112912853Sgabeblack@google.com
113012853Sgabeblack@google.com// ----------------------------------------------------------------------------
113112853Sgabeblack@google.com//  CLASS : sc_uint_base
113212853Sgabeblack@google.com//
113312853Sgabeblack@google.com//  Base class for sc_uint.
113412853Sgabeblack@google.com// ----------------------------------------------------------------------------
113512853Sgabeblack@google.com
113612853Sgabeblack@google.com// bit selection
113712853Sgabeblack@google.cominline sc_uint_bitref &
113812853Sgabeblack@google.comsc_uint_base::operator [] (int i)
113912853Sgabeblack@google.com{
114012853Sgabeblack@google.com    check_index(i);
114112853Sgabeblack@google.com    sc_uint_bitref *result_p = sc_uint_bitref::m_pool.allocate();
114212853Sgabeblack@google.com    result_p->initialize(this, i);
114312853Sgabeblack@google.com    return *result_p;
114412853Sgabeblack@google.com}
114512853Sgabeblack@google.com
114612853Sgabeblack@google.cominline const sc_uint_bitref_r &
114712853Sgabeblack@google.comsc_uint_base::operator [] (int i) const
114812853Sgabeblack@google.com{
114912853Sgabeblack@google.com    check_index(i);
115012853Sgabeblack@google.com    sc_uint_bitref *result_p = sc_uint_bitref::m_pool.allocate();
115112853Sgabeblack@google.com    result_p->initialize(this, i);
115212853Sgabeblack@google.com    return *result_p;
115312853Sgabeblack@google.com}
115412853Sgabeblack@google.com
115512853Sgabeblack@google.cominline sc_uint_bitref &
115612853Sgabeblack@google.comsc_uint_base::bit(int i)
115712853Sgabeblack@google.com{
115812853Sgabeblack@google.com    check_index(i);
115912853Sgabeblack@google.com    sc_uint_bitref *result_p = sc_uint_bitref::m_pool.allocate();
116012853Sgabeblack@google.com    result_p->initialize(this, i);
116112853Sgabeblack@google.com    return *result_p;
116212853Sgabeblack@google.com}
116312853Sgabeblack@google.com
116412853Sgabeblack@google.cominline const sc_uint_bitref_r &
116512853Sgabeblack@google.comsc_uint_base::bit(int i) const
116612853Sgabeblack@google.com{
116712853Sgabeblack@google.com    check_index(i);
116812853Sgabeblack@google.com    sc_uint_bitref *result_p = sc_uint_bitref::m_pool.allocate();
116912853Sgabeblack@google.com    result_p->initialize(this, i);
117012853Sgabeblack@google.com    return *result_p;
117112853Sgabeblack@google.com}
117212853Sgabeblack@google.com
117312853Sgabeblack@google.com// part selection
117412853Sgabeblack@google.cominline sc_uint_subref &
117512853Sgabeblack@google.comsc_uint_base::operator () (int left, int right)
117612853Sgabeblack@google.com{
117712853Sgabeblack@google.com    check_range(left, right);
117812853Sgabeblack@google.com    sc_uint_subref *result_p = sc_uint_subref::m_pool.allocate();
117912853Sgabeblack@google.com    result_p->initialize(this, left, right);
118012853Sgabeblack@google.com    return *result_p;
118112853Sgabeblack@google.com}
118212853Sgabeblack@google.com
118312853Sgabeblack@google.cominline const sc_uint_subref_r &
118412853Sgabeblack@google.comsc_uint_base::operator () (int left, int right) const
118512853Sgabeblack@google.com{
118612853Sgabeblack@google.com    check_range(left, right);
118712853Sgabeblack@google.com    sc_uint_subref *result_p = sc_uint_subref::m_pool.allocate();
118812853Sgabeblack@google.com    result_p->initialize(this, left, right);
118912853Sgabeblack@google.com    return *result_p;
119012853Sgabeblack@google.com}
119112853Sgabeblack@google.com
119212853Sgabeblack@google.cominline sc_uint_subref &
119312853Sgabeblack@google.comsc_uint_base::range(int left, int right)
119412853Sgabeblack@google.com{
119512853Sgabeblack@google.com    check_range(left, right);
119612853Sgabeblack@google.com    sc_uint_subref *result_p = sc_uint_subref::m_pool.allocate();
119712853Sgabeblack@google.com    result_p->initialize(this, left, right);
119812853Sgabeblack@google.com    return *result_p;
119912853Sgabeblack@google.com}
120012853Sgabeblack@google.com
120112853Sgabeblack@google.cominline const sc_uint_subref_r &
120212853Sgabeblack@google.comsc_uint_base::range(int left, int right) const
120312853Sgabeblack@google.com{
120412853Sgabeblack@google.com    check_range(left, right);
120512853Sgabeblack@google.com    sc_uint_subref *result_p = sc_uint_subref::m_pool.allocate();
120612853Sgabeblack@google.com    result_p->initialize(this, left, right);
120712853Sgabeblack@google.com    return *result_p;
120812853Sgabeblack@google.com}
120912853Sgabeblack@google.com
121012853Sgabeblack@google.com// functional notation for the reduce methods
121112853Sgabeblack@google.cominline bool
121212853Sgabeblack@google.comand_reduce(const sc_uint_base &a)
121312853Sgabeblack@google.com{
121412853Sgabeblack@google.com    return a.and_reduce();
121512853Sgabeblack@google.com}
121612853Sgabeblack@google.cominline bool
121712853Sgabeblack@google.comnand_reduce(const sc_uint_base &a)
121812853Sgabeblack@google.com{
121912853Sgabeblack@google.com    return a.nand_reduce();
122012853Sgabeblack@google.com}
122112853Sgabeblack@google.cominline bool
122212853Sgabeblack@google.comor_reduce(const sc_uint_base &a)
122312853Sgabeblack@google.com{
122412853Sgabeblack@google.com    return a.or_reduce();
122512853Sgabeblack@google.com}
122612853Sgabeblack@google.cominline bool
122712853Sgabeblack@google.comnor_reduce(const sc_uint_base &a)
122812853Sgabeblack@google.com{
122912853Sgabeblack@google.com    return a.nor_reduce();
123012853Sgabeblack@google.com}
123112853Sgabeblack@google.cominline bool
123212853Sgabeblack@google.comxor_reduce(const sc_uint_base &a)
123312853Sgabeblack@google.com{
123412853Sgabeblack@google.com    return a.xor_reduce();
123512853Sgabeblack@google.com}
123612853Sgabeblack@google.cominline bool
123712853Sgabeblack@google.comxnor_reduce(const sc_uint_base &a)
123812853Sgabeblack@google.com{
123912853Sgabeblack@google.com    return a.xnor_reduce();
124012853Sgabeblack@google.com}
124112853Sgabeblack@google.com
124212853Sgabeblack@google.cominline ::std::ostream &
124312853Sgabeblack@google.comoperator << (::std::ostream &os, const sc_uint_base &a)
124412853Sgabeblack@google.com{
124512853Sgabeblack@google.com    a.print(os);
124612853Sgabeblack@google.com    return os;
124712853Sgabeblack@google.com}
124812853Sgabeblack@google.com
124912853Sgabeblack@google.cominline ::std::istream &
125012853Sgabeblack@google.comoperator >> (::std::istream &is, sc_uint_base &a)
125112853Sgabeblack@google.com{
125212853Sgabeblack@google.com    a.scan(is);
125312853Sgabeblack@google.com    return is;
125412853Sgabeblack@google.com}
125512853Sgabeblack@google.com
125612853Sgabeblack@google.com} // namespace sc_dt
125712853Sgabeblack@google.com
125812853Sgabeblack@google.com#endif // __SYSTEMC_EXT_DT_INT_SC_UINT_BASE_HH__
1259