1 | ////////////////////////////////////////////////////////////////////////////// |
---|
2 | // File: tsar_iob_cluster.h |
---|
3 | // Author: Alain Greiner |
---|
4 | // Copyright: UPMC/LIP6 |
---|
5 | // Date : april 2013 |
---|
6 | // This program is released under the GNU public license |
---|
7 | ////////////////////////////////////////////////////////////////////////////// |
---|
8 | |
---|
9 | #ifndef SOCLIB_CABA_TSAR_IOB_CLUSTER_H |
---|
10 | #define SOCLIB_CABA_TSAR_IOB_CLUSTER_H |
---|
11 | |
---|
12 | #include <systemc> |
---|
13 | #include <sys/time.h> |
---|
14 | #include <iostream> |
---|
15 | #include <sstream> |
---|
16 | #include <cstdlib> |
---|
17 | #include <cstdarg> |
---|
18 | |
---|
19 | #include "gdbserver.h" |
---|
20 | #include "mapping_table.h" |
---|
21 | #include "mips32.h" |
---|
22 | #include "vci_simple_ram.h" |
---|
23 | #include "vci_simple_rom.h" |
---|
24 | #include "vci_xicu.h" |
---|
25 | #include "vci_local_crossbar.h" |
---|
26 | #include "dspin_local_crossbar.h" |
---|
27 | #include "vci_dspin_initiator_wrapper.h" |
---|
28 | #include "vci_dspin_target_wrapper.h" |
---|
29 | #include "dspin_router_tsar.h" |
---|
30 | #include "virtual_dspin_router.h" |
---|
31 | #include "vci_multi_dma.h" |
---|
32 | #include "vci_mem_cache.h" |
---|
33 | #include "vci_cc_vcache_wrapper.h" |
---|
34 | #include "vci_io_bridge.h" |
---|
35 | #include "vci_multi_tty.h" |
---|
36 | #include "hard_config.h" |
---|
37 | |
---|
38 | /////////////////////////////////////////////////////////////////////// |
---|
39 | // Number of channels for debug TTY (may be 0) |
---|
40 | /////////////////////////////////////////////////////////////////////// |
---|
41 | #define NB_DEBUG_TTY_CHANNELS 1 |
---|
42 | |
---|
43 | /////////////////////////////////////////////////////////////////////// |
---|
44 | // TGT_ID and INI_ID port indexing for INT local interconnect |
---|
45 | /////////////////////////////////////////////////////////////////////// |
---|
46 | |
---|
47 | #define INT_MEMC_TGT_ID 0 |
---|
48 | #define INT_XICU_TGT_ID 1 |
---|
49 | #define INT_BROM_TGT_ID 2 |
---|
50 | #define INT_MDMA_TGT_ID 3 |
---|
51 | #define INT_MTTY_TGT_ID 4 |
---|
52 | #define INT_IOBX_TGT_ID (4 + (NB_DEBUG_TTY_CHANNELS ? 1 : 0)) |
---|
53 | |
---|
54 | #define INT_PROC_INI_ID 0 // from 0 to 7 |
---|
55 | #define INT_MDMA_INI_ID NB_PROCS |
---|
56 | #define INT_IOBX_INI_ID (NB_PROCS + 1) |
---|
57 | |
---|
58 | /////////////////////////////////////////////////////////////////////// |
---|
59 | // TGT_ID and INI_ID port indexing for RAM local interconnect |
---|
60 | /////////////////////////////////////////////////////////////////////// |
---|
61 | |
---|
62 | #define RAM_XRAM_TGT_ID 0 |
---|
63 | |
---|
64 | #define RAM_MEMC_INI_ID 0 |
---|
65 | #define RAM_IOBX_INI_ID 1 |
---|
66 | |
---|
67 | namespace soclib { namespace caba { |
---|
68 | |
---|
69 | /////////////////////////////////////////////////////////////////////////// |
---|
70 | template<typename vci_param_int, |
---|
71 | typename vci_param_ext, |
---|
72 | size_t dspin_int_cmd_width, |
---|
73 | size_t dspin_int_rsp_width, |
---|
74 | size_t dspin_ram_cmd_width, |
---|
75 | size_t dspin_ram_rsp_width> |
---|
76 | class TsarIobCluster |
---|
77 | /////////////////////////////////////////////////////////////////////////// |
---|
78 | : public soclib::caba::BaseModule |
---|
79 | { |
---|
80 | |
---|
81 | public: |
---|
82 | |
---|
83 | // Ports |
---|
84 | sc_in<bool> p_clk; |
---|
85 | sc_in<bool> p_resetn; |
---|
86 | |
---|
87 | // Thes two ports are used to connect IOB to IOX nework in top cell |
---|
88 | soclib::caba::VciInitiator<vci_param_ext>* p_vci_iob_iox_ini; |
---|
89 | soclib::caba::VciTarget<vci_param_ext>* p_vci_iob_iox_tgt; |
---|
90 | |
---|
91 | // These ports are used to connect IOB to RAM network in top cell |
---|
92 | soclib::caba::DspinOutput<dspin_ram_cmd_width>* p_dspin_iob_cmd_out; |
---|
93 | soclib::caba::DspinInput<dspin_ram_rsp_width>* p_dspin_iob_rsp_in; |
---|
94 | |
---|
95 | // These ports are used to connect hard IRQ from external peripherals to |
---|
96 | // IOB0 |
---|
97 | sc_in<bool>* p_irq[32]; |
---|
98 | |
---|
99 | // These arrays of ports are used to connect the INT & RAM networks in |
---|
100 | // top cell |
---|
101 | soclib::caba::DspinOutput<dspin_int_cmd_width>** p_dspin_int_cmd_out; |
---|
102 | soclib::caba::DspinInput<dspin_int_cmd_width>** p_dspin_int_cmd_in; |
---|
103 | soclib::caba::DspinOutput<dspin_int_rsp_width>** p_dspin_int_rsp_out; |
---|
104 | soclib::caba::DspinInput<dspin_int_rsp_width>** p_dspin_int_rsp_in; |
---|
105 | |
---|
106 | soclib::caba::DspinOutput<dspin_ram_cmd_width>* p_dspin_ram_cmd_out; |
---|
107 | soclib::caba::DspinInput<dspin_ram_cmd_width>* p_dspin_ram_cmd_in; |
---|
108 | soclib::caba::DspinOutput<dspin_ram_rsp_width>* p_dspin_ram_rsp_out; |
---|
109 | soclib::caba::DspinInput<dspin_ram_rsp_width>* p_dspin_ram_rsp_in; |
---|
110 | |
---|
111 | // interrupt signals |
---|
112 | sc_signal<bool> signal_false; |
---|
113 | sc_signal<bool> signal_proc_it[8]; |
---|
114 | sc_signal<bool> signal_irq_mdma[8]; |
---|
115 | sc_signal<bool> signal_irq_mtty[8]; |
---|
116 | sc_signal<bool> signal_irq_memc; |
---|
117 | |
---|
118 | // INT network DSPIN signals between DSPIN routers and DSPIN |
---|
119 | // local_crossbars |
---|
120 | DspinSignals<dspin_int_cmd_width> signal_int_dspin_cmd_l2g_d; |
---|
121 | DspinSignals<dspin_int_cmd_width> signal_int_dspin_cmd_g2l_d; |
---|
122 | DspinSignals<dspin_int_rsp_width> signal_int_dspin_rsp_l2g_d; |
---|
123 | DspinSignals<dspin_int_rsp_width> signal_int_dspin_rsp_g2l_d; |
---|
124 | DspinSignals<dspin_int_cmd_width> signal_int_dspin_m2p_l2g_c; |
---|
125 | DspinSignals<dspin_int_cmd_width> signal_int_dspin_m2p_g2l_c; |
---|
126 | DspinSignals<dspin_int_cmd_width> signal_int_dspin_clack_l2g_c; |
---|
127 | DspinSignals<dspin_int_cmd_width> signal_int_dspin_clack_g2l_c; |
---|
128 | DspinSignals<dspin_int_rsp_width> signal_int_dspin_p2m_l2g_c; |
---|
129 | DspinSignals<dspin_int_rsp_width> signal_int_dspin_p2m_g2l_c; |
---|
130 | |
---|
131 | // INT network VCI signals between VCI components and VCI local crossbar |
---|
132 | VciSignals<vci_param_int> signal_int_vci_ini_proc[8]; |
---|
133 | VciSignals<vci_param_int> signal_int_vci_ini_mdma; |
---|
134 | VciSignals<vci_param_int> signal_int_vci_ini_iobx; |
---|
135 | |
---|
136 | VciSignals<vci_param_int> signal_int_vci_tgt_memc; |
---|
137 | VciSignals<vci_param_int> signal_int_vci_tgt_xicu; |
---|
138 | VciSignals<vci_param_int> signal_int_vci_tgt_brom; |
---|
139 | VciSignals<vci_param_int> signal_int_vci_tgt_mtty; |
---|
140 | VciSignals<vci_param_int> signal_int_vci_tgt_mdma; |
---|
141 | VciSignals<vci_param_int> signal_int_vci_tgt_iobx; |
---|
142 | |
---|
143 | VciSignals<vci_param_int> signal_int_vci_l2g; |
---|
144 | VciSignals<vci_param_int> signal_int_vci_g2l; |
---|
145 | |
---|
146 | // Coherence DSPIN signals between DSPIN local crossbars and CC |
---|
147 | // components |
---|
148 | DspinSignals<dspin_int_cmd_width> signal_int_dspin_m2p_memc; |
---|
149 | DspinSignals<dspin_int_cmd_width> signal_int_dspin_clack_memc; |
---|
150 | DspinSignals<dspin_int_rsp_width> signal_int_dspin_p2m_memc; |
---|
151 | DspinSignals<dspin_int_cmd_width> signal_int_dspin_m2p_proc[8]; |
---|
152 | DspinSignals<dspin_int_cmd_width> signal_int_dspin_clack_proc[8]; |
---|
153 | DspinSignals<dspin_int_rsp_width> signal_int_dspin_p2m_proc[8]; |
---|
154 | |
---|
155 | // RAM network VCI signals between VCI components and VCI/DSPIN wrappers |
---|
156 | VciSignals<vci_param_ext> signal_ram_vci_ini_memc; |
---|
157 | VciSignals<vci_param_ext> signal_ram_vci_ini_iobx; |
---|
158 | VciSignals<vci_param_ext> signal_ram_vci_tgt_xram; |
---|
159 | |
---|
160 | // RAM network DSPIN signals between VCI/DSPIN wrappers and routers |
---|
161 | DspinSignals<dspin_ram_cmd_width> signal_ram_dspin_cmd_xram_t; |
---|
162 | DspinSignals<dspin_ram_rsp_width> signal_ram_dspin_rsp_xram_t; |
---|
163 | DspinSignals<dspin_ram_cmd_width> signal_ram_dspin_cmd_memc_i; |
---|
164 | DspinSignals<dspin_ram_rsp_width> signal_ram_dspin_rsp_memc_i; |
---|
165 | |
---|
166 | ////////////////////////////////////// |
---|
167 | // Hardwate Components (pointers) |
---|
168 | ////////////////////////////////////// |
---|
169 | typedef VciCcVCacheWrapper<vci_param_int, dspin_int_cmd_width, |
---|
170 | dspin_int_rsp_width, GdbServer<Mips32ElIss> > |
---|
171 | VciCcVCacheWrapperType; |
---|
172 | |
---|
173 | typedef VciMemCache<vci_param_int, vci_param_ext, dspin_int_rsp_width, |
---|
174 | dspin_int_cmd_width> VciMemCacheType; |
---|
175 | |
---|
176 | typedef VciDspinInitiatorWrapper<vci_param_int, dspin_int_cmd_width, |
---|
177 | dspin_int_rsp_width> VciIntDspinInitiatorWrapperType; |
---|
178 | |
---|
179 | typedef VciDspinTargetWrapper<vci_param_int, dspin_int_cmd_width, |
---|
180 | dspin_int_rsp_width> VciIntDspinTargetWrapperType; |
---|
181 | |
---|
182 | typedef VciDspinInitiatorWrapper<vci_param_ext, dspin_ram_cmd_width, |
---|
183 | dspin_ram_rsp_width> VciExtDspinInitiatorWrapperType; |
---|
184 | |
---|
185 | typedef VciDspinTargetWrapper<vci_param_ext, dspin_ram_cmd_width, |
---|
186 | dspin_ram_rsp_width> VciExtDspinTargetWrapperType; |
---|
187 | |
---|
188 | VciCcVCacheWrapperType* proc[8]; |
---|
189 | |
---|
190 | VciMemCacheType* memc; |
---|
191 | VciExtDspinInitiatorWrapperType* memc_ram_wi; |
---|
192 | |
---|
193 | VciXicu<vci_param_int>* xicu; |
---|
194 | |
---|
195 | VciMultiDma<vci_param_int>* mdma; |
---|
196 | |
---|
197 | VciSimpleRom<vci_param_int>* brom; |
---|
198 | |
---|
199 | VciMultiTty<vci_param_int>* mtty; |
---|
200 | |
---|
201 | VciLocalCrossbar<vci_param_int>* int_xbar_d; |
---|
202 | VciIntDspinInitiatorWrapperType* int_wi_gate_d; |
---|
203 | VciIntDspinTargetWrapperType* int_wt_gate_d; |
---|
204 | |
---|
205 | DspinLocalCrossbar<dspin_int_cmd_width>* int_xbar_m2p_c; |
---|
206 | DspinLocalCrossbar<dspin_int_rsp_width>* int_xbar_p2m_c; |
---|
207 | DspinLocalCrossbar<dspin_int_cmd_width>* int_xbar_clack_c; |
---|
208 | |
---|
209 | VirtualDspinRouter<dspin_int_cmd_width>* int_router_cmd; |
---|
210 | VirtualDspinRouter<dspin_int_rsp_width>* int_router_rsp; |
---|
211 | |
---|
212 | VciSimpleRam<vci_param_ext>* xram; |
---|
213 | VciExtDspinTargetWrapperType* xram_ram_wt; |
---|
214 | |
---|
215 | DspinRouterTsar<dspin_ram_cmd_width>* ram_router_cmd; |
---|
216 | DspinRouterTsar<dspin_ram_rsp_width>* ram_router_rsp; |
---|
217 | |
---|
218 | // IO Network Components (not instanciated in all clusters) |
---|
219 | |
---|
220 | VciIoBridge<vci_param_int, vci_param_ext>* iob; |
---|
221 | VciExtDspinInitiatorWrapperType* iob_ram_wi; |
---|
222 | |
---|
223 | size_t m_procs; |
---|
224 | |
---|
225 | struct ClusterParams { |
---|
226 | sc_module_name insname; |
---|
227 | |
---|
228 | size_t x_id; |
---|
229 | size_t y_id; |
---|
230 | |
---|
231 | const soclib::common::MappingTable &mt_int; |
---|
232 | const soclib::common::MappingTable &mt_ext; |
---|
233 | const soclib::common::MappingTable &mt_iox; |
---|
234 | |
---|
235 | size_t memc_ways; |
---|
236 | size_t memc_sets; |
---|
237 | size_t l1_i_ways; |
---|
238 | size_t l1_i_sets; |
---|
239 | size_t l1_d_ways; |
---|
240 | size_t l1_d_sets; |
---|
241 | size_t xram_latency; |
---|
242 | |
---|
243 | const Loader& loader; |
---|
244 | |
---|
245 | uint32_t frozen_cycles; |
---|
246 | uint32_t debug_start_cycle; |
---|
247 | bool memc_debug_ok; |
---|
248 | bool proc_debug_ok; |
---|
249 | bool iob_debug_ok; |
---|
250 | }; |
---|
251 | |
---|
252 | // utility functions |
---|
253 | static uint32_t clusterId(size_t x_id, size_t y_id) { |
---|
254 | return ((x_id << Y_WIDTH) | y_id); |
---|
255 | }; |
---|
256 | |
---|
257 | // cluster constructor |
---|
258 | TsarIobCluster(struct ClusterParams& params); |
---|
259 | ~TsarIobCluster(); |
---|
260 | }; |
---|
261 | |
---|
262 | }} |
---|
263 | |
---|
264 | #endif |
---|
265 | |
---|
266 | // vim: filetype=cpp:expandtab:shiftwidth=3:tabstop=3:softtabstop=3 |
---|