1 | /* -*- c++ -*- |
---|
2 | * SOCLIB_LGPL_HEADER_BEGIN |
---|
3 | * |
---|
4 | * This file is part of SoCLib, GNU LGPLv2.1. |
---|
5 | * |
---|
6 | * SoCLib is free software; you can redistribute it and/or modify it |
---|
7 | * under the terms of the GNU Lesser General Public License as published |
---|
8 | * by the Free Software Foundation; version 2.1 of the License. |
---|
9 | * |
---|
10 | * SoCLib is distributed in the hope that it will be useful, but |
---|
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
13 | * Lesser General Public License for more details. |
---|
14 | * |
---|
15 | * You should have received a copy of the GNU Lesser General Public |
---|
16 | * License along with SoCLib; if not, write to the Free Software |
---|
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
---|
18 | * 02110-1301 USA |
---|
19 | * |
---|
20 | * SOCLIB_LGPL_HEADER_END |
---|
21 | * |
---|
22 | * Authors : Franck WAJSBÜRT, Abdelmalek SI MERABET |
---|
23 | * Date : january 2009 |
---|
24 | * Copyright: UPMC - LIP6 |
---|
25 | */ |
---|
26 | |
---|
27 | #ifndef SOCLIB_CABA_GATE_PORTS_H_ |
---|
28 | #define SOCLIB_CABA_GATE_PORTS_H_ |
---|
29 | |
---|
30 | #include "gate_signals_2.h" |
---|
31 | |
---|
32 | namespace soclib { namespace caba { |
---|
33 | |
---|
34 | template<int ring_cmd_data_size, int ring_rsp_data_size> |
---|
35 | class GateTarget2 |
---|
36 | { |
---|
37 | public: |
---|
38 | |
---|
39 | sc_core::sc_out<sc_dt::sc_uint<ring_cmd_data_size> > cmd_data; |
---|
40 | sc_core::sc_in<bool> cmd_wok; |
---|
41 | sc_core::sc_out<bool> cmd_w; |
---|
42 | |
---|
43 | sc_core::sc_in<sc_dt::sc_uint<ring_rsp_data_size> > rsp_data; |
---|
44 | sc_core::sc_out<bool> rsp_r; |
---|
45 | sc_core::sc_in<bool> rsp_rok; |
---|
46 | |
---|
47 | GateTarget2(const std::string &name = sc_core::sc_gen_unique_name("gate_target_2_")) |
---|
48 | : cmd_data ((name+"cmd_data").c_str()), |
---|
49 | cmd_wok ((name+"cmd_wok").c_str()), |
---|
50 | cmd_w ((name+"cmd_w").c_str()), |
---|
51 | |
---|
52 | rsp_data ((name+"rsp_data").c_str()), |
---|
53 | rsp_r ((name+"rsp_r").c_str()), |
---|
54 | rsp_rok ((name+"rsp_rok").c_str()) |
---|
55 | { } |
---|
56 | |
---|
57 | void operator () (GateSignals2<ring_cmd_data_size, ring_rsp_data_size> &sig) |
---|
58 | { |
---|
59 | |
---|
60 | cmd_data (sig.cmd_data); |
---|
61 | cmd_wok (sig.cmd_r_wok); |
---|
62 | cmd_w (sig.cmd_w_rok); |
---|
63 | |
---|
64 | rsp_data (sig.rsp_data); |
---|
65 | rsp_r (sig.rsp_r_wok); |
---|
66 | rsp_rok (sig.rsp_w_rok); |
---|
67 | |
---|
68 | } |
---|
69 | |
---|
70 | void operator () (GateTarget2 &port) |
---|
71 | { |
---|
72 | cmd_data (port.cmd_data); |
---|
73 | cmd_wok (port.cmd_wok); |
---|
74 | cmd_w (port.cmd_w); |
---|
75 | |
---|
76 | rsp_data (port.rsp_data); |
---|
77 | rsp_r (port.rsp_r); |
---|
78 | rsp_rok (port.rsp_rok); |
---|
79 | |
---|
80 | } |
---|
81 | |
---|
82 | }; |
---|
83 | |
---|
84 | template<int ring_cmd_data_size, int ring_rsp_data_size> |
---|
85 | class GateInitiator2 |
---|
86 | { |
---|
87 | public: |
---|
88 | |
---|
89 | sc_core::sc_in<sc_dt::sc_uint<ring_cmd_data_size> > cmd_data; |
---|
90 | sc_core::sc_out<bool> cmd_r; |
---|
91 | sc_core::sc_in<bool> cmd_rok; |
---|
92 | |
---|
93 | sc_core::sc_out<sc_dt::sc_uint<ring_rsp_data_size> > rsp_data; |
---|
94 | sc_core::sc_in<bool> rsp_wok; |
---|
95 | sc_core::sc_out<bool> rsp_w; |
---|
96 | |
---|
97 | GateInitiator2(const std::string &name = sc_core::sc_gen_unique_name("gate_initiator_2_")) |
---|
98 | : |
---|
99 | |
---|
100 | cmd_data ((name+"cmd_data").c_str()), |
---|
101 | cmd_r ((name+"cmd_r").c_str()), |
---|
102 | cmd_rok ((name+"cmd_rok").c_str()), |
---|
103 | |
---|
104 | rsp_data ((name+"rsp_data").c_str()), |
---|
105 | rsp_wok ((name+"rsp_wok").c_str()), |
---|
106 | rsp_w ((name+"rsp_w").c_str()) |
---|
107 | { } |
---|
108 | |
---|
109 | void operator () (GateSignals2<ring_cmd_data_size, ring_rsp_data_size> &sig) |
---|
110 | { |
---|
111 | cmd_data (sig.cmd_data); |
---|
112 | cmd_r (sig.cmd_r_wok); |
---|
113 | cmd_rok (sig.cmd_w_rok); |
---|
114 | |
---|
115 | rsp_data (sig.rsp_data); |
---|
116 | rsp_wok (sig.rsp_r_wok); |
---|
117 | rsp_w (sig.rsp_w_rok); |
---|
118 | } |
---|
119 | |
---|
120 | void operator () (GateInitiator2 &port) |
---|
121 | { |
---|
122 | |
---|
123 | cmd_data (port.cmd_data); |
---|
124 | cmd_r (port.cmd_r); |
---|
125 | cmd_rok (port.cmd_rok); |
---|
126 | |
---|
127 | rsp_data (port.rsp_data); |
---|
128 | rsp_wok (port.rsp_wok); |
---|
129 | rsp_w (port.rsp_w); |
---|
130 | } |
---|
131 | |
---|
132 | |
---|
133 | }; |
---|
134 | |
---|
135 | }} |
---|
136 | |
---|
137 | #endif // SOCLIB_CABA_GATE_PORTS_H_ |
---|
138 | |
---|
139 | |
---|