gem5  v22.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>
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>
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>
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>
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>
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>
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>
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__ */
virtual void get(T &t)
Definition: core_ifs.hh:48
virtual T get(tlm_tag< T > *t=nullptr)=0
virtual T peek(tlm_tag< T > *t=nullptr) const =0
virtual void peek(T &t) const
Definition: core_ifs.hh:97
virtual void put(const T &t)=0
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
virtual RSP transport(const REQ &)=0
virtual void transport(const REQ &req, RSP &rsp)
Definition: core_ifs.hh:36
Bitfield< 51 > t
Definition: pagetable.hh:56

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