TLM-2.0: include/tlm/tlm_1/tlm_req_rsp/tlm_channels/tlm_req_rsp_channels/tlm_put_get_imp.h Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# include/tlm/tlm_1/tlm_req_rsp/tlm_channels/tlm_req_rsp_channels/tlm_put_get_imp.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 // To the LRM writer : these classes are purely artifacts of the implementation.
    00020 //
    00021
    00022 #ifndef __TLM_PUT_GET_IMP_H__
    00023 #define __TLM_PUT_GET_IMP_H__
    00024
    00025 #include "tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_master_slave_ifs.h"
    00026
    00027 namespace tlm {
    00028
    00029 template < typename PUT_DATA , typename GET_DATA>
    00030 class tlm_put_get_imp :
    00031   private virtual tlm_put_if< PUT_DATA > ,
    00032   private virtual tlm_get_peek_if< GET_DATA >
    00033 {
    00034 public:
    00035   tlm_put_get_imp( tlm_put_if<PUT_DATA> &p ,
    00036        tlm_get_peek_if<GET_DATA> &g ) :
    00037     put_fifo( p ) , get_fifo( g ) {}
    00038
    00039   // put interface
    00040
    00041   void put( const PUT_DATA &t ) { put_fifo.put( t ); }
    00042
    00043   bool nb_put( const PUT_DATA &t ) { return put_fifo.nb_put( t ); }
    00044   bool nb_can_put( tlm_tag<PUT_DATA> *t = 0 ) const {
    00045     return put_fifo.nb_can_put( t );
    00046   }
    00047   const sc_core::sc_event &ok_to_put( tlm_tag<PUT_DATA> *t = 0 ) const {
    00048     return put_fifo.ok_to_put( t );
    00049   }
    00050
    00051   // get interface
    00052
    00053   GET_DATA get( tlm_tag<GET_DATA> *t = 0 ) { return get_fifo.get(); }
    00054
    00055   bool nb_get( GET_DATA &t ) { return get_fifo.nb_get( t ); }
    00056
    00057   bool nb_can_get( tlm_tag<GET_DATA> *t = 0 ) const {
    00058     return get_fifo.nb_can_get( t );
    00059   }
    00060
    00061   virtual const sc_core::sc_event &ok_to_get( tlm_tag<GET_DATA> *t = 0 ) const {
    00062     return get_fifo.ok_to_get( t );
    00063   }
    00064
    00065   // peek interface
    00066
    00067   GET_DATA peek( tlm_tag<GET_DATA> *t = 0 ) const { return get_fifo.peek(); }
    00068
    00069   bool nb_peek( GET_DATA &t ) const { return get_fifo.nb_peek( t ); }
    00070
    00071   bool nb_can_peek( tlm_tag<GET_DATA> *t = 0 ) const {
    00072     return get_fifo.nb_can_peek( t );
    00073   }
    00074
    00075   virtual const sc_core::sc_event &ok_to_peek( tlm_tag<GET_DATA> *t = 0 ) const {
    00076     return get_fifo.ok_to_peek( t );
    00077   }
    00078
    00079 private:
    00080   tlm_put_if<PUT_DATA> &put_fifo;
    00081   tlm_get_peek_if<GET_DATA> &get_fifo;
    00082 };
    00083
    00084 template < typename REQ , typename RSP >
    00085 class tlm_master_imp :
    00086   private tlm_put_get_imp< REQ , RSP > ,
    00087   public virtual tlm_master_if< REQ , RSP >
    00088 {
    00089 public:
    00090
    00091   tlm_master_imp( tlm_put_if<REQ> &req ,
    00092                   tlm_get_peek_if<RSP> &rsp ) :
    00093     tlm_put_get_imp<REQ,RSP>( req , rsp ) {}
    00094
    00095 };
    00096
    00097 template < typename REQ , typename RSP >
    00098 class tlm_slave_imp :
    00099   private tlm_put_get_imp< RSP , REQ > ,
    00100   public virtual tlm_slave_if< REQ , RSP >
    00101 {
    00102 public:
    00103
    00104   tlm_slave_imp( tlm_get_peek_if<REQ> &req ,
    00105                  tlm_put_if<RSP> &rsp ) :
    00106     tlm_put_get_imp<RSP,REQ>( rsp  , req ) {}
    00107
    00108 };
    00109
    00110 } // namespace tlm
    00111
    00112 #endif