OpenCores
URL https://opencores.org/ocsvn/ht_tunnel/ht_tunnel/trunk

Subversion Repositories ht_tunnel

[/] [ht_tunnel/] [trunk/] [rtl/] [systemc/] [reordering_l2/] [reordering_l2.cpp] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 acastong
//reordering_l2.cpp
2
 
3
/* ***** BEGIN LICENSE BLOCK *****
4
 * Version: MPL 1.1
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version
7
 * 1.1 (the "License"); you may not use this file except in compliance with
8
 * the License. You may obtain a copy of the License at
9
 * http://www.mozilla.org/MPL/
10
 *
11
 * Software distributed under the License is distributed on an "AS IS" basis,
12
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13
 * for the specific language governing rights and limitations under the
14
 * License.
15
 *
16
 * The Original Code is HyperTransport Tunnel IP Core.
17
 *
18
 * The Initial Developer of the Original Code is
19
 * Ecole Polytechnique de Montreal.
20
 * Portions created by the Initial Developer are Copyright (C) 2005
21
 * the Initial Developer. All Rights Reserved.
22
 *
23
 * Contributor(s):
24
 *   Ami Castonguay <acastong@grm.polymtl.ca>
25
 *   Laurent Aubray
26
 *
27
 * Alternatively, the contents of this file may be used under the terms
28
 * of the Polytechnique HyperTransport Tunnel IP Core Source Code License
29
 * (the  "PHTICSCL License", see the file PHTICSCL.txt), in which case the
30
 * provisions of PHTICSCL License are applicable instead of those
31
 * above. If you wish to allow use of your version of this file only
32
 * under the terms of the PHTICSCL License and not to allow others to use
33
 * your version of this file under the MPL, indicate your decision by
34
 * deleting the provisions above and replace them with the notice and
35
 * other provisions required by the PHTICSCL License. If you do not delete
36
 * the provisions above, a recipient may use your version of this file
37
 * under either the MPL or the PHTICSCL License."
38
 *
39
 * ***** END LICENSE BLOCK ***** */
40
 
41
#include "reordering_l2.h"
42
 
43
#include "entrance_reordering_l3.h"
44
#include "final_reordering_l3.h"
45
#include "posted_vc_l3.h"
46
#include "nposted_vc_l3.h"
47
#include "response_vc_l3.h"
48
#include "nophandler_l3.h"
49
#include "address_manager_l3.h"
50
#include "fetch_packet_l3.h"
51
 
