gem5  v22.1.0.0
put_get_imp.hh
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 #ifndef \
21  __SYSTEMC_EXT_TLM_CORE_1_REQ_RSP_CHANNELS_REQ_RSP_CHANNELS_PUT_GET_IMP_HH__
22 #define \
23  __SYSTEMC_EXT_TLM_CORE_1_REQ_RSP_CHANNELS_REQ_RSP_CHANNELS_PUT_GET_IMP_HH__
24 
25 #include "../../interfaces/master_slave_ifs.hh"
26 
27 namespace tlm
28 {
29 
30 template <typename PUT_DATA, typename GET_DATA>
31 class tlm_put_get_imp : private virtual tlm_put_if<PUT_DATA>,
32  private virtual tlm_get_peek_if<GET_DATA>
33 {
34  public:
36  put_fifo(p), get_fifo(g)
37  {}
38 
39  // Put interface.
40  void put(const PUT_DATA &t) { put_fifo.put(t); }
41  bool nb_put(const PUT_DATA &t) { return put_fifo.nb_put(t); }
42  bool
43  nb_can_put(tlm_tag<PUT_DATA> *t=nullptr) const
44  {
45  return put_fifo.nb_can_put(t);
46  }
47  const sc_core::sc_event &
48  ok_to_put(tlm_tag<PUT_DATA> *t=nullptr) const
49  {
50  return put_fifo.ok_to_put(t);
51  }
52 
53  // Get interface.
54  GET_DATA get(tlm_tag<GET_DATA> * =nullptr) { return get_fifo.get(); }
55  bool nb_get(GET_DATA &t) { return get_fifo.nb_get(t); }
56  bool
57  nb_can_get(tlm_tag<GET_DATA> *t=nullptr) const
58  {
59  return get_fifo.nb_can_get(t);
60  }
61 
62  virtual const sc_core::sc_event &
63  ok_to_get(tlm_tag<GET_DATA> *t=nullptr) const
64  {
65  return get_fifo.ok_to_get(t);
66  }
67 
68  // Peek interface.
69  GET_DATA
70  peek(tlm_tag<GET_DATA> * =nullptr) const
71  {
72  return get_fifo.peek();
73  }
74  bool nb_peek(GET_DATA &t) const { return get_fifo.nb_peek(t); }
75  bool
77  {
78  return get_fifo.nb_can_peek(t);
79  }
80 
81  virtual const sc_core::sc_event &
82  ok_to_peek(tlm_tag<GET_DATA> *t=nullptr) const
83  {
84  return get_fifo.ok_to_peek(t);
85  }
86 
87  private:
90 };
91 
92 template <typename REQ, typename RSP>
93 class tlm_master_imp : private tlm_put_get_imp<REQ, RSP>,
94  public virtual tlm_master_if<REQ, RSP>
95 {
96  public:
98  tlm_put_get_imp<REQ, RSP>(req, rsp)
99  {}
100 };
101 
102 template <typename REQ, typename RSP>
103 class tlm_slave_imp : private tlm_put_get_imp<RSP, REQ>,
104  public virtual tlm_slave_if<REQ, RSP>
105 {
106  public:
108  tlm_put_get_imp<RSP, REQ>(rsp, req)
109  {}
110 };
111 
112 } // namespace tlm
113 
114 #endif
115 /*__SYSTEMC_EXT_TLM_CORE_1_REQ_RSP_CHANNELS_REQ_RSP_CHANNELS_PUT_GET_IMP_HH__*/
virtual T get(tlm_tag< T > *t=nullptr)=0
virtual T peek(tlm_tag< T > *t=nullptr) const =0
virtual void put(const T &t)=0
tlm_master_imp(tlm_put_if< REQ > &req, tlm_get_peek_if< RSP > &rsp)
Definition: put_get_imp.hh:97
virtual bool nb_get(T &t)=0
virtual bool nb_can_get(tlm_tag< T > *t=nullptr) const =0
virtual const sc_core::sc_event & ok_to_get(tlm_tag< T > *t=nullptr) const =0
virtual const sc_core::sc_event & ok_to_peek(tlm_tag< T > *t=nullptr) const =0
virtual bool nb_peek(T &t) const =0
virtual bool nb_can_peek(tlm_tag< T > *t=nullptr) const =0
virtual bool nb_put(const T &t)=0
virtual const sc_core::sc_event & ok_to_put(tlm_tag< T > *t=nullptr) const =0
virtual bool nb_can_put(tlm_tag< T > *t=nullptr) const =0
bool nb_can_put(tlm_tag< PUT_DATA > *t=nullptr) const
Definition: put_get_imp.hh:43
bool nb_can_get(tlm_tag< GET_DATA > *t=nullptr) const
Definition: put_get_imp.hh:57
tlm_get_peek_if< GET_DATA > & get_fifo
Definition: put_get_imp.hh:89
void put(const PUT_DATA &t)
Definition: put_get_imp.hh:40
bool nb_get(GET_DATA &t)
Definition: put_get_imp.hh:55
const sc_core::sc_event & ok_to_put(tlm_tag< PUT_DATA > *t=nullptr) const
Definition: put_get_imp.hh:48
bool nb_put(const PUT_DATA &t)
Definition: put_get_imp.hh:41
GET_DATA get(tlm_tag< GET_DATA > *=nullptr)
Definition: put_get_imp.hh:54
tlm_put_if< PUT_DATA > & put_fifo
Definition: put_get_imp.hh:88
tlm_put_get_imp(tlm_put_if< PUT_DATA > &p, tlm_get_peek_if< GET_DATA > &g)
Definition: put_get_imp.hh:35
virtual const sc_core::sc_event & ok_to_peek(tlm_tag< GET_DATA > *t=nullptr) const
Definition: put_get_imp.hh:82
GET_DATA peek(tlm_tag< GET_DATA > *=nullptr) const
Definition: put_get_imp.hh:70
bool nb_can_peek(tlm_tag< GET_DATA > *t=nullptr) const
Definition: put_get_imp.hh:76
virtual const sc_core::sc_event & ok_to_get(tlm_tag< GET_DATA > *t=nullptr) const
Definition: put_get_imp.hh:63
bool nb_peek(GET_DATA &t) const
Definition: put_get_imp.hh:74
tlm_slave_imp(tlm_get_peek_if< REQ > &req, tlm_put_if< RSP > &rsp)
Definition: put_get_imp.hh:107
Bitfield< 4 > g
Definition: dt_constants.hh:86
Bitfield< 51 > t
Definition: pagetable.hh:56
Bitfield< 54 > p
Definition: pagetable.hh:70

Generated on Wed Dec 21 2022 10:22:42 for gem5 by doxygen 1.9.1