C:/ESLX/projects/TLMWG/tlm2/include/tlm/tlm_h/tlm_req_rsp/tlm_1_interfaces/tlm_core_ifs.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002 
00003   The following code is derived, directly or indirectly, from the SystemC
00004   source code Copyright (c) 1996-2008 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 3.0 (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 // Note to the LRM writer : This is the core of the TLM standard
00020 //
00021 
00022 
00023 #ifndef __TLM_CORE_IFS_H__
00024 #define __TLM_CORE_IFS_H__
00025 
00026 //#include <systemc>
00027 
00028 #include "tlm_h/tlm_req_rsp/tlm_1_interfaces/tlm_tag.h"
00029 
00030 namespace tlm {
00031 
00032 // bidirectional blocking interfaces
00033 
00034 template < typename REQ , typename RSP >
00035 class tlm_transport_if : public virtual sc_core::sc_interface
00036 {
00037 public:
00038   virtual RSP transport( const REQ & ) = 0;
00039 
00040   virtual void transport( const REQ &req , RSP &rsp ) {
00041     rsp = transport( req );
00042   }
00043 
00044 };
00045 
00046 
00047 // uni-directional blocking interfaces
00048 
00049 template < typename T >
00050 class tlm_blocking_get_if : public virtual sc_core::sc_interface
00051 {
00052 public:
00053   virtual T get( tlm_tag<T> *t = 0 ) = 0;
00054   virtual void get( T &t ) { t = get(); }
00055 
00056 };
00057 
00058 template < typename T >
00059 class tlm_blocking_put_if : public virtual sc_core::sc_interface
00060 {
00061 public:
00062   virtual void put( const T &t ) = 0;
00063 };
00064 
00065 // uni-directional non blocking interfaces
00066 
00067 template < typename T >
00068 class tlm_nonblocking_get_if : public virtual sc_core::sc_interface
00069 {
00070 public:
00071   virtual bool nb_get( T &t ) = 0;
00072   virtual bool nb_can_get( tlm_tag<T> *t = 0 ) const = 0;
00073   virtual const sc_core::sc_event &ok_to_get( tlm_tag<T> *t = 0 ) const = 0;
00074 };
00075 
00076 template < typename T >
00077 class tlm_nonblocking_put_if : public virtual sc_core::sc_interface
00078 {
00079 public:
00080   virtual bool nb_put( const T &t ) = 0;
00081   virtual bool nb_can_put( tlm_tag<T> *t = 0 ) const = 0;
00082   virtual const sc_core::sc_event &ok_to_put( tlm_tag<T> *t = 0 ) const = 0;
00083 };
00084 
00085 
00086 // combined uni-directional blocking and non blocking 
00087 
00088 template < typename T >
00089 class tlm_get_if :
00090   public virtual tlm_blocking_get_if< T > ,
00091   public virtual tlm_nonblocking_get_if< T > {};
00092 
00093 template < typename T >
00094 class tlm_put_if :
00095   public virtual tlm_blocking_put_if< T > ,
00096   public virtual tlm_nonblocking_put_if< T > {};
00097 
00098 
00099 // peek interfaces
00100 
00101 template < typename T >
00102 class tlm_blocking_peek_if : public virtual sc_core::sc_interface
00103 {
00104 public:
00105   virtual T peek( tlm_tag<T> *t = 0 ) const = 0;
00106   virtual void peek( T &t ) const { t = peek(); }
00107 
00108 };
00109 
00110 template < typename T >
00111 class tlm_nonblocking_peek_if : public virtual sc_core::sc_interface
00112 {
00113 public:
00114   virtual bool nb_peek( T &t ) const = 0;
00115   virtual bool nb_can_peek( tlm_tag<T> *t = 0 ) const = 0;
00116   virtual const sc_core::sc_event &ok_to_peek( tlm_tag<T> *t = 0 ) const = 0;
00117 };
00118 
00119 template < typename T >
00120 class tlm_peek_if :
00121   public virtual tlm_blocking_peek_if< T > ,
00122   public virtual tlm_nonblocking_peek_if< T > {};
00123 
00124 // get_peek interfaces
00125 
00126 template < typename T >
00127 class tlm_blocking_get_peek_if :
00128   public virtual tlm_blocking_get_if<T> ,
00129   public virtual tlm_blocking_peek_if<T> {};
00130 
00131 template < typename T >
00132 class tlm_nonblocking_get_peek_if :
00133   public virtual tlm_nonblocking_get_if<T> ,
00134   public virtual tlm_nonblocking_peek_if<T> {};
00135 
00136 
00137 template < typename T >
00138 class tlm_get_peek_if :
00139   public virtual tlm_get_if<T> ,
00140   public virtual tlm_peek_if<T> ,
00141   public virtual tlm_blocking_get_peek_if<T> ,
00142   public virtual tlm_nonblocking_get_peek_if<T>
00143   {};
00144 
00145 } // namespace tlm
00146 
00147 #endif

Generated on Thu Jun 5 17:43:03 2008 for TLM 2 by  doxygen 1.5.3