52
/// Main constructor
53
reordering_l2::reordering_l2(sc_module_name name): sc_module(name)
54
{
55
 
56
        SC_METHOD(doOrFwdEhAck);
57
        sensitive << fwd_ack_ro << eh_ack_ro;
58
 
59
        SC_METHOD(or_overflows);
60
        sensitive << vc_overflow[0] << vc_overflow[1] << vc_overflow[2];
61
 
62
        SC_METHOD(wire_through);
63
        sensitive << cd_available_ro << ro_packet_accepted;
64
 
65
        /***********************************************
66
                vcBuffersLinking
67
        ***********************************************/
68
 
69
 
70
        /////////////////////////////////////////
71
        //POSTED Buffer
72
        /////////////////////////////////////////
73
        vc_pc_module = new posted_vc_l3("VC_PC");
74
 
75
        vc_pc_module->clk(clk);
76
        vc_pc_module->resetx(resetx);
77
        vc_pc_module->buffers_cleared(buffers_cleared[VC_POSTED]);
78
 
79
        for(int n = 0; n < 2; n++){
80
                vc_pc_module->out_packet_addr[n](posted_packet_addr[n]);
81
#ifdef ENABLE_REORDERING
82
                vc_pc_module->out_packet_passpw[n](posted_packet_passpw[n]);
83
                vc_pc_module->out_packet_seqid[n](posted_packet_seqid[n]);
84
                vc_pc_module->out_packet_chain[n](posted_packet_chain[n]);
85
                vc_pc_module->out_packet_nposted_refid[n](posted_packet_nposted_refid[n]);
86
                vc_pc_module->out_packet_response_refid[n](posted_packet_response_refid[n]);
87
#endif
88
                vc_pc_module->packet_available[n](posted_available[n]);
89
                vc_pc_module->acknowledge[n](ack_posted[n]);
90
 
91
                vc_pc_module->in_packet_destination[n](destination_pc[n]);
92
        }
93
 
94
 
95
        vc_pc_module->in_packet_addr(new_packet_addr);
96
#ifdef ENABLE_REORDERING
97
        vc_pc_module->in_packet_chain(new_packet_chain);
98
        vc_pc_module->in_packet_passpw(new_packet_passpw);
99
        vc_pc_module->in_packet_seqid(new_packet_seqid);
100
 
101
        vc_pc_module->in_packet_clumped_unitid(new_packet_clumped_unitid);
102
        vc_pc_module->unitid_reorder_disable(csr_unitid_reorder_disable);
103
        vc_pc_module->nposted_refid_rejected(nposted_refid_rejected);
104
        vc_pc_module->response_refid_rejected(response_refid_rejected);
105
        vc_pc_module->nposted_refid_accepted(nposted_refid_accepted);
106
        vc_pc_module->response_refid_accepted(response_refid_accepted);
107
#endif
108
 
109
        vc_pc_module->vc_overflow(vc_overflow[VC_POSTED]);
110
 
111
        /////////////////////////////////////////
112
        //NON POSTED Buffer
113
        /////////////////////////////////////////
114
        vc_npc_module = new nposted_vc_l3("VC_NPC");
115
 
116
        vc_npc_module->clk(clk);
117
        vc_npc_module->resetx(resetx);
118
 
119
        vc_npc_module->buffers_cleared(buffers_cleared[VC_NON_POSTED]);
120
 
121
        for(int n = 0; n < 2; n++){
122
                vc_npc_module->out_packet_addr[n](nposted_packet_addr[n]);
123
#ifdef ENABLE_REORDERING
124
                vc_npc_module->out_packet_passpw[n](nposted_packet_passpw[n]);
125
                vc_npc_module->out_packet_seqid[n](nposted_packet_seqid[n]);
126
#endif
127
                vc_npc_module->packet_available[n](nposted_available[n]);
128
                vc_npc_module->acknowledge[n](ack_nposted[n]);
129
 
130
                vc_npc_module->in_packet_destination[n](destination_npc[n]);
131
        }
132
 
133
 
134
        vc_npc_module->in_packet_addr(new_packet_addr);
135
#ifdef ENABLE_REORDERING
136
        vc_npc_module->in_packet_passpw(new_packet_passpw);
137
        vc_npc_module->in_packet_seqid(new_packet_seqid);
138
 
139
        vc_npc_module->in_packet_clumped_unitid(new_packet_clumped_unitid);
140
        vc_npc_module->unitid_reorder_disable(csr_unitid_reorder_disable);
141
#endif
142
 
143
        vc_npc_module->vc_overflow(vc_overflow[VC_NON_POSTED]);
144
 
145
        /////////////////////////////////////////
146
        //RESPONSE Buffer
147
        /////////////////////////////////////////
148
        vc_rc_module = new response_vc_l3("VC_RC");
149
 
150
        vc_rc_module->clk(clk);
151
        vc_rc_module->resetx(resetx);
152
 
153
        vc_rc_module->buffers_cleared(buffers_cleared[VC_RESPONSE]);
154
 
155
        for(int n = 0; n < 2; n++){
156
                vc_rc_module->out_packet_addr[n](response_packet_addr[n]);
157
#ifdef ENABLE_REORDERING
158
                vc_rc_module->out_packet_passpw[n](response_packet_passpw[n]);
159
#endif
160
                vc_rc_module->packet_available[n](response_available[n]);
161
                vc_rc_module->acknowledge[n](ack_response[n]);
162
 
163
                vc_rc_module->in_packet_destination[n](destination_rc[n]);
164
 
165
        }
166
 
167
        vc_rc_module->in_packet_addr(new_packet_addr);
168
#ifdef ENABLE_REORDERING
169
        vc_rc_module->in_packet_passpw(new_packet_passpw);
170
        vc_rc_module->unitid_reorder_disable(csr_unitid_reorder_disable);
171
#endif
172
 
173
        vc_rc_module->vc_overflow(vc_overflow[VC_RESPONSE]);
174
 
175
 
176
        /*****************************************
177
                entranceReorderingLinking
178
        *****************************************/
179
 
180
        entranceReorderingModule = new entrance_reordering_l3("The_Entrance_Reordering");
181
 
182
        entranceReorderingModule->clk(clk);
183
        entranceReorderingModule->resetx(resetx);
184
 
185
        entranceReorderingModule->in_packet(cd_packet_ro);
186
        entranceReorderingModule->packet_available(cd_available_ro);
187
        entranceReorderingModule->unit_id(csr_unit_id);
188
#ifdef ENABLE_DIRECTROUTE
189
        entranceReorderingModule->csr_direct_route_enable(csr_direct_route_enable);
190
#endif
191
        entranceReorderingModule->csr_memory_space_enable(csr_memory_space_enable);
192
        entranceReorderingModule->csr_io_space_enable(csr_io_space_enable);
193
 
194
#ifdef ENABLE_REORDERING
195
        entranceReorderingModule->new_packet_passPW(new_packet_passpw);
196
        entranceReorderingModule->new_packet_chain(new_packet_chain);
197
        entranceReorderingModule->new_packet_seqid(new_packet_seqid);
198
        entranceReorderingModule->nposted_refid_rejected(nposted_refid_rejected);
199
        entranceReorderingModule->response_refid_rejected(response_refid_rejected);
200
        entranceReorderingModule->nposted_refid_accepted(nposted_refid_accepted);
201
        entranceReorderingModule->response_refid_accepted(response_refid_accepted);
202
#endif
203
 
204
        entranceReorderingModule->ro_command_packet_wr_data(ro_command_packet_wr_data);
205
 
206
        for(int n = 0; n < NbRegsBars; n++){
207
                entranceReorderingModule->csr_bar[n](csr_bar[n]);
208
        }
209
 
210
        for(int n = 0; n < 2; n++){
211
                entranceReorderingModule->destination_pc[n](destination_pc[n]);
212
                entranceReorderingModule->destination_npc[n](destination_npc[n]);
213
                entranceReorderingModule->destination_rc[n](destination_rc[n]);
214
        }
215
 
216
        for(int n = 0; n < 3; n++){
217
                entranceReorderingModule->new_packet_available[n](new_packet_available[n]);
218
        }
219
 
220
#ifdef ENABLE_REORDERING
221
 
222
 
223
        entranceReorderingModule->new_packet_clumped_unitid(new_packet_clumped_unitid);
224
        for(int n = 0; n < 32; n++){
225
                entranceReorderingModule->clumped_unit_id[n](clumped_unit_id[n]);
226
        }
227
#else
228
        for(int n = 0; n < 4; n++){
229
                entranceReorderingModule->clumped_unit_id[n](clumped_unit_id[n]);
230
        }
231
#endif
232
 
233
#ifdef RETRY_MODE_ENABLED
234
        entranceReorderingModule->input_packet_vc(input_packet_vc);
235
#endif
236
 
237
        /***************************************
238
                finalReorderingLinking
239
        ***************************************/
240
 
241
        finalReorderingModule = new final_reordering_l3("final_reordering");
242
 
243
        finalReorderingModule->clk(clk);
244
        finalReorderingModule->resetx(resetx);
245
 
246
        for(int destination = 0; destination <2 ; destination++){
247
                finalReorderingModule->posted_requested[destination](posted_requested[destination]);
248
                finalReorderingModule->nposted_requested[destination](nposted_requested[destination]);
249
                finalReorderingModule->response_requested[destination](response_requested[destination]);
250
 
251
                finalReorderingModule->fetched_packet[destination](fetched_packet[destination]);
252
                finalReorderingModule->fetched_packet_available[destination](fetched_packet_available[destination]);
253
                finalReorderingModule->fetched_packet_vc[destination](fetched_packet_vc[destination]);
254
 
255
                finalReorderingModule->fetched_packet_nposted_refid[destination](fetched_packet_nposted_refid[destination]);
256
                finalReorderingModule->fetched_packet_response_refid[destination](fetched_packet_response_refid[destination]);
257
        }
258
 
259
        finalReorderingModule->out_packet_accepted(ro_packet_accepted);
260
        finalReorderingModule->out_packet_fwd(ro_packet_fwd);
261
        finalReorderingModule->out_packet_vc_fwd(ro_packet_vc_fwd);
262
 
263
 
264
 
265
        finalReorderingModule->out_packet_available_csr(ro_available_csr);
266
        finalReorderingModule->out_packet_available_ui(ro_available_ui);
267
        finalReorderingModule->out_packet_available_fwd(ro_available_fwd);
268
 
269
        finalReorderingModule->ack[FWD_DEST](orFwdEhAck);
270
        finalReorderingModule->ack[CSR_DEST](csr_ack_ro);
271
        finalReorderingModule->ack[UI_DEST](ui_ack_ro);
272
 
273
        finalReorderingModule->cd_data_pending_ro(cd_data_pending_ro);
274
        finalReorderingModule->cd_data_pending_addr_ro(cd_data_pending_addr_ro);
275
 
276
        finalReorderingModule->csr_sync(csr_sync);
277
        finalReorderingModule->fwd_next_node_buffer_status_ro(fwd_next_node_buffer_status_ro);
278
 
279
        /**************************************
280
                nopHandlerLinking
281
        **************************************/
282
 
283
        nopHandlerModule = new nophandler_l3("The_Nop_Handler");
284
 
285
        nopHandlerModule->clk(clk);
286
        nopHandlerModule->resetx(resetx);
287
        nopHandlerModule->fc_nop_sent(fc_nop_sent);
288
 
289
        for(int n = 0; n < 3; n++){
290
                nopHandlerModule->received_packet[n](new_packet_available[n]);
291
                nopHandlerModule->buffers_cleared[n](buffers_cleared[n]);
292
        }
293
 
294
        nopHandlerModule->ro_nop_req_fc(ro_nop_req_fc);
295
        nopHandlerModule->ro_buffer_cnt_fc(ro_buffer_cnt_fc);
296
 
297
#ifdef RETRY_MODE_ENABLED
298
        nopHandlerModule->lk_rx_connected(lk_rx_connected);
299
        nopHandlerModule->csr_retry(csr_retry);
300
        nopHandlerModule->cd_received_non_flow_stomped_ro(cd_received_non_flow_stomped_ro);
301
        nopHandlerModule->input_packet_vc(input_packet_vc);
302
#endif
303
 
304
        /**************************************
305
                Address Manager Linking
306
        **************************************/
307
 
308
        addressManagerModule = new address_manager_l3("CMD_Address_Manager");
309
        addressManagerModule->clk(clk);
310
        addressManagerModule->resetx(resetx);
311
        addressManagerModule->use_address(cd_available_ro);
312
        for(int n = 0; n < 3; n++){
313
                addressManagerModule->new_packet_available[n](new_packet_available[n]);
314
                addressManagerModule->buffers_cleared[n](buffers_cleared[n]);
315
        }
316
        addressManagerModule->ro_command_packet_wr_addr(ro_command_packet_wr_addr);
317
        addressManagerModule->new_packet_addr(new_packet_addr);
318
 
319
        addressManagerModule->ro_command_packet_rd_addr[0](ro_command_packet_rd_addr[0]);
320
        addressManagerModule->ro_command_packet_rd_addr[1](ro_command_packet_rd_addr[1]);
321
 
322
        /**************************************
323
                Fetch Packet Module Linking
324
        **************************************/
325
        fetchPacketModule = new fetch_packet_l3("CMD_fetch_packet");
326
 
327
        fetchPacketModule->clk(clk);
328
        fetchPacketModule->resetx(resetx);
329
 
330
        for(int destination = 0; destination < 2; destination++){
331
                //Packet from posted buffers
332
                fetchPacketModule->posted_packet_addr[destination](posted_packet_addr[destination]);
333
#ifdef ENABLE_REORDERING
334
                fetchPacketModule->posted_packet_passpw[destination](posted_packet_passpw[destination]);
335
                fetchPacketModule->posted_packet_seqid[destination](posted_packet_seqid[destination]);
336
                fetchPacketModule->posted_packet_chain[destination](posted_packet_chain[destination]);
337
                fetchPacketModule->posted_packet_nposted_refid[destination](posted_packet_nposted_refid[destination]);
338
                fetchPacketModule->posted_packet_response_refid[destination](posted_packet_response_refid[destination]);
339
#endif
340
                fetchPacketModule->posted_available[destination](posted_available[destination]);
341
 
342
                //Packet from nposted buffers
343
                fetchPacketModule->nposted_packet_addr[destination](nposted_packet_addr[destination]);
344
#ifdef ENABLE_REORDERING
345
                fetchPacketModule->nposted_packet_passpw[destination](nposted_packet_passpw[destination]);
346
                fetchPacketModule->nposted_packet_seqid[destination](nposted_packet_seqid[destination]);
347
#endif
348
                fetchPacketModule->nposted_available[destination](nposted_available[destination]);
349
 
350
                //Packet from response buffers
351
                fetchPacketModule->response_packet_addr[destination](response_packet_addr[destination]);
352
#ifdef ENABLE_REORDERING
353
                fetchPacketModule->response_packet_passpw[destination](response_packet_passpw[destination]);
354
#endif
355
                fetchPacketModule->response_available[destination](response_available[destination]);
356
 
357
                //Data from memory
358
                fetchPacketModule->command_packet_rd_data_ro[destination](command_packet_rd_data_ro[destination]);
359
 
360
                //Packet types requested
361
                fetchPacketModule->posted_requested[destination](posted_requested[destination]);
362
                fetchPacketModule->nposted_requested[destination](nposted_requested[destination]);
363
                fetchPacketModule->response_requested[destination](response_requested[destination]);
364
 
365
                fetchPacketModule->ack_posted[destination](ack_posted[destination]);
366
                fetchPacketModule->ack_nposted[destination](ack_nposted[destination]);
367
                fetchPacketModule->ack_response[destination](ack_response[destination]);
368
 
369
                //Actual retrieved packet
370
                fetchPacketModule->fetched_packet[destination](fetched_packet[destination]);
371
                fetchPacketModule->fetched_packet_available[destination](fetched_packet_available[destination]);
372
                fetchPacketModule->fetched_packet_vc[destination](fetched_packet_vc[destination]);
373
 
374
                fetchPacketModule->fetched_packet_nposted_refid[destination](fetched_packet_nposted_refid[destination]);
375
                fetchPacketModule->fetched_packet_response_refid[destination](fetched_packet_response_refid[destination]);
376
 
377
        }
378
 
379
        //Address to retrieve data from memory
380
        fetchPacketModule->ro_command_packet_rd_addr[0](ro_command_packet_rd_addr[0]);
381
        fetchPacketModule->ro_command_packet_rd_addr[1](ro_command_packet_rd_addr[1]);
382
}
383
 
384
 
385
void reordering_l2::doOrFwdEhAck(){
386
        orFwdEhAck = fwd_ack_ro.read() || eh_ack_ro.read();
387
}
388
 
389
void reordering_l2::or_overflows(){
390
        ro_overflow_csr = vc_overflow[0].read() || vc_overflow[1].read() || vc_overflow[2].read();
391
}
392
 
393
void reordering_l2::wire_through(){
394
        ro_command_packet_write = cd_available_ro;
395
        ro_packet_ui = ro_packet_accepted;
396
        ro_packet_csr = ro_packet_accepted;
397
}
398
 
399
#ifdef SYSTEMC_SIM
400
reordering_l2::~reordering_l2(){
401
        delete vc_pc_module;
402
        delete vc_npc_module;
403
        delete vc_rc_module;
404
        delete entranceReorderingModule;
405
        delete finalReorderingModule;
406
        delete nopHandlerModule;
407
}
408
#endif
409
 

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.