TLM-2.0  2.0.4
Accellera TLM-2.0 proof-of-concept library
tlm_req_rsp_channels.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4  more contributor license agreements. See the NOTICE file distributed
5  with this work for additional information regarding copyright ownership.
6  Accellera licenses this file to you under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with the
8  License. You may obtain a copy of the License at
9 
10  http://www.apache.org/licenses/LICENSE-2.0
11 
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15  implied. See the License for the specific language governing
16  permissions and limitations under the License.
17 
18  *****************************************************************************/
19 
20 #ifndef __TLM_REQ_RSP_CHANNELS_H__
21 #define __TLM_REQ_RSP_CHANNELS_H__
22 
26 
27 namespace tlm {
28 
29 template < typename REQ , typename RSP ,
30  typename REQ_CHANNEL = tlm_fifo<REQ> ,
31  typename RSP_CHANNEL = tlm_fifo<RSP> >
32 
34 {
35 public:
36  // uni-directional slave interface
37 
40 
41  // uni-directional master interface
42 
45 
46  // master / slave interfaces
47 
50 
51 
52  tlm_req_rsp_channel( int req_size = 1 , int rsp_size = 1 ) :
53  sc_core::sc_module( sc_core::sc_module_name( sc_core::sc_gen_unique_name("tlm_req_rsp_channel") ) ) ,
54  request_fifo( req_size ) ,
55  response_fifo( rsp_size ) ,
58  {
59 
60  bind_exports();
61 
62  }
63 
65  int req_size = 1 , int rsp_size = 1 ) :
66  sc_core::sc_module( module_name ) ,
67  request_fifo( req_size ) ,
68  response_fifo( rsp_size ) ,
71  {
72 
73  bind_exports();
74 
75  }
76 
77 private:
78  void bind_exports() {
79 
82 
85 
88 
89  }
90 
91 protected:
92  REQ_CHANNEL request_fifo;
93  RSP_CHANNEL response_fifo;
94 
97 };
98 
99 template < typename REQ , typename RSP ,
100  typename REQ_CHANNEL = tlm_fifo<REQ> ,
101  typename RSP_CHANNEL = tlm_fifo<RSP> >
103 {
104 public:
105 
106  // master transport interface
107 
109 
110  // slave interfaces
111 
114 
116 
118  sc_core::sc_module( sc_core::sc_module_name( sc_core::sc_gen_unique_name("transport_channel" ) ) ) ,
119  target_export("target_export") ,
120  req_rsp( "req_rsp" , 1 , 1 ) ,
121  t2m("ts2m")
122  {
123  do_binding();
124  }
125 
127  sc_core::sc_module( nm ) ,
128  target_export("target_export") ,
129  req_rsp( "req_rsp" , 1 , 1 ) ,
130  t2m("tsm" )
131  {
132  do_binding();
133  }
134 
135 private:
136  void do_binding() {
137 
138  target_export( t2m.target_export );
139 
140  t2m.master_port( req_rsp.master_export );
141 
142  get_request_export( req_rsp.get_request_export );
143  put_response_export( req_rsp.put_response_export );
144  slave_export( req_rsp.slave_export );
145 
146  }
147 
150 
151 };
152 
153 } // namespace tlm
154 
155 #endif
tlm_req_rsp_channel(int req_size=1, int rsp_size=1)
tlm_transport_channel(sc_core::sc_module_name nm)
sc_core::sc_export< tlm_fifo_put_if< RSP > > put_response_export
sc_core::sc_export< tlm_transport_if< REQ, RSP > > target_export
sc_core::sc_export< tlm_fifo_put_if< RSP > > put_response_export
sc_core::sc_export< tlm_fifo_get_if< REQ > > get_request_export
sc_core::sc_export< tlm_slave_if< REQ, RSP > > slave_export
tlm_slave_imp< REQ, RSP > slave
sc_core::sc_export< tlm_fifo_get_if< RSP > > get_response_export
sc_core::sc_export< tlm_fifo_get_if< REQ > > get_request_export
friend friend class sc_module_name
tlm_master_imp< REQ, RSP > master
SC_API const char * sc_gen_unique_name(const char *, bool preserve_first)
sc_core::sc_export< tlm_master_if< REQ, RSP > > master_export
tlm_req_rsp_channel(sc_core::sc_module_name module_name, int req_size=1, int rsp_size=1)
sc_core::sc_export< tlm_slave_if< REQ, RSP > > slave_export
sc_core::sc_export< tlm_fifo_put_if< REQ > > put_request_export