Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

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-2004 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.3 (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 #ifndef SCFX_OTHER_DEFS_H
00037 #define SCFX_OTHER_DEFS_H
00038 
00039 
00040 #include "systemc/datatypes/fx/sc_fx_ids.h"
00041 #include "systemc/datatypes/int/sc_signed.h"
00042 #include "systemc/datatypes/int/sc_unsigned.h"
00043 #include "systemc/datatypes/int/sc_int_base.h"
00044 #include "systemc/datatypes/int/sc_uint_base.h"
00045 #include "systemc/tracing/sc_trace.h"
00046 
00047 
00048 namespace sc_dt
00049 {
00050 
00051 #ifdef SC_INCLUDE_FX
00052 
00053 // ----------------------------------------------------------------------------
00054 //  CLASS : sc_signed
00055 // ----------------------------------------------------------------------------
00056 
00057 // assignment operators
00058 
00059 inline
00060 sc_signed&
00061 sc_signed::operator = ( const sc_fxval& v )
00062 {
00063     if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
00064     {
00065   SC_REPORT_ERROR( SC_ID_INVALID_FX_VALUE_,
00066        "sc_signed::operator = ( const sc_fxval& )" );
00067     }
00068 
00069     for( int i = 0; i < length(); ++ i )
00070   (*this)[i] = v.get_bit( i );
00071 
00072     return *this;
00073 }
00074 
00075 inline
00076 sc_signed&
00077 sc_signed::operator = ( const sc_fxval_fast& v )
00078 {
00079     if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
00080     {
00081   SC_REPORT_ERROR( SC_ID_INVALID_FX_VALUE_,
00082        "sc_signed::operator = ( const sc_fxval_fast& )" );
00083     }
00084 
00085     for( int i = 0; i < length(); ++ i )
00086   (*this)[i] = v.get_bit( i );
00087 
00088     return *this;
00089 }
00090 
00091 inline
00092 sc_signed&
00093 sc_signed::operator = ( const sc_fxnum& v )
00094 {
00095     if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
00096     {
00097   SC_REPORT_ERROR( SC_ID_INVALID_FX_VALUE_,
00098        "sc_signed::operator = ( const sc_fxnum& )" );
00099     }
00100 
00101     for( int i = 0; i < length(); ++ i )
00102   (*this)[i] = v.get_bit( i );
00103 
00104     return *this;
00105 }
00106 
00107 inline
00108 sc_signed&
00109 sc_signed::operator = ( const sc_fxnum_fast& v )
00110 {
00111     if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
00112     {
00113   SC_REPORT_ERROR( SC_ID_INVALID_FX_VALUE_,
00114        "sc_signed::operator = ( const sc_fxnum_fast& )" );
00115     }
00116 
00117     for( int i = 0; i < length(); ++ i )
00118   (*this)[i] = v.get_bit( i );
00119 
00120     return *this;
00121 }
00122 
00123 
00124 // ----------------------------------------------------------------------------
00125 //  CLASS : sc_unsigned
00126 // ----------------------------------------------------------------------------
00127 
00128 // assignment operators
00129 
00130 inline
00131 sc_unsigned&
00132 sc_unsigned::operator = ( const sc_fxval& v )
00133 {
00134     if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
00135     {
00136   SC_REPORT_ERROR( SC_ID_INVALID_FX_VALUE_,
00137        "sc_unsigned::operator = ( const sc_fxval& )" );
00138     }
00139 
00140     for( int i = 0; i < length(); ++ i )
00141   (*this)[i] = v.get_bit( i );
00142 
00143     return *this;
00144 }
00145 
00146 inline
00147 sc_unsigned&
00148 sc_unsigned::operator = ( const sc_fxval_fast& v )
00149 {
00150     if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
00151     {
00152   SC_REPORT_ERROR( SC_ID_INVALID_FX_VALUE_,
00153        "sc_unsigned::operator = ( const sc_fxval_fast& )" );
00154     }
00155 
00156     for( int i = 0; i < length(); ++ i )
00157   (*this)[i] = v.get_bit( i );
00158 
00159     return *this;
00160 }
00161 
00162 inline
00163 sc_unsigned&
00164 sc_unsigned::operator = ( const sc_fxnum& v )
00165 {
00166     if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
00167     {
00168   SC_REPORT_ERROR( SC_ID_INVALID_FX_VALUE_,
00169        "sc_unsigned::operator = ( const sc_fxnum& )" );
00170     }
00171 
00172     for( int i = 0; i < length(); ++ i )
00173   (*this)[i] = v.get_bit( i );
00174 
00175     return *this;
00176 }
00177 
00178 inline
00179 sc_unsigned&
00180 sc_unsigned::operator = ( const sc_fxnum_fast& v )
00181 {
00182     if( ! v.is_normal() ) /* also triggers OBSERVER_READ call */
00183     {
00184   SC_REPORT_ERROR( SC_ID_INVALID_FX_VALUE_,
00185        "sc_unsigned::operator = ( const sc_fxnum_fast& )" );
00186     }
00187 
00188     for( int i = 0; i < length(); ++ i )
00189   (*this)[i] = v.get_bit( i );
00190 
00191     return *this;
00192 }
00193 
00194 
00195 // ----------------------------------------------------------------------------
00196 //  CLASS : sc_int_base
00197 // ----------------------------------------------------------------------------
00198 
00199 #ifndef _32BIT_
00200 #define NUM_WIDTH LLWIDTH
00201 #else
00202 #define NUM_WIDTH INTWIDTH
00203 #endif
00204 
00205 
00206 // assignment operators
00207 
00208 inline
00209 sc_int_base&
00210 sc_int_base::operator = ( const sc_fxval& v )
00211 {
00212     if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
00213   SC_REPORT_ERROR( SC_ID_INVALID_FX_VALUE_,
00214        "sc_int_base::operator = ( const sc_fxval& )" );
00215     }
00216     for( int i = 0; i < m_len; ++ i ) {
00217   set( i, v.get_bit( i ) );
00218     }
00219     extend_sign();
00220     return *this;
00221 }
00222 
00223 inline
00224 sc_int_base&
00225 sc_int_base::operator = ( const sc_fxval_fast& v )
00226 {
00227     if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
00228   SC_REPORT_ERROR( SC_ID_INVALID_FX_VALUE_,
00229        "sc_int_base::operator = ( const sc_fxval_fast& )" );
00230     }
00231     for( int i = 0; i < m_len; ++ i ) {
00232   set( i, v.get_bit( i ) );
00233     }
00234     extend_sign();
00235     return *this;
00236 }
00237 
00238 inline
00239 sc_int_base&
00240 sc_int_base::operator = ( const sc_fxnum& v )
00241 {
00242     if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
00243   SC_REPORT_ERROR( SC_ID_INVALID_FX_VALUE_,
00244        "sc_int_base::operator = ( const sc_fxnum& )" );
00245     }
00246     for( int i = 0; i < m_len; ++ i ) {
00247   set( i, v.get_bit( i ) );
00248     }
00249     extend_sign();
00250     return *this;
00251 }
00252 
00253 inline
00254 sc_int_base&
00255 sc_int_base::operator = ( const sc_fxnum_fast& v )
00256 {
00257     if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
00258   SC_REPORT_ERROR( SC_ID_INVALID_FX_VALUE_,
00259        "sc_int_base::operator = ( const sc_fxnum_fast& )" );
00260     }
00261     for( int i = 0; i < m_len; ++ i ) {
00262   set( i, v.get_bit( i ) );
00263     }
00264     extend_sign();
00265     return *this;
00266 }
00267 
00268 #undef NUM_WIDTH
00269 
00270 
00271 // ----------------------------------------------------------------------------
00272 //  CLASS : sc_uint_base
00273 // ----------------------------------------------------------------------------
00274 
00275 // assignment operators
00276 
00277 inline
00278 sc_uint_base&
00279 sc_uint_base::operator = ( const sc_fxval& v )
00280 {
00281     if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
00282   SC_REPORT_ERROR( SC_ID_INVALID_FX_VALUE_,
00283        "sc_uint_base::operator = ( const sc_fxval& )" );
00284     }
00285     for( int i = 0; i < m_len; ++ i ) {
00286   set( i, v.get_bit( i ) );
00287     }
00288     extend_sign();
00289     return *this;
00290 }
00291 
00292 inline
00293 sc_uint_base&
00294 sc_uint_base::operator = ( const sc_fxval_fast& v )
00295 {
00296     if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
00297   SC_REPORT_ERROR( SC_ID_INVALID_FX_VALUE_,
00298        "sc_uint_base::operator = ( const sc_fxval_fast& )" );
00299     }
00300     for( int i = 0; i < m_len; ++ i ) {
00301   set( i, v.get_bit( i ) );
00302     }
00303     extend_sign();
00304     return *this;
00305 }
00306 
00307 inline
00308 sc_uint_base&
00309 sc_uint_base::operator = ( const sc_fxnum& v )
00310 {
00311     if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
00312   SC_REPORT_ERROR( SC_ID_INVALID_FX_VALUE_,
00313        "sc_uint_base::operator = ( const sc_fxnum& )" );
00314     }
00315     for( int i = 0; i < m_len; ++ i ) {
00316   set( i, v.get_bit( i ) );
00317     }
00318     extend_sign();
00319     return *this;
00320 }
00321 
00322 inline
00323 sc_uint_base&
00324 sc_uint_base::operator = ( const sc_fxnum_fast& v )
00325 {
00326     if( ! v.is_normal() ) { /* also triggers OBSERVER_READ call */
00327   SC_REPORT_ERROR( SC_ID_INVALID_FX_VALUE_,
00328        "sc_uint_base::operator = ( const sc_fxnum_fast& )" );
00329     }
00330     for( int i = 0; i < m_len; ++ i ) {
00331   set( i, v.get_bit( i ) );
00332     }
00333     extend_sign();
00334     return *this;
00335 }
00336 
00337 
00338 #endif
00339 
00340 
00341 // ----------------------------------------------------------------------------
00342 //  FUNCTION : sc_trace
00343 // ----------------------------------------------------------------------------
00344 
00345 inline
00346 void
00347 sc_trace( sc_trace_file* tf,
00348     const sc_fxval& object, const sc_string& name )
00349 {
00350     if( tf )
00351   tf->trace( object, name );
00352 }
00353 
00354 inline
00355 void
00356 sc_trace( sc_trace_file* tf,
00357     const sc_fxval* object, const sc_string& name )
00358 {
00359     if( tf )
00360   tf->trace( *object, name );
00361 }
00362 
00363 inline
00364 void
00365 sc_trace( sc_trace_file* tf,
00366     const sc_fxval_fast& object, const sc_string& name )
00367 {
00368     if( tf )
00369   tf->trace( object, name );
00370 }
00371 
00372 inline
00373 void
00374 sc_trace( sc_trace_file* tf,
00375     const sc_fxval_fast* object, const sc_string& name )
00376 {
00377     if( tf )
00378   tf->trace( *object, name );
00379 }
00380 
00381 inline
00382 void
00383 sc_trace( sc_trace_file* tf,
00384     const sc_fxnum& object, const sc_string& name )
00385 {
00386     if( tf )
00387   tf->trace( object, name );
00388 }
00389 
00390 inline
00391 void
00392 sc_trace( sc_trace_file* tf,
00393     const sc_fxnum* object, const sc_string& name )
00394 {
00395     if( tf )
00396   tf->trace( *object, name );
00397 }
00398 
00399 inline
00400 void
00401 sc_trace( sc_trace_file* tf,
00402     const sc_fxnum_fast& object, const sc_string& name )
00403 {
00404     if( tf )
00405   tf->trace( object, name );
00406 }
00407 
00408 inline
00409 void
00410 sc_trace( sc_trace_file* tf,
00411     const sc_fxnum_fast* object, const sc_string& name )
00412 {
00413     if( tf )
00414   tf->trace( *object, name );
00415 }
00416 
00417 } // namespace sc_dt
00418 
00419 
00420 #endif
00421 
00422 // Taf!

Generated on Fri Jan 14 08:29:09 2005 for SystemC2.1beta11(excludingMSLib)(IncludingSCV)\nProvidedby:www.openverificationfoundation.org by doxygen1.2.18