| 1 | /***************************************************************************** |
| 2 | |
| 3 | The following code is derived, directly or indirectly, from the SystemC |
| 4 | source code Copyright (c) 1996-2004 by all Contributors. |
| 5 | All Rights reserved. |
| 6 | |
| 7 | The contents of this file are subject to the restrictions and limitations |
| 8 | set forth in the SystemC Open Source License Version 2.4 (the "License"); |
| 9 | You may not use this file except in compliance with such restrictions and |
| 10 | limitations. You may obtain instructions on how to receive a copy of the |
| 11 | License at http://www.systemc.org/. Software distributed by Contributors |
| 12 | under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF |
| 13 | ANY KIND, either express or implied. See the License for the specific |
| 14 | language governing rights and limitations under the License. |
| 15 | |
| 16 | *****************************************************************************/ |
| 17 | |
| 18 | |
| 19 | // |
| 20 | // To the LRM writer : these classes are purely artifacts of the implementation. |
| 21 | // |
| 22 | |
| 23 | #ifndef TLM_ANNOTATED_PUT_GET_IMP_HEADER |
| 24 | #define TLM_ANNOTATED_PUT_GET_IMP_HEADER |
| 25 | |
| 26 | #include "tlm_core.h" |
| 27 | #include "tlm_annotated/tlm_annotated_ifs/tlm_annotated_master_slave_ifs.h" |
| 28 | |
| 29 | using tlm_core::tlm_put_get_imp; |
| 30 | |
| 31 | template< typename PUT_DATA , typename GET_DATA > |
| 32 | class tlm_annotated_put_get_imp : |
| 33 | private virtual tlm_annotated_put_if< PUT_DATA > , |
| 34 | private virtual tlm_annotated_get_peek_if< GET_DATA > , |
| 35 | private tlm_put_get_imp< PUT_DATA , GET_DATA > { |
| 36 | public: |
| 37 | |
| 38 | tlm_annotated_put_get_imp( tlm_annotated_put_if <PUT_DATA > &put_if , |
| 39 | tlm_annotated_get_peek_if< GET_DATA > &get_peek_if ) : |
| 40 | tlm_put_get_imp<PUT_DATA,GET_DATA>( put_if , get_peek_if ) , |
| 41 | delayed_put_if( put_if ) , delayed_get_if( get_peek_if ) {} |
| 42 | |
| 43 | bool nb_put( const PUT_DATA &t , const sc_time &time ) { |
| 44 | return delayed_put_if.nb_put( t , time ); |
| 45 | } |
| 46 | |
| 47 | bool nb_can_put( const sc_time &time , tlm_tag<PUT_DATA> *t = 0 ) const { |
| 48 | return delayed_put_if.nb_can_put( time , t ); |
| 49 | } |
| 50 | |
| 51 | bool nb_get( GET_DATA &t , const sc_time &time ) { |
| 52 | return delayed_get_if.nb_get( t , time ); |
| 53 | } |
| 54 | |
| 55 | bool nb_can_get( const sc_time &time , tlm_tag<GET_DATA> *t = 0 ) const { |
| 56 | return delayed_get_if.nb_can_get( time , t ); |
| 57 | } |
| 58 | |
| 59 | |
| 60 | private: |
| 61 | tlm_annotated_nonblocking_put_if< PUT_DATA > &delayed_put_if; |
| 62 | tlm_annotated_nonblocking_get_if<GET_DATA> &delayed_get_if; |
| 63 | |
| 64 | }; |
| 65 | |
| 66 | template < typename REQ , typename RSP > |
| 67 | class tlm_annotated_master_imp : |
| 68 | private tlm_annotated_put_get_imp< REQ , RSP > , |
| 69 | public virtual tlm_annotated_master_if< REQ , RSP > |
| 70 | { |
| 71 | public: |
| 72 | |
| 73 | tlm_annotated_master_imp( tlm_annotated_put_if<REQ> &req , |
| 74 | tlm_annotated_get_peek_if<RSP> &rsp ) : |
| 75 | tlm_annotated_put_get_imp<REQ,RSP>( req , rsp ) {} |
| 76 | |
| 77 | }; |
| 78 | |
| 79 | template < typename REQ , typename RSP > |
| 80 | class tlm_annotated_slave_imp : |
| 81 | private tlm_annotated_put_get_imp< RSP , REQ > , |
| 82 | public virtual tlm_annotated_slave_if< REQ , RSP > |
| 83 | { |
| 84 | public: |
| 85 | |
| 86 | tlm_annotated_slave_imp( tlm_annotated_get_peek_if<REQ> &req , |
| 87 | tlm_annotated_put_if<RSP> &rsp ) : |
| 88 | tlm_annotated_put_get_imp<RSP,REQ>( rsp , req ) {} |
| 89 | |
| 90 | }; |
| 91 | |
| 92 | #endif |