TLM-2.0  2.0.4
Accellera TLM-2.0 proof-of-concept library
tlm_put_get_imp.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4  more contributor license agreements. See the NOTICE file distributed
5  with this work for additional information regarding copyright ownership.
6  Accellera licenses this file to you under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with the
8  License. You may obtain a copy of the License at
9 
10  http://www.apache.org/licenses/LICENSE-2.0
11 
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15  implied. See the License for the specific language governing
16  permissions and limitations under the License.
17 
18  *****************************************************************************/
19 
20 //
21 // To the LRM writer : these classes are purely artifacts of the implementation.
22 //
23 
24 #ifndef __TLM_PUT_GET_IMP_H__
25 #define __TLM_PUT_GET_IMP_H__
26 
28 
29 namespace tlm {
30 
31 template < typename PUT_DATA , typename GET_DATA>
33  private virtual tlm_put_if< PUT_DATA > ,
34  private virtual tlm_get_peek_if< GET_DATA >
35 {
36 public:
39  put_fifo( p ) , get_fifo( g ) {}
40 
41  // put interface
42 
43  void put( const PUT_DATA &t ) { put_fifo.put( t ); }
44 
45  bool nb_put( const PUT_DATA &t ) { return put_fifo.nb_put( t ); }
46  bool nb_can_put( tlm_tag<PUT_DATA> *t = 0 ) const {
47  return put_fifo.nb_can_put( t );
48  }
50  return put_fifo.ok_to_put( t );
51  }
52 
53  // get interface
54 
55  GET_DATA get( tlm_tag<GET_DATA> * = 0 ) { return get_fifo.get(); }
56 
57  bool nb_get( GET_DATA &t ) { return get_fifo.nb_get( t ); }
58 
59  bool nb_can_get( tlm_tag<GET_DATA> *t = 0 ) const {
60  return get_fifo.nb_can_get( t );
61  }
62 
63  virtual const sc_core::sc_event &ok_to_get( tlm_tag<GET_DATA> *t = 0 ) const {
64  return get_fifo.ok_to_get( t );
65  }
66 
67  // peek interface
68 
69  GET_DATA peek( tlm_tag<GET_DATA> * = 0 ) const { return get_fifo.peek(); }
70 
71  bool nb_peek( GET_DATA &t ) const { return get_fifo.nb_peek( t ); }
72 
73  bool nb_can_peek( tlm_tag<GET_DATA> *t = 0 ) const {
74  return get_fifo.nb_can_peek( t );
75  }
76 
77  virtual const sc_core::sc_event &ok_to_peek( tlm_tag<GET_DATA> *t = 0 ) const {
78  return get_fifo.ok_to_peek( t );
79  }
80 
81 private:
82  tlm_put_if<PUT_DATA> &put_fifo;
83  tlm_get_peek_if<GET_DATA> &get_fifo;
84 };
85 
86 template < typename REQ , typename RSP >
88  private tlm_put_get_imp< REQ , RSP > ,
89  public virtual tlm_master_if< REQ , RSP >
90 {
91 public:
92 
94  tlm_get_peek_if<RSP> &rsp ) :
95  tlm_put_get_imp<REQ,RSP>( req , rsp ) {}
96 
97 };
98 
99 template < typename REQ , typename RSP >
101  private tlm_put_get_imp< RSP , REQ > ,
102  public virtual tlm_slave_if< REQ , RSP >
103 {
104 public:
105 
107  tlm_put_if<RSP> &rsp ) :
108  tlm_put_get_imp<RSP,REQ>( rsp , req ) {}
109 
110 };
111 
112 } // namespace tlm
113 
114 #endif
GET_DATA peek(tlm_tag< GET_DATA > *=0) const
virtual bool nb_put(const T &t)=0
virtual void put(const T &t)=0
bool nb_can_get(tlm_tag< GET_DATA > *t=0) const
virtual const sc_core::sc_event & ok_to_put(tlm_tag< T > *t=0) const =0
virtual bool nb_can_peek(tlm_tag< T > *t=0) const =0
virtual bool nb_can_get(tlm_tag< T > *t=0) const =0
const sc_core::sc_event & ok_to_put(tlm_tag< PUT_DATA > *t=0) const
void put(const PUT_DATA &t)
bool nb_get(GET_DATA &t)
virtual T get(tlm_tag< T > *t=0)=0
bool nb_peek(GET_DATA &t) const
bool nb_put(const PUT_DATA &t)
bool nb_can_put(tlm_tag< PUT_DATA > *t=0) const
virtual const sc_core::sc_event & ok_to_get(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_can_put(tlm_tag< T > *t=0) const =0
virtual const sc_core::sc_event & ok_to_peek(tlm_tag< GET_DATA > *t=0) const
tlm_slave_imp(tlm_get_peek_if< REQ > &req, tlm_put_if< RSP > &rsp)
virtual bool nb_peek(T &t) const =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
virtual bool nb_get(T &t)=0
tlm_master_imp(tlm_put_if< REQ > &req, tlm_get_peek_if< RSP > &rsp)
virtual T peek(tlm_tag< T > *t=0) const =0
tlm_put_get_imp(tlm_put_if< PUT_DATA > &p, tlm_get_peek_if< GET_DATA > &g)