void
at_negedge( const sc_signal_in_if<bool>& s, sc_simcontext* simc )
{
    if( s.read() == false ) 
        do { wait(simc); } while ( s.read() == false );
    do { wait(simc); } while ( s.read() == true );
}
void
at_posedge( const sc_signal_in_if<sc_dt::sc_logic>& s, sc_simcontext* simc )
{
    if( s.read() == '1' ) 
        do { wait(simc); } while ( s.read() == '1' );
    do { wait(simc); } while ( s.read() == '0' );
}
Exemple #3
0
//------------------------------------------------------------------------------
//"sc_reset::reset_signal_is"
//
// This static method will register the active process instance as being
// reset by the sc_signal<bool> whose interface has been supplied. If no
// sc_reset object instance has been attached to the sc_signal<bool> yet, it
// will be created and attached. The active process instance is pushed into
// the list of processes that the sc_reset object instance should notify if
// the value of the reset signal changes.
//
// Arguments:
//     async = true if the reset signal is asynchronous, false if not.
//     iface = interface for the reset signal.
//     level = is the level at which reset is active, either true or false.
// Notes:
//   (1) If reset is asserted we tell the process that it is in reset
//       initially.
//------------------------------------------------------------------------------
void sc_reset::reset_signal_is( 
    bool async, const sc_signal_in_if<bool>& iface, bool level )
{
    sc_process_b*   process_p;    // process adding reset for.
    sc_reset_target reset_target; // entry to build for the process.
    sc_reset*       reset_p;      // reset object.

    process_p = sc_process_b::last_created_process_base();
    assert( process_p );
    process_p->m_has_reset_signal = true;
    switch ( process_p->proc_kind() )
    {
      case SC_METHOD_PROC_:
      case SC_CTHREAD_PROC_:
      case SC_THREAD_PROC_:
	reset_p = iface.is_reset();
	process_p->m_resets.push_back(reset_p);
        reset_target.m_async = async; 
	reset_target.m_level = level;
	reset_target.m_process_p = process_p;
	reset_p->m_targets.push_back(reset_target);
	if ( iface.read() == level ) process_p->initially_in_reset( async );
        break;
      default:
        SC_REPORT_ERROR(SC_ID_UNKNOWN_PROCESS_TYPE_, process_p->name());
        break;
    }
}
Exemple #4
0
//------------------------------------------------------------------------------
//"sc_reset::reset_signal_is"
//
// Notes:
//   (1) For sc_cthread_process instances we do not record the process in
//       the m_processes list. This is because we want the reset to act as
//       a synchronous reset rather than an asynchronous one.
//------------------------------------------------------------------------------
void sc_reset::reset_signal_is( const sc_signal_in_if<bool>& iface, bool level )
{
    sc_process_b* process_p; // Process adding reset for.
    sc_reset*        reset_p;   // Reset object.

    process_p = sc_process_b::last_created_process_base();
    assert( process_p );
    if ( process_p->m_reset_p )
        SC_REPORT_ERROR(SC_ID_MULTIPLE_RESETS_,process_p->name());
    switch ( process_p->proc_kind() )
    {
    case SC_CTHREAD_PROC_:
        process_p->m_reset_level = level;
        reset_p = iface.is_reset();
        process_p->m_reset_p = reset_p;
        reset_p->m_processes.push_back(process_p);
        break;
    case SC_THREAD_PROC_:
    case SC_METHOD_PROC_:
        SC_REPORT_ERROR(SC_ID_RESET_SIGNAL_IS_NOT_ALLOWED_,"");
        break;
    default:
        SC_REPORT_ERROR(SC_ID_UNKNOWN_PROCESS_TYPE_, process_p->name());
        break;
    }
}
void
sc_trace( sc_trace_file* tf,
	  const sc_signal_in_if<char>& object,
	  const std::string& name,
	  int width )
{
    if( tf ) {
	tf->trace( object.read(), name, width );
    }
}