// ---------------------------------------------------------------------------- // Specialized versions of the virtual methods (inherited from psc_objinfo): // - on_bits // - bit_diff // - update_toggle_count // ---------------------------------------------------------------------------- unsigned short int psc_logic::on_bits( const sc_logic & v ) { // if ( !v.is_01() ) // cerr << "Warning: value of sc_logic parameter is undefined" << endl; if ( psc_logic::must_update() && (v.to_bool() != 0) ) psc_objinfo<1, sc_logic>::inc_bit_toggle_count( 0, 1 ); return( v.to_bool() ); }
inline sc_logic psc_logic::bit_diff( const sc_logic & v1, const sc_logic & v2 ) { bool v1_, v2_; if ( v1.is_01() ) v1_ = v1.to_bool(); else { v1_ = ( m_bLastUndefToBool == true ) ? false : true; m_bLastUndefToBool = !m_bLastUndefToBool; } if ( v2.is_01() ) v2_ = v2.to_bool(); else { v2_ = ( m_bLastUndefToBool == true ) ? false : true; m_bLastUndefToBool = !m_bLastUndefToBool; } return( sc_logic(v1_ ^ v2_) ); }
sc_bit::sc_bit( const sc_logic& a ) // non-VSIA : m_val( a.to_bool() ) { sc_deprecated_sc_bit(); }
uint64 psc_logic::uint64value( const sc_logic & v ) const { uint64 value = v.to_bool(); return( value ); }