TLM-2.0  2.0.3
Accellera TLM-2.0 proof-of-concept library
tlm_core_ifs.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 // Note to the LRM writer : This is the core of the TLM standard
20 //
21 
22 
23 #ifndef __TLM_CORE_IFS_H__
24 #define __TLM_CORE_IFS_H__
25 
26 //#include <systemc>
27 
29 
30 namespace tlm {
31 
32 // bidirectional blocking interfaces
33 
34 template < typename REQ , typename RSP >
36 {
37 public:
38  virtual RSP transport( const REQ & ) = 0;
39 
40  virtual void transport( const REQ &req , RSP &rsp ) {
41  rsp = transport( req );
42  }
43 
44 };
45 
46 
47 // uni-directional blocking interfaces
48 
49 template < typename T >
51 {
52 public:
53  virtual T get( tlm_tag<T> *t = 0 ) = 0;
54  virtual void get( T &t ) { t = get(); }
55 
56 };
57 
58 template < typename T >
60 {
61 public:
62  virtual void put( const T &t ) = 0;
63 };
64 
65 // uni-directional non blocking interfaces
66 
67 template < typename T >
69 {
70 public:
71  virtual bool nb_get( T &t ) = 0;
72  virtual bool nb_can_get( tlm_tag<T> *t = 0 ) const = 0;
73  virtual const sc_core::sc_event &ok_to_get( tlm_tag<T> *t = 0 ) const = 0;
74 };
75 
76 template < typename T >
78 {
79 public:
80  virtual bool nb_put( const T &t ) = 0;
81  virtual bool nb_can_put( tlm_tag<T> *t = 0 ) const = 0;
82  virtual const sc_core::sc_event &ok_to_put( tlm_tag<T> *t = 0 ) const = 0;
83 };
84 
85 
86 // combined uni-directional blocking and non blocking
87 
88 template < typename T >
89 class tlm_get_if :
90  public virtual tlm_blocking_get_if< T > ,
91  public virtual tlm_nonblocking_get_if< T > {};
92 
93 template < typename T >
94 class tlm_put_if :
95  public virtual tlm_blocking_put_if< T > ,
96  public virtual tlm_nonblocking_put_if< T > {};
97 
98 
99 // peek interfaces
100 
101 template < typename T >
103 {
104 public:
105  virtual T peek( tlm_tag<T> *t = 0 ) const = 0;
106  virtual void peek( T &t ) const { t = peek(); }
107 
108 };
109 
110 template < typename T >
112 {
113 public:
114  virtual bool nb_peek( T &t ) const = 0;
115  virtual bool nb_can_peek( tlm_tag<T> *t = 0 ) const = 0;
116  virtual const sc_core::sc_event &ok_to_peek( tlm_tag<T> *t = 0 ) const = 0;
117 };
118 
119 template < typename T >
120 class tlm_peek_if :
121  public virtual tlm_blocking_peek_if< T > ,
122  public virtual tlm_nonblocking_peek_if< T > {};
123 
124 // get_peek interfaces
125 
126 template < typename T >
128  public virtual tlm_blocking_get_if<T> ,
129  public virtual tlm_blocking_peek_if<T> {};
130 
131 template < typename T >
133  public virtual tlm_nonblocking_get_if<T> ,
134  public virtual tlm_nonblocking_peek_if<T> {};
135 
136 
137 template < typename T >
139  public virtual tlm_get_if<T> ,
140  public virtual tlm_peek_if<T> ,
141  public virtual tlm_blocking_get_peek_if<T> ,
142  public virtual tlm_nonblocking_get_peek_if<T>
143  {};
144 
145 } // namespace tlm
146 
147 #endif
virtual T peek(tlm_tag< T > *t=0) const =0
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
virtual bool nb_put(const T &t)=0
virtual void peek(T &t) const
Definition: tlm_core_ifs.h:106
virtual bool nb_get(T &t)=0
virtual bool nb_can_peek(tlm_tag< T > *t=0) const =0
virtual void put(const T &t)=0
virtual RSP transport(const REQ &)=0
virtual const sc_core::sc_event & ok_to_put(tlm_tag< T > *t=0) const =0
virtual bool nb_peek(T &t) const =0
virtual void transport(const REQ &req, RSP &rsp)
Definition: tlm_core_ifs.h:40
virtual const sc_core::sc_event & ok_to_peek(tlm_tag< T > *t=0) const =0