scfx_other_defs.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002 
00003   The following code is derived, directly or indirectly, from the SystemC
00004   source code Copyright (c) 1996-2006 by all Contributors.
00005   All Rights reserved.
00006 
00007   The contents of this file are subject to the restrictions and limitations
00008   set forth in the SystemC Open Source License Version 2.4 (the "License");
00009   You may not use this file except in compliance with such restrictions and
00010   limitations. You may obtain instructions on how to receive a copy of the
00011   License at http://www.systemc.org/. Software distributed by Contributors
00012   under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
00013   ANY KIND, either express or implied. See the License for the specific
00014   language governing rights and limitations under the License.
00015 
00016  *****************************************************************************/
00017 
00018 /*****************************************************************************
00019 
00020   scfx_other_defs.h - 
00021 
00022   Original Author: Martin Janssen, Synopsys, Inc.
00023 
00024  *****************************************************************************/
00025 
00026 /*****************************************************************************
00027 
00028   MODIFICATION LOG - modifiers, enter your name, affiliation, date and
00029   changes you are making here.
00030 
00031       Name, Affiliation, Date:
00032   Description of Modification:
00033 
00034  *****************************************************************************/
00035 
00036 // $Log: scfx_other_defs.h,v $
00037 // Revision 1.1.1.1  2006/12/15 20:31:36  acg
00038 // SystemC 2.2
00039 //
00040 // Revision 1.3  2006/01/13 18:53:58  acg
00041 // Andy Goodrich: added $Log command so that CVS comments are reproduced in
00042 // the source.
00043 //
00044 
00045 #ifndef SCFX_OTHER_DEFS_H
00046 #define SCFX_OTHER_DEFS_H
00047 
00048 
00049 #include "sysc/datatypes/fx/sc_fx_ids.h"
00050 #include "sysc/datatypes/int/sc_signed.h"
00051 #include "sysc/datatypes/int/sc_unsigned.h"
00052 #include "sysc/datatypes/int/sc_int_base.h"
00053 #include "sysc/datatypes/int/sc_uint_base.h"
00054 #include "sysc/tracing/sc_trace.h"
00055 
00056 
00057 namespace sc_dt
00058 {
00059 
00060 #ifdef SC_INCLUDE_FX
00061 
00062 // ----------------------------------------------------------------------------
00063 //  CLASS : sc_signed
00064 // ----------------------------------------------------------------------------
00065 
00066 // assignment operators
00067 
00068 inline
00069 const sc_signed&
00070 sc_signed::operator = ( const sc_fxval& v )
00071 {
00072     if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
00073     {
00074     SC_REPORT_ERROR( sc_core::SC_ID_INVALID_FX_VALUE_,
00075              "sc_signed::operator = ( const sc_fxval& )" );
00076     }
00077 
00078     for( int i = 0; i < length(); ++ i )
00079     (*this)[i] = v.get_bit( i );
00080 
00081     return *this;
00082 }
00083 
00084 inline
00085 const sc_signed&
00086 sc_signed::operator = ( const sc_fxval_fast& v )
00087 {
00088     if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
00089     {
00090     SC_REPORT_ERROR( sc_core::SC_ID_INVALID_FX_VALUE_,
00091              "sc_signed::operator = ( const sc_fxval_fast& )" );
00092     }
00093 
00094     for( int i = 0; i < length(); ++ i )
00095     (*this)[i] = v.get_bit( i );
00096 
00097     return *this;
00098 }
00099 
00100 inline
00101 const sc_signed&
00102 sc_signed::operator = ( const sc_fxnum& v )
00103 {
00104     if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
00105     {
00106     SC_REPORT_ERROR( sc_core::SC_ID_INVALID_FX_VALUE_,
00107              "sc_signed::operator = ( const sc_fxnum& )" );
00108     }
00109 
00110     for( int i = 0; i < length(); ++ i )
00111     (*this)[i] = v.get_bit( i );
00112 
00113     return *this;
00114 }
00115 
00116 inline
00117 const sc_signed&
00118 sc_signed::operator = ( const sc_fxnum_fast& v )
00119 {
00120     if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
00121     {
00122     SC_REPORT_ERROR( sc_core::SC_ID_INVALID_FX_VALUE_,
00123              "sc_signed::operator = ( const sc_fxnum_fast& )" );
00124     }
00125 
00126     for( int i = 0; i < length(); ++ i )
00127     (*this)[i] = v.get_bit( i );
00128 
00129     return *this;
00130 }
00131 
00132 
00133 // ----------------------------------------------------------------------------
00134 //  CLASS : sc_unsigned
00135 // ----------------------------------------------------------------------------
00136 
00137 // assignment operators
00138 
00139 inline
00140 const sc_unsigned&
00141 sc_unsigned::operator = ( const sc_fxval& v )
00142 {
00143     if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
00144     {
00145     SC_REPORT_ERROR( sc_core::SC_ID_INVALID_FX_VALUE_,
00146              "sc_unsigned::operator = ( const sc_fxval& )" );
00147     }
00148 
00149     for( int i = 0; i < length(); ++ i )
00150     (*this)[i] = v.get_bit( i );
00151 
00152     return *this;
00153 }
00154 
00155 inline
00156 const sc_unsigned&
00157 sc_unsigned::operator = ( const sc_fxval_fast& v )
00158 {
00159     if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
00160     {
00161     SC_REPORT_ERROR( sc_core::SC_ID_INVALID_FX_VALUE_,
00162              "sc_unsigned::operator = ( const sc_fxval_fast& )" );
00163     }
00164 
00165     for( int i = 0; i < length(); ++ i )
00166     (*this)[i] = v.get_bit( i );
00167 
00168     return *this;
00169 }
00170 
00171 inline
00172 const sc_unsigned&
00173 sc_unsigned::operator = ( const sc_fxnum& v )
00174 {
00175     if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
00176     {
00177     SC_REPORT_ERROR( sc_core::SC_ID_INVALID_FX_VALUE_,
00178              "sc_unsigned::operator = ( const sc_fxnum& )" );
00179     }
00180 
00181     for( int i = 0; i < length(); ++ i )
00182     (*this)[i] = v.get_bit( i );
00183 
00184     return *this;
00185 }
00186 
00187 inline
00188 const sc_unsigned&
00189 sc_unsigned::operator = ( const sc_fxnum_fast& v )
00190 {
00191     if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
00192     {
00193     SC_REPORT_ERROR( sc_core::SC_ID_INVALID_FX_VALUE_,
00194              "sc_unsigned::operator = ( const sc_fxnum_fast& )" );
00195     }
00196 
00197     for( int i = 0; i < length(); ++ i )
00198     (*this)[i] = v.get_bit( i );
00199 
00200     return *this;
00201 }
00202 
00203 
00204 // ----------------------------------------------------------------------------
00205 //  CLASS : sc_int_base
00206 // ----------------------------------------------------------------------------
00207 
00208 #ifndef _32BIT_
00209 #define NUM_WIDTH LLWIDTH
00210 #else
00211 #define NUM_WIDTH INTWIDTH
00212 #endif
00213 
00214 
00215 // assignment operators
00216 
00217 inline
00218 sc_int_base&
00219 sc_int_base::operator = ( const sc_fxval& v )
00220 {
00221     if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
00222     SC_REPORT_ERROR( sc_core::SC_ID_INVALID_FX_VALUE_,
00223              "sc_int_base::operator = ( const sc_fxval& )" );
00224     }
00225     for( int i = 0; i < m_len; ++ i ) {
00226     set( i, v.get_bit( i ) );
00227     }
00228     extend_sign();
00229     return *this;
00230 }
00231 
00232 inline
00233 sc_int_base&
00234 sc_int_base::operator = ( const sc_fxval_fast& v )
00235 {
00236     if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
00237     SC_REPORT_ERROR( sc_core::SC_ID_INVALID_FX_VALUE_,
00238              "sc_int_base::operator = ( const sc_fxval_fast& )" );
00239     }
00240     for( int i = 0; i < m_len; ++ i ) {
00241     set( i, v.get_bit( i ) );
00242     }
00243     extend_sign();
00244     return *this;
00245 }
00246 
00247 inline
00248 sc_int_base&
00249 sc_int_base::operator = ( const sc_fxnum& v )
00250 {
00251     if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
00252     SC_REPORT_ERROR( sc_core::SC_ID_INVALID_FX_VALUE_,
00253              "sc_int_base::operator = ( const sc_fxnum& )" );
00254     }
00255     for( int i = 0; i < m_len; ++ i ) {
00256     set( i, v.get_bit( i ) );
00257     }
00258     extend_sign();
00259     return *this;
00260 }
00261 
00262 inline
00263 sc_int_base&
00264 sc_int_base::operator = ( const sc_fxnum_fast& v )
00265 {
00266     if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
00267     SC_REPORT_ERROR( sc_core::SC_ID_INVALID_FX_VALUE_,
00268              "sc_int_base::operator = ( const sc_fxnum_fast& )" );
00269     }
00270     for( int i = 0; i < m_len; ++ i ) {
00271     set( i, v.get_bit( i ) );
00272     }
00273     extend_sign();
00274     return *this;
00275 }
00276 
00277 #undef NUM_WIDTH
00278 
00279 
00280 // ----------------------------------------------------------------------------
00281 //  CLASS : sc_uint_base
00282 // ----------------------------------------------------------------------------
00283 
00284 // assignment operators
00285 
00286 inline
00287 sc_uint_base&
00288 sc_uint_base::operator = ( const sc_fxval& v )
00289 {
00290     if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
00291     SC_REPORT_ERROR( sc_core::SC_ID_INVALID_FX_VALUE_,
00292              "sc_uint_base::operator = ( const sc_fxval& )" );
00293     }
00294     for( int i = 0; i < m_len; ++ i ) {
00295     set( i, v.get_bit( i ) );
00296     }
00297     extend_sign();
00298     return *this;
00299 }
00300 
00301 inline
00302 sc_uint_base&
00303 sc_uint_base::operator = ( const sc_fxval_fast& v )
00304 {
00305     if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
00306     SC_REPORT_ERROR( sc_core::SC_ID_INVALID_FX_VALUE_,
00307              "sc_uint_base::operator = ( const sc_fxval_fast& )" );
00308     }
00309     for( int i = 0; i < m_len; ++ i ) {
00310     set( i, v.get_bit( i ) );
00311     }
00312     extend_sign();
00313     return *this;
00314 }
00315 
00316 inline
00317 sc_uint_base&
00318 sc_uint_base::operator = ( const sc_fxnum& v )
00319 {
00320     if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
00321     SC_REPORT_ERROR( sc_core::SC_ID_INVALID_FX_VALUE_,
00322              "sc_uint_base::operator = ( const sc_fxnum& )" );
00323     }
00324     for( int i = 0; i < m_len; ++ i ) {
00325     set( i, v.get_bit( i ) );
00326     }
00327     extend_sign();
00328     return *this;
00329 }
00330 
00331 inline
00332 sc_uint_base&
00333 sc_uint_base::operator = ( const sc_fxnum_fast& v )
00334 {
00335     if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
00336     SC_REPORT_ERROR( sc_core::SC_ID_INVALID_FX_VALUE_,
00337              "sc_uint_base::operator = ( const sc_fxnum_fast& )" );
00338     }
00339     for( int i = 0; i < m_len; ++ i ) {
00340     set( i, v.get_bit( i ) );
00341     }
00342     extend_sign();
00343     return *this;
00344 }
00345 
00346 
00347 #endif
00348 
00349 
00350 // ----------------------------------------------------------------------------
00351 //  FUNCTION : sc_trace
00352 // ----------------------------------------------------------------------------
00353 
00354 inline
00355 void
00356 sc_trace( sc_core::sc_trace_file* tf,
00357       const sc_fxval& object, const std::string& name )
00358 {
00359     if( tf )
00360     tf->trace( object, name );
00361 }
00362 
00363 inline
00364 void
00365 sc_trace( sc_core::sc_trace_file* tf,
00366       const sc_fxval* object, const std::string& name )
00367 {
00368     if( tf )
00369     tf->trace( *object, name );
00370 }
00371 
00372 inline
00373 void
00374 sc_trace( sc_core::sc_trace_file* tf,
00375       const sc_fxval_fast& object, const std::string& name )
00376 {
00377     if( tf )
00378     tf->trace( object, name );
00379 }
00380 
00381 inline
00382 void
00383 sc_trace( sc_core::sc_trace_file* tf,
00384       const sc_fxval_fast* object, const std::string& name )
00385 {
00386     if( tf )
00387     tf->trace( *object, name );
00388 }
00389 
00390 inline
00391 void
00392 sc_trace( sc_core::sc_trace_file* tf,
00393       const sc_fxnum& object, const std::string& name )
00394 {
00395     if( tf )
00396     tf->trace( object, name );
00397 }
00398 
00399 inline
00400 void
00401 sc_trace( sc_core::sc_trace_file* tf,
00402       const sc_fxnum* object, const std::string& name )
00403 {
00404     if( tf )
00405     tf->trace( *object, name );
00406 }
00407 
00408 inline
00409 void
00410 sc_trace( sc_core::sc_trace_file* tf,
00411       const sc_fxnum_fast& object, const std::string& name )
00412 {
00413     if( tf )
00414     tf->trace( object, name );
00415 }
00416 
00417 inline
00418 void
00419 sc_trace( sc_core::sc_trace_file* tf,
00420       const sc_fxnum_fast* object, const std::string& name )
00421 {
00422     if( tf )
00423     tf->trace( *object, name );
00424 }
00425 
00426 } // namespace sc_dt
00427 
00428 
00429 #endif
00430 
00431 // Taf!

Generated on Wed Jan 21 15:32:08 2009 for SystemC by  doxygen 1.5.5