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

Subversion Repositories ao486

[/] [ao486/] [trunk/] [rtl/] [ao486/] [memory/] [memory.v] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alfik
/*
2
 * Copyright (c) 2014, Aleksander Osman
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions are met:
7
 *
8
 * * Redistributions of source code must retain the above copyright notice, this
9
 *   list of conditions and the following disclaimer.
10
 *
11
 * * Redistributions in binary form must reproduce the above copyright notice,
12
 *   this list of conditions and the following disclaimer in the documentation
13
 *   and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
 
27
`include "defines.v"
28
 
29
module memory(
30
    input               clk,
31
    input               rst_n,
32
 
33
    //REQ:
34
    input               read_do,
35
    output              read_done,
36
    output              read_page_fault,
37
    output              read_ac_fault,
38
 
39
    input       [1:0]   read_cpl,
40
    input       [31:0]  read_address,
41
    input       [3:0]   read_length,
42
    input               read_lock,
43
    input               read_rmw,
44
    output      [63:0]  read_data,
45
    //END
46
 
47
    //REQ:
48
    input               write_do,
49
    output              write_done,
50
    output              write_page_fault,
51
    output              write_ac_fault,
52
 
53
    input       [1:0]   write_cpl,
54
    input       [31:0]  write_address,
55
    input       [2:0]   write_length,
56
    input               write_lock,
57
    input               write_rmw,
58
    input       [31:0]  write_data,
59
    //END
60
 
61
    //REQ:
62
    input               tlbcheck_do,
63
    output              tlbcheck_done,
64
    output              tlbcheck_page_fault,
65
 
66
    input       [31:0]  tlbcheck_address,
67
    input               tlbcheck_rw,
68
    //END
69
 
70
    output              dcache_busy,
71
 
72
    //RESP:
73
    input               tlbflushsingle_do,
74
    output              tlbflushsingle_done,
75
 
76
    input       [31:0]  tlbflushsingle_address,
77
    //END
78
 
79
    //RESP:
80
    input               tlbflushall_do,
81
    //END
82
 
83
    //RESP:
84
    input               invdcode_do,
85
    output              invdcode_done,
86
    //END
87
 
88
    //RESP:
89
    input               invddata_do,
90
    output              invddata_done,
91
    //END
92
 
93
    //RESP:
94
    input               wbinvddata_do,
95
    output              wbinvddata_done,
96
    //END
97
 
98
    // prefetch exported
99
    input       [1:0]   prefetch_cpl,
100
    input       [31:0]  prefetch_eip,
101
    input       [63:0]  cs_cache,
102
 
103
    input               cr0_pg,
104
    input               cr0_wp,
105
    input               cr0_am,
106
    input               cr0_cd,
107
    input               cr0_nw,
108
 
109
    input               acflag,
110
 
111
    input       [31:0]  cr3,
112
 
113
 
114
    // prefetch_fifo exported
115
    input               prefetchfifo_accept_do,
116
    output      [67:0]  prefetchfifo_accept_data,
117
    output              prefetchfifo_accept_empty,
118
 
119
    input               pipeline_after_read_empty,
120
    input               pipeline_after_prefetch_empty,
121
 
122
    output      [31:0]  tlb_code_pf_cr2,
123
    output      [15:0]  tlb_code_pf_error_code,
124
 
125
    output      [31:0]  tlb_check_pf_cr2,
126
    output      [15:0]  tlb_check_pf_error_code,
127
 
128
    output      [31:0]  tlb_write_pf_cr2,
129
    output      [15:0]  tlb_write_pf_error_code,
130
 
131
    output      [31:0]  tlb_read_pf_cr2,
132
    output      [15:0]  tlb_read_pf_error_code,
133
 
134
    // reset exported
135
    input               pr_reset,
136
    input               rd_reset,
137
    input               exe_reset,
138
    input               wr_reset,
139
 
140
    // avalon master
141
    output      [31:0]  avm_address,
142
    output      [31:0]  avm_writedata,
143
    output      [3:0]   avm_byteenable,
144
    output      [2:0]   avm_burstcount,
145
    output              avm_write,
146
    output              avm_read,
147
 
148
    input               avm_waitrequest,
149
    input               avm_readdatavalid,
150
    input       [31:0]  avm_readdata
151
);
152
 
153
 
154
//------------------------------------------------------------------------------
155
 
156
wire        req_writeburst_do;
157
wire        req_writeburst_done;
158
wire [31:0] req_writeburst_address;
159
wire [1:0]  req_writeburst_dword_length;
160
wire [3:0]  req_writeburst_byteenable_0;
161
wire [3:0]  req_writeburst_byteenable_1;
162
wire [55:0] req_writeburst_data;
163
 
164
wire        resp_writeburst_do;
165
wire        resp_writeburst_done;
166
wire [31:0] resp_writeburst_address;
167
wire [1:0]  resp_writeburst_dword_length;
168
wire [3:0]  resp_writeburst_byteenable_0;
169
wire [3:0]  resp_writeburst_byteenable_1;
170
wire [55:0] resp_writeburst_data;
171
 
172
link_writeburst link_writeburst_inst(
173
    .clk                            (clk),
174 7 alfik
    .rst_n                          (rst_n),
175 2 alfik
 
176
    // writeburst REQ
177
    .req_writeburst_do              (req_writeburst_do),            //input
178
    .req_writeburst_done            (req_writeburst_done),          //output
179
 
180
    .req_writeburst_address         (req_writeburst_address),       //input [31:0]
181
    .req_writeburst_dword_length    (req_writeburst_dword_length),  //input [1:0]
182
    .req_writeburst_byteenable_0    (req_writeburst_byteenable_0),  //input [3:0]
183
    .req_writeburst_byteenable_1    (req_writeburst_byteenable_1),  //input [3:0]
184
    .req_writeburst_data            (req_writeburst_data),          //input [55:0]
185
 
186
    // writeburst RESP
187
    .resp_writeburst_do             (resp_writeburst_do),           //output
188
    .resp_writeburst_done           (resp_writeburst_done),         //input
189
 
190
    .resp_writeburst_address        (resp_writeburst_address),      //output [31:0]
191
    .resp_writeburst_dword_length   (resp_writeburst_dword_length), //output [1:0]
192
    .resp_writeburst_byteenable_0   (resp_writeburst_byteenable_0), //output [3:0]
193
    .resp_writeburst_byteenable_1   (resp_writeburst_byteenable_1), //output [3:0]
194
    .resp_writeburst_data           (resp_writeburst_data)          //output [55:0]
195
);
196
 
197
//------------------------------------------------------------------------------
198
 
199
wire         req_writeline_do;
200
wire         req_writeline_done;
201
wire [31:0]  req_writeline_address;
202
wire [127:0] req_writeline_line;
203
 
204
wire         resp_writeline_do;
205
wire         resp_writeline_done;
206
wire [31:0]  resp_writeline_address;
207
wire [127:0] resp_writeline_line;
208
 
209
link_writeline link_writeline_inst(
210
    .clk                (clk),
211 7 alfik
    .rst_n              (rst_n),
212 2 alfik
 
213
    // writeline REQ
214
    .req_writeline_do       (req_writeline_do),         //input
215
    .req_writeline_done     (req_writeline_done),       //output
216
 
217
    .req_writeline_address  (req_writeline_address),    //input [31:0]
218
    .req_writeline_line     (req_writeline_line),       //input [127:0]
219
 
220
    // writeline RESP
221
    .resp_writeline_do      (resp_writeline_do),        //output
222
    .resp_writeline_done    (resp_writeline_done),      //input
223
 
224
    .resp_writeline_address (resp_writeline_address),   //output [31:0]
225
    .resp_writeline_line    (resp_writeline_line)       //output [127:0]
226
);
227
 
228
//------------------------------------------------------------------------------
229
 
230
wire         req_readburst_do;
231
wire         req_readburst_done;
232
wire [31:0]  req_readburst_address;
233
wire [1:0]   req_readburst_dword_length;
234
wire [3:0]   req_readburst_byte_length;
235
wire [95:0]  req_readburst_data;
236
 
237
wire         resp_readburst_do;
238
wire         resp_readburst_done;
239
wire [31:0]  resp_readburst_address;
240
wire [1:0]   resp_readburst_dword_length;
241
wire [3:0]   resp_readburst_byte_length;
242
wire [95:0]  resp_readburst_data;
243
 
244
link_readburst link_readburst_inst(
245
    .clk                    (clk),
246 7 alfik
    .rst_n                  (rst_n),
247 2 alfik
 
248
    // readburst REQ
249
    .req_readburst_do               (req_readburst_do),             //input
250
    .req_readburst_done             (req_readburst_done),           //output
251
 
252
    .req_readburst_address          (req_readburst_address),        //input [31:0]
253
    .req_readburst_dword_length     (req_readburst_dword_length),   //input [1:0]
254
    .req_readburst_byte_length      (req_readburst_byte_length),    //input [11:0]
255
    .req_readburst_data             (req_readburst_data),           //output [95:0]
256
 
257
    // readburst RESP
258
    .resp_readburst_do              (resp_readburst_do),            //output
259
    .resp_readburst_done            (resp_readburst_done),          //input
260
 
261
    .resp_readburst_address         (resp_readburst_address),       //output [31:0]
262
    .resp_readburst_dword_length    (resp_readburst_dword_length),  //output [1:0]
263
    .resp_readburst_byte_length     (resp_readburst_byte_length),   //output [3:0]
264
    .resp_readburst_data            (resp_readburst_data)           //input [95:0]
265
);
266
 
267
//------------------------------------------------------------------------------
268
 
269
 
270
wire         req_readline_do;
271
wire         req_readline_done;
272
wire [31:0]  req_readline_address;
273
wire [127:0] req_readline_line;
274
 
275
wire         resp_readline_do;
276
wire         resp_readline_done;
277
wire [31:0]  resp_readline_address;
278
wire [127:0] resp_readline_line;
279
 
280
link_readline link_readline_inst(
281
    .clk                    (clk),
282 7 alfik
    .rst_n                  (rst_n),
283 2 alfik
 
284
    // readline REQ
285
    .req_readline_do        (req_readline_do),      //input
286
    .req_readline_done      (req_readline_done),    //output
287
 
288
    .req_readline_address   (req_readline_address), //input [31:0]
289
    .req_readline_line      (req_readline_line),    //output [127:0]
290
 
291
    // readline RESP
292
    .resp_readline_do       (resp_readline_do),     //output
293
    .resp_readline_done     (resp_readline_done),   //input
294
 
295
    .resp_readline_address  (resp_readline_address),//output [31:0]
296
    .resp_readline_line     (resp_readline_line)    //input [127:0]
297
);
298
 
299
//------------------------------------------------------------------------------
300
 
301
wire         req_readcode_do;
302
wire         req_readcode_done;
303
wire [31:0]  req_readcode_address;
304
wire [127:0] req_readcode_line;
305
wire [31:0]  req_readcode_partial;
306
wire         req_readcode_partial_done;
307
 
308
wire         resp_readcode_do;
309
wire         resp_readcode_done;
310
wire [31:0]  resp_readcode_address;
311
wire [127:0] resp_readcode_line;
312
wire [31:0]  resp_readcode_partial;
313
wire         resp_readcode_partial_done;
314
 
315
link_readcode link_readcode_inst(
316
    .clk                (clk),
317 7 alfik
    .rst_n              (rst_n),
318 2 alfik
 
319
    // readcode REQ
320
    .req_readcode_do                (req_readcode_do),            //input
321
    .req_readcode_done              (req_readcode_done),          //output
322
 
323
    .req_readcode_address           (req_readcode_address),       //input [31:0]
324
    .req_readcode_line              (req_readcode_line),          //output [127:0]
325
    .req_readcode_partial           (req_readcode_partial),       //output [31:0]
326
    .req_readcode_partial_done      (req_readcode_partial_done),  //output
327
 
328
    // readcode RESP
329
    .resp_readcode_do               (resp_readcode_do),           //output
330
    .resp_readcode_done             (resp_readcode_done),         //input
331
 
332
    .resp_readcode_address          (resp_readcode_address),      //output [31:0]
333
    .resp_readcode_line             (resp_readcode_line),         //input [127:0]
334
    .resp_readcode_partial          (resp_readcode_partial),      //input [31:0]
335
    .resp_readcode_partial_done     (resp_readcode_partial_done)  //input
336
);
337
 
338
//------------------------------------------------------------------------------
339
 
340
wire             req_dcacheread_do;
341
wire             req_dcacheread_done;
342
wire [3:0]       req_dcacheread_length;
343
wire             req_dcacheread_cache_disable;
344
wire [31:0]      req_dcacheread_address;
345
wire [63:0]      req_dcacheread_data;
346
 
347
wire             resp_dcacheread_do;
348
wire             resp_dcacheread_done;
349
wire [3:0]       resp_dcacheread_length;
350
wire             resp_dcacheread_cache_disable;
351
wire [31:0]      resp_dcacheread_address;
352
wire [63:0]      resp_dcacheread_data;
353
 
354
link_dcacheread link_dcacheread_inst(
355
    .clk                (clk),
356 7 alfik
    .rst_n              (rst_n),
357 2 alfik
 
358
    // dcacheread REQ
359
    .req_dcacheread_do                  (req_dcacheread_do),              //input
360
    .req_dcacheread_done                (req_dcacheread_done),            //output
361
 
362
    .req_dcacheread_length              (req_dcacheread_length),          //input [3:0]
363
    .req_dcacheread_cache_disable       (req_dcacheread_cache_disable),   //input
364
    .req_dcacheread_address             (req_dcacheread_address),         //input [31:0]
365
    .req_dcacheread_data                (req_dcacheread_data),            //output [63:0]
366
 
367
    // dcacheread RESP
368
    .resp_dcacheread_do                 (resp_dcacheread_do),             //output
369
    .resp_dcacheread_done               (resp_dcacheread_done),           //input
370
 
371
    .resp_dcacheread_length             (resp_dcacheread_length),         //output [3:0]
372
    .resp_dcacheread_cache_disable      (resp_dcacheread_cache_disable),  //output
373
    .resp_dcacheread_address            (resp_dcacheread_address),        //output [31:0]
374
    .resp_dcacheread_data               (resp_dcacheread_data)            //input [63:0]
375
);
376
 
377
//------------------------------------------------------------------------------
378
 
379
wire               req_dcachewrite_do;
380
wire               req_dcachewrite_done;
381
wire   [2:0]       req_dcachewrite_length;
382
wire               req_dcachewrite_cache_disable;
383
wire   [31:0]      req_dcachewrite_address;
384
wire               req_dcachewrite_write_through;
385
wire   [31:0]      req_dcachewrite_data;
386
 
387
wire              resp_dcachewrite_do;
388
wire              resp_dcachewrite_done;
389
wire  [2:0]       resp_dcachewrite_length;
390
wire              resp_dcachewrite_cache_disable;
391
wire  [31:0]      resp_dcachewrite_address;
392
wire              resp_dcachewrite_write_through;
393
wire  [31:0]      resp_dcachewrite_data;
394
 
395
link_dcachewrite link_dcachewrite_inst(
396
    .clk                (clk),
397 7 alfik
    .rst_n              (rst_n),
398 2 alfik
 
399
    // dcachewrite REQ
400
    .req_dcachewrite_do                 (req_dcachewrite_do),             //input
401
    .req_dcachewrite_done               (req_dcachewrite_done),           //output
402
 
403
    .req_dcachewrite_length             (req_dcachewrite_length),         //input [2:0]
404
    .req_dcachewrite_cache_disable      (req_dcachewrite_cache_disable),  //input
405
    .req_dcachewrite_address            (req_dcachewrite_address),        //input [31:0]
406
    .req_dcachewrite_write_through      (req_dcachewrite_write_through),  //input
407
    .req_dcachewrite_data               (req_dcachewrite_data),           //input [31:0]
408
 
409
    // dcachewrite RESP
410
    .resp_dcachewrite_do                (resp_dcachewrite_do),            //output
411
    .resp_dcachewrite_done              (resp_dcachewrite_done),          //input
412
 
413
    .resp_dcachewrite_length            (resp_dcachewrite_length),        //output [2:0]
414
    .resp_dcachewrite_cache_disable     (resp_dcachewrite_cache_disable), //output
415
    .resp_dcachewrite_address           (resp_dcachewrite_address),       //output [31:0]
416
    .resp_dcachewrite_write_through     (resp_dcachewrite_write_through), //output
417
    .resp_dcachewrite_data              (resp_dcachewrite_data)           //output [31:0]
418
);
419
 
420
//------------------------------------------------------------------------------
421
 
422
wire         tlbread_do;
423
wire         tlbread_done;
424
wire         tlbread_page_fault;
425
wire         tlbread_ac_fault;
426
wire         tlbread_retry;
427
 
428
wire [1:0]   tlbread_cpl;
429
wire [31:0]  tlbread_address;
430
wire [3:0]   tlbread_length;
431
wire [3:0]   tlbread_length_full;
432
wire         tlbread_lock;
433
wire         tlbread_rmw;
434
wire [63:0]  tlbread_data;
435
 
436
 
437
//------------------------------------------------------------------------------
438
 
439
wire         tlbwrite_do;
440
wire         tlbwrite_done;
441
wire         tlbwrite_page_fault;
442
wire         tlbwrite_ac_fault;
443
 
444
wire [1:0]   tlbwrite_cpl;
445
wire [31:0]  tlbwrite_address;
446
wire [2:0]   tlbwrite_length;
447
wire [2:0]   tlbwrite_length_full;
448
wire         tlbwrite_lock;
449
wire         tlbwrite_rmw;
450
wire [31:0]  tlbwrite_data;
451
 
452
//------------------------------------------------------------------------------
453
 
454
wire        dcachetoicache_write_do;
455
wire [31:0] dcachetoicache_write_address;
456
 
457
//------------------------------------------------------------------------------
458
 
459
wire        dcachetoicache_accept_do;
460
wire [31:0] dcachetoicache_accept_address;
461
wire        dcachetoicache_accept_empty;
462
 
463
//------------------------------------------------------------------------------
464
 
465
wire        icacheread_do;
466
wire [31:0] icacheread_address;
467
wire [4:0]  icacheread_length; // takes into account: page size and cs segment limit
468
wire        icacheread_cache_disable;
469
 
470
//------------------------------------------------------------------------------
471
 
472
wire            prefetchfifo_write_do;
473
wire [135:0]    prefetchfifo_write_data;
474
 
475
//------------------------------------------------------------------------------
476
 
477
wire            prefetched_do;
478
wire [4:0]      prefetched_length;
479
 
480
//------------------------------------------------------------------------------
481
 
482
wire [31:0]     prefetch_address;
483
wire [4:0]      prefetch_length;
484
wire            prefetch_su;
485
 
486
//------------------------------------------------------------------------------
487
 
488
wire            prefetchfifo_signal_limit_do;
489
wire            prefetchfifo_signal_pf_do;
490
wire [4:0]      prefetchfifo_used;
491
 
492
//------------------------------------------------------------------------------
493
 
494
wire            tlbcoderequest_do;
495
wire [31:0]     tlbcoderequest_address;
496
wire            tlbcoderequest_su;
497
 
498
//------------------------------------------------------------------------------
499
 
500
wire            tlbcode_do;
501
wire [31:0]     tlbcode_linear;
502
wire [31:0]     tlbcode_physical;
503
wire            tlbcode_cache_disable;
504
 
505
//------------------------------------------------------------------------------
506
 
507
//------------------------------------------------------------------------------
508
 
509
avalon_mem avalon_mem_inst(
510
    // global
511
    .clk                        (clk),
512
    .rst_n                      (rst_n),
513
 
514
    //RESP:
515
    .writeburst_do              (resp_writeburst_do),           //input
516
    .writeburst_done            (resp_writeburst_done),         //output
517
 
518
    .writeburst_address         (resp_writeburst_address),      //input [31:0]
519
    .writeburst_dword_length    (resp_writeburst_dword_length), //input [1:0]
520
    .writeburst_byteenable_0    (resp_writeburst_byteenable_0), //input [3:0]
521
    .writeburst_byteenable_1    (resp_writeburst_byteenable_1), //input [3:0]
522
    .writeburst_data            (resp_writeburst_data),         //input [55:0]
523
    //END
524
 
525
    //RESP:
526
    .writeline_do               (resp_writeline_do),            //input
527
    .writeline_done             (resp_writeline_done),          //output
528
 
529
    .writeline_address          (resp_writeline_address),       //input [31:0]
530
    .writeline_line             (resp_writeline_line),          //input [127:0]
531
    //END
532
 
533
    //RESP:
534
    .readburst_do               (resp_readburst_do),            //input
535
    .readburst_done             (resp_readburst_done),          //output
536
 
537
    .readburst_address          (resp_readburst_address),       //input  [31:0]
538
    .readburst_dword_length     (resp_readburst_dword_length),  //input  [1:0]
539
    .readburst_byte_length      (resp_readburst_byte_length),   //input [3:0]
540
    .readburst_data             (resp_readburst_data),          //output [95:0]
541
    //END
542
 
543
    //RESP:
544
    .readline_do                (resp_readline_do),             //input
545
    .readline_done              (resp_readline_done),           //output
546
 
547
    .readline_address           (resp_readline_address),        //input [31:0]
548
    .readline_line              (resp_readline_line),           //output [127:0]
549
    //END
550
 
551
    //RESP:
552
    .readcode_do                (resp_readcode_do),             //input
553
    .readcode_done              (resp_readcode_done),           //output
554
 
555
    .readcode_address           (resp_readcode_address),        //input [31:0]
556
    .readcode_line              (resp_readcode_line),           //output [127:0]
557
    .readcode_partial           (resp_readcode_partial),        //output [31:0]
558
    .readcode_partial_done      (resp_readcode_partial_done),   //output
559
    //END
560
 
561
    // avalon master
562
    .avm_address                (avm_address),                  //output [31:0]
563
    .avm_writedata              (avm_writedata),                //output [31:0]
564
    .avm_byteenable             (avm_byteenable),               //output [3:0]
565
    .avm_burstcount             (avm_burstcount),               //output [2:0]
566
    .avm_write                  (avm_write),                    //output
567
    .avm_read                   (avm_read),                     //output
568
 
569
    .avm_waitrequest            (avm_waitrequest),              //input
570
    .avm_readdatavalid          (avm_readdatavalid),            //input
571
    .avm_readdata               (avm_readdata)                  //input [31:0]
572
);
573
 
574
//------------------------------------------------------------------------------
575
 
576
dcache dcache_inst(
577
    // global
578
    .clk                (clk),
579 7 alfik
    .rst_n              (rst_n),
580 2 alfik
 
581
    //RESP:
582
    .dcacheread_do              (resp_dcacheread_do),              //input
583
    .dcacheread_done            (resp_dcacheread_done),            //output
584
 
585
    .dcacheread_length          (resp_dcacheread_length),          //input [3:0]
586
    .dcacheread_cache_disable   (resp_dcacheread_cache_disable),   //input
587
    .dcacheread_address         (resp_dcacheread_address),         //input [31:0]
588
    .dcacheread_data            (resp_dcacheread_data),            //output [63:0]
589
    //END
590
 
591
    //RESP:
592
    .dcachewrite_do                 (resp_dcachewrite_do),                 //input
593
    .dcachewrite_done               (resp_dcachewrite_done),               //output
594
 
595
    .dcachewrite_length             (resp_dcachewrite_length),             //input [2:0]
596
    .dcachewrite_cache_disable      (resp_dcachewrite_cache_disable),      //input
597
    .dcachewrite_address            (resp_dcachewrite_address),            //input [31:0]
598
    .dcachewrite_write_through      (resp_dcachewrite_write_through),      //input
599
    .dcachewrite_data               (resp_dcachewrite_data),               //input [31:0]
600
    //END
601
 
602
    //REQ:
603
    .readline_do            (req_readline_do),      //output
604
    .readline_done          (req_readline_done),    //input
605
 
606
    .readline_address       (req_readline_address),   //output [31:0]
607
    .readline_line          (req_readline_line),      //input [127:0]
608
    //END
609
 
610
    //REQ:
611
    .readburst_do               (req_readburst_do),             //output
612
    .readburst_done             (req_readburst_done),           //input
613
 
614
    .readburst_address          (req_readburst_address),        //output [31:0]
615
    .readburst_dword_length     (req_readburst_dword_length),   //output [1:0]
616
    .readburst_byte_length      (req_readburst_byte_length),    //output [3:0]
617
    .readburst_data             (req_readburst_data),           //input [95:0]
618
    //END
619
 
620
    //REQ:
621
    .writeline_do               (req_writeline_do),         //output
622
    .writeline_done             (req_writeline_done),       //input
623
 
624
    .writeline_address          (req_writeline_address),    //output [31:0]
625
    .writeline_line             (req_writeline_line),       //output [127:0]
626
    //END
627
 
628
    //REQ:
629
    .writeburst_do              (req_writeburst_do),            //output
630
    .writeburst_done            (req_writeburst_done),          //input
631
 
632
    .writeburst_address         (req_writeburst_address),       //output [31:0]
633
    .writeburst_dword_length    (req_writeburst_dword_length),  //output [1:0]
634
    .writeburst_byteenable_0    (req_writeburst_byteenable_0),  //output [3:0]
635
    .writeburst_byteenable_1    (req_writeburst_byteenable_1),  //output [3:0]
636
    .writeburst_data            (req_writeburst_data),          //output [55:0]
637
    //END
638
 
639
    .dcachetoicache_write_do        (dcachetoicache_write_do),         //output
640
    .dcachetoicache_write_address   (dcachetoicache_write_address),    //output [31:0]
641
 
642
 
643
    //RESP:
644
    .invddata_do        (invddata_do),        //input
645
    .invddata_done      (invddata_done),      //output
646
    //END
647
 
648
    //RESP:
649
    .wbinvddata_do      (wbinvddata_do),      //input
650
    .wbinvddata_done    (wbinvddata_done),    //output
651
    //END
652
 
653
    .dcache_busy        (dcache_busy)           //output
654
);
655
 
656
//------------------------------------------------------------------------------
657
 
658
dcache_to_icache_fifo dcache_to_icache_fifo_inst(
659
    .clk            (clk),
660 7 alfik
    .rst_n          (rst_n),
661 2 alfik
 
662
    //RESP:
663
    .dcachetoicache_write_do        (dcachetoicache_write_do),        //input
664
    .dcachetoicache_write_address   (dcachetoicache_write_address),   //input [31:0]
665
    //END
666
 
667
 
668
    //RESP:
669
    .dcachetoicache_accept_do       (dcachetoicache_accept_do),       //input
670
    .dcachetoicache_accept_address  (dcachetoicache_accept_address),  //output [31:0]
671
    .dcachetoicache_accept_empty    (dcachetoicache_accept_empty)     //output
672
    //END
673
);
674
 
675
//------------------------------------------------------------------------------
676
 
677
icache icache_inst(
678
    .clk            (clk),
679 7 alfik
    .rst_n          (rst_n),
680 2 alfik
 
681
    //RESP:
682
    .pr_reset       (pr_reset),   //input
683
    //END
684
 
685
    //RESP:
686
    .icacheread_do              (icacheread_do),              //input
687
    .icacheread_address         (icacheread_address),         //input [31:0]
688
    .icacheread_length          (icacheread_length),          //input [4:0] // takes into account: page size and cs segment limit
689
    .icacheread_cache_disable   (icacheread_cache_disable),   //input
690
 
691
    //REQ:
692
    .readcode_do                (req_readcode_do),              //output
693
    .readcode_done              (req_readcode_done),            //input
694
 
695
    .readcode_address           (req_readcode_address),         //output [31:0]
696
    .readcode_line              (req_readcode_line),            //input [127:0]
697
    .readcode_partial           (req_readcode_partial),         //input [31:0]
698
    .readcode_partial_done      (req_readcode_partial_done),    //input
699
    //END
700
 
701
    //REQ:
702
    .dcachetoicache_accept_do       (dcachetoicache_accept_do),       //output
703
    .dcachetoicache_accept_address  (dcachetoicache_accept_address),  //input [31:0]
704
    .dcachetoicache_accept_empty    (dcachetoicache_accept_empty),    //input
705
    //END
706
 
707
    //REQ:
708
    .prefetchfifo_write_do      (prefetchfifo_write_do),      //output
709
    .prefetchfifo_write_data    (prefetchfifo_write_data),    //output [135:0]
710
    //END
711
 
712
    //REQ:
713
    .prefetched_do      (prefetched_do),      //output
714
    .prefetched_length  (prefetched_length),  //output [4:0]
715
    //END
716
 
717
    //RESP:
718
    .invdcode_do        (invdcode_do),    //input
719
    .invdcode_done      (invdcode_done)   //output
720
    //END
721
);
722
 
723
//------------------------------------------------------------------------------
724
 
725
memory_read memory_read_inst(
726
    // global
727
    .clk                (clk),
728 7 alfik
    .rst_n              (rst_n),
729 2 alfik
 
730
    // read step
731
    .rd_reset           (rd_reset),   //input
732
 
733
    //RESP:
734
    .read_do            (read_do),            //input
735
    .read_done          (read_done),          //output
736
    .read_page_fault    (read_page_fault),    //output
737
    .read_ac_fault      (read_ac_fault),      //output
738
 
739
    .read_cpl           (read_cpl),           //input [1:0]
740
    .read_address       (read_address),       //input [31:0]
741
    .read_length        (read_length),        //input [3:0]
742
    .read_lock          (read_lock),          //input
743
    .read_rmw           (read_rmw),           //input
744
    .read_data          (read_data),          //output [63:0]
745
    //END
746
 
747
    //REQ:
748
    .tlbread_do             (tlbread_do),             //output
749
    .tlbread_done           (tlbread_done),           //input
750
    .tlbread_page_fault     (tlbread_page_fault),     //input
751
    .tlbread_ac_fault       (tlbread_ac_fault),       //input
752
    .tlbread_retry          (tlbread_retry),          //input
753
 
754
    .tlbread_cpl            (tlbread_cpl),            //output [1:0]
755
    .tlbread_address        (tlbread_address),        //output [31:0]
756
    .tlbread_length         (tlbread_length),         //output [3:0]
757
    .tlbread_length_full    (tlbread_length_full),    //output [3:0]
758
    .tlbread_lock           (tlbread_lock),           //output
759
    .tlbread_rmw            (tlbread_rmw),            //output
760
    .tlbread_data           (tlbread_data)            //input [63:0]
761
    //END
762
 
763
);
764
 
765
//------------------------------------------------------------------------------
766
 
767
memory_write memory_write_inst(
768
    .clk                (clk),
769 7 alfik
    .rst_n              (rst_n),
770 2 alfik
 
771
    // write step
772
    .wr_reset           (wr_reset),   //input
773
 
774
    //RESP:
775
    .write_do           (write_do),           //input
776
    .write_done         (write_done),         //output
777
    .write_page_fault   (write_page_fault),   //output
778
    .write_ac_fault     (write_ac_fault),     //output
779
 
780
    .write_cpl          (write_cpl),          //input [1:0]
781
    .write_address      (write_address),      //input [31:0]
782
    .write_length       (write_length),       //input [2:0]
783
    .write_lock         (write_lock),         //input
784
    .write_rmw          (write_rmw),          //input
785
    .write_data         (write_data),         //input [31:0]
786
    //END
787
 
788
    //REQ:
789
    .tlbwrite_do            (tlbwrite_do),            //output
790
    .tlbwrite_done          (tlbwrite_done),          //input
791
    .tlbwrite_page_fault    (tlbwrite_page_fault),    //input
792
    .tlbwrite_ac_fault      (tlbwrite_ac_fault),      //input
793
 
794
    .tlbwrite_cpl           (tlbwrite_cpl),           //output [1:0]
795
    .tlbwrite_address       (tlbwrite_address),       //output [31:0]
796
    .tlbwrite_length        (tlbwrite_length),        //output [2:0]
797
    .tlbwrite_length_full   (tlbwrite_length_full),   //output [2:0]
798
    .tlbwrite_lock          (tlbwrite_lock),          //output
799
    .tlbwrite_rmw           (tlbwrite_rmw),           //output
800
    .tlbwrite_data          (tlbwrite_data)           //output [31:0]
801
    //END
802
 
803
);
804
 
805
//------------------------------------------------------------------------------
806
 
807
prefetch prefetch_inst(
808
    .clk                (clk),
809 7 alfik
    .rst_n              (rst_n),
810 2 alfik
 
811
    .pr_reset       (pr_reset),   //input
812
 
813
    // prefetch exported
814
    .prefetch_cpl   (prefetch_cpl),        //input [1:0]
815
    .prefetch_eip   (prefetch_eip),        //input [31:0]
816
    .cs_cache       (cs_cache),            //input [63:0]
817
 
818
    //to prefetch_control
819
    .prefetch_address   (prefetch_address),   //output [31:0]
820
    .prefetch_length    (prefetch_length),    //output [4:0]
821
    .prefetch_su        (prefetch_su),        //output
822
 
823
    //RESP:
824
    .prefetched_do      (prefetched_do),      //input
825
    .prefetched_length  (prefetched_length),  //input [4:0]
826
    //END
827
 
828
    //REQ:
829
    .prefetchfifo_signal_limit_do   (prefetchfifo_signal_limit_do)    //output
830
    //END
831
);
832
 
833
//------------------------------------------------------------------------------
834
 
835
prefetch_fifo prefetch_fifo_inst(
836
    .clk            (clk),
837 7 alfik
    .rst_n          (rst_n),
838 2 alfik
 
839
    .pr_reset       (pr_reset),   //input
840
 
841
    //RESP:
842
    .prefetchfifo_signal_limit_do    (prefetchfifo_signal_limit_do), //input
843
    //END
844
 
845
    //RESP:
846
    .prefetchfifo_signal_pf_do   (prefetchfifo_signal_pf_do),  //input
847
    //END
848
 
849
    //RESP:
850
    .prefetchfifo_write_do      (prefetchfifo_write_do),      //input
851
    .prefetchfifo_write_data    (prefetchfifo_write_data),    //input [135:0]
852
    //END
853
 
854
    .prefetchfifo_used   (prefetchfifo_used),    //output [4:0]
855
 
856
    //RESP:
857
    .prefetchfifo_accept_do     (prefetchfifo_accept_do),     //input
858
    .prefetchfifo_accept_data   (prefetchfifo_accept_data),   //output [67:0]
859
    .prefetchfifo_accept_empty  (prefetchfifo_accept_empty)   //output
860
    //END
861
);
862
 
863
//------------------------------------------------------------------------------
864
 
865
 
866
prefetch_control prefetch_control_inst(
867
    .clk                    (clk),
868 7 alfik
    .rst_n                  (rst_n),
869 2 alfik
 
870
    .pr_reset       (pr_reset), //input //same as reset to icache
871
 
872
    //REQ:
873
    .tlbcoderequest_do       (tlbcoderequest_do),      //output
874
    .tlbcoderequest_address  (tlbcoderequest_address), //output [31:0]
875
    .tlbcoderequest_su       (tlbcoderequest_su),      //output
876
    //END
877
 
878
    //RESP:
879
    .tlbcode_do             (tlbcode_do),             //input
880
    .tlbcode_linear         (tlbcode_linear),         //input [31:0]
881
    .tlbcode_physical       (tlbcode_physical),       //input [31:0]
882
    .tlbcode_cache_disable  (tlbcode_cache_disable),  //input
883
    //END
884
 
885
    //from prefetch
886
    .prefetch_address   (prefetch_address),   //input [31:0]
887
    .prefetch_length    (prefetch_length),    //input [4:0]
888
    .prefetch_su        (prefetch_su),        //input
889
 
890
    //from prefetchfifo
891
    .prefetchfifo_used  (prefetchfifo_used),  //input [4:0]
892
 
893
    //REQ
894
    .icacheread_do              (icacheread_do),              //output
895
    .icacheread_address         (icacheread_address),         //output [31:0]
896
    .icacheread_length          (icacheread_length),          //output [4:0] // takes into account: page size and cs segment limit
897
    .icacheread_cache_disable   (icacheread_cache_disable)    //output
898
    //END
899
);
900
 
901
 
902
 
903
//------------------------------------------------------------------------------
904
 
905
tlb tlb_inst(
906
    .clk                (clk),
907 7 alfik
    .rst_n              (rst_n),
908 2 alfik
 
909
    .pr_reset       (pr_reset),   //input
910
    .rd_reset       (rd_reset),   //input
911
    .exe_reset      (exe_reset),  //input
912
    .wr_reset       (wr_reset),   //input
913
 
914
    // tlb exported
915
    .cr0_pg                             (cr0_pg),                             //input
916
    .cr0_wp                             (cr0_wp),                             //input
917
    .cr0_am                             (cr0_am),                             //input
918
    .cr0_cd                             (cr0_cd),                             //input
919
    .cr0_nw                             (cr0_nw),                             //input
920
 
921
    .acflag                             (acflag),                             //input
922
 
923
    .cr3                                (cr3),                                //input [31:0]
924
 
925
    .pipeline_after_read_empty          (pipeline_after_read_empty),          //input
926
    .pipeline_after_prefetch_empty      (pipeline_after_prefetch_empty),      //input
927
 
928
    .tlb_code_pf_cr2         (tlb_code_pf_cr2),            //output [31:0]
929
    .tlb_code_pf_error_code  (tlb_code_pf_error_code),     //output [15:0]
930
 
931
    .tlb_check_pf_cr2        (tlb_check_pf_cr2),           //output [31:0]
932
    .tlb_check_pf_error_code (tlb_check_pf_error_code),    //output [15:0]
933
 
934
    .tlb_write_pf_cr2        (tlb_write_pf_cr2),           //output [31:0]
935
    .tlb_write_pf_error_code (tlb_write_pf_error_code),    //output [15:0]
936
 
937
    .tlb_read_pf_cr2         (tlb_read_pf_cr2),            //output [31:0]
938
    .tlb_read_pf_error_code  (tlb_read_pf_error_code),     //output [15:0]
939
 
940
    //RESP:
941
    .tlbflushsingle_do          (tlbflushsingle_do),          //input
942
    .tlbflushsingle_done        (tlbflushsingle_done),        //output
943
 
944
    .tlbflushsingle_address     (tlbflushsingle_address),     //input
945
    //END
946
 
947
    //RESP:
948
    .tlbflushall_do             (tlbflushall_do),             //input
949
    //END
950
 
951
    //RESP:
952
    .tlbread_do             (tlbread_do),             //input
953
    .tlbread_done           (tlbread_done),           //output
954
    .tlbread_page_fault     (tlbread_page_fault),     //output
955
    .tlbread_ac_fault       (tlbread_ac_fault),       //output
956
    .tlbread_retry          (tlbread_retry),          //output
957
 
958
    .tlbread_cpl            (tlbread_cpl),            //input [1:0]
959
    .tlbread_address        (tlbread_address),        //input [31:0]
960
    .tlbread_length         (tlbread_length),         //input [3:0]
961
    .tlbread_length_full    (tlbread_length_full),    //input [3:0]
962
    .tlbread_lock           (tlbread_lock),           //input
963
    .tlbread_rmw            (tlbread_rmw),            //input
964
    .tlbread_data           (tlbread_data),           //output [63:0]
965
    //END
966
 
967
    //RESP:
968
    .tlbwrite_do            (tlbwrite_do),            //input
969
    .tlbwrite_done          (tlbwrite_done),          //output
970
    .tlbwrite_page_fault    (tlbwrite_page_fault),    //output
971
    .tlbwrite_ac_fault      (tlbwrite_ac_fault),      //output
972
 
973
    .tlbwrite_cpl           (tlbwrite_cpl),           //input [1:0]
974
    .tlbwrite_address       (tlbwrite_address),       //input [31:0]
975
    .tlbwrite_length        (tlbwrite_length),        //input [2:0]
976
    .tlbwrite_length_full   (tlbwrite_length_full),   //input [2:0]
977
    .tlbwrite_lock          (tlbwrite_lock),          //input
978
    .tlbwrite_rmw           (tlbwrite_rmw),           //input
979
    .tlbwrite_data          (tlbwrite_data),          //input [31:0]
980
    //END
981
 
982
    //RESP:
983
    .tlbcheck_do            (tlbcheck_do),            //input
984
    .tlbcheck_done          (tlbcheck_done),          //output
985
    .tlbcheck_page_fault    (tlbcheck_page_fault),    //output
986
 
987
    .tlbcheck_address       (tlbcheck_address),       //input [31:0]
988
    .tlbcheck_rw            (tlbcheck_rw),            //input
989
    //END
990
 
991
    //REQ:
992
    .dcacheread_do              (req_dcacheread_do),
993
    .dcacheread_done            (req_dcacheread_done),
994
 
995
    .dcacheread_length          (req_dcacheread_length),
996
    .dcacheread_cache_disable   (req_dcacheread_cache_disable),
997
    .dcacheread_address         (req_dcacheread_address),
998
    .dcacheread_data            (req_dcacheread_data),
999
    //END
1000
 
1001
    //REQ:
1002
    .dcachewrite_do                 (req_dcachewrite_do),                 //output
1003
    .dcachewrite_done               (req_dcachewrite_done),               //input
1004
 
1005
    .dcachewrite_length             (req_dcachewrite_length),             //output [2:0]
1006
    .dcachewrite_cache_disable      (req_dcachewrite_cache_disable),      //output
1007
    .dcachewrite_address            (req_dcachewrite_address),            //output [31:0]
1008
    .dcachewrite_write_through      (req_dcachewrite_write_through),      //output
1009
    .dcachewrite_data               (req_dcachewrite_data),               //output [31:0]
1010
    //END
1011
 
1012
    //RESP:
1013
    .tlbcoderequest_do       (tlbcoderequest_do),          //input
1014
    .tlbcoderequest_address  (tlbcoderequest_address),     //input [31:0]
1015
    .tlbcoderequest_su       (tlbcoderequest_su),          //input
1016
    //END
1017
 
1018
    //REQ:
1019
    .tlbcode_do              (tlbcode_do),             //output
1020
    .tlbcode_linear          (tlbcode_linear),         //output [31:0]
1021
    .tlbcode_physical        (tlbcode_physical),       //output [31:0]
1022
    .tlbcode_cache_disable   (tlbcode_cache_disable),  //output
1023
    //END
1024
 
1025
    //REQ:
1026
    .prefetchfifo_signal_pf_do   (prefetchfifo_signal_pf_do)     //output
1027
    //END
1028
);
1029
 
1030
 
1031
 
1032
endmodule

powered by: WebSVN 2.1.0

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