sc_bit.cpp

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   sc_bit.cpp -- Bit class.
00021 
00022   Original Author: Gene Bushuyev, 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 
00037 // $Log: sc_bit.cpp,v $
00038 // Revision 1.1.1.1  2006/12/15 20:31:36  acg
00039 // SystemC 2.2
00040 //
00041 // Revision 1.6  2006/04/12 20:17:52  acg
00042 //  Andy Goodrich: enabled deprecation message for sc_bit.
00043 //
00044 // Revision 1.5  2006/01/25 00:31:15  acg
00045 //  Andy Goodrich: Changed over to use a standard message id of
00046 //  SC_ID_IEEE_1666_DEPRECATION for all deprecation messages.
00047 //
00048 // Revision 1.4  2006/01/24 20:50:55  acg
00049 // Andy Goodrich: added warnings indicating that sc_bit is deprecated and that
00050 // the C bool data type should be used in its place.
00051 //
00052 // Revision 1.3  2006/01/13 18:53:53  acg
00053 // Andy Goodrich: added $Log command so that CVS comments are reproduced in
00054 // the source.
00055 //
00056 
00057 #include "sysc/datatypes/bit/sc_bit.h"
00058 #include "sysc/datatypes/bit/sc_bit_ids.h"
00059 #include "sysc/utils/sc_utils_ids.h"
00060 #include "sysc/datatypes/bit/sc_logic.h"
00061 
00062 #include <stdio.h>
00063 
00064 
00065 namespace sc_dt
00066 {
00067 
00068 // ----------------------------------------------------------------------------
00069 //  CLASS : sc_bit
00070 //
00071 //  Bit class.
00072 //  Note: VSIA compatibility indicated.
00073 // ----------------------------------------------------------------------------
00074 
00075 // support methods
00076 
00077 void
00078 sc_bit::invalid_value( char c )
00079 {
00080     char msg[BUFSIZ];
00081     std::sprintf( msg, "sc_bit( '%c' )", c );
00082     SC_REPORT_ERROR( sc_core::SC_ID_VALUE_NOT_VALID_, msg );
00083 }
00084 
00085 void
00086 sc_bit::invalid_value( int i )
00087 {
00088     char msg[BUFSIZ];
00089     std::sprintf( msg, "sc_bit( %d )", i );
00090     SC_REPORT_ERROR( sc_core::SC_ID_VALUE_NOT_VALID_, msg );
00091 }
00092 
00093 
00094 // constructors
00095 
00096 sc_bit::sc_bit( const sc_logic& a )  // non-VSIA
00097     : m_val( a.to_bool() )
00098 {
00099    sc_deprecated_sc_bit();
00100 }
00101 
00102 
00103 // assignment operators
00104 
00105 sc_bit&
00106 sc_bit::operator = ( const sc_logic& b )  // non-VSIA
00107 {
00108     return ( *this = sc_bit( b ) );
00109 }
00110 
00111 
00112 // other methods
00113 
00114 void
00115 sc_bit::scan( ::std::istream& is )
00116 {
00117     bool b;
00118     is >> b;
00119     *this = b;
00120 }
00121 
00122 void sc_deprecated_sc_bit()
00123 {
00124     static bool warn_sc_bit_deprecated=true;
00125     if ( warn_sc_bit_deprecated )
00126     {
00127         warn_sc_bit_deprecated=false;
00128     SC_REPORT_INFO(sc_core::SC_ID_IEEE_1666_DEPRECATION_,
00129         "sc_bit is deprecated, use bool instead");
00130     }
00131 }
00132 
00133 } // namespace sc_dt
00134 
00135 
00136 // Taf!

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