112027Sjungma@eit.uni-kl.de/*****************************************************************************
212027Sjungma@eit.uni-kl.de
312027Sjungma@eit.uni-kl.de  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
412027Sjungma@eit.uni-kl.de  more contributor license agreements.  See the NOTICE file distributed
512027Sjungma@eit.uni-kl.de  with this work for additional information regarding copyright ownership.
612027Sjungma@eit.uni-kl.de  Accellera licenses this file to you under the Apache License, Version 2.0
712027Sjungma@eit.uni-kl.de  (the "License"); you may not use this file except in compliance with the
812027Sjungma@eit.uni-kl.de  License.  You may obtain a copy of the License at
912027Sjungma@eit.uni-kl.de
1012027Sjungma@eit.uni-kl.de    http://www.apache.org/licenses/LICENSE-2.0
1112027Sjungma@eit.uni-kl.de
1212027Sjungma@eit.uni-kl.de  Unless required by applicable law or agreed to in writing, software
1312027Sjungma@eit.uni-kl.de  distributed under the License is distributed on an "AS IS" BASIS,
1412027Sjungma@eit.uni-kl.de  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1512027Sjungma@eit.uni-kl.de  implied.  See the License for the specific language governing
1612027Sjungma@eit.uni-kl.de  permissions and limitations under the License.
1712027Sjungma@eit.uni-kl.de
1812027Sjungma@eit.uni-kl.de *****************************************************************************/
1912027Sjungma@eit.uni-kl.de
2012027Sjungma@eit.uni-kl.de/*****************************************************************************
2112027Sjungma@eit.uni-kl.de
2212027Sjungma@eit.uni-kl.de  sc_value_base.h -- Base class for SystemC bit values.
2312027Sjungma@eit.uni-kl.de
2412027Sjungma@eit.uni-kl.de  Original Author: Andy Goodrich, Forte Design Systems
2512027Sjungma@eit.uni-kl.de
2612027Sjungma@eit.uni-kl.de *****************************************************************************/
2712027Sjungma@eit.uni-kl.de
2812027Sjungma@eit.uni-kl.de/*****************************************************************************
2912027Sjungma@eit.uni-kl.de
3012027Sjungma@eit.uni-kl.de  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
3112027Sjungma@eit.uni-kl.de  changes you are making here.
3212027Sjungma@eit.uni-kl.de
3312027Sjungma@eit.uni-kl.de      Name, Affiliation, Date:
3412027Sjungma@eit.uni-kl.de  Description of Modification:
3512027Sjungma@eit.uni-kl.de
3612027Sjungma@eit.uni-kl.de *****************************************************************************/
3712027Sjungma@eit.uni-kl.de
3812027Sjungma@eit.uni-kl.de// $Log: sc_value_base.h,v $
3912027Sjungma@eit.uni-kl.de// Revision 1.4  2011/08/29 18:04:32  acg
4012027Sjungma@eit.uni-kl.de//  Philipp A. Hartmann: miscellaneous clean ups.
4112027Sjungma@eit.uni-kl.de//
4212027Sjungma@eit.uni-kl.de// Revision 1.3  2011/08/24 22:05:48  acg
4312027Sjungma@eit.uni-kl.de//  Torsten Maehne: initialization changes to remove warnings.
4412027Sjungma@eit.uni-kl.de//
4512027Sjungma@eit.uni-kl.de// Revision 1.2  2011/06/28 21:23:04  acg
4612027Sjungma@eit.uni-kl.de//  Andy Goodrich: merging of SCV tree.
4712027Sjungma@eit.uni-kl.de//
4812027Sjungma@eit.uni-kl.de// Revision 1.1.1.1  2006/12/15 20:20:05  acg
4912027Sjungma@eit.uni-kl.de// SystemC 2.3
5012027Sjungma@eit.uni-kl.de//
5112027Sjungma@eit.uni-kl.de// Revision 1.3  2006/01/13 18:54:01  acg
5212027Sjungma@eit.uni-kl.de// Andy Goodrich: added $Log command so that CVS comments are reproduced in
5312027Sjungma@eit.uni-kl.de// the source.
5412027Sjungma@eit.uni-kl.de//
5512027Sjungma@eit.uni-kl.de
5612027Sjungma@eit.uni-kl.de#ifndef SC_VALUE_BASE_H
5712027Sjungma@eit.uni-kl.de#define SC_VALUE_BASE_H
5812027Sjungma@eit.uni-kl.de
5912027Sjungma@eit.uni-kl.de
6012027Sjungma@eit.uni-kl.de#include "sysc/datatypes/int/sc_nbdefs.h"
6112027Sjungma@eit.uni-kl.de
6212027Sjungma@eit.uni-kl.denamespace sc_dt
6312027Sjungma@eit.uni-kl.de{
6412027Sjungma@eit.uni-kl.de
6512027Sjungma@eit.uni-kl.declass sc_signed;
6612027Sjungma@eit.uni-kl.declass sc_unsigned;
6712027Sjungma@eit.uni-kl.de
6812027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
6912027Sjungma@eit.uni-kl.de//  CLASS : sc_value_base
7012027Sjungma@eit.uni-kl.de//
7112027Sjungma@eit.uni-kl.de//  Abstract base class of all SystemC native variables. It provides
7212027Sjungma@eit.uni-kl.de//  support for concatenation operations via a set of virtual methods.
7312027Sjungma@eit.uni-kl.de//  A general description of the methods appear with their default
7412027Sjungma@eit.uni-kl.de//  definitions in sc_object.cpp.
7512027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
7612027Sjungma@eit.uni-kl.de
7712027Sjungma@eit.uni-kl.declass sc_value_base
7812027Sjungma@eit.uni-kl.de{
7912027Sjungma@eit.uni-kl.de    friend class sc_concatref;
8012027Sjungma@eit.uni-kl.de  private:
8112027Sjungma@eit.uni-kl.de    virtual void concat_clear_data( bool to_ones=false );
8212027Sjungma@eit.uni-kl.de    virtual bool concat_get_ctrl( sc_digit* dst_p, int low_i ) const;
8312027Sjungma@eit.uni-kl.de    virtual bool concat_get_data( sc_digit* dst_p, int low_i ) const;
8412027Sjungma@eit.uni-kl.de    virtual uint64 concat_get_uint64() const;
8512027Sjungma@eit.uni-kl.de    virtual int concat_length(bool* xz_present_p=0) const;
8612027Sjungma@eit.uni-kl.de    virtual void concat_set( int64 src, int low_i );
8712027Sjungma@eit.uni-kl.de    virtual void concat_set( const sc_signed& src, int low_i );
8812027Sjungma@eit.uni-kl.de    virtual void concat_set( const sc_unsigned& src, int low_i );
8912027Sjungma@eit.uni-kl.de    virtual void concat_set( uint64 src, int low_i );
9012027Sjungma@eit.uni-kl.de  public:
9112027Sjungma@eit.uni-kl.de    virtual ~sc_value_base() {}
9212027Sjungma@eit.uni-kl.de};
9312027Sjungma@eit.uni-kl.de
9412027Sjungma@eit.uni-kl.de
9512027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
9612027Sjungma@eit.uni-kl.de//  CLASS : sc_generic_base
9712027Sjungma@eit.uni-kl.de//
9812027Sjungma@eit.uni-kl.de//  Proxy class for user-defined value classes and other classes that
9912027Sjungma@eit.uni-kl.de//  are defined outside of SystemC.
10012027Sjungma@eit.uni-kl.de//  The class is utilized as a base class for the arbitrary class:
10112027Sjungma@eit.uni-kl.de//
10212027Sjungma@eit.uni-kl.de//       class my_class : public sc_generic_base<my_class>
10312027Sjungma@eit.uni-kl.de//
10412027Sjungma@eit.uni-kl.de//  The purpose of the class is to allow to_XXXX methods defined within that
10512027Sjungma@eit.uni-kl.de//  class so that assignments and casts from the arbitrary class to native
10612027Sjungma@eit.uni-kl.de//  SystemC types are possible. To interact correctly with the SystemC library
10712027Sjungma@eit.uni-kl.de//  the class derived from sc_generic_base must implement the following
10812027Sjungma@eit.uni-kl.de//  methods:
10912027Sjungma@eit.uni-kl.de//    (1) uint64 to_uint64() const
11012027Sjungma@eit.uni-kl.de//    (2) int64  to_int64() const
11112027Sjungma@eit.uni-kl.de//    (3) void to_sc_unsigned( sc_unsigned& ) const
11212027Sjungma@eit.uni-kl.de//    (4) void to_sc_signed( sc_signed& ) const
11312027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
11412027Sjungma@eit.uni-kl.detemplate< class T >
11512027Sjungma@eit.uni-kl.declass sc_generic_base {
11612027Sjungma@eit.uni-kl.de  public:
11712027Sjungma@eit.uni-kl.de    inline const T* operator-> () const
11812027Sjungma@eit.uni-kl.de    {
11912027Sjungma@eit.uni-kl.de        return (const T*)this;
12012027Sjungma@eit.uni-kl.de    }
12112027Sjungma@eit.uni-kl.de    inline T* operator-> ()
12212027Sjungma@eit.uni-kl.de    {
12312027Sjungma@eit.uni-kl.de        return (T*)this;
12412027Sjungma@eit.uni-kl.de    }
12512027Sjungma@eit.uni-kl.de};
12612027Sjungma@eit.uni-kl.de
12712027Sjungma@eit.uni-kl.de} // namespace sc_dt
12812027Sjungma@eit.uni-kl.de
12912027Sjungma@eit.uni-kl.de#endif
130