// ---------------------------------------------------------------------------- // 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_) ); }
void sc_lv_base::init( int length_, const sc_logic& init_value ) { // check the length if( length_ <= 0 ) { SC_REPORT_ERROR( sc_core::SC_ID_ZERO_LENGTH_, 0 ); } // allocate memory for the data and control words m_len = length_; m_size = (m_len - 1) / SC_DIGIT_SIZE + 1; m_data = new sc_digit[m_size * 2]; m_ctrl = m_data + m_size; // initialize the bits to 'init_value' sc_digit dw = data_array[init_value.value()]; sc_digit cw = ctrl_array[init_value.value()]; int sz = m_size; for( int i = 0; i < sz; ++ i ) { m_data[i] = dw; m_ctrl[i] = cw; } clean_tail(); }
void uvm_packer_rep::pack_sc_logic(const sc_logic& a) { check_size(1); (*m_bits).set_bit(pack_index, a.value()); pack_index++; }
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 ); }