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 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 #include "systemc/datatypes/bit/sc_bit.h" 00038 #include "systemc/datatypes/bit/sc_bit_ids.h" 00039 #include "systemc/datatypes/bit/sc_logic.h" 00040 00041 #include <stdio.h> 00042 00043 00044 namespace sc_dt 00045 { 00046 00047 // ---------------------------------------------------------------------------- 00048 // CLASS : sc_bit 00049 // 00050 // Bit class. 00051 // Note: VSIA compatibility indicated. 00052 // ---------------------------------------------------------------------------- 00053 00054 // support methods 00055 00056 void 00057 sc_bit::invalid_value( char c ) 00058 { 00059 char msg[BUFSIZ]; 00060 sprintf( msg, "sc_bit( '%c' )", c ); 00061 SC_REPORT_ERROR( SC_ID_VALUE_NOT_VALID_, msg ); 00062 } 00063 00064 void 00065 sc_bit::invalid_value( int i ) 00066 { 00067 char msg[BUFSIZ]; 00068 sprintf( msg, "sc_bit( %d )", i ); 00069 SC_REPORT_ERROR( SC_ID_VALUE_NOT_VALID_, msg ); 00070 } 00071 00072 00073 // constructors 00074 00075 sc_bit::sc_bit( const sc_logic& a ) // non-VSIA 00076 : m_val( a.to_bool() ) 00077 {} 00078 00079 00080 // assignment operators 00081 00082 sc_bit& 00083 sc_bit::operator = ( const sc_logic& b ) // non-VSIA 00084 { 00085 return ( *this = sc_bit( b ) ); 00086 } 00087 00088 00089 // other methods 00090 00091 void 00092 sc_bit::scan( istream& is ) 00093 { 00094 bool b; 00095 is >> b; 00096 *this = b; 00097 } 00098 00099 } // namespace sc_dt 00100 00101 00102 // Taf!
1.2.18