⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sc_prim_channel.h

📁 system C源码 一种替代verilog的语言
💻 H
字号:
/*****************************************************************************  The following code is derived, directly or indirectly, from the SystemC  source code Copyright (c) 1996-2006 by all Contributors.  All Rights reserved.  The contents of this file are subject to the restrictions and limitations  set forth in the SystemC Open Source License Version 2.4 (the "License");  You may not use this file except in compliance with such restrictions and  limitations. You may obtain instructions on how to receive a copy of the  License at http://www.systemc.org/. Software distributed by Contributors  under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF  ANY KIND, either express or implied. See the License for the specific  language governing rights and limitations under the License. *****************************************************************************//*****************************************************************************  sc_prim_channel.h -- Abstract base class of all primitive channel classes.  Original Author: Martin Janssen, Synopsys, Inc., 2001-05-21 *****************************************************************************//*****************************************************************************  MODIFICATION LOG - modifiers, enter your name, affiliation, date and  changes you are making here.      Name, Affiliation, Date: Andy Goodrich, Forte,                               Bishnupriya Bhattacharya, Cadence Design Systems,                               25 August, 2003  Description of Modification: phase callbacks     *****************************************************************************///$Log: sc_prim_channel.h,v $//Revision 1.1.1.1  2006/12/15 20:31:35  acg//SystemC 2.2////Revision 1.2  2006/01/03 23:18:26  acg//Changed copyright to include 2006.////Revision 1.1.1.1  2005/12/19 23:16:43  acg//First check in of SystemC 2.1 into its own archive.////Revision 1.10  2005/07/30 03:44:11  acg//Changes from 2.1.////Revision 1.9  2005/06/10 22:43:55  acg//Added CVS change log annotation.//#ifndef SC_PRIM_CHANNEL_H#define SC_PRIM_CHANNEL_H#include "sysc/kernel/sc_object.h"#include "sysc/kernel/sc_wait.h"#include "sysc/kernel/sc_wait_cthread.h"namespace sc_core {// ----------------------------------------------------------------------------//  CLASS : sc_prim_channel////  Abstract base class of all primitive channel classes.// ----------------------------------------------------------------------------class sc_prim_channel: public sc_object{    friend class sc_prim_channel_registry;public:    enum { list_end = 0xdb };public:    virtual const char* kind() const        { return "sc_prim_channel"; }    inline bool update_requested() 	{ return m_update_next_p != (sc_prim_channel*)list_end; }    // request the update method to be executed during the update phase    inline void request_update();protected:    // constructors    sc_prim_channel();    explicit sc_prim_channel( const char* );    // destructor    virtual ~sc_prim_channel();    // the update method (does nothing by default)    virtual void update();    // called by construction_done (does nothing by default)    virtual void before_end_of_elaboration();    // called by elaboration_done (does nothing by default)    virtual void end_of_elaboration();    // called by start_simulation (does nothing by default)    virtual void start_of_simulation();    // called by simulation_done (does nothing by default)    virtual void end_of_simulation();protected:    // to avoid calling sc_get_curr_simcontext()    // static sensitivity for SC_THREADs and SC_CTHREADs    void wait()        { sc_core::wait( simcontext() ); }    // dynamic sensitivity for SC_THREADs and SC_CTHREADs    void wait( const sc_event& e )        { sc_core::wait( e, simcontext() ); }    void wait( sc_event_or_list& el )	{ sc_core::wait( el, simcontext() ); }    void wait( sc_event_and_list& el )	{ sc_core::wait( el, simcontext() ); }    void wait( const sc_time& t )        { sc_core::wait( t, simcontext() ); }    void wait( double v, sc_time_unit tu )        { sc_core::wait( sc_time( v, tu, simcontext() ), simcontext() ); }    void wait( const sc_time& t, const sc_event& e )        { sc_core::wait( t, e, simcontext() ); }    void wait( double v, sc_time_unit tu, const sc_event& e )        { sc_core::wait( sc_time( v, tu, simcontext() ), e, simcontext() ); }    void wait( const sc_time& t, sc_event_or_list& el )        { sc_core::wait( t, el, simcontext() ); }    void wait( double v, sc_time_unit tu, sc_event_or_list& el )        { sc_core::wait( sc_time( v, tu, simcontext() ), el, simcontext() ); }    void wait( const sc_time& t, sc_event_and_list& el )        { sc_core::wait( t, el, simcontext() ); }    void wait( double v, sc_time_unit tu, sc_event_and_list& el )        { sc_core::wait( sc_time( v, tu, simcontext() ), el, simcontext() ); }    void wait( int n )        { sc_core::wait( n, simcontext() ); }    // static sensitivity for SC_METHODs    void next_trigger()	{ sc_core::next_trigger( simcontext() ); }    // dynamic sensitivity for SC_METHODs    void next_trigger( const sc_event& e )        { sc_core::next_trigger( e, simcontext() ); }    void next_trigger( sc_event_or_list& el )        { sc_core::next_trigger( el, simcontext() ); }    void next_trigger( sc_event_and_list& el )        { sc_core::next_trigger( el, simcontext() ); }    void next_trigger( const sc_time& t )        { sc_core::next_trigger( t, simcontext() ); }    void next_trigger( double v, sc_time_unit tu )        {sc_core::next_trigger( sc_time( v, tu, simcontext() ), simcontext() );}    void next_trigger( const sc_time& t, const sc_event& e )        { sc_core::next_trigger( t, e, simcontext() ); }    void next_trigger( double v, sc_time_unit tu, const sc_event& e )        { sc_core::next_trigger( 	    sc_time( v, tu, simcontext() ), e, simcontext() ); }    void next_trigger( const sc_time& t, sc_event_or_list& el )        { sc_core::next_trigger( t, el, simcontext() ); }    void next_trigger( double v, sc_time_unit tu, sc_event_or_list& el )        { sc_core::next_trigger( 	    sc_time( v, tu, simcontext() ), el, simcontext() ); }    void next_trigger( const sc_time& t, sc_event_and_list& el )        { sc_core::next_trigger( t, el, simcontext() ); }    void next_trigger( double v, sc_time_unit tu, sc_event_and_list& el )        { sc_core::next_trigger( 	    sc_time( v, tu, simcontext() ), el, simcontext() ); }    // for SC_METHODs and SC_THREADs and SC_CTHREADs    bool timed_out()	{ return sc_core::timed_out( simcontext() ); }    // delta count maintenance    sc_dt::uint64 delta_count()	{ return simcontext()->m_delta_count; }private:    // called during the update phase of a delta cycle (if requested)    void perform_update();    // called when construction is done    void construction_done();    // called when elaboration is done    void elaboration_done();    // called before simulation starts    void start_simulation();    // called after simulation ends    void simulation_done();    // disabled    sc_prim_channel( const sc_prim_channel& );    sc_prim_channel& operator = ( const sc_prim_channel& );private:    sc_prim_channel_registry* m_registry;      // Update list manager.    sc_prim_channel*          m_update_next_p; // Next entry in update list.};// ----------------------------------------------------------------------------//  CLASS : sc_prim_channel_registry////  Registry for all primitive channels.//  FOR INTERNAL USE ONLY!// ----------------------------------------------------------------------------class sc_prim_channel_registry{    friend class sc_simcontext;public:    void insert( sc_prim_channel& );    void remove( sc_prim_channel& );    int size() const        { return m_prim_channel_vec.size(); }    inline void request_update( sc_prim_channel& );    bool pending_updates() const         { return m_update_list_p != 		(sc_prim_channel*)sc_prim_channel::list_end; 	}private:    // constructor    explicit sc_prim_channel_registry( sc_simcontext& simc_ );    // destructor    ~sc_prim_channel_registry();    // called during the update phase of a delta cycle    inline void perform_update();    // called when construction is done    void construction_done();    // called when elaboration is done    void elaboration_done();    // called before simulation starts    void start_simulation();    // called after simulation ends    void simulation_done();    // disabled    sc_prim_channel_registry();    sc_prim_channel_registry( const sc_prim_channel_registry& );    sc_prim_channel_registry& operator = ( const sc_prim_channel_registry& );private:    sc_simcontext*                m_simc;    std::vector<sc_prim_channel*> m_prim_channel_vec;    sc_prim_channel*              m_update_list_p;};// IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII// ----------------------------------------------------------------------------//  CLASS : sc_prim_channel_registry////  Registry for all primitive channels.//  FOR INTERNAL USE ONLY!// ----------------------------------------------------------------------------inlinevoidsc_prim_channel_registry::request_update( sc_prim_channel& prim_channel_ ){    prim_channel_.m_update_next_p = m_update_list_p;    m_update_list_p = &prim_channel_;}// called during the update phase of a delta cycleinlinevoidsc_prim_channel_registry::perform_update(){    sc_prim_channel* next_p; // Next update to perform.    sc_prim_channel* now_p;  // Update now performing.    now_p = m_update_list_p;    m_update_list_p = (sc_prim_channel*)sc_prim_channel::list_end;    for ( ; now_p != (sc_prim_channel*)sc_prim_channel::list_end;     	now_p = next_p )    {        next_p = now_p->m_update_next_p;	now_p->perform_update();    }}// ----------------------------------------------------------------------------//  CLASS : sc_prim_channel////  Abstract base class of all primitive channel classes.// ----------------------------------------------------------------------------// request the update method (to be executed during the update phase)inlinevoidsc_prim_channel::request_update(){    if( ! m_update_next_p ) {	m_registry->request_update( *this );    }}// called during the update phase of a delta cycle (if requested)inlinevoidsc_prim_channel::perform_update(){    update();    m_update_next_p = 0;}} // namespace sc_core#endif// Taf!

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -