Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | |
2 | /***************************************************************************** | |
3 | ||
4 | The following code is derived, directly or indirectly, from the SystemC | |
5 | source code Copyright (c) 1996-2004 by all Contributors. | |
6 | All Rights reserved. | |
7 | ||
8 | The contents of this file are subject to the restrictions and limitations | |
9 | set forth in the SystemC Open Source License Version 2.4 (the "License"); | |
10 | You may not use this file except in compliance with such restrictions and | |
11 | limitations. You may obtain instructions on how to receive a copy of the | |
12 | License at http://www.systemc.org/. Software distributed by Contributors | |
13 | under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF | |
14 | ANY KIND, either express or implied. See the License for the specific | |
15 | language governing rights and limitations under the License. | |
16 | ||
17 | *****************************************************************************/ | |
18 | ||
19 | // | |
20 | // Note to the LRM writer : This is the core of the TLM standard | |
21 | // | |
22 | ||
23 | ||
24 | #ifndef TLM_CORE_IFS_HEADER | |
25 | #define TLM_CORE_IFS_HEADER | |
26 | ||
27 | #include <systemc.h> | |
28 | ||
29 | #include "tlm_core/tlm_interfaces/tlm_tag.h" | |
30 | ||
31 | ||
32 | // bidirectional blocking interfaces | |
33 | ||
34 | template < typename REQ , typename RSP > | |
35 | class tlm_transport_if : public virtual sc_interface | |
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 > | |
50 | class tlm_blocking_get_if : public virtual sc_interface | |
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 > | |
59 | class tlm_blocking_put_if : public virtual sc_interface | |
60 | { | |
61 | public: | |
62 | virtual void put( const T &t ) = 0; | |
63 | }; | |
64 | ||
65 | // uni-directional non blocking interfaces | |
66 | ||
67 | template < typename T > | |
68 | class tlm_nonblocking_get_if : public virtual sc_interface | |
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_event &ok_to_get( tlm_tag<T> *t = 0 ) const = 0; | |
74 | }; | |
75 | ||
76 | template < typename T > | |
77 | class tlm_nonblocking_put_if : public virtual sc_interface | |
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_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 > | |
102 | class tlm_blocking_peek_if : public virtual sc_interface | |
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 > | |
111 | class tlm_nonblocking_peek_if : public virtual sc_interface | |
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_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 > | |
127 | class tlm_blocking_get_peek_if : | |
128 | public virtual tlm_blocking_get_if<T> , | |
129 | public virtual tlm_blocking_peek_if<T> {}; | |
130 | ||
131 | template < typename T > | |
132 | class tlm_nonblocking_get_peek_if : | |
133 | public virtual tlm_nonblocking_get_if<T> , | |
134 | public virtual tlm_nonblocking_peek_if<T> {}; | |
135 | ||
136 | ||
137 | template < typename T > | |
138 | class tlm_get_peek_if : | |
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 | ||
146 | #endif |