TLM-2.0  2.0.3
Accellera TLM-2.0 proof-of-concept library
tlm_put_get_imp.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  The following code is derived, directly or indirectly, from the SystemC
4  source code Copyright (c) 1996-2014 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 (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.accellera.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 // To the LRM writer : these classes are purely artifacts of the implementation.
20 //
21 
22 #ifndef __TLM_PUT_GET_IMP_H__
23 #define __TLM_PUT_GET_IMP_H__
24 
26 
27 namespace tlm {
28 
29 template < typename PUT_DATA , typename GET_DATA>
31  private virtual tlm_put_if< PUT_DATA > ,
32  private virtual tlm_get_peek_if< GET_DATA >
33 {
34 public:
37  put_fifo( p ) , get_fifo( g ) {}
38 
39  // put interface
40 
41  void put( const PUT_DATA &t ) { put_fifo.put( t ); }
42 
43  bool nb_put( const PUT_DATA &t ) { return put_fifo.nb_put( t ); }
44  bool nb_can_put( tlm_tag<PUT_DATA> *t = 0 ) const {
45  return put_fifo.nb_can_put( t );
46  }
48  return put_fifo.ok_to_put( t );
49  }
50 
51  // get interface
52 
53  GET_DATA get( tlm_tag<GET_DATA> * = 0 ) { return get_fifo.get(); }
54 
55  bool nb_get( GET_DATA &t ) { return get_fifo.nb_get( t ); }
56 
57  bool nb_can_get( tlm_tag<GET_DATA> *t = 0 ) const {
58  return get_fifo.nb_can_get( t );
59  }
60 
61  virtual const sc_core::sc_event &ok_to_get( tlm_tag<GET_DATA> *t = 0 ) const {
62  return get_fifo.ok_to_get( t );
63  }
64 
65  // peek interface
66 
67  GET_DATA peek( tlm_tag<GET_DATA> * = 0 ) const { return get_fifo.peek(); }
68 
69  bool nb_peek( GET_DATA &t ) const { return get_fifo.nb_peek( t ); }
70 
71  bool nb_can_peek( tlm_tag<GET_DATA> *t = 0 ) const {
72  return get_fifo.nb_can_peek( t );
73  }
74 
75  virtual const sc_core::sc_event &ok_to_peek( tlm_tag<GET_DATA> *t = 0 ) const {
76  return get_fifo.ok_to_peek( t );
77  }
78 
79 private:
80  tlm_put_if<PUT_DATA> &put_fifo;
81  tlm_get_peek_if<GET_DATA> &get_fifo;
82 };
83 
84 template < typename REQ , typename RSP >
86  private tlm_put_get_imp< REQ , RSP > ,
87  public virtual tlm_master_if< REQ , RSP >
88 {
89 public:
90 
92  tlm_get_peek_if<RSP> &rsp ) :
93  tlm_put_get_imp<REQ,RSP>( req , rsp ) {}
94 
95 };
96 
97 template < typename REQ , typename RSP >
99  private tlm_put_get_imp< RSP , REQ > ,
100  public virtual tlm_slave_if< REQ , RSP >
101 {
102 public:
103 
105  tlm_put_if<RSP> &rsp ) :
106  tlm_put_get_imp<RSP,REQ>( rsp , req ) {}
107 
108 };
109 
110 } // namespace tlm
111 
112 #endif
const sc_core::sc_event & ok_to_put(tlm_tag< PUT_DATA > *t=0) const
virtual T peek(tlm_tag< T > *t=0) const =0
bool nb_can_put(tlm_tag< PUT_DATA > *t=0) const
virtual const sc_core::sc_event & ok_to_peek(tlm_tag< GET_DATA > *t=0) const
virtual const sc_core::sc_event & ok_to_get(tlm_tag< T > *t=0) const =0
virtual bool nb_can_put(tlm_tag< T > *t=0) const =0
virtual bool nb_can_get(tlm_tag< T > *t=0) const =0
bool nb_get(GET_DATA &t)
virtual bool nb_put(const T &t)=0
GET_DATA peek(tlm_tag< GET_DATA > *=0) const
virtual bool nb_get(T &t)=0
virtual bool nb_can_peek(tlm_tag< T > *t=0) const =0
tlm_slave_imp(tlm_get_peek_if< REQ > &req, tlm_put_if< RSP > &rsp)
bool nb_peek(GET_DATA &t) const
tlm_put_get_imp(tlm_put_if< PUT_DATA > &p, tlm_get_peek_if< GET_DATA > &g)
virtual void put(const T &t)=0
virtual const sc_core::sc_event & ok_to_put(tlm_tag< T > *t=0) const =0
virtual const sc_core::sc_event & ok_to_get(tlm_tag< GET_DATA > *t=0) const
virtual bool nb_peek(T &t) const =0
void put(const PUT_DATA &t)
virtual T get(tlm_tag< T > *t=0)=0
bool nb_can_peek(tlm_tag< GET_DATA > *t=0) const
virtual const sc_core::sc_event & ok_to_peek(tlm_tag< T > *t=0) const =0
bool nb_put(const PUT_DATA &t)
tlm_master_imp(tlm_put_if< REQ > &req, tlm_get_peek_if< RSP > &rsp)
bool nb_can_get(tlm_tag< GET_DATA > *t=0) const