Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / model / vendor / TLM-2006-11-29 / tlm / tlm_core / tlm_interfaces / tlm_core_ifs.h
CommitLineData
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
34template < typename REQ , typename RSP >
35class tlm_transport_if : public virtual sc_interface
36{
37public:
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
49template < typename T >
50class tlm_blocking_get_if : public virtual sc_interface
51{
52public:
53 virtual T get( tlm_tag<T> *t = 0 ) = 0;
54 virtual void get( T &t ) { t = get(); }
55
56};
57
58template < typename T >
59class tlm_blocking_put_if : public virtual sc_interface
60{
61public:
62 virtual void put( const T &t ) = 0;
63};
64
65// uni-directional non blocking interfaces
66
67template < typename T >
68class tlm_nonblocking_get_if : public virtual sc_interface
69{
70public:
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
76template < typename T >
77class tlm_nonblocking_put_if : public virtual sc_interface
78{
79public:
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
88template < typename T >
89class tlm_get_if :
90 public virtual tlm_blocking_get_if< T > ,
91 public virtual tlm_nonblocking_get_if< T > {};
92
93template < typename T >
94class 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
101template < typename T >
102class tlm_blocking_peek_if : public virtual sc_interface
103{
104public:
105 virtual T peek( tlm_tag<T> *t = 0 ) const = 0;
106 virtual void peek( T &t ) const { t = peek(); }
107
108};
109
110template < typename T >
111class tlm_nonblocking_peek_if : public virtual sc_interface
112{
113public:
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
119template < typename T >
120class 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
126template < typename T >
127class tlm_blocking_get_peek_if :
128 public virtual tlm_blocking_get_if<T> ,
129 public virtual tlm_blocking_peek_if<T> {};
130
131template < typename T >
132class tlm_nonblocking_get_peek_if :
133 public virtual tlm_nonblocking_get_if<T> ,
134 public virtual tlm_nonblocking_peek_if<T> {};
135
136
137template < typename T >
138class 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