Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | |
2 | #ifndef TLM_ANNOTATED_REQ_RSP_HEADER | |
3 | #define TLM_ANNOTATED_REQ_RSP_HEADER | |
4 | ||
5 | #include "tlm_annotated/tlm_annotated_channels/tlm_annotated_fifo.h" | |
6 | #include "tlm_annotated/tlm_annotated_channels/tlm_annotated_put_get_imp.h" | |
7 | ||
8 | ||
9 | template < typename REQ , typename RSP , | |
10 | typename REQ_CHANNEL = tlm_annotated_fifo<REQ> , | |
11 | typename RSP_CHANNEL = tlm_annotated_fifo<RSP> > | |
12 | class tlm_annotated_req_rsp_channel : public sc_module | |
13 | { | |
14 | public: | |
15 | // uni-directional slave interface | |
16 | ||
17 | sc_export< tlm_annotated_get_peek_if< REQ > > get_request_export; | |
18 | sc_export< tlm_annotated_put_if< RSP > > put_response_export; | |
19 | ||
20 | // uni-directional master interface | |
21 | ||
22 | sc_export< tlm_annotated_put_if< REQ > > put_request_export; | |
23 | sc_export< tlm_annotated_get_peek_if< RSP > > get_response_export; | |
24 | ||
25 | // master / slave interfaces | |
26 | ||
27 | sc_export< tlm_annotated_master_if< REQ , RSP > > master_export; | |
28 | sc_export< tlm_annotated_slave_if< REQ , RSP > > slave_export; | |
29 | ||
30 | ||
31 | tlm_annotated_req_rsp_channel( int req_size = 1 , int rsp_size = 1 ) : | |
32 | sc_module( sc_module_name( sc_gen_unique_name("tlm_req_rsp_channel") ) ) , | |
33 | request_fifo( "req_fifo" , req_size ) , | |
34 | response_fifo( "rsp_fifo" , rsp_size ) , | |
35 | master( request_fifo , response_fifo ) , | |
36 | slave( request_fifo , response_fifo ) | |
37 | { | |
38 | ||
39 | bind_exports(); | |
40 | ||
41 | } | |
42 | ||
43 | tlm_annotated_req_rsp_channel( sc_module_name module_name , | |
44 | int req_size = 1 , int rsp_size = 1 ) : | |
45 | sc_module( module_name ) , | |
46 | request_fifo( "req_fifo" , req_size ) , | |
47 | response_fifo( "rsp_fifo" , rsp_size ) , | |
48 | master( request_fifo , response_fifo ) , | |
49 | slave( request_fifo , response_fifo ) | |
50 | { | |
51 | ||
52 | bind_exports(); | |
53 | ||
54 | } | |
55 | ||
56 | private: | |
57 | void bind_exports() { | |
58 | ||
59 | put_request_export( request_fifo ); | |
60 | get_request_export( request_fifo ); | |
61 | ||
62 | put_response_export( response_fifo ); | |
63 | get_response_export( response_fifo ); | |
64 | ||
65 | master_export( master ); | |
66 | slave_export( slave ); | |
67 | ||
68 | } | |
69 | ||
70 | protected: | |
71 | REQ_CHANNEL request_fifo; | |
72 | RSP_CHANNEL response_fifo; | |
73 | ||
74 | tlm_annotated_master_imp< REQ , RSP > master; | |
75 | tlm_annotated_slave_imp< REQ , RSP > slave; | |
76 | }; | |
77 | ||
78 | ||
79 | #endif |