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_lv_base.h -- Arbitrary size logic vector class.
2312853Sgabeblack@google.com
2412853Sgabeblack@google.com  Original Author: Gene Bushuyev, Synopsys, Inc.
2512853Sgabeblack@google.com
2612853Sgabeblack@google.com *****************************************************************************/
2712853Sgabeblack@google.com
2812853Sgabeblack@google.com/*****************************************************************************
2912853Sgabeblack@google.com
3012853Sgabeblack@google.com  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
3112853Sgabeblack@google.com  changes you are making here.
3212853Sgabeblack@google.com
3312853Sgabeblack@google.com      Name, Affiliation, Date:
3412853Sgabeblack@google.com  Description of Modification:
3512853Sgabeblack@google.com        Andy Goodrich, Forte Design Systems
3612853Sgabeblack@google.com          Fixed bug in clean_tail for sizes that are modulo 32, which caused
3712853Sgabeblack@google.com          zeroing of values.
3812853Sgabeblack@google.com
3912853Sgabeblack@google.com *****************************************************************************/
4012853Sgabeblack@google.com
4112853Sgabeblack@google.com// $Log: sc_lv_base.h,v $
4212853Sgabeblack@google.com// Revision 1.4  2011/08/26 22:32:00  acg
4312853Sgabeblack@google.com//  Torsten Maehne: added parentheses to make opearator ordering more obvious.
4412853Sgabeblack@google.com//
4512853Sgabeblack@google.com// Revision 1.3  2010/01/27 19:41:29  acg
4612853Sgabeblack@google.com//  Andy Goodrich: fix 8 instances of sc_concref constructor invocations
4712853Sgabeblack@google.com//  that failed to indicate that their arguments should be freed when the
4812853Sgabeblack@google.com//  object was freed.
4912853Sgabeblack@google.com//
5012853Sgabeblack@google.com// Revision 1.2  2009/02/28 00:26:14  acg
5112853Sgabeblack@google.com//  Andy Goodrich: bug fixes.
5212853Sgabeblack@google.com//
5312853Sgabeblack@google.com// Revision 1.2  2007/03/14 17:47:49  acg
5412853Sgabeblack@google.com//  Andy Goodrich: Formatting.
5512853Sgabeblack@google.com//
5612853Sgabeblack@google.com// Revision 1.1.1.1  2006/12/15 20:31:36  acg
5712853Sgabeblack@google.com// SystemC 2.2
5812853Sgabeblack@google.com//
5912853Sgabeblack@google.com// Revision 1.3  2006/01/13 18:53:53  acg
6012853Sgabeblack@google.com// Andy Goodrich: added $Log command so that CVS comments are reproduced in
6112853Sgabeblack@google.com// the source.
6212853Sgabeblack@google.com//
6312853Sgabeblack@google.com
6412853Sgabeblack@google.com#ifndef __SYSTEMC_EXT_DT_BIT_SC_LV_BASE_HH__
6512853Sgabeblack@google.com#define __SYSTEMC_EXT_DT_BIT_SC_LV_BASE_HH__
6612853Sgabeblack@google.com
6712853Sgabeblack@google.com#include "../int/sc_length_param.hh"
6812853Sgabeblack@google.com#include "sc_bv_base.hh"
6912853Sgabeblack@google.com#include "sc_logic.hh"
7012853Sgabeblack@google.com
7112853Sgabeblack@google.comnamespace sc_dt
7212853Sgabeblack@google.com{
7312853Sgabeblack@google.com
7412853Sgabeblack@google.com// classes defined in this module
7512853Sgabeblack@google.comclass sc_lv_base;
7612853Sgabeblack@google.com
7712853Sgabeblack@google.com
7812853Sgabeblack@google.com// ----------------------------------------------------------------------------
7912853Sgabeblack@google.com//  CLASS : sc_lv_base
8012853Sgabeblack@google.com//
8112853Sgabeblack@google.com//  Arbitrary size logic vector base class.
8212853Sgabeblack@google.com// ----------------------------------------------------------------------------
8312853Sgabeblack@google.com
8412853Sgabeblack@google.comclass sc_lv_base : public sc_proxy<sc_lv_base>
8512853Sgabeblack@google.com{
8612853Sgabeblack@google.com    friend class sc_bv_base;
8712853Sgabeblack@google.com
8812853Sgabeblack@google.com    void init(int length_, const sc_logic &init_value=SC_LOGIC_X);
8912853Sgabeblack@google.com    void assign_from_string(const std::string &);
9012853Sgabeblack@google.com
9112853Sgabeblack@google.com  public:
9212853Sgabeblack@google.com    // typedefs
9312853Sgabeblack@google.com    typedef sc_proxy<sc_lv_base> base_type;
9412853Sgabeblack@google.com    typedef base_type::value_type value_type;
9512853Sgabeblack@google.com
9612853Sgabeblack@google.com    // constructors
9712853Sgabeblack@google.com    explicit sc_lv_base(int length_=sc_length_param().len()) :
9812853Sgabeblack@google.com        m_len(0), m_size(0), m_data(0), m_ctrl(0)
9912853Sgabeblack@google.com    {
10012853Sgabeblack@google.com        init(length_);
10112853Sgabeblack@google.com    }
10212853Sgabeblack@google.com
10312853Sgabeblack@google.com    explicit sc_lv_base(
10412853Sgabeblack@google.com            const sc_logic &a, int length_=sc_length_param().len()) :
10512853Sgabeblack@google.com        m_len(0), m_size(0), m_data(0), m_ctrl(0)
10612853Sgabeblack@google.com    {
10712853Sgabeblack@google.com        init(length_, a);
10812853Sgabeblack@google.com    }
10912853Sgabeblack@google.com
11012853Sgabeblack@google.com    sc_lv_base(const char *a);
11112853Sgabeblack@google.com    sc_lv_base(const char *a, int length_);
11212853Sgabeblack@google.com
11312853Sgabeblack@google.com    template <class X>
11412853Sgabeblack@google.com    sc_lv_base(const sc_proxy<X> &a) :
11512853Sgabeblack@google.com        m_len(0), m_size(0), m_data(0), m_ctrl(0)
11612853Sgabeblack@google.com    {
11712853Sgabeblack@google.com        init(a.back_cast().length());
11812853Sgabeblack@google.com        base_type::assign_(a);
11912853Sgabeblack@google.com    }
12012853Sgabeblack@google.com
12112853Sgabeblack@google.com    sc_lv_base(const sc_lv_base &a);
12212853Sgabeblack@google.com
12312853Sgabeblack@google.com    // destructor
12412853Sgabeblack@google.com    virtual ~sc_lv_base() { delete [] m_data; }
12512853Sgabeblack@google.com
12612853Sgabeblack@google.com    // assignment operators
12712853Sgabeblack@google.com    template <class X>
12812853Sgabeblack@google.com    sc_lv_base &
12912853Sgabeblack@google.com    operator = (const sc_proxy<X> &a)
13012853Sgabeblack@google.com    {
13112853Sgabeblack@google.com        assign_p_(*this, a);
13212853Sgabeblack@google.com        return *this;
13312853Sgabeblack@google.com    }
13412853Sgabeblack@google.com
13512853Sgabeblack@google.com    sc_lv_base &
13612853Sgabeblack@google.com    operator = (const sc_lv_base &a)
13712853Sgabeblack@google.com    {
13812853Sgabeblack@google.com        assign_p_(*this, a);
13912853Sgabeblack@google.com        return *this;
14012853Sgabeblack@google.com    }
14112853Sgabeblack@google.com
14212853Sgabeblack@google.com    sc_lv_base &operator = (const char *a);
14312853Sgabeblack@google.com
14412853Sgabeblack@google.com    sc_lv_base &
14512853Sgabeblack@google.com    operator = (const bool *a)
14612853Sgabeblack@google.com    {
14712853Sgabeblack@google.com        base_type::assign_(a);
14812853Sgabeblack@google.com        return *this;
14912853Sgabeblack@google.com    }
15012853Sgabeblack@google.com
15112853Sgabeblack@google.com    sc_lv_base &
15212853Sgabeblack@google.com    operator = (const sc_logic *a)
15312853Sgabeblack@google.com    {
15412853Sgabeblack@google.com        base_type::assign_(a);
15512853Sgabeblack@google.com        return *this;
15612853Sgabeblack@google.com    }
15712853Sgabeblack@google.com
15812853Sgabeblack@google.com    sc_lv_base &
15912853Sgabeblack@google.com    operator = (const sc_unsigned &a)
16012853Sgabeblack@google.com    {
16112853Sgabeblack@google.com        base_type::assign_(a);
16212853Sgabeblack@google.com        return *this;
16312853Sgabeblack@google.com    }
16412853Sgabeblack@google.com
16512853Sgabeblack@google.com    sc_lv_base &
16612853Sgabeblack@google.com    operator = (const sc_signed &a)
16712853Sgabeblack@google.com    {
16812853Sgabeblack@google.com        base_type::assign_(a);
16912853Sgabeblack@google.com        return *this;
17012853Sgabeblack@google.com    }
17112853Sgabeblack@google.com
17212853Sgabeblack@google.com    sc_lv_base &
17312853Sgabeblack@google.com    operator = (const sc_uint_base &a)
17412853Sgabeblack@google.com    {
17512853Sgabeblack@google.com        base_type::assign_(a);
17612853Sgabeblack@google.com        return *this;
17712853Sgabeblack@google.com    }
17812853Sgabeblack@google.com
17912853Sgabeblack@google.com    sc_lv_base &
18012853Sgabeblack@google.com    operator = (const sc_int_base &a)
18112853Sgabeblack@google.com    {
18212853Sgabeblack@google.com        base_type::assign_(a);
18312853Sgabeblack@google.com        return *this;
18412853Sgabeblack@google.com    }
18512853Sgabeblack@google.com
18612853Sgabeblack@google.com    sc_lv_base &
18712853Sgabeblack@google.com    operator = (unsigned long a)
18812853Sgabeblack@google.com    {
18912853Sgabeblack@google.com        base_type::assign_(a);
19012853Sgabeblack@google.com        return *this;
19112853Sgabeblack@google.com    }
19212853Sgabeblack@google.com
19312853Sgabeblack@google.com    sc_lv_base &
19412853Sgabeblack@google.com    operator = (long a)
19512853Sgabeblack@google.com    {
19612853Sgabeblack@google.com        base_type::assign_(a);
19712853Sgabeblack@google.com        return *this;
19812853Sgabeblack@google.com    }
19912853Sgabeblack@google.com
20012853Sgabeblack@google.com    sc_lv_base &
20112853Sgabeblack@google.com    operator = (unsigned int a)
20212853Sgabeblack@google.com    {
20312853Sgabeblack@google.com        base_type::assign_(a);
20412853Sgabeblack@google.com        return *this;
20512853Sgabeblack@google.com    }
20612853Sgabeblack@google.com
20712853Sgabeblack@google.com    sc_lv_base &
20812853Sgabeblack@google.com    operator = (int a)
20912853Sgabeblack@google.com    {
21012853Sgabeblack@google.com        base_type::assign_(a);
21112853Sgabeblack@google.com        return *this;
21212853Sgabeblack@google.com    }
21312853Sgabeblack@google.com
21412853Sgabeblack@google.com    sc_lv_base &
21512853Sgabeblack@google.com    operator = (uint64 a)
21612853Sgabeblack@google.com    {
21712853Sgabeblack@google.com        base_type::assign_(a);
21812853Sgabeblack@google.com        return *this;
21912853Sgabeblack@google.com    }
22012853Sgabeblack@google.com
22112853Sgabeblack@google.com    sc_lv_base &
22212853Sgabeblack@google.com    operator = (int64 a)
22312853Sgabeblack@google.com    {
22412853Sgabeblack@google.com        base_type::assign_(a);
22512853Sgabeblack@google.com        return *this;
22612853Sgabeblack@google.com    }
22712853Sgabeblack@google.com
22812853Sgabeblack@google.com    // common methods
22912853Sgabeblack@google.com    int length() const { return m_len; }
23012853Sgabeblack@google.com    int size() const { return m_size; }
23112853Sgabeblack@google.com
23212853Sgabeblack@google.com    value_type get_bit(int i) const;
23312853Sgabeblack@google.com    void set_bit(int i, value_type value);
23412853Sgabeblack@google.com
23512853Sgabeblack@google.com    sc_digit get_word(int wi) const { return m_data[wi]; }
23612853Sgabeblack@google.com
23712853Sgabeblack@google.com    // note the test for out of range access here. this is necessary
23812853Sgabeblack@google.com    // because of the hair-brained way concatenations are set up.
23912853Sgabeblack@google.com    // an extend_sign on a concatenation uses the whole length of
24012853Sgabeblack@google.com    // the concatenation to determine how many words to set.
24112853Sgabeblack@google.com    void
24212853Sgabeblack@google.com    set_word(int wi, sc_digit w)
24312853Sgabeblack@google.com    {
24412853Sgabeblack@google.com        sc_assert(wi < m_size);
24512853Sgabeblack@google.com        m_data[wi] = w;
24612853Sgabeblack@google.com    }
24712853Sgabeblack@google.com
24812853Sgabeblack@google.com    sc_digit get_cword(int wi) const { return m_ctrl[wi]; }
24912853Sgabeblack@google.com
25012853Sgabeblack@google.com    void
25112853Sgabeblack@google.com    set_cword(int wi, sc_digit w)
25212853Sgabeblack@google.com    {
25312853Sgabeblack@google.com        sc_assert(wi < m_size);
25412853Sgabeblack@google.com        m_ctrl[wi] = w;
25512853Sgabeblack@google.com    }
25612853Sgabeblack@google.com    void clean_tail();
25712853Sgabeblack@google.com
25812853Sgabeblack@google.com    // other methods
25912853Sgabeblack@google.com    bool is_01() const;
26012853Sgabeblack@google.com
26112853Sgabeblack@google.com  protected:
26212853Sgabeblack@google.com    int m_len; // length in bits
26312853Sgabeblack@google.com    int m_size; // size of the data array
26412853Sgabeblack@google.com    sc_digit *m_data; // data array
26512853Sgabeblack@google.com    sc_digit *m_ctrl; // dito (control part)
26612853Sgabeblack@google.com};
26712853Sgabeblack@google.com
26812853Sgabeblack@google.com// IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
26912853Sgabeblack@google.com
27012853Sgabeblack@google.cominline sc_lv_base::value_type
27112853Sgabeblack@google.comsc_lv_base::get_bit(int i) const
27212853Sgabeblack@google.com{
27312853Sgabeblack@google.com    int wi = i / SC_DIGIT_SIZE;
27412853Sgabeblack@google.com    int bi = i % SC_DIGIT_SIZE;
27512853Sgabeblack@google.com    return value_type(((m_data[wi] >> bi) & SC_DIGIT_ONE) |
27612853Sgabeblack@google.com                      (((m_ctrl[wi] >> bi) << 1) & SC_DIGIT_TWO));
27712853Sgabeblack@google.com}
27812853Sgabeblack@google.com
27912853Sgabeblack@google.cominline void
28012853Sgabeblack@google.comsc_lv_base::set_bit(int i, value_type value)
28112853Sgabeblack@google.com{
28212853Sgabeblack@google.com    int wi = i / SC_DIGIT_SIZE; // word index
28312853Sgabeblack@google.com    int bi = i % SC_DIGIT_SIZE; // bit index
28412853Sgabeblack@google.com    sc_digit mask = SC_DIGIT_ONE << bi;
28512853Sgabeblack@google.com    m_data[wi] |= mask; // set bit to 1
28612853Sgabeblack@google.com    m_ctrl[wi] |= mask; // set bit to 1
28712853Sgabeblack@google.com    m_data[wi] &= value << bi | ~mask;
28812853Sgabeblack@google.com    m_ctrl[wi] &= value >> 1 << bi | ~mask;
28912853Sgabeblack@google.com}
29012853Sgabeblack@google.com
29112853Sgabeblack@google.cominline void
29212853Sgabeblack@google.comsc_lv_base::clean_tail()
29312853Sgabeblack@google.com{
29412853Sgabeblack@google.com    int wi = m_size - 1;
29512853Sgabeblack@google.com    int bi = m_len % SC_DIGIT_SIZE;
29612853Sgabeblack@google.com    sc_digit mask = ~SC_DIGIT_ZERO >> (SC_DIGIT_SIZE - bi);
29712853Sgabeblack@google.com    if (mask) {
29812853Sgabeblack@google.com        m_data[wi] &= mask;
29912853Sgabeblack@google.com        m_ctrl[wi] &= mask;
30012853Sgabeblack@google.com    }
30112853Sgabeblack@google.com}
30212853Sgabeblack@google.com
30312853Sgabeblack@google.com
30412853Sgabeblack@google.com// ----------------------------------------------------------------------------
30512853Sgabeblack@google.com//  CLASS TEMPLATE : sc_proxy
30612853Sgabeblack@google.com//
30712853Sgabeblack@google.com//  Base class template for bit/logic vector classes.
30812853Sgabeblack@google.com//  (Barton/Nackmann implementation)
30912853Sgabeblack@google.com// ----------------------------------------------------------------------------
31012853Sgabeblack@google.com
31112853Sgabeblack@google.com// bitwise operators and functions
31212853Sgabeblack@google.com
31312853Sgabeblack@google.com// bitwise complement
31412853Sgabeblack@google.comtemplate <class X>
31512853Sgabeblack@google.cominline const sc_lv_base
31612853Sgabeblack@google.comsc_proxy<X>::operator ~ () const
31712853Sgabeblack@google.com{
31812853Sgabeblack@google.com    sc_lv_base a(back_cast());
31912853Sgabeblack@google.com    return a.b_not();
32012853Sgabeblack@google.com}
32112853Sgabeblack@google.com
32212853Sgabeblack@google.com// bitwise and
32312853Sgabeblack@google.comtemplate <class X, class Y>
32412853Sgabeblack@google.cominline X &
32512853Sgabeblack@google.comoperator &= (sc_proxy<X> &px, const sc_proxy<Y> &py)
32612853Sgabeblack@google.com{
32712853Sgabeblack@google.com    X &x = px.back_cast();
32812853Sgabeblack@google.com    sc_lv_base a(x.length());
32912853Sgabeblack@google.com    a = py.back_cast();
33012853Sgabeblack@google.com    return b_and_assign_(x, a);
33112853Sgabeblack@google.com}
33212853Sgabeblack@google.com
33312853Sgabeblack@google.com#define DEFN_BITWISE_AND_ASN_OP_T(tp) \
33412853Sgabeblack@google.comtemplate <class X> \
33512853Sgabeblack@google.cominline X & \
33612853Sgabeblack@google.comsc_proxy<X>::operator &= (tp b) \
33712853Sgabeblack@google.com{ \
33812853Sgabeblack@google.com    X &x = back_cast(); \
33912853Sgabeblack@google.com    sc_lv_base a(x.length()); \
34012853Sgabeblack@google.com    a = b; \
34112853Sgabeblack@google.com    return b_and_assign_(x, a); \
34212853Sgabeblack@google.com}
34312853Sgabeblack@google.com
34412853Sgabeblack@google.comDEFN_BITWISE_AND_ASN_OP_T(const char *)
34512853Sgabeblack@google.comDEFN_BITWISE_AND_ASN_OP_T(const bool *)
34612853Sgabeblack@google.comDEFN_BITWISE_AND_ASN_OP_T(const sc_logic *)
34712853Sgabeblack@google.comDEFN_BITWISE_AND_ASN_OP_T(const sc_unsigned &)
34812853Sgabeblack@google.comDEFN_BITWISE_AND_ASN_OP_T(const sc_signed &)
34912853Sgabeblack@google.comDEFN_BITWISE_AND_ASN_OP_T(unsigned long)
35012853Sgabeblack@google.comDEFN_BITWISE_AND_ASN_OP_T(long)
35112853Sgabeblack@google.comDEFN_BITWISE_AND_ASN_OP_T(uint64)
35212853Sgabeblack@google.comDEFN_BITWISE_AND_ASN_OP_T(int64)
35312853Sgabeblack@google.com
35412853Sgabeblack@google.com#undef DEFN_BITWISE_AND_ASN_OP_T
35512853Sgabeblack@google.com
35612853Sgabeblack@google.comtemplate <class X, class Y>
35712853Sgabeblack@google.cominline const sc_lv_base
35812853Sgabeblack@google.comoperator & (const sc_proxy<X> &px, const sc_proxy<Y> &py)
35912853Sgabeblack@google.com{
36012853Sgabeblack@google.com    sc_lv_base a(px.back_cast());
36112853Sgabeblack@google.com    return (a &= py.back_cast());
36212853Sgabeblack@google.com}
36312853Sgabeblack@google.com
36412853Sgabeblack@google.com#define DEFN_BITWISE_AND_OP_T_A(tp) \
36512853Sgabeblack@google.comtemplate <class X> \
36612853Sgabeblack@google.cominline const sc_lv_base \
36712853Sgabeblack@google.comsc_proxy<X>::operator & (tp b) const \
36812853Sgabeblack@google.com{ \
36912853Sgabeblack@google.com    sc_lv_base a(back_cast()); \
37012853Sgabeblack@google.com    return (a &= b); \
37112853Sgabeblack@google.com}
37212853Sgabeblack@google.com
37312853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_A(const char *)
37412853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_A(const bool *)
37512853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_A(const sc_logic *)
37612853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_A(const sc_unsigned &)
37712853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_A(const sc_signed &)
37812853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_A(const sc_uint_base &)
37912853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_A(const sc_int_base &)
38012853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_A(unsigned long)
38112853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_A(long)
38212853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_A(unsigned int)
38312853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_A(int)
38412853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_A(uint64)
38512853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_A(int64)
38612853Sgabeblack@google.com
38712853Sgabeblack@google.com#undef DEFN_BITWISE_AND_OP_T_A
38812853Sgabeblack@google.com
38912853Sgabeblack@google.com#define DEFN_BITWISE_AND_OP_T_B(tp) \
39012853Sgabeblack@google.comtemplate <class X> \
39112853Sgabeblack@google.cominline const sc_lv_base \
39212853Sgabeblack@google.comoperator & (tp b, const sc_proxy<X> &px) \
39312853Sgabeblack@google.com{ \
39412853Sgabeblack@google.com    return (px & b); \
39512853Sgabeblack@google.com}
39612853Sgabeblack@google.com
39712853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_B(const char *)
39812853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_B(const bool *)
39912853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_B(const sc_logic *)
40012853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_B(const sc_unsigned &)
40112853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_B(const sc_signed &)
40212853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_B(const sc_uint_base &)
40312853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_B(const sc_int_base &)
40412853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_B(unsigned long)
40512853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_B(long)
40612853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_B(unsigned int)
40712853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_B(int)
40812853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_B(uint64)
40912853Sgabeblack@google.comDEFN_BITWISE_AND_OP_T_B(int64)
41012853Sgabeblack@google.com
41112853Sgabeblack@google.com#undef DEFN_BITWISE_AND_OP_T_B
41212853Sgabeblack@google.com
41312853Sgabeblack@google.com// bitwise or
41412853Sgabeblack@google.comtemplate <class X, class Y>
41512853Sgabeblack@google.cominline X &
41612853Sgabeblack@google.comoperator |= (sc_proxy<X> &px, const sc_proxy<Y> &py)
41712853Sgabeblack@google.com{
41812853Sgabeblack@google.com    X &x = px.back_cast();
41912853Sgabeblack@google.com    sc_lv_base a(x.length());
42012853Sgabeblack@google.com    a = py.back_cast();
42112853Sgabeblack@google.com    return b_or_assign_(x, a);
42212853Sgabeblack@google.com}
42312853Sgabeblack@google.com
42412853Sgabeblack@google.com#define DEFN_BITWISE_OR_ASN_OP_T(tp) \
42512853Sgabeblack@google.comtemplate <class X> \
42612853Sgabeblack@google.cominline X & \
42712853Sgabeblack@google.comsc_proxy<X>::operator |= (tp b) \
42812853Sgabeblack@google.com{ \
42912853Sgabeblack@google.com    X &x = back_cast(); \
43012853Sgabeblack@google.com    sc_lv_base a(x.length()); \
43112853Sgabeblack@google.com    a = b; \
43212853Sgabeblack@google.com    return b_or_assign_(x, a); \
43312853Sgabeblack@google.com}
43412853Sgabeblack@google.com
43512853Sgabeblack@google.comDEFN_BITWISE_OR_ASN_OP_T(const char *)
43612853Sgabeblack@google.comDEFN_BITWISE_OR_ASN_OP_T(const bool *)
43712853Sgabeblack@google.comDEFN_BITWISE_OR_ASN_OP_T(const sc_logic *)
43812853Sgabeblack@google.comDEFN_BITWISE_OR_ASN_OP_T(const sc_unsigned &)
43912853Sgabeblack@google.comDEFN_BITWISE_OR_ASN_OP_T(const sc_signed &)
44012853Sgabeblack@google.comDEFN_BITWISE_OR_ASN_OP_T(unsigned long)
44112853Sgabeblack@google.comDEFN_BITWISE_OR_ASN_OP_T(long)
44212853Sgabeblack@google.comDEFN_BITWISE_OR_ASN_OP_T(uint64)
44312853Sgabeblack@google.comDEFN_BITWISE_OR_ASN_OP_T(int64)
44412853Sgabeblack@google.com
44512853Sgabeblack@google.com#undef DEFN_BITWISE_OR_ASN_OP_T
44612853Sgabeblack@google.com
44712853Sgabeblack@google.comtemplate <class X, class Y>
44812853Sgabeblack@google.cominline const sc_lv_base
44912853Sgabeblack@google.comoperator | (const sc_proxy<X> &px, const sc_proxy<Y> &py)
45012853Sgabeblack@google.com{
45112853Sgabeblack@google.com    sc_lv_base a(px.back_cast());
45212853Sgabeblack@google.com    return (a |= py.back_cast());
45312853Sgabeblack@google.com}
45412853Sgabeblack@google.com
45512853Sgabeblack@google.com#define DEFN_BITWISE_OR_OP_T_A(tp) \
45612853Sgabeblack@google.comtemplate <class X> \
45712853Sgabeblack@google.cominline const sc_lv_base \
45812853Sgabeblack@google.comsc_proxy<X>::operator | (tp b) const \
45912853Sgabeblack@google.com{ \
46012853Sgabeblack@google.com    sc_lv_base a(back_cast()); \
46112853Sgabeblack@google.com    return (a |= b); \
46212853Sgabeblack@google.com}
46312853Sgabeblack@google.com
46412853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_A(const char *)
46512853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_A(const bool *)
46612853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_A(const sc_logic *)
46712853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_A(const sc_unsigned &)
46812853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_A(const sc_signed &)
46912853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_A(const sc_uint_base &)
47012853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_A(const sc_int_base &)
47112853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_A(unsigned long)
47212853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_A(long)
47312853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_A(unsigned int)
47412853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_A(int)
47512853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_A(uint64)
47612853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_A(int64)
47712853Sgabeblack@google.com
47812853Sgabeblack@google.com#undef DEFN_BITWISE_OR_OP_T_A
47912853Sgabeblack@google.com
48012853Sgabeblack@google.com#define DEFN_BITWISE_OR_OP_T_B(tp) \
48112853Sgabeblack@google.comtemplate <class X> \
48212853Sgabeblack@google.cominline const sc_lv_base \
48312853Sgabeblack@google.comoperator | (tp b, const sc_proxy<X> &px) \
48412853Sgabeblack@google.com{ \
48512853Sgabeblack@google.com    return (px | b); \
48612853Sgabeblack@google.com}
48712853Sgabeblack@google.com
48812853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_B(const char *)
48912853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_B(const bool *)
49012853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_B(const sc_logic *)
49112853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_B(const sc_unsigned &)
49212853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_B(const sc_signed &)
49312853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_B(const sc_uint_base &)
49412853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_B(const sc_int_base &)
49512853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_B(unsigned long)
49612853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_B(long)
49712853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_B(unsigned int)
49812853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_B(int)
49912853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_B(uint64)
50012853Sgabeblack@google.comDEFN_BITWISE_OR_OP_T_B(int64)
50112853Sgabeblack@google.com
50212853Sgabeblack@google.com#undef DEFN_BITWISE_OR_OP_T_B
50312853Sgabeblack@google.com
50412853Sgabeblack@google.com// bitwise xor
50512853Sgabeblack@google.comtemplate <class X, class Y>
50612853Sgabeblack@google.cominline X &
50712853Sgabeblack@google.comoperator ^= (sc_proxy<X> &px, const sc_proxy<Y> &py)
50812853Sgabeblack@google.com{
50912853Sgabeblack@google.com    X &x = px.back_cast();
51012853Sgabeblack@google.com    sc_lv_base a(x.length());
51112853Sgabeblack@google.com    a = py.back_cast();
51212853Sgabeblack@google.com    return b_xor_assign_(x, a);
51312853Sgabeblack@google.com}
51412853Sgabeblack@google.com
51512853Sgabeblack@google.com#define DEFN_BITWISE_XOR_ASN_OP_T(tp) \
51612853Sgabeblack@google.comtemplate <class X> \
51712853Sgabeblack@google.cominline X & \
51812853Sgabeblack@google.comsc_proxy<X>::operator ^= (tp b) \
51912853Sgabeblack@google.com{ \
52012853Sgabeblack@google.com    X &x = back_cast(); \
52112853Sgabeblack@google.com    sc_lv_base a(x.length()); \
52212853Sgabeblack@google.com    a = b; \
52312853Sgabeblack@google.com    return b_xor_assign_(x, a); \
52412853Sgabeblack@google.com}
52512853Sgabeblack@google.com
52612853Sgabeblack@google.comDEFN_BITWISE_XOR_ASN_OP_T(const char *)
52712853Sgabeblack@google.comDEFN_BITWISE_XOR_ASN_OP_T(const bool *)
52812853Sgabeblack@google.comDEFN_BITWISE_XOR_ASN_OP_T(const sc_logic *)
52912853Sgabeblack@google.comDEFN_BITWISE_XOR_ASN_OP_T(const sc_unsigned &)
53012853Sgabeblack@google.comDEFN_BITWISE_XOR_ASN_OP_T(const sc_signed &)
53112853Sgabeblack@google.comDEFN_BITWISE_XOR_ASN_OP_T(unsigned long)
53212853Sgabeblack@google.comDEFN_BITWISE_XOR_ASN_OP_T(long)
53312853Sgabeblack@google.comDEFN_BITWISE_XOR_ASN_OP_T(uint64)
53412853Sgabeblack@google.comDEFN_BITWISE_XOR_ASN_OP_T(int64)
53512853Sgabeblack@google.com
53612853Sgabeblack@google.com#undef DEFN_BITWISE_XOR_ASN_OP_T
53712853Sgabeblack@google.com
53812853Sgabeblack@google.comtemplate <class X, class Y>
53912853Sgabeblack@google.cominline const sc_lv_base
54012853Sgabeblack@google.comoperator ^ (const sc_proxy<X> &px, const sc_proxy<Y> &py)
54112853Sgabeblack@google.com{
54212853Sgabeblack@google.com    sc_lv_base a(px.back_cast());
54312853Sgabeblack@google.com    return (a ^= py.back_cast());
54412853Sgabeblack@google.com}
54512853Sgabeblack@google.com
54612853Sgabeblack@google.com#define DEFN_BITWISE_XOR_OP_T_A(tp) \
54712853Sgabeblack@google.comtemplate <class X> \
54812853Sgabeblack@google.cominline const sc_lv_base \
54912853Sgabeblack@google.comsc_proxy<X>::operator ^ (tp b) const \
55012853Sgabeblack@google.com{ \
55112853Sgabeblack@google.com    sc_lv_base a(back_cast()); \
55212853Sgabeblack@google.com    return (a ^= b); \
55312853Sgabeblack@google.com}
55412853Sgabeblack@google.com
55512853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_A(const char *)
55612853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_A(const bool *)
55712853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_A(const sc_logic *)
55812853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_A(const sc_unsigned &)
55912853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_A(const sc_signed &)
56012853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_A(const sc_uint_base &)
56112853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_A(const sc_int_base &)
56212853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_A(unsigned long)
56312853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_A(long)
56412853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_A(unsigned int)
56512853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_A(int)
56612853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_A(uint64)
56712853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_A(int64)
56812853Sgabeblack@google.com
56912853Sgabeblack@google.com#undef DEFN_BITWISE_XOR_OP_T_A
57012853Sgabeblack@google.com
57112853Sgabeblack@google.com#define DEFN_BITWISE_XOR_OP_T_B(tp) \
57212853Sgabeblack@google.comtemplate <class X> \
57312853Sgabeblack@google.cominline const sc_lv_base \
57412853Sgabeblack@google.comoperator ^ (tp b, const sc_proxy<X> &px) \
57512853Sgabeblack@google.com{ \
57612853Sgabeblack@google.com    return (px ^ b); \
57712853Sgabeblack@google.com}
57812853Sgabeblack@google.com
57912853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_B(const char *)
58012853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_B(const bool *)
58112853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_B(const sc_logic *)
58212853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_B(const sc_unsigned &)
58312853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_B(const sc_signed &)
58412853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_B(const sc_uint_base &)
58512853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_B(const sc_int_base &)
58612853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_B(unsigned long)
58712853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_B(long)
58812853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_B(unsigned int)
58912853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_B(int)
59012853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_B(uint64)
59112853Sgabeblack@google.comDEFN_BITWISE_XOR_OP_T_B(int64)
59212853Sgabeblack@google.com
59312853Sgabeblack@google.com#undef DEFN_BITWISE_XOR_OP_T_B
59412853Sgabeblack@google.com
59512853Sgabeblack@google.com// bitwise left shift
59612853Sgabeblack@google.comtemplate <class X>
59712853Sgabeblack@google.cominline const sc_lv_base
59812853Sgabeblack@google.comsc_proxy<X>::operator << (int n) const
59912853Sgabeblack@google.com{
60012853Sgabeblack@google.com    sc_lv_base a(back_cast().length() + n);
60112853Sgabeblack@google.com    a = back_cast();
60212853Sgabeblack@google.com    return (a <<= n);
60312853Sgabeblack@google.com}
60412853Sgabeblack@google.com
60512853Sgabeblack@google.com// bitwise right shift
60612853Sgabeblack@google.comtemplate <class X>
60712853Sgabeblack@google.cominline const sc_lv_base
60812853Sgabeblack@google.comsc_proxy<X>::operator >> (int n) const
60912853Sgabeblack@google.com{
61012853Sgabeblack@google.com    sc_lv_base a(back_cast());
61112853Sgabeblack@google.com    return (a >>= n);
61212853Sgabeblack@google.com}
61312853Sgabeblack@google.com
61412853Sgabeblack@google.com// bitwise left rotate
61512853Sgabeblack@google.comtemplate <class X>
61612853Sgabeblack@google.cominline X &
61712853Sgabeblack@google.comsc_proxy<X>::lrotate(int n)
61812853Sgabeblack@google.com{
61912853Sgabeblack@google.com    X &x = back_cast();
62012853Sgabeblack@google.com    if (n < 0) {
62112853Sgabeblack@google.com        sc_proxy_out_of_bounds("left rotate operation is only allowed with "
62212853Sgabeblack@google.com                               "positive rotate values, rotate value = ", n);
62312853Sgabeblack@google.com        return x;
62412853Sgabeblack@google.com    }
62512853Sgabeblack@google.com    int len = x.length();
62612853Sgabeblack@google.com    n %= len;
62712853Sgabeblack@google.com    // x = (x << n) | (x >> (len - n));
62812853Sgabeblack@google.com    sc_lv_base a(x << n);
62912853Sgabeblack@google.com    sc_lv_base b(x >> (len - n));
63012853Sgabeblack@google.com    int sz = x.size();
63112853Sgabeblack@google.com    for (int i = 0; i < sz; ++i) {
63212853Sgabeblack@google.com        x.set_word(i, a.get_word(i) | b.get_word(i));
63312853Sgabeblack@google.com        x.set_cword(i, a.get_cword(i) | b.get_cword(i));
63412853Sgabeblack@google.com    }
63512853Sgabeblack@google.com    x.clean_tail();
63612853Sgabeblack@google.com    return x;
63712853Sgabeblack@google.com}
63812853Sgabeblack@google.com
63912853Sgabeblack@google.comtemplate <class X>
64012853Sgabeblack@google.cominline const sc_lv_base
64112853Sgabeblack@google.comlrotate(const sc_proxy<X> &x, int n)
64212853Sgabeblack@google.com{
64312853Sgabeblack@google.com    sc_lv_base a(x.back_cast());
64412853Sgabeblack@google.com    return a.lrotate(n);
64512853Sgabeblack@google.com}
64612853Sgabeblack@google.com
64712853Sgabeblack@google.com// bitwise right rotate
64812853Sgabeblack@google.comtemplate <class X>
64912853Sgabeblack@google.cominline X &
65012853Sgabeblack@google.comsc_proxy<X>::rrotate(int n)
65112853Sgabeblack@google.com{
65212853Sgabeblack@google.com    X &x = back_cast();
65312853Sgabeblack@google.com    if (n < 0 ) {
65412853Sgabeblack@google.com        sc_proxy_out_of_bounds("right rotate operation is only allowed with "
65512853Sgabeblack@google.com                               "positive rotate values, rotate value = ", n);
65612853Sgabeblack@google.com        return x;
65712853Sgabeblack@google.com    }
65812853Sgabeblack@google.com    int len = x.length();
65912853Sgabeblack@google.com    n %= len;
66012853Sgabeblack@google.com    // x = (x >> n) | (x << (len - n));
66112853Sgabeblack@google.com    sc_lv_base a(x >> n);
66212853Sgabeblack@google.com    sc_lv_base b(x << (len - n));
66312853Sgabeblack@google.com    int sz = x.size();
66412853Sgabeblack@google.com    for (int i = 0; i < sz; ++i) {
66512853Sgabeblack@google.com        x.set_word(i, a.get_word(i) | b.get_word(i));
66612853Sgabeblack@google.com        x.set_cword(i, a.get_cword(i) | b.get_cword(i));
66712853Sgabeblack@google.com    }
66812853Sgabeblack@google.com    x.clean_tail();
66912853Sgabeblack@google.com    return x;
67012853Sgabeblack@google.com}
67112853Sgabeblack@google.com
67212853Sgabeblack@google.comtemplate <class X>
67312853Sgabeblack@google.cominline const sc_lv_base
67412853Sgabeblack@google.comrrotate(const sc_proxy<X> &x, int n)
67512853Sgabeblack@google.com{
67612853Sgabeblack@google.com    sc_lv_base a(x.back_cast());
67712853Sgabeblack@google.com    return a.rrotate(n);
67812853Sgabeblack@google.com}
67912853Sgabeblack@google.com
68012853Sgabeblack@google.com// bitwise reverse
68112853Sgabeblack@google.comtemplate <class X>
68212853Sgabeblack@google.cominline const sc_lv_base
68312853Sgabeblack@google.comreverse(const sc_proxy<X> &x)
68412853Sgabeblack@google.com{
68512853Sgabeblack@google.com    sc_lv_base a(x.back_cast());
68612853Sgabeblack@google.com    return a.reverse();
68712853Sgabeblack@google.com}
68812853Sgabeblack@google.com
68912853Sgabeblack@google.com// relational operators
69012853Sgabeblack@google.comtemplate <class X, class Y>
69112853Sgabeblack@google.cominline bool
69212853Sgabeblack@google.comoperator == (const sc_proxy<X> &px, const sc_proxy<Y> &py)
69312853Sgabeblack@google.com{
69412853Sgabeblack@google.com    const X &x = px.back_cast();
69512853Sgabeblack@google.com    const Y &y = py.back_cast();
69612853Sgabeblack@google.com    int x_len = x.length();
69712853Sgabeblack@google.com    int y_len = y.length();
69812853Sgabeblack@google.com    if (x_len != y_len) {
69912853Sgabeblack@google.com        return false;
70012853Sgabeblack@google.com    }
70112853Sgabeblack@google.com    int sz = x.size();
70212853Sgabeblack@google.com    for (int i = 0; i < sz; ++i) {
70312853Sgabeblack@google.com        if (x.get_word(i) != y.get_word(i) ||
70412853Sgabeblack@google.com            x.get_cword(i) != y.get_cword(i)) {
70512853Sgabeblack@google.com            return false;
70612853Sgabeblack@google.com        }
70712853Sgabeblack@google.com    }
70812853Sgabeblack@google.com    return true;
70912853Sgabeblack@google.com}
71012853Sgabeblack@google.com
71112853Sgabeblack@google.com#define DEFN_REL_OP_T(tp) \
71212853Sgabeblack@google.comtemplate <class X> \
71312853Sgabeblack@google.cominline bool \
71412853Sgabeblack@google.comsc_proxy<X>::operator == (tp b) const \
71512853Sgabeblack@google.com{ \
71612853Sgabeblack@google.com    const X &x = back_cast(); \
71712853Sgabeblack@google.com    sc_lv_base y(x.length()); \
71812853Sgabeblack@google.com    y = b; \
71912853Sgabeblack@google.com    return (x == y); \
72012853Sgabeblack@google.com}
72112853Sgabeblack@google.com
72212853Sgabeblack@google.comDEFN_REL_OP_T(const char *)
72312853Sgabeblack@google.comDEFN_REL_OP_T(const bool *)
72412853Sgabeblack@google.comDEFN_REL_OP_T(const sc_logic *)
72512853Sgabeblack@google.comDEFN_REL_OP_T(const sc_unsigned &)
72612853Sgabeblack@google.comDEFN_REL_OP_T(const sc_signed &)
72712853Sgabeblack@google.comDEFN_REL_OP_T(const sc_uint_base &)
72812853Sgabeblack@google.comDEFN_REL_OP_T(const sc_int_base &)
72912853Sgabeblack@google.comDEFN_REL_OP_T(unsigned long)
73012853Sgabeblack@google.comDEFN_REL_OP_T(long)
73112853Sgabeblack@google.comDEFN_REL_OP_T(unsigned int)
73212853Sgabeblack@google.comDEFN_REL_OP_T(int)
73312853Sgabeblack@google.comDEFN_REL_OP_T(uint64)
73412853Sgabeblack@google.comDEFN_REL_OP_T(int64)
73512853Sgabeblack@google.com
73612853Sgabeblack@google.com#undef DEFN_REL_OP_T
73712853Sgabeblack@google.com
73812853Sgabeblack@google.com
73912853Sgabeblack@google.com// ----------------------------------------------------------------------------
74012853Sgabeblack@google.com//  CLASS TEMPLATE : sc_bitref_r<X>
74112853Sgabeblack@google.com//
74212853Sgabeblack@google.com//  Proxy class for sc_proxy bit selection (r-value only).
74312853Sgabeblack@google.com// ----------------------------------------------------------------------------
74412853Sgabeblack@google.com
74512853Sgabeblack@google.com// r-value concatenation operators and functions
74612853Sgabeblack@google.com
74712853Sgabeblack@google.comtemplate <class T>
74812853Sgabeblack@google.cominline sc_concref_r<sc_bitref_r<T>, sc_lv_base>
74912853Sgabeblack@google.comoperator , (sc_bitref_r<T> a, const char *b)
75012853Sgabeblack@google.com{
75112853Sgabeblack@google.com    return sc_concref_r<sc_bitref_r<T>, sc_lv_base>(
75212853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b), 3);
75312853Sgabeblack@google.com}
75412853Sgabeblack@google.com
75512853Sgabeblack@google.comtemplate <class T>
75612853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_bitref_r<T> >
75712853Sgabeblack@google.comoperator , (const char *a, sc_bitref_r<T> b)
75812853Sgabeblack@google.com{
75912853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_bitref_r<T> >(
76012853Sgabeblack@google.com            *new sc_lv_base(a), *b.clone(), 3);
76112853Sgabeblack@google.com}
76212853Sgabeblack@google.com
76312853Sgabeblack@google.comtemplate <class T>
76412853Sgabeblack@google.cominline sc_concref_r<sc_bitref_r<T>, sc_lv_base>
76512853Sgabeblack@google.comoperator , (sc_bitref_r<T> a, const sc_logic &b)
76612853Sgabeblack@google.com{
76712853Sgabeblack@google.com    return sc_concref_r<sc_bitref_r<T>, sc_lv_base>(
76812853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b, 1), 3);
76912853Sgabeblack@google.com}
77012853Sgabeblack@google.com
77112853Sgabeblack@google.comtemplate <class T>
77212853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_bitref_r<T> >
77312853Sgabeblack@google.comoperator , (const sc_logic &a, sc_bitref_r<T> b)
77412853Sgabeblack@google.com{
77512853Sgabeblack@google.com    return sc_concref_r<sc_lv_base,sc_bitref_r<T> >(
77612853Sgabeblack@google.com            *new sc_lv_base(a, 1), *b.clone(), 3);
77712853Sgabeblack@google.com}
77812853Sgabeblack@google.com
77912853Sgabeblack@google.comtemplate <class T>
78012853Sgabeblack@google.cominline sc_concref_r<sc_bitref_r<T>, sc_bv_base>
78112853Sgabeblack@google.comoperator , (sc_bitref_r<T> a, bool b)
78212853Sgabeblack@google.com{
78312853Sgabeblack@google.com    return sc_concref_r<sc_bitref_r<T>, sc_bv_base>(
78412853Sgabeblack@google.com            *a.clone(), *new sc_bv_base(b, 1), 3);
78512853Sgabeblack@google.com}
78612853Sgabeblack@google.com
78712853Sgabeblack@google.comtemplate <class T>
78812853Sgabeblack@google.cominline sc_concref_r<sc_bv_base, sc_bitref_r<T> >
78912853Sgabeblack@google.comoperator , (bool a, sc_bitref_r<T> b)
79012853Sgabeblack@google.com{
79112853Sgabeblack@google.com    return sc_concref_r<sc_bv_base, sc_bitref_r<T> >(
79212853Sgabeblack@google.com            *new sc_bv_base(a, 1), *b.clone(), 3);
79312853Sgabeblack@google.com}
79412853Sgabeblack@google.com
79512853Sgabeblack@google.comtemplate <class T>
79612853Sgabeblack@google.cominline sc_concref_r<sc_bitref_r<T>, sc_lv_base>
79712853Sgabeblack@google.comconcat(sc_bitref_r<T> a, const char *b)
79812853Sgabeblack@google.com{
79912853Sgabeblack@google.com    return sc_concref_r<sc_bitref_r<T>, sc_lv_base>(
80012853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b), 3);
80112853Sgabeblack@google.com}
80212853Sgabeblack@google.com
80312853Sgabeblack@google.comtemplate <class T>
80412853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_bitref_r<T> >
80512853Sgabeblack@google.comconcat(const char *a, sc_bitref_r<T> b)
80612853Sgabeblack@google.com{
80712853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_bitref_r<T> >(
80812853Sgabeblack@google.com            *new sc_lv_base(a), *b.clone(), 3);
80912853Sgabeblack@google.com}
81012853Sgabeblack@google.com
81112853Sgabeblack@google.comtemplate <class T>
81212853Sgabeblack@google.cominline sc_concref_r<sc_bitref_r<T>, sc_lv_base>
81312853Sgabeblack@google.comconcat(sc_bitref_r<T> a, const sc_logic &b)
81412853Sgabeblack@google.com{
81512853Sgabeblack@google.com    return sc_concref_r<sc_bitref_r<T>, sc_lv_base>(
81612853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b, 1), 3);
81712853Sgabeblack@google.com}
81812853Sgabeblack@google.com
81912853Sgabeblack@google.comtemplate <class T>
82012853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_bitref_r<T> >
82112853Sgabeblack@google.comconcat(const sc_logic &a, sc_bitref_r<T> b)
82212853Sgabeblack@google.com{
82312853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_bitref_r<T> >(
82412853Sgabeblack@google.com            *new sc_lv_base(a, 1), *b.clone(), 3);
82512853Sgabeblack@google.com}
82612853Sgabeblack@google.com
82712853Sgabeblack@google.comtemplate <class T>
82812853Sgabeblack@google.cominline sc_concref_r<sc_bitref_r<T>, sc_bv_base>
82912853Sgabeblack@google.comconcat(sc_bitref_r<T> a, bool b)
83012853Sgabeblack@google.com{
83112853Sgabeblack@google.com    return sc_concref_r<sc_bitref_r<T>, sc_bv_base>(
83212853Sgabeblack@google.com            *a.clone(), *new sc_bv_base(b, 1), 3);
83312853Sgabeblack@google.com}
83412853Sgabeblack@google.com
83512853Sgabeblack@google.comtemplate <class T>
83612853Sgabeblack@google.cominline sc_concref_r<sc_bv_base, sc_bitref_r<T> >
83712853Sgabeblack@google.comconcat(bool a, sc_bitref_r<T> b)
83812853Sgabeblack@google.com{
83912853Sgabeblack@google.com    return sc_concref_r<sc_bv_base, sc_bitref_r<T> >(
84012853Sgabeblack@google.com            *new sc_bv_base(a, 1), *b.clone(), 3);
84112853Sgabeblack@google.com}
84212853Sgabeblack@google.com
84312853Sgabeblack@google.com
84412853Sgabeblack@google.comtemplate <class T>
84512853Sgabeblack@google.cominline sc_concref_r<sc_bitref_r<T>, sc_lv_base>
84612853Sgabeblack@google.comoperator , (sc_bitref<T> a, const char *b)
84712853Sgabeblack@google.com{
84812853Sgabeblack@google.com    return sc_concref_r<sc_bitref_r<T>, sc_lv_base>(
84912853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b), 3);
85012853Sgabeblack@google.com}
85112853Sgabeblack@google.com
85212853Sgabeblack@google.comtemplate <class T>
85312853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_bitref_r<T> >
85412853Sgabeblack@google.comoperator , (const char *a, sc_bitref<T> b)
85512853Sgabeblack@google.com{
85612853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_bitref_r<T> >(
85712853Sgabeblack@google.com            *new sc_lv_base(a), *b.clone(), 3);
85812853Sgabeblack@google.com}
85912853Sgabeblack@google.com
86012853Sgabeblack@google.comtemplate <class T>
86112853Sgabeblack@google.cominline sc_concref_r<sc_bitref_r<T>, sc_lv_base>
86212853Sgabeblack@google.comoperator , (sc_bitref<T> a, const sc_logic &b)
86312853Sgabeblack@google.com{
86412853Sgabeblack@google.com    return sc_concref_r<sc_bitref_r<T>, sc_lv_base>(
86512853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b, 1), 3);
86612853Sgabeblack@google.com}
86712853Sgabeblack@google.com
86812853Sgabeblack@google.comtemplate <class T>
86912853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_bitref_r<T> >
87012853Sgabeblack@google.comoperator , (const sc_logic &a, sc_bitref<T> b)
87112853Sgabeblack@google.com{
87212853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_bitref_r<T> >(
87312853Sgabeblack@google.com            *new sc_lv_base(a, 1), *b.clone(), 3);
87412853Sgabeblack@google.com}
87512853Sgabeblack@google.com
87612853Sgabeblack@google.comtemplate <class T>
87712853Sgabeblack@google.cominline sc_concref_r<sc_bitref_r<T>, sc_bv_base>
87812853Sgabeblack@google.comoperator , (sc_bitref<T> a, bool b)
87912853Sgabeblack@google.com{
88012853Sgabeblack@google.com    return sc_concref_r<sc_bitref_r<T>, sc_bv_base>(
88112853Sgabeblack@google.com            *a.clone(), *new sc_bv_base(b, 1), 3);
88212853Sgabeblack@google.com}
88312853Sgabeblack@google.com
88412853Sgabeblack@google.comtemplate <class T>
88512853Sgabeblack@google.cominline sc_concref_r<sc_bv_base, sc_bitref_r<T> >
88612853Sgabeblack@google.comoperator , (bool a, sc_bitref<T> b)
88712853Sgabeblack@google.com{
88812853Sgabeblack@google.com    return sc_concref_r<sc_bv_base, sc_bitref_r<T> > (
88912853Sgabeblack@google.com            *new sc_bv_base(a, 1), *b.clone(), 3);
89012853Sgabeblack@google.com}
89112853Sgabeblack@google.com
89212853Sgabeblack@google.comtemplate <class T>
89312853Sgabeblack@google.cominline sc_concref_r<sc_bitref_r<T>, sc_lv_base>
89412853Sgabeblack@google.comconcat(sc_bitref<T> a, const char *b)
89512853Sgabeblack@google.com{
89612853Sgabeblack@google.com    return sc_concref_r<sc_bitref_r<T>, sc_lv_base>(
89712853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b), 3);
89812853Sgabeblack@google.com}
89912853Sgabeblack@google.com
90012853Sgabeblack@google.comtemplate <class T>
90112853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_bitref_r<T> >
90212853Sgabeblack@google.comconcat(const char *a, sc_bitref<T> b)
90312853Sgabeblack@google.com{
90412853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_bitref_r<T> >(
90512853Sgabeblack@google.com            *new sc_lv_base(a), *b.clone(), 3);
90612853Sgabeblack@google.com}
90712853Sgabeblack@google.com
90812853Sgabeblack@google.comtemplate <class T>
90912853Sgabeblack@google.cominline sc_concref_r<sc_bitref_r<T>, sc_lv_base>
91012853Sgabeblack@google.comconcat(sc_bitref<T> a, const sc_logic &b)
91112853Sgabeblack@google.com{
91212853Sgabeblack@google.com    return sc_concref_r<sc_bitref_r<T>, sc_lv_base>(
91312853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b, 1), 3);
91412853Sgabeblack@google.com}
91512853Sgabeblack@google.com
91612853Sgabeblack@google.comtemplate <class T>
91712853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_bitref_r<T> >
91812853Sgabeblack@google.comconcat(const sc_logic &a, sc_bitref<T> b)
91912853Sgabeblack@google.com{
92012853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_bitref_r<T> >(
92112853Sgabeblack@google.com            *new sc_lv_base(a, 1), *b.clone(), 3);
92212853Sgabeblack@google.com}
92312853Sgabeblack@google.com
92412853Sgabeblack@google.comtemplate <class T>
92512853Sgabeblack@google.cominline sc_concref_r<sc_bitref_r<T>, sc_bv_base>
92612853Sgabeblack@google.comconcat(sc_bitref<T> a, bool b)
92712853Sgabeblack@google.com{
92812853Sgabeblack@google.com    return sc_concref_r<sc_bitref_r<T>, sc_bv_base>(
92912853Sgabeblack@google.com            *a.clone(), *new sc_bv_base(b, 1), 3);
93012853Sgabeblack@google.com}
93112853Sgabeblack@google.com
93212853Sgabeblack@google.comtemplate <class T>
93312853Sgabeblack@google.cominline sc_concref_r<sc_bv_base, sc_bitref_r<T> >
93412853Sgabeblack@google.comconcat(bool a, sc_bitref<T> b)
93512853Sgabeblack@google.com{
93612853Sgabeblack@google.com    return sc_concref_r<sc_bv_base, sc_bitref_r<T> >(
93712853Sgabeblack@google.com            *new sc_bv_base(a, 1), *b.clone(), 3);
93812853Sgabeblack@google.com}
93912853Sgabeblack@google.com
94012853Sgabeblack@google.com
94112853Sgabeblack@google.com// ----------------------------------------------------------------------------
94212853Sgabeblack@google.com//  CLASS TEMPLATE : sc_subref_r<X>
94312853Sgabeblack@google.com//
94412853Sgabeblack@google.com//  Proxy class for sc_proxy part selection (r-value only).
94512853Sgabeblack@google.com// ----------------------------------------------------------------------------
94612853Sgabeblack@google.com
94712853Sgabeblack@google.com// r-value concatenation operators and functions
94812853Sgabeblack@google.comtemplate <class T>
94912853Sgabeblack@google.cominline sc_concref_r<sc_subref_r<T>, sc_lv_base>
95012853Sgabeblack@google.comoperator , (sc_subref_r<T> a, const char *b)
95112853Sgabeblack@google.com{
95212853Sgabeblack@google.com    return sc_concref_r<sc_subref_r<T>, sc_lv_base>(
95312853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b), 3);
95412853Sgabeblack@google.com}
95512853Sgabeblack@google.com
95612853Sgabeblack@google.comtemplate <class T>
95712853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_subref_r<T> >
95812853Sgabeblack@google.comoperator , (const char *a, sc_subref_r<T> b)
95912853Sgabeblack@google.com{
96012853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_subref_r<T> >(
96112853Sgabeblack@google.com            *new sc_lv_base(a), *b.clone(), 3);
96212853Sgabeblack@google.com}
96312853Sgabeblack@google.com
96412853Sgabeblack@google.comtemplate <class T>
96512853Sgabeblack@google.cominline sc_concref_r<sc_subref_r<T>, sc_lv_base>
96612853Sgabeblack@google.comoperator , (sc_subref_r<T> a, const sc_logic &b)
96712853Sgabeblack@google.com{
96812853Sgabeblack@google.com    return sc_concref_r<sc_subref_r<T>, sc_lv_base>(
96912853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b, 1), 3);
97012853Sgabeblack@google.com}
97112853Sgabeblack@google.com
97212853Sgabeblack@google.comtemplate <class T>
97312853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_subref_r<T> >
97412853Sgabeblack@google.comoperator , (const sc_logic &a, sc_subref_r<T> b)
97512853Sgabeblack@google.com{
97612853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_subref_r<T> >(
97712853Sgabeblack@google.com            *new sc_lv_base(a, 1), *b.clone(), 3);
97812853Sgabeblack@google.com}
97912853Sgabeblack@google.com
98012853Sgabeblack@google.comtemplate <class T>
98112853Sgabeblack@google.cominline sc_concref_r<sc_subref_r<T>, sc_bv_base>
98212853Sgabeblack@google.comoperator , (sc_subref_r<T> a, bool b)
98312853Sgabeblack@google.com{
98412853Sgabeblack@google.com    return sc_concref_r<sc_subref_r<T>, sc_bv_base>(
98512853Sgabeblack@google.com            *a.clone(), *new sc_bv_base(b, 1), 3);
98612853Sgabeblack@google.com}
98712853Sgabeblack@google.com
98812853Sgabeblack@google.comtemplate <class T>
98912853Sgabeblack@google.cominline sc_concref_r<sc_bv_base, sc_subref_r<T> >
99012853Sgabeblack@google.comoperator , (bool a, sc_subref_r<T> b)
99112853Sgabeblack@google.com{
99212853Sgabeblack@google.com    return sc_concref_r<sc_bv_base, sc_subref_r<T> >(
99312853Sgabeblack@google.com            *new sc_bv_base(a, 1), *b.clone(), 3);
99412853Sgabeblack@google.com}
99512853Sgabeblack@google.com
99612853Sgabeblack@google.comtemplate <class T>
99712853Sgabeblack@google.cominline sc_concref_r<sc_subref_r<T>, sc_lv_base>
99812853Sgabeblack@google.comconcat(sc_subref_r<T> a, const char *b)
99912853Sgabeblack@google.com{
100012853Sgabeblack@google.com    return sc_concref_r<sc_subref_r<T>, sc_lv_base>(
100112853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b), 3);
100212853Sgabeblack@google.com}
100312853Sgabeblack@google.com
100412853Sgabeblack@google.comtemplate <class T>
100512853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_subref_r<T> >
100612853Sgabeblack@google.comconcat(const char *a, sc_subref_r<T> b)
100712853Sgabeblack@google.com{
100812853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_subref_r<T> >(
100912853Sgabeblack@google.com            *new sc_lv_base(a), *b.clone(), 3);
101012853Sgabeblack@google.com}
101112853Sgabeblack@google.com
101212853Sgabeblack@google.comtemplate <class T>
101312853Sgabeblack@google.cominline sc_concref_r<sc_subref_r<T>, sc_lv_base>
101412853Sgabeblack@google.comconcat(sc_subref_r<T> a, const sc_logic &b)
101512853Sgabeblack@google.com{
101612853Sgabeblack@google.com    return sc_concref_r<sc_subref_r<T>, sc_lv_base>(
101712853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b, 1), 3);
101812853Sgabeblack@google.com}
101912853Sgabeblack@google.com
102012853Sgabeblack@google.comtemplate <class T>
102112853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_subref_r<T> >
102212853Sgabeblack@google.comconcat(const sc_logic &a, sc_subref_r<T> b)
102312853Sgabeblack@google.com{
102412853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_subref_r<T> >(
102512853Sgabeblack@google.com            *new sc_lv_base(a, 1), *b.clone(), 3);
102612853Sgabeblack@google.com}
102712853Sgabeblack@google.com
102812853Sgabeblack@google.comtemplate <class T>
102912853Sgabeblack@google.cominline sc_concref_r<sc_subref_r<T>, sc_bv_base>
103012853Sgabeblack@google.comconcat(sc_subref_r<T> a, bool b)
103112853Sgabeblack@google.com{
103212853Sgabeblack@google.com    return sc_concref_r<sc_subref_r<T>, sc_bv_base>(
103312853Sgabeblack@google.com            *a.clone(), *new sc_bv_base(b, 1), 3);
103412853Sgabeblack@google.com}
103512853Sgabeblack@google.com
103612853Sgabeblack@google.comtemplate <class T>
103712853Sgabeblack@google.cominline sc_concref_r<sc_bv_base, sc_subref_r<T> >
103812853Sgabeblack@google.comconcat(bool a, sc_subref_r<T> b)
103912853Sgabeblack@google.com{
104012853Sgabeblack@google.com    return sc_concref_r<sc_bv_base, sc_subref_r<T> >(
104112853Sgabeblack@google.com            *new sc_bv_base(a, 1), *b.clone(), 3);
104212853Sgabeblack@google.com}
104312853Sgabeblack@google.com
104412853Sgabeblack@google.com
104512853Sgabeblack@google.comtemplate <class T>
104612853Sgabeblack@google.cominline sc_concref_r<sc_subref_r<T>, sc_lv_base>
104712853Sgabeblack@google.comoperator , (sc_subref<T> a, const char *b)
104812853Sgabeblack@google.com{
104912853Sgabeblack@google.com    return sc_concref_r<sc_subref_r<T>, sc_lv_base>(
105012853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b), 3);
105112853Sgabeblack@google.com}
105212853Sgabeblack@google.com
105312853Sgabeblack@google.comtemplate <class T>
105412853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_subref_r<T> >
105512853Sgabeblack@google.comoperator , (const char *a, sc_subref<T> b)
105612853Sgabeblack@google.com{
105712853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_subref_r<T> >(
105812853Sgabeblack@google.com            *new sc_lv_base(a), *b.clone(), 3);
105912853Sgabeblack@google.com}
106012853Sgabeblack@google.com
106112853Sgabeblack@google.comtemplate <class T>
106212853Sgabeblack@google.cominline sc_concref_r<sc_subref_r<T>, sc_lv_base>
106312853Sgabeblack@google.comoperator , (sc_subref<T> a, const sc_logic &b)
106412853Sgabeblack@google.com{
106512853Sgabeblack@google.com    return sc_concref_r<sc_subref_r<T>, sc_lv_base>(
106612853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b, 1), 3);
106712853Sgabeblack@google.com}
106812853Sgabeblack@google.com
106912853Sgabeblack@google.comtemplate <class T>
107012853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_subref_r<T> >
107112853Sgabeblack@google.comoperator , (const sc_logic &a, sc_subref<T> b)
107212853Sgabeblack@google.com{
107312853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_subref_r<T> >(
107412853Sgabeblack@google.com            *new sc_lv_base(a, 1), *b.clone(), 3);
107512853Sgabeblack@google.com}
107612853Sgabeblack@google.com
107712853Sgabeblack@google.comtemplate <class T>
107812853Sgabeblack@google.cominline sc_concref_r<sc_subref_r<T>, sc_bv_base>
107912853Sgabeblack@google.comoperator , (sc_subref<T> a, bool b)
108012853Sgabeblack@google.com{
108112853Sgabeblack@google.com    return sc_concref_r<sc_subref_r<T>, sc_bv_base>(
108212853Sgabeblack@google.com            *a.clone(), *new sc_bv_base(b, 1), 3);
108312853Sgabeblack@google.com}
108412853Sgabeblack@google.com
108512853Sgabeblack@google.comtemplate <class T>
108612853Sgabeblack@google.cominline sc_concref_r<sc_bv_base, sc_subref_r<T> >
108712853Sgabeblack@google.comoperator , (bool a, sc_subref<T> b)
108812853Sgabeblack@google.com{
108912853Sgabeblack@google.com    return sc_concref_r<sc_bv_base, sc_subref_r<T> >(
109012853Sgabeblack@google.com            *new sc_bv_base(a, 1), *b.clone(), 3);
109112853Sgabeblack@google.com}
109212853Sgabeblack@google.com
109312853Sgabeblack@google.com
109412853Sgabeblack@google.comtemplate <class T>
109512853Sgabeblack@google.cominline sc_concref_r<sc_subref_r<T>, sc_lv_base>
109612853Sgabeblack@google.comconcat(sc_subref<T> a, const char *b)
109712853Sgabeblack@google.com{
109812853Sgabeblack@google.com    return sc_concref_r<sc_subref_r<T>, sc_lv_base>(
109912853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b), 3);
110012853Sgabeblack@google.com}
110112853Sgabeblack@google.com
110212853Sgabeblack@google.comtemplate <class T>
110312853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_subref_r<T> >
110412853Sgabeblack@google.comconcat(const char *a, sc_subref<T> b)
110512853Sgabeblack@google.com{
110612853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_subref_r<T> >(
110712853Sgabeblack@google.com            *new sc_lv_base(a), *b.clone(), 3);
110812853Sgabeblack@google.com}
110912853Sgabeblack@google.com
111012853Sgabeblack@google.comtemplate <class T>
111112853Sgabeblack@google.cominline sc_concref_r<sc_subref_r<T>, sc_lv_base>
111212853Sgabeblack@google.comconcat(sc_subref<T> a, const sc_logic &b)
111312853Sgabeblack@google.com{
111412853Sgabeblack@google.com    return sc_concref_r<sc_subref_r<T>, sc_lv_base>(
111512853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b, 1), 3);
111612853Sgabeblack@google.com}
111712853Sgabeblack@google.com
111812853Sgabeblack@google.comtemplate <class T>
111912853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_subref_r<T> >
112012853Sgabeblack@google.comconcat(const sc_logic &a, sc_subref<T> b)
112112853Sgabeblack@google.com{
112212853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_subref_r<T> >(
112312853Sgabeblack@google.com            *new sc_lv_base(a, 1), *b.clone(), 3);
112412853Sgabeblack@google.com}
112512853Sgabeblack@google.com
112612853Sgabeblack@google.comtemplate <class T>
112712853Sgabeblack@google.cominline sc_concref_r<sc_subref_r<T>, sc_bv_base>
112812853Sgabeblack@google.comconcat(sc_subref<T> a, bool b)
112912853Sgabeblack@google.com{
113012853Sgabeblack@google.com    return sc_concref_r<sc_subref_r<T>, sc_bv_base>(
113112853Sgabeblack@google.com            *a.clone(), *new sc_bv_base(b, 1), 3);
113212853Sgabeblack@google.com}
113312853Sgabeblack@google.com
113412853Sgabeblack@google.comtemplate <class T>
113512853Sgabeblack@google.cominline sc_concref_r<sc_bv_base, sc_subref_r<T> >
113612853Sgabeblack@google.comconcat(bool a, sc_subref<T> b)
113712853Sgabeblack@google.com{
113812853Sgabeblack@google.com    return sc_concref_r<sc_bv_base, sc_subref_r<T> >(
113912853Sgabeblack@google.com            *new sc_bv_base(a, 1), *b.clone(), 3);
114012853Sgabeblack@google.com}
114112853Sgabeblack@google.com
114212853Sgabeblack@google.com
114312853Sgabeblack@google.com// ----------------------------------------------------------------------------
114412853Sgabeblack@google.com//  CLASS TEMPLATE : sc_subref<X>
114512853Sgabeblack@google.com//
114612853Sgabeblack@google.com//  Proxy class for sc_proxy part selection (r-value and l-value).
114712853Sgabeblack@google.com// ----------------------------------------------------------------------------
114812853Sgabeblack@google.com
114912853Sgabeblack@google.comtemplate <class X>
115012853Sgabeblack@google.cominline sc_subref<X> &
115112853Sgabeblack@google.comsc_subref<X>::operator = (const sc_subref_r<X> &b)
115212853Sgabeblack@google.com{
115312853Sgabeblack@google.com    sc_lv_base t(b); // (partial) self assignment protection
115412853Sgabeblack@google.com    int len = sc_min(this->length(), t.length());
115512853Sgabeblack@google.com    if (!this->reversed()) {
115612853Sgabeblack@google.com        for (int i = len - 1; i >= 0; --i) {
115712853Sgabeblack@google.com            this->m_obj.set_bit(this->m_lo + i, t[i].value());
115812853Sgabeblack@google.com        }
115912853Sgabeblack@google.com    } else {
116012853Sgabeblack@google.com        for (int i = len - 1; i >= 0; --i) {
116112853Sgabeblack@google.com            this->m_obj.set_bit(this->m_lo - i, t[i].value());
116212853Sgabeblack@google.com        }
116312853Sgabeblack@google.com    }
116412853Sgabeblack@google.com    return *this;
116512853Sgabeblack@google.com}
116612853Sgabeblack@google.com
116712853Sgabeblack@google.comtemplate <class X>
116812853Sgabeblack@google.cominline sc_subref<X> &
116912853Sgabeblack@google.comsc_subref<X>::operator = (const sc_subref<X> &b)
117012853Sgabeblack@google.com{
117112853Sgabeblack@google.com    sc_lv_base t(b); // (partial) self assignment protection
117212853Sgabeblack@google.com    int len = sc_min(this->length(), t.length());
117312853Sgabeblack@google.com    if (!this->reversed()) {
117412853Sgabeblack@google.com        for (int i = len - 1; i >= 0; --i) {
117512853Sgabeblack@google.com            this->m_obj.set_bit(this->m_lo + i, t[i].value());
117612853Sgabeblack@google.com        }
117712853Sgabeblack@google.com    } else {
117812853Sgabeblack@google.com        for (int i = len - 1; i >= 0; --i) {
117912853Sgabeblack@google.com            this->m_obj.set_bit(this->m_lo - i, t[i].value());
118012853Sgabeblack@google.com        }
118112853Sgabeblack@google.com    }
118212853Sgabeblack@google.com    return *this;
118312853Sgabeblack@google.com}
118412853Sgabeblack@google.com
118512853Sgabeblack@google.com
118612853Sgabeblack@google.com// ----------------------------------------------------------------------------
118712853Sgabeblack@google.com//  CLASS TEMPLATE : sc_concref_r<X,Y>
118812853Sgabeblack@google.com//
118912853Sgabeblack@google.com//  Proxy class for sc_proxy concatenation (r-value only).
119012853Sgabeblack@google.com// ----------------------------------------------------------------------------
119112853Sgabeblack@google.com
119212853Sgabeblack@google.com// r-value concatenation operators and functions
119312853Sgabeblack@google.com
119412853Sgabeblack@google.comtemplate <class T1, class T2>
119512853Sgabeblack@google.cominline sc_concref_r<sc_concref_r<T1, T2>, sc_lv_base>
119612853Sgabeblack@google.comoperator , (sc_concref_r<T1, T2> a, const char *b)
119712853Sgabeblack@google.com{
119812853Sgabeblack@google.com    return sc_concref_r<sc_concref_r<T1, T2>, sc_lv_base>(
119912853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b), 3);
120012853Sgabeblack@google.com}
120112853Sgabeblack@google.com
120212853Sgabeblack@google.comtemplate <class T1, class T2>
120312853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_concref_r<T1, T2> >
120412853Sgabeblack@google.comoperator , (const char *a, sc_concref_r<T1, T2> b)
120512853Sgabeblack@google.com{
120612853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_concref_r<T1, T2> >(
120712853Sgabeblack@google.com            *new sc_lv_base(a), *b.clone(), 3);
120812853Sgabeblack@google.com}
120912853Sgabeblack@google.com
121012853Sgabeblack@google.comtemplate <class T1, class T2>
121112853Sgabeblack@google.cominline sc_concref_r<sc_concref_r<T1, T2>, sc_lv_base>
121212853Sgabeblack@google.comoperator , (sc_concref_r<T1, T2> a, const sc_logic &b)
121312853Sgabeblack@google.com{
121412853Sgabeblack@google.com    return sc_concref_r<sc_concref_r<T1, T2>, sc_lv_base>(
121512853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b, 1), 3);
121612853Sgabeblack@google.com}
121712853Sgabeblack@google.com
121812853Sgabeblack@google.comtemplate <class T1, class T2>
121912853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_concref_r<T1, T2> >
122012853Sgabeblack@google.comoperator , (const sc_logic &a, sc_concref_r<T1, T2> b)
122112853Sgabeblack@google.com{
122212853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_concref_r<T1, T2> >(
122312853Sgabeblack@google.com            *new sc_lv_base(a, 1), *b.clone(), 3);
122412853Sgabeblack@google.com}
122512853Sgabeblack@google.com
122612853Sgabeblack@google.comtemplate <class T1, class T2>
122712853Sgabeblack@google.cominline sc_concref_r<sc_concref_r<T1, T2>, sc_bv_base>
122812853Sgabeblack@google.comoperator , (sc_concref_r<T1, T2> a, bool b)
122912853Sgabeblack@google.com{
123012853Sgabeblack@google.com    return sc_concref_r<sc_concref_r<T1, T2>, sc_bv_base>(
123112853Sgabeblack@google.com            *a.clone(), *new sc_bv_base(b, 1), 3);
123212853Sgabeblack@google.com}
123312853Sgabeblack@google.com
123412853Sgabeblack@google.comtemplate <class T1, class T2>
123512853Sgabeblack@google.cominline sc_concref_r<sc_bv_base, sc_concref_r<T1, T2> >
123612853Sgabeblack@google.comoperator , (bool a, sc_concref_r<T1, T2> b)
123712853Sgabeblack@google.com{
123812853Sgabeblack@google.com    return sc_concref_r<sc_bv_base, sc_concref_r<T1, T2> >(
123912853Sgabeblack@google.com            *new sc_bv_base(a, 1), *b.clone(), 3);
124012853Sgabeblack@google.com}
124112853Sgabeblack@google.com
124212853Sgabeblack@google.comtemplate <class T1, class T2>
124312853Sgabeblack@google.cominline sc_concref_r<sc_concref_r<T1, T2>, sc_lv_base>
124412853Sgabeblack@google.comconcat(sc_concref_r<T1, T2> a, const char *b)
124512853Sgabeblack@google.com{
124612853Sgabeblack@google.com    return sc_concref_r<sc_concref_r<T1, T2>, sc_lv_base>(
124712853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b), 3);
124812853Sgabeblack@google.com}
124912853Sgabeblack@google.com
125012853Sgabeblack@google.comtemplate <class T1, class T2>
125112853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_concref_r<T1, T2> >
125212853Sgabeblack@google.comconcat(const char *a, sc_concref_r<T1, T2> b)
125312853Sgabeblack@google.com{
125412853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_concref_r<T1, T2> >(
125512853Sgabeblack@google.com            *new sc_lv_base(a), *b.clone(), 3);
125612853Sgabeblack@google.com}
125712853Sgabeblack@google.com
125812853Sgabeblack@google.comtemplate <class T1, class T2>
125912853Sgabeblack@google.cominline sc_concref_r<sc_concref_r<T1, T2>, sc_lv_base>
126012853Sgabeblack@google.comconcat(sc_concref_r<T1, T2> a, const sc_logic &b)
126112853Sgabeblack@google.com{
126212853Sgabeblack@google.com    return sc_concref_r<sc_concref_r<T1, T2>, sc_lv_base>(
126312853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b, 1), 3);
126412853Sgabeblack@google.com}
126512853Sgabeblack@google.com
126612853Sgabeblack@google.comtemplate <class T1, class T2>
126712853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_concref_r<T1, T2> >
126812853Sgabeblack@google.comconcat(const sc_logic &a, sc_concref_r<T1, T2> b)
126912853Sgabeblack@google.com{
127012853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_concref_r<T1, T2> >(
127112853Sgabeblack@google.com            *new sc_lv_base(a, 1), *b.clone(), 3);
127212853Sgabeblack@google.com}
127312853Sgabeblack@google.com
127412853Sgabeblack@google.comtemplate <class T1, class T2>
127512853Sgabeblack@google.cominline sc_concref_r<sc_concref_r<T1, T2>, sc_bv_base>
127612853Sgabeblack@google.comconcat(sc_concref_r<T1, T2> a, bool b)
127712853Sgabeblack@google.com{
127812853Sgabeblack@google.com    return sc_concref_r<sc_concref_r<T1, T2>, sc_bv_base>(
127912853Sgabeblack@google.com            *a.clone(), *new sc_bv_base(b, 1), 3);
128012853Sgabeblack@google.com}
128112853Sgabeblack@google.com
128212853Sgabeblack@google.comtemplate <class T1, class T2>
128312853Sgabeblack@google.cominline sc_concref_r<sc_bv_base, sc_concref_r<T1, T2> >
128412853Sgabeblack@google.comconcat(bool a, sc_concref_r<T1, T2> b)
128512853Sgabeblack@google.com{
128612853Sgabeblack@google.com    return sc_concref_r<sc_bv_base, sc_concref_r<T1, T2> >(
128712853Sgabeblack@google.com            *new sc_bv_base(a, 1), *b.clone(), 3);
128812853Sgabeblack@google.com}
128912853Sgabeblack@google.com
129012853Sgabeblack@google.com
129112853Sgabeblack@google.comtemplate <class T1, class T2>
129212853Sgabeblack@google.cominline sc_concref_r<sc_concref_r<T1, T2>, sc_lv_base>
129312853Sgabeblack@google.comoperator , (sc_concref<T1, T2> a, const char *b)
129412853Sgabeblack@google.com{
129512853Sgabeblack@google.com    return sc_concref_r<sc_concref_r<T1, T2>, sc_lv_base>(
129612853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b), 3);
129712853Sgabeblack@google.com}
129812853Sgabeblack@google.com
129912853Sgabeblack@google.comtemplate <class T1, class T2>
130012853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_concref_r<T1, T2> >
130112853Sgabeblack@google.comoperator , (const char *a, sc_concref<T1, T2> b)
130212853Sgabeblack@google.com{
130312853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_concref_r<T1, T2> >(
130412853Sgabeblack@google.com            *new sc_lv_base(a), *b.clone(), 3);
130512853Sgabeblack@google.com}
130612853Sgabeblack@google.com
130712853Sgabeblack@google.comtemplate <class T1, class T2>
130812853Sgabeblack@google.cominline sc_concref_r<sc_concref_r<T1, T2>, sc_lv_base>
130912853Sgabeblack@google.comoperator , (sc_concref<T1, T2> a, const sc_logic &b)
131012853Sgabeblack@google.com{
131112853Sgabeblack@google.com    return sc_concref_r<sc_concref_r<T1, T2>, sc_lv_base>(
131212853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b, 1), 3);
131312853Sgabeblack@google.com}
131412853Sgabeblack@google.com
131512853Sgabeblack@google.comtemplate <class T1, class T2>
131612853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_concref_r<T1, T2> >
131712853Sgabeblack@google.comoperator , (const sc_logic &a, sc_concref<T1, T2> b)
131812853Sgabeblack@google.com{
131912853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_concref_r<T1, T2> >(
132012853Sgabeblack@google.com            *new sc_lv_base(a, 1), *b.clone(), 3);
132112853Sgabeblack@google.com}
132212853Sgabeblack@google.com
132312853Sgabeblack@google.comtemplate <class T1, class T2>
132412853Sgabeblack@google.cominline sc_concref_r<sc_concref_r<T1, T2>, sc_bv_base>
132512853Sgabeblack@google.comoperator , (sc_concref<T1, T2> a, bool b)
132612853Sgabeblack@google.com{
132712853Sgabeblack@google.com    return sc_concref_r<sc_concref_r<T1, T2>, sc_bv_base>(
132812853Sgabeblack@google.com            *a.clone(), *new sc_bv_base(b, 1), 3);
132912853Sgabeblack@google.com}
133012853Sgabeblack@google.com
133112853Sgabeblack@google.comtemplate <class T1, class T2>
133212853Sgabeblack@google.cominline sc_concref_r<sc_bv_base, sc_concref_r<T1, T2> >
133312853Sgabeblack@google.comoperator , (bool a, sc_concref<T1, T2> b)
133412853Sgabeblack@google.com{
133512853Sgabeblack@google.com    return sc_concref_r<sc_bv_base, sc_concref_r<T1, T2> >(
133612853Sgabeblack@google.com            *new sc_bv_base(a, 1), *b.clone(), 3);
133712853Sgabeblack@google.com}
133812853Sgabeblack@google.com
133912853Sgabeblack@google.comtemplate <class T1, class T2>
134012853Sgabeblack@google.cominline sc_concref_r<sc_concref_r<T1, T2>, sc_lv_base>
134112853Sgabeblack@google.comconcat(sc_concref<T1, T2> a, const char *b)
134212853Sgabeblack@google.com{
134312853Sgabeblack@google.com    return sc_concref_r<sc_concref_r<T1, T2>, sc_lv_base>(
134412853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b), 3);
134512853Sgabeblack@google.com}
134612853Sgabeblack@google.com
134712853Sgabeblack@google.comtemplate <class T1, class T2>
134812853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_concref_r<T1, T2> >
134912853Sgabeblack@google.comconcat(const char *a, sc_concref<T1, T2> b)
135012853Sgabeblack@google.com{
135112853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_concref_r<T1, T2> >(
135212853Sgabeblack@google.com            *new sc_lv_base(a), *b.clone(), 3);
135312853Sgabeblack@google.com}
135412853Sgabeblack@google.com
135512853Sgabeblack@google.comtemplate <class T1, class T2>
135612853Sgabeblack@google.cominline sc_concref_r<sc_concref_r<T1, T2>, sc_lv_base>
135712853Sgabeblack@google.comconcat(sc_concref<T1, T2> a, const sc_logic &b)
135812853Sgabeblack@google.com{
135912853Sgabeblack@google.com    return sc_concref_r<sc_concref_r<T1, T2>, sc_lv_base>(
136012853Sgabeblack@google.com            *a.clone(), *new sc_lv_base(b, 1), 3);
136112853Sgabeblack@google.com}
136212853Sgabeblack@google.com
136312853Sgabeblack@google.comtemplate <class T1, class T2>
136412853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, sc_concref_r<T1, T2> >
136512853Sgabeblack@google.comconcat(const sc_logic &a, sc_concref<T1, T2> b)
136612853Sgabeblack@google.com{
136712853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, sc_concref_r<T1, T2> >(
136812853Sgabeblack@google.com            *new sc_lv_base(a, 1), *b.clone(), 3);
136912853Sgabeblack@google.com}
137012853Sgabeblack@google.com
137112853Sgabeblack@google.comtemplate <class T1, class T2>
137212853Sgabeblack@google.cominline sc_concref_r<sc_concref_r<T1, T2>, sc_bv_base>
137312853Sgabeblack@google.comconcat(sc_concref<T1, T2> a, bool b)
137412853Sgabeblack@google.com{
137512853Sgabeblack@google.com    return sc_concref_r<sc_concref_r<T1, T2>, sc_bv_base>(
137612853Sgabeblack@google.com            *a.clone(), *new sc_bv_base(b, 1), 3);
137712853Sgabeblack@google.com}
137812853Sgabeblack@google.com
137912853Sgabeblack@google.comtemplate <class T1, class T2>
138012853Sgabeblack@google.cominline sc_concref_r<sc_bv_base, sc_concref_r<T1, T2> >
138112853Sgabeblack@google.comconcat(bool a, sc_concref<T1, T2> b)
138212853Sgabeblack@google.com{
138312853Sgabeblack@google.com    return sc_concref_r<sc_bv_base, sc_concref_r<T1, T2> >(
138412853Sgabeblack@google.com            *new sc_bv_base(a, 1), *b.clone(), 3);
138512853Sgabeblack@google.com}
138612853Sgabeblack@google.com
138712853Sgabeblack@google.com
138812853Sgabeblack@google.com// ----------------------------------------------------------------------------
138912853Sgabeblack@google.com//  CLASS TEMPLATE : sc_proxy<T>
139012853Sgabeblack@google.com//
139112853Sgabeblack@google.com//  Base class template for bit/logic vector classes.
139212853Sgabeblack@google.com//  (Barton/Nackmann implementation)
139312853Sgabeblack@google.com// ----------------------------------------------------------------------------
139412853Sgabeblack@google.com
139512853Sgabeblack@google.com// r-value concatenation operators and functions
139612853Sgabeblack@google.com
139712853Sgabeblack@google.comtemplate <class T>
139812853Sgabeblack@google.cominline sc_concref_r<T, sc_lv_base>
139912853Sgabeblack@google.comoperator , (const sc_proxy<T> &a, const char *b)
140012853Sgabeblack@google.com{
140112853Sgabeblack@google.com    return sc_concref_r<T, sc_lv_base>(a.back_cast(), *new sc_lv_base(b), 2);
140212853Sgabeblack@google.com}
140312853Sgabeblack@google.com
140412853Sgabeblack@google.comtemplate <class T>
140512853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, T>
140612853Sgabeblack@google.comoperator , (const char *a, const sc_proxy<T> &b)
140712853Sgabeblack@google.com{
140812853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, T>(*new sc_lv_base(a), b.back_cast(), 1);
140912853Sgabeblack@google.com}
141012853Sgabeblack@google.com
141112853Sgabeblack@google.comtemplate <class T>
141212853Sgabeblack@google.cominline sc_concref_r<T, sc_lv_base>
141312853Sgabeblack@google.comoperator , (const sc_proxy<T> &a, const sc_logic &b)
141412853Sgabeblack@google.com{
141512853Sgabeblack@google.com    return sc_concref_r<T, sc_lv_base>(
141612853Sgabeblack@google.com            a.back_cast(), *new sc_lv_base(b, 1), 2);
141712853Sgabeblack@google.com}
141812853Sgabeblack@google.com
141912853Sgabeblack@google.comtemplate <class T>
142012853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, T>
142112853Sgabeblack@google.comoperator , (const sc_logic &a, const sc_proxy<T> &b)
142212853Sgabeblack@google.com{
142312853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, T>(
142412853Sgabeblack@google.com            *new sc_lv_base(a, 1), b.back_cast(), 1);
142512853Sgabeblack@google.com}
142612853Sgabeblack@google.com
142712853Sgabeblack@google.comtemplate <class T>
142812853Sgabeblack@google.cominline sc_concref_r<T, sc_bv_base>
142912853Sgabeblack@google.comoperator , (const sc_proxy<T> &a, bool b)
143012853Sgabeblack@google.com{
143112853Sgabeblack@google.com    return sc_concref_r<T, sc_bv_base>(
143212853Sgabeblack@google.com            a.back_cast(), *new sc_bv_base(b, 1), 2);
143312853Sgabeblack@google.com}
143412853Sgabeblack@google.com
143512853Sgabeblack@google.comtemplate <class T>
143612853Sgabeblack@google.cominline sc_concref_r<sc_bv_base, T>
143712853Sgabeblack@google.comoperator , (bool a, const sc_proxy<T> &b)
143812853Sgabeblack@google.com{
143912853Sgabeblack@google.com    return sc_concref_r<sc_bv_base, T>(
144012853Sgabeblack@google.com            *new sc_bv_base(a, 1), b.back_cast(), 1);
144112853Sgabeblack@google.com}
144212853Sgabeblack@google.com
144312853Sgabeblack@google.comtemplate <class T>
144412853Sgabeblack@google.cominline sc_concref_r<T, sc_lv_base>
144512853Sgabeblack@google.comconcat(const sc_proxy<T> &a, const char *b)
144612853Sgabeblack@google.com{
144712853Sgabeblack@google.com    return sc_concref_r<T, sc_lv_base>(a.back_cast(), *new sc_lv_base(b), 2);
144812853Sgabeblack@google.com}
144912853Sgabeblack@google.com
145012853Sgabeblack@google.comtemplate <class T>
145112853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, T>
145212853Sgabeblack@google.comconcat(const char *a, const sc_proxy<T> &b)
145312853Sgabeblack@google.com{
145412853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, T>(*new sc_lv_base(a), b.back_cast(), 1);
145512853Sgabeblack@google.com}
145612853Sgabeblack@google.com
145712853Sgabeblack@google.comtemplate <class T>
145812853Sgabeblack@google.cominline sc_concref_r<T, sc_lv_base>
145912853Sgabeblack@google.comconcat(const sc_proxy<T> &a, const sc_logic &b)
146012853Sgabeblack@google.com{
146112853Sgabeblack@google.com    return sc_concref_r<T, sc_lv_base>(
146212853Sgabeblack@google.com            a.back_cast(), *new sc_lv_base(b, 1), 2);
146312853Sgabeblack@google.com}
146412853Sgabeblack@google.com
146512853Sgabeblack@google.comtemplate <class T>
146612853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, T>
146712853Sgabeblack@google.comconcat(const sc_logic &a, const sc_proxy<T> &b)
146812853Sgabeblack@google.com{
146912853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, T>(
147012853Sgabeblack@google.com            *new sc_lv_base(a, 1), b.back_cast(), 1);
147112853Sgabeblack@google.com}
147212853Sgabeblack@google.com
147312853Sgabeblack@google.comtemplate <class T>
147412853Sgabeblack@google.cominline sc_concref_r<T, sc_bv_base>
147512853Sgabeblack@google.comconcat(const sc_proxy<T> &a, bool b)
147612853Sgabeblack@google.com{
147712853Sgabeblack@google.com    return sc_concref_r<T, sc_bv_base>(
147812853Sgabeblack@google.com            a.back_cast(), *new sc_bv_base(b, 1), 2);
147912853Sgabeblack@google.com}
148012853Sgabeblack@google.com
148112853Sgabeblack@google.comtemplate <class T>
148212853Sgabeblack@google.cominline sc_concref_r<sc_bv_base, T>
148312853Sgabeblack@google.comconcat(bool a, const sc_proxy<T> &b)
148412853Sgabeblack@google.com{
148512853Sgabeblack@google.com    return sc_concref_r<sc_bv_base, T>(
148612853Sgabeblack@google.com            *new sc_bv_base(a, 1), b.back_cast(), 1);
148712853Sgabeblack@google.com}
148812853Sgabeblack@google.com
148912853Sgabeblack@google.com
149012853Sgabeblack@google.comtemplate <class T>
149112853Sgabeblack@google.cominline sc_concref_r<T, sc_lv_base>
149212853Sgabeblack@google.comoperator , (sc_proxy<T> &a, const char *b)
149312853Sgabeblack@google.com{
149412853Sgabeblack@google.com    return sc_concref_r<T, sc_lv_base>(a.back_cast(), *new sc_lv_base(b), 2);
149512853Sgabeblack@google.com}
149612853Sgabeblack@google.com
149712853Sgabeblack@google.comtemplate <class T>
149812853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, T>
149912853Sgabeblack@google.comoperator , (const char *a, sc_proxy<T> &b)
150012853Sgabeblack@google.com{
150112853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, T>(*new sc_lv_base(a), b.back_cast(), 1);
150212853Sgabeblack@google.com}
150312853Sgabeblack@google.com
150412853Sgabeblack@google.comtemplate <class T>
150512853Sgabeblack@google.cominline sc_concref_r<T, sc_lv_base>
150612853Sgabeblack@google.comoperator , (sc_proxy<T> &a, const sc_logic &b)
150712853Sgabeblack@google.com{
150812853Sgabeblack@google.com    return sc_concref_r<T, sc_lv_base>(
150912853Sgabeblack@google.com            a.back_cast(), *new sc_lv_base(b, 1), 2);
151012853Sgabeblack@google.com}
151112853Sgabeblack@google.com
151212853Sgabeblack@google.comtemplate <class T>
151312853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, T>
151412853Sgabeblack@google.comoperator , (const sc_logic &a, sc_proxy<T> &b)
151512853Sgabeblack@google.com{
151612853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, T>(
151712853Sgabeblack@google.com            *new sc_lv_base(a, 1), b.back_cast(), 1);
151812853Sgabeblack@google.com}
151912853Sgabeblack@google.com
152012853Sgabeblack@google.comtemplate <class T>
152112853Sgabeblack@google.cominline sc_concref_r<T, sc_bv_base>
152212853Sgabeblack@google.comoperator , (sc_proxy<T> &a, bool b)
152312853Sgabeblack@google.com{
152412853Sgabeblack@google.com    return sc_concref_r<T, sc_bv_base>(
152512853Sgabeblack@google.com            a.back_cast(), *new sc_bv_base(b, 1), 2);
152612853Sgabeblack@google.com}
152712853Sgabeblack@google.com
152812853Sgabeblack@google.comtemplate <class T>
152912853Sgabeblack@google.cominline sc_concref_r<sc_bv_base, T>
153012853Sgabeblack@google.comoperator , (bool a, sc_proxy<T> &b)
153112853Sgabeblack@google.com{
153212853Sgabeblack@google.com    return sc_concref_r<sc_bv_base, T>(
153312853Sgabeblack@google.com            *new sc_bv_base(a, 1), b.back_cast(), 1);
153412853Sgabeblack@google.com}
153512853Sgabeblack@google.com
153612853Sgabeblack@google.com
153712853Sgabeblack@google.comtemplate <class T>
153812853Sgabeblack@google.cominline sc_concref_r<T, sc_lv_base>
153912853Sgabeblack@google.comconcat(sc_proxy<T> &a, const char *b)
154012853Sgabeblack@google.com{
154112853Sgabeblack@google.com    return sc_concref_r<T, sc_lv_base>(a.back_cast(), *new sc_lv_base(b), 2);
154212853Sgabeblack@google.com}
154312853Sgabeblack@google.com
154412853Sgabeblack@google.comtemplate <class T>
154512853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, T>
154612853Sgabeblack@google.comconcat(const char *a, sc_proxy<T> &b)
154712853Sgabeblack@google.com{
154812853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, T>(*new sc_lv_base(a), b.back_cast(), 1);
154912853Sgabeblack@google.com}
155012853Sgabeblack@google.com
155112853Sgabeblack@google.comtemplate <class T>
155212853Sgabeblack@google.cominline sc_concref_r<T, sc_lv_base>
155312853Sgabeblack@google.comconcat(sc_proxy<T> &a, const sc_logic &b)
155412853Sgabeblack@google.com{
155512853Sgabeblack@google.com    return sc_concref_r<T, sc_lv_base>(
155612853Sgabeblack@google.com            a.back_cast(), *new sc_lv_base(b, 1), 2);
155712853Sgabeblack@google.com}
155812853Sgabeblack@google.com
155912853Sgabeblack@google.comtemplate <class T>
156012853Sgabeblack@google.cominline sc_concref_r<sc_lv_base, T>
156112853Sgabeblack@google.comconcat(const sc_logic &a, sc_proxy<T> &b)
156212853Sgabeblack@google.com{
156312853Sgabeblack@google.com    return sc_concref_r<sc_lv_base, T>(
156412853Sgabeblack@google.com            *new sc_lv_base(a, 1), b.back_cast(), 1);
156512853Sgabeblack@google.com}
156612853Sgabeblack@google.com
156712853Sgabeblack@google.comtemplate <class T>
156812853Sgabeblack@google.cominline sc_concref_r<T, sc_bv_base>
156912853Sgabeblack@google.comconcat(sc_proxy<T> &a, bool b)
157012853Sgabeblack@google.com{
157112853Sgabeblack@google.com    return sc_concref_r<T, sc_bv_base>(
157212853Sgabeblack@google.com            a.back_cast(), *new sc_bv_base(b, 1), 2);
157312853Sgabeblack@google.com}
157412853Sgabeblack@google.com
157512853Sgabeblack@google.comtemplate <class T>
157612853Sgabeblack@google.cominline sc_concref_r<sc_bv_base, T>
157712853Sgabeblack@google.comconcat(bool a, sc_proxy<T> &b)
157812853Sgabeblack@google.com{
157912853Sgabeblack@google.com    return sc_concref_r<sc_bv_base, T>(
158012853Sgabeblack@google.com            *new sc_bv_base(a, 1), b.back_cast(), 1);
158112853Sgabeblack@google.com}
158212853Sgabeblack@google.com
158312853Sgabeblack@google.com// extern template instantiations
158412853Sgabeblack@google.comextern template class sc_proxy<sc_lv_base>;
158512853Sgabeblack@google.comextern template class sc_proxy<sc_bv_base>;
158612853Sgabeblack@google.com
158712853Sgabeblack@google.com} // namespace sc_dt
158812853Sgabeblack@google.com
158912853Sgabeblack@google.com#endif // __SYSTEMC_EXT_DT_BIT_SC_LV_BASE_HH__
1590