TLM-2.0  2.0.3
Accellera TLM-2.0 proof-of-concept library
tlm_req_rsp_channels.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 #ifndef __TLM_REQ_RSP_CHANNELS_H__
19 #define __TLM_REQ_RSP_CHANNELS_H__
20 
24 
25 namespace tlm {
26 
27 template < typename REQ , typename RSP ,
28  typename REQ_CHANNEL = tlm_fifo<REQ> ,
29  typename RSP_CHANNEL = tlm_fifo<RSP> >
30 
32 {
33 public:
34  // uni-directional slave interface
35 
38 
39  // uni-directional master interface
40 
43 
44  // master / slave interfaces
45 
48 
49 
50  tlm_req_rsp_channel( int req_size = 1 , int rsp_size = 1 ) :
51  sc_core::sc_module( sc_core::sc_module_name( sc_core::sc_gen_unique_name("tlm_req_rsp_channel") ) ) ,
52  request_fifo( req_size ) ,
53  response_fifo( rsp_size ) ,
56  {
57 
58  bind_exports();
59 
60  }
61 
63  int req_size = 1 , int rsp_size = 1 ) :
64  sc_core::sc_module( module_name ) ,
65  request_fifo( req_size ) ,
66  response_fifo( rsp_size ) ,
69  {
70 
71  bind_exports();
72 
73  }
74 
75 private:
76  void bind_exports() {
77 
80 
83 
86 
87  }
88 
89 protected:
90  REQ_CHANNEL request_fifo;
91  RSP_CHANNEL response_fifo;
92 
95 };
96 
97 template < typename REQ , typename RSP ,
98  typename REQ_CHANNEL = tlm_fifo<REQ> ,
99  typename RSP_CHANNEL = tlm_fifo<RSP> >
101 {
102 public:
103 
104  // master transport interface
105 
107 
108  // slave interfaces
109 
112 
114 
116  sc_core::sc_module( sc_core::sc_module_name( sc_core::sc_gen_unique_name("transport_channel" ) ) ) ,
117  target_export("target_export") ,
118  req_rsp( "req_rsp" , 1 , 1 ) ,
119  t2m("ts2m")
120  {
121  do_binding();
122  }
123 
125  sc_core::sc_module( nm ) ,
126  target_export("target_export") ,
127  req_rsp( "req_rsp" , 1 , 1 ) ,
128  t2m("tsm" )
129  {
130  do_binding();
131  }
132 
133 private:
134  void do_binding() {
135 
136  target_export( t2m.target_export );
137 
138  t2m.master_port( req_rsp.master_export );
139 
140  get_request_export( req_rsp.get_request_export );
141  put_response_export( req_rsp.put_response_export );
142  slave_export( req_rsp.slave_export );
143 
144  }
145 
146  tlm_req_rsp_channel< REQ , RSP , REQ_CHANNEL , RSP_CHANNEL > req_rsp;
147  tlm_transport_to_master< REQ , RSP > t2m;
148 
149 };
150 
151 } // namespace tlm
152 
153 #endif
tlm_slave_imp< REQ, RSP > slave
sc_core::sc_export< tlm_fifo_put_if< RSP > > put_response_export
sc_core::sc_export< tlm_transport_if< REQ, RSP > > target_export
tlm_req_rsp_channel(sc_core::sc_module_name module_name, int req_size=1, int rsp_size=1)
const char * sc_gen_unique_name(const char *, bool preserve_first)
sc_core::sc_export< tlm_fifo_put_if< REQ > > put_request_export
tlm_transport_channel(sc_core::sc_module_name nm)
tlm_req_rsp_channel(int req_size=1, int rsp_size=1)
tlm_master_imp< REQ, RSP > master
sc_core::sc_export< tlm_master_if< REQ, RSP > > master_export
sc_core::sc_export< tlm_fifo_get_if< REQ > > get_request_export
sc_core::sc_export< tlm_fifo_get_if< RSP > > get_response_export
sc_core::sc_export< tlm_fifo_get_if< REQ > > get_request_export
sc_core::sc_export< tlm_fifo_put_if< RSP > > put_response_export
friend friend class sc_module
sc_core::sc_export< tlm_slave_if< REQ, RSP > > slave_export
friend friend class sc_module_name
sc_core::sc_export< tlm_slave_if< REQ, RSP > > slave_export