gem5  v20.1.0.0
core_ifs.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 __SYSTEMC_EXT_TLM_CORE_1_REQ_RSP_INTERFACES_CORE_IFS_HH__
21 #define __SYSTEMC_EXT_TLM_CORE_1_REQ_RSP_INTERFACES_CORE_IFS_HH__
22 
23 #include "tag.hh"
24 
25 namespace tlm
26 {
27 
28 // Bidirectional blocking interfaces.
29 template <typename REQ, typename RSP>
30 class tlm_transport_if : public virtual sc_core::sc_interface
31 {
32  public:
33  virtual RSP transport(const REQ &) = 0;
34 
35  virtual void
36  transport(const REQ &req, RSP &rsp)
37  {
38  rsp = transport(req);
39  }
40 };
41 
42 // Uni-directional blocking interfaces.
43 template <typename T>
44 class tlm_blocking_get_if : public virtual sc_core::sc_interface
45 {
46  public:
47  virtual T get(tlm_tag<T> *t=nullptr) = 0;
48  virtual void get(T &t) { t = get(); }
49 };
50 
51 template <typename T>
52 class tlm_blocking_put_if : public virtual sc_core::sc_interface
53 {
54  public:
55  virtual void put(const T &t) = 0;
56 };
57 
58 // Uni-directional non blocking interfaces.
59 
60 template <typename T>
62 {
63  public:
64  virtual bool nb_get(T &t) = 0;
65  virtual bool nb_can_get(tlm_tag<T> *t=nullptr) const = 0;
66  virtual const sc_core::sc_event &
67  ok_to_get(tlm_tag<T> *t=nullptr) const = 0;
68 };
69 
70 template <typename T>
71 class tlm_nonblocking_put_if : public virtual sc_core::sc_interface
72 {
73  public:
74  virtual bool nb_put(const T &t) = 0;
75  virtual bool nb_can_put(tlm_tag<T> *t=nullptr) const = 0;
76  virtual const sc_core::sc_event &
77  ok_to_put(tlm_tag<T> *t=nullptr) const = 0;
78 };
79 
80 // Combined uni-directional blocking and non blocking.
81 template <typename T>
82 class tlm_get_if : public virtual tlm_blocking_get_if<T>,
83  public virtual tlm_nonblocking_get_if<T>
84 {};
85 
86 template <typename T>
87 class tlm_put_if : public virtual tlm_blocking_put_if<T>,
88  public virtual tlm_nonblocking_put_if<T>
89 {};
90 
91 // Peek interfaces.
92 template <typename T>
93 class tlm_blocking_peek_if : public virtual sc_core::sc_interface
94 {
95  public:
96  virtual T peek(tlm_tag<T> *t=nullptr) const = 0;
97  virtual void peek(T &t) const { t = peek(); }
98 };
99 
100 template <typename T>
101 class tlm_nonblocking_peek_if : public virtual sc_core::sc_interface
102 {
103  public:
104  virtual bool nb_peek(T &t) const = 0;
105  virtual bool nb_can_peek(tlm_tag<T> *t=nullptr) const = 0;
106  virtual const sc_core::sc_event &
107  ok_to_peek(tlm_tag<T> *t=nullptr) const = 0;
108 };
109 
110 template <typename T>
111 class tlm_peek_if :
112  public virtual tlm_blocking_peek_if<T>,
113  public virtual tlm_nonblocking_peek_if<T>
114 {};
115 
116 // Get_peek interfaces.
117 template <typename T>
119  public virtual tlm_blocking_peek_if<T>
120 {};
121 
122 template <typename T>
123 class tlm_nonblocking_get_peek_if : public virtual tlm_nonblocking_get_if<T>,
124  public virtual tlm_nonblocking_peek_if<T>
125 {};
126 
127 template <typename T>
128 class tlm_get_peek_if : public virtual tlm_get_if<T>,
129  public virtual tlm_peek_if<T>, public virtual tlm_blocking_get_peek_if<T>,
130  public virtual tlm_nonblocking_get_peek_if<T>
131 {};
132 
133 } // namespace tlm
134 
135 #endif /* __SYSTEMC_EXT_TLM_CORE_1_REQ_RSP_INTERFACES_CORE_IFS_HH__ */
tlm::tlm_peek_if
Definition: core_ifs.hh:128
tlm::tlm_blocking_peek_if
Definition: core_ifs.hh:110
tlm::tlm_get_peek_if
Definition: core_ifs.hh:145
tlm::tlm_blocking_put_if::put
virtual void put(const T &t)=0
tlm::tlm_blocking_get_if::get
virtual T get(tlm_tag< T > *t=nullptr)=0
tlm::tlm_nonblocking_peek_if::nb_peek
virtual bool nb_peek(T &t) const =0
sc_core::sc_interface
Definition: sc_interface.hh:37
tlm::tlm_nonblocking_put_if::ok_to_put
virtual const sc_core::sc_event & ok_to_put(tlm_tag< T > *t=nullptr) const =0
tlm::tlm_nonblocking_peek_if
Definition: core_ifs.hh:118
tlm::tlm_nonblocking_put_if::nb_can_put
virtual bool nb_can_put(tlm_tag< T > *t=nullptr) const =0
tlm::tlm_nonblocking_get_if::ok_to_get
virtual const sc_core::sc_event & ok_to_get(tlm_tag< T > *t=nullptr) const =0
tlm::tlm_nonblocking_get_if::nb_get
virtual bool nb_get(T &t)=0
tlm::tlm_tag
Definition: tag.hh:44
tlm::tlm_nonblocking_get_if::nb_can_get
virtual bool nb_can_get(tlm_tag< T > *t=nullptr) const =0
sc_core::sc_event
Definition: sc_event.hh:169
tlm::tlm_nonblocking_put_if::nb_put
virtual bool nb_put(const T &t)=0
tlm::tlm_blocking_get_peek_if
Definition: core_ifs.hh:135
tlm::tlm_blocking_peek_if::peek
virtual T peek(tlm_tag< T > *t=nullptr) const =0
tlm
Definition: analysis_fifo.hh:27
tlm::tlm_nonblocking_get_peek_if
Definition: core_ifs.hh:140
tlm::tlm_blocking_get_if
Definition: core_ifs.hh:61
tlm::tlm_nonblocking_peek_if::nb_can_peek
virtual bool nb_can_peek(tlm_tag< T > *t=nullptr) const =0
tlm::tlm_get_if
Definition: core_ifs.hh:99
tlm::tlm_nonblocking_get_if
Definition: core_ifs.hh:78
tag.hh
ArmISA::t
Bitfield< 5 > t
Definition: miscregs_types.hh:67
tlm::tlm_transport_if::transport
virtual RSP transport(const REQ &)=0
tlm::tlm_nonblocking_peek_if::ok_to_peek
virtual const sc_core::sc_event & ok_to_peek(tlm_tag< T > *t=nullptr) const =0
tlm::tlm_nonblocking_put_if
Definition: core_ifs.hh:88

Generated on Wed Sep 30 2020 14:02:16 for gem5 by doxygen 1.8.17