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 | #ifndef TLM_NONBLOCKING_PORT_HEADER | |
20 | #define TLM_NONBLOCKING_PORT_HEADER | |
21 | ||
22 | #include "tlm_core/tlm_interfaces/tlm_core_ifs.h" | |
23 | #include "tlm_core/tlm_event_finder/tlm_event_finder.h" | |
24 | ||
25 | template < typename T > | |
26 | class tlm_nonblocking_get_port : | |
27 | public sc_port< tlm_nonblocking_get_if< T > , 1 > | |
28 | { | |
29 | public: | |
30 | typedef tlm_nonblocking_get_if<T> get_if_type; | |
31 | ||
32 | tlm_nonblocking_get_port( const char *port_name ) : | |
33 | sc_port< tlm_nonblocking_get_if< T > , 1 >( port_name ) {} | |
34 | ||
35 | sc_event_finder& ok_to_get() const { | |
36 | ||
37 | return *new tlm_event_finder_t< get_if_type , T >( | |
38 | *this, | |
39 | &get_if_type::ok_to_get ); | |
40 | ||
41 | } | |
42 | ||
43 | }; | |
44 | ||
45 | template < typename T > | |
46 | class tlm_nonblocking_peek_port : | |
47 | public sc_port< tlm_nonblocking_peek_if< T > , 1 > | |
48 | { | |
49 | public: | |
50 | typedef tlm_nonblocking_peek_if<T> peek_if_type; | |
51 | ||
52 | tlm_nonblocking_peek_port( const char *port_name ) : | |
53 | sc_port< tlm_nonblocking_peek_if< T > , 1 >( port_name ) {} | |
54 | ||
55 | sc_event_finder& ok_to_peek() const { | |
56 | ||
57 | return *new tlm_event_finder_t< peek_if_type , T >( | |
58 | *this, | |
59 | &peek_if_type::ok_to_peek ); | |
60 | ||
61 | } | |
62 | ||
63 | }; | |
64 | ||
65 | ||
66 | template < typename T > | |
67 | class tlm_nonblocking_put_port : | |
68 | public sc_port< tlm_nonblocking_put_if< T > , 1 > | |
69 | { | |
70 | public: | |
71 | typedef tlm_nonblocking_put_if<T> put_if_type; | |
72 | ||
73 | tlm_nonblocking_put_port( const char *port_name ) : | |
74 | sc_port< tlm_nonblocking_put_if< T > , 1 >( port_name ) {} | |
75 | ||
76 | sc_event_finder& ok_to_put() const { | |
77 | ||
78 | return *new tlm_event_finder_t< put_if_type , T >( | |
79 | *this, | |
80 | &put_if_type::ok_to_put ); | |
81 | ||
82 | } | |
83 | ||
84 | }; | |
85 | #endif |