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

Subversion Repositories m32632

[/] [m32632/] [trunk/] [rtl/] [DCACHE.v] - Blame information for rev 49

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 29 ns32kum
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 9 ns32kum
//
3
// This file is part of the M32632 project
4
// http://opencores.org/project,m32632
5
//
6 23 ns32kum
//      Filename:       DCACHE.v
7 49 ns32kum
//      Version:        3.2 bug fix     
8
//  History:    3.0 Cache Interface reworked
9
//                              2.1 bug fix of November 2016
10 29 ns32kum
//                              2.0 50 MHz release of 14 August 2016
11
//                              1.1 bug fix of 7 October 2015
12 23 ns32kum
//                              1.0 first release of 30 Mai 2015
13 49 ns32kum
//      Date:           17 January 2021
14 9 ns32kum
//
15 49 ns32kum
// Copyright (C) 2021 Udo Moeller
16 9 ns32kum
// 
17
// This source file may be used and distributed without 
18
// restriction provided that this copyright statement is not 
19
// removed from the file and that any derivative work contains 
20
// the original copyright notice and the associated disclaimer.
21
// 
22
// This source file is free software; you can redistribute it 
23
// and/or modify it under the terms of the GNU Lesser General 
24
// Public License as published by the Free Software Foundation;
25
// either version 2.1 of the License, or (at your option) any 
26
// later version. 
27
// 
28
// This source is distributed in the hope that it will be 
29
// useful, but WITHOUT ANY WARRANTY; without even the implied 
30
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
31
// PURPOSE. See the GNU Lesser General Public License for more 
32
// details. 
33
// 
34
// You should have received a copy of the GNU Lesser General 
35
// Public License along with this source; if not, download it 
36
// from http://www.opencores.org/lgpl.shtml 
37
// 
38 29 ns32kum
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
39 9 ns32kum
//
40
//      Modules contained in this file:
41
//      DCACHE          the data cache of M32632
42
//
43 11 ns32kum
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
44 9 ns32kum
 
45 29 ns32kum
module DCACHE(  BCLK, DRAMSZ, MDONE, BRESET, PTB_WR, PTB_SEL, IO_READY, CTRL_QW, PSR_USER, WRITE, READ, RMW,
46
                                QWATWO, ENWR, IC_PREQ, DMA_CHK, CFG, CINVAL, DMA_AA, DP_Q, DRAM_Q, IC_VA, ICTODC, IO_Q, IVAR,
47
                                MCR_FLAGS, PACKET, SIZE, VADR, INHIBIT, IO_RD, IO_WR, DRAM_ACC, DRAM_WR, INIT_RUN, PTE_STAT, KDET,
48 23 ns32kum
                                HLDA, ACC_STAT, DP_DI, DRAM_A, DRAM_DI, IACC_STAT, IC_SIGS, IO_A, IO_BE, IO_DI, KOLLI_A, MMU_DIN, ZTEST,
49 9 ns32kum
                                RWVAL, RWVFLAG, DBG_IN, DBG_HIT, ENDRAM );
50
 
51
input                   BCLK;
52 23 ns32kum
input    [2:0]   DRAMSZ;
53 9 ns32kum
input                   MDONE;
54
input                   BRESET;
55
input                   PTB_WR;
56
input                   PTB_SEL;
57
input                   IO_READY;
58 29 ns32kum
input    [1:0]   CTRL_QW;
59 9 ns32kum
input                   PSR_USER;
60
input                   WRITE;
61
input                   READ;
62
input                   ZTEST;
63
input                   RMW;
64 12 ns32kum
input                   QWATWO;
65 9 ns32kum
input                   ENWR;
66
input                   IC_PREQ;
67 23 ns32kum
input                   DMA_CHK;
68 9 ns32kum
input    [1:0]   CFG;
69
input    [1:0]   CINVAL;
70 29 ns32kum
input   [28:4]  DMA_AA;
71 9 ns32kum
input   [63:0]   DP_Q;
72 29 ns32kum
input  [127:0]   DRAM_Q;
73 9 ns32kum
input  [31:12]  IC_VA;
74
input    [3:0]   ICTODC;
75
input   [31:0]   IO_Q;
76
input    [1:0]   IVAR;
77
input    [3:0]   MCR_FLAGS;
78
input    [3:0]   PACKET;
79
input    [1:0]   SIZE;
80
input   [31:0]   VADR;
81 29 ns32kum
input                   INHIBIT;
82 9 ns32kum
input    [2:0]   RWVAL;
83
input   [40:2]  DBG_IN;
84
input                   ENDRAM;
85
 
86
output                  IO_RD;
87
output                  IO_WR;
88
output                  DRAM_ACC;
89
output                  DRAM_WR;
90
output                  INIT_RUN;
91
output   [1:0]   PTE_STAT;
92
output                  KDET;
93
output                  HLDA;
94
output                  RWVFLAG;
95
output   [5:0]   ACC_STAT;
96
output  [31:0]   DP_DI;
97
output   [3:1]  IACC_STAT;
98
output   [1:0]   IC_SIGS;
99 29 ns32kum
output  [28:4]  KOLLI_A;
100 9 ns32kum
output  [23:0]   MMU_DIN;
101 29 ns32kum
output reg      [28:0]   DRAM_A;
102 9 ns32kum
output reg      [35:0]   DRAM_DI;
103
output reg      [31:0]   IO_A;
104
output reg       [3:0]   IO_BE;
105
output reg      [31:0]   IO_DI;
106
output                  DBG_HIT;
107
 
108
reg             [31:0]   DFFE_IOR;
109
reg             [31:0]   CAPDAT;
110
reg             [31:0]   VADR_R;
111
reg                             AUX_ALT;
112
reg                             DFF_QWEXT;
113 29 ns32kum
reg             [11:4]  KOLLI_AR;
114 9 ns32kum
 
115 29 ns32kum
wire    [28:4]  ADDR;
116 9 ns32kum
wire                    ADR_EQU;
117
wire                    AUX_DAT;
118
wire                    CA_HIT;
119
wire                    CA_SET;
120
wire                    CUPDATE;
121
wire                    DMA_MUX;
122
wire     [3:0]   ENBYTE;
123
wire                    HIT_ALL;
124
wire                    INIT_CA_RUN;
125
wire                    IO_ACC;
126
wire                    IO_SPACE;
127
wire                    KOMUX;
128
wire                    MMU_HIT;
129
wire                    NEW_PTB;
130
wire                    PTB_ONE;
131 29 ns32kum
wire    [28:0]   PTE_ADR;
132 9 ns32kum
wire   [31:12]  RADR;
133
wire    [11:4]  TAGA;
134
wire    [23:0]   UPDATE_C;
135
wire    [31:0]   UPDATE_M;
136
wire                    USE_CA;
137
wire                    USER;
138
wire                    WB_ACC;
139
wire                    WEMV;
140
wire                    WR_MRAM;
141
wire    [31:0]   WRDATA;
142
wire                    VIRT_A;
143
wire                    PTE_MUX;
144
wire                    WE_CV;
145
wire    [23:0]   DAT_CV;
146
wire     [4:0]   WADR_CV;
147
wire                    WRSET0;
148 29 ns32kum
wire    [15:0]   BE_SET;
149
wire   [127:0]   DAT_SET;
150
wire    [31:0]   CAP_Q;
151 9 ns32kum
wire                    WRSET1;
152
wire                    SEL_PTB1;
153
wire                    CI;
154 29 ns32kum
wire    [28:0]   ADR_MX;
155 9 ns32kum
wire                    LD_DRAM_A;
156
wire                    VIRTUELL;
157
wire                    NEW_PTB_RUN;
158
wire                    KILL;
159
wire                    LAST_MUX;
160
wire    [31:0]   SET_DAT;
161
wire    [31:0]   ALT_DAT;
162
wire    [31:0]   DAT_MV;
163
wire     [3:0]   RADR_MV;
164
wire     [3:0]   WADR_MV;
165
wire    [31:0]   LAST_DAT;
166
wire                    WRCRAM0;
167
wire                    WRCRAM1;
168
wire                    PROT_ERROR;
169
wire                    AUX_QW;
170
wire                    PD_MUX;
171
wire    [19:0]   PTE_DAT;
172
wire                    PKEEP;
173 29 ns32kum
wire                    XADDR2;
174
wire   [28:12]  TAGDAT;
175 49 ns32kum
wire                    clr_up;
176 9 ns32kum
 
177
// +++++++++++++++++++ Memories ++++++++++++++++++++
178
 
179 29 ns32kum
reg              [7:0]   DATA0_P [0:255]; // Data Set 0 : 4 kBytes
180
reg              [7:0]   DATA0_O [0:255];
181
reg              [7:0]   DATA0_N [0:255];
182
reg              [7:0]   DATA0_M [0:255];
183
reg              [7:0]   DATA0_L [0:255]; // Data Set 0 : 4 kBytes
184
reg              [7:0]   DATA0_K [0:255];
185
reg              [7:0]   DATA0_J [0:255];
186
reg              [7:0]   DATA0_I [0:255];
187
reg              [7:0]   DATA0_H [0:255]; // Data Set 0 : 4 kBytes
188
reg              [7:0]   DATA0_G [0:255];
189
reg              [7:0]   DATA0_F [0:255];
190
reg              [7:0]   DATA0_E [0:255];
191
reg              [7:0]   DATA0_D [0:255]; // Data Set 0 : 4 kBytes
192
reg              [7:0]   DATA0_C [0:255];
193
reg              [7:0]   DATA0_B [0:255];
194
reg              [7:0]   DATA0_A [0:255];
195
reg        [127:0]       RDDATA0;
196 9 ns32kum
reg             [31:0]   SET_DAT0;
197
 
198 29 ns32kum
reg              [7:0]   DATA1_P [0:255]; // Data Set 1 : 4 kBytes
199
reg              [7:0]   DATA1_O [0:255];
200
reg              [7:0]   DATA1_N [0:255];
201
reg              [7:0]   DATA1_M [0:255];
202
reg              [7:0]   DATA1_L [0:255]; // Data Set 1 : 4 kBytes
203
reg              [7:0]   DATA1_K [0:255];
204
reg              [7:0]   DATA1_J [0:255];
205
reg              [7:0]   DATA1_I [0:255];
206
reg              [7:0]   DATA1_H [0:255]; // Data Set 1 : 4 kBytes
207
reg              [7:0]   DATA1_G [0:255];
208
reg              [7:0]   DATA1_F [0:255];
209
reg              [7:0]   DATA1_E [0:255];
210
reg              [7:0]   DATA1_D [0:255]; // Data Set 1 : 4 kBytes
211
reg              [7:0]   DATA1_C [0:255];
212
reg              [7:0]   DATA1_B [0:255];
213
reg              [7:0]   DATA1_A [0:255];
214
reg        [127:0]       RDDATA1;
215 9 ns32kum
reg             [31:0]   SET_DAT1;
216
 
217 29 ns32kum
reg             [16:0]   TAGSET_0 [0:255];        // Tag Set for Data Set 0 : 256 entries of 17 bits
218
reg             [16:0]   TAG0;
219 9 ns32kum
 
220 29 ns32kum
reg             [16:0]   TAGSET_1 [0:255];        // Tag Set for Data Set 1 : 256 entries of 17 bits
221
reg             [16:0]   TAG1;
222 9 ns32kum
 
223 23 ns32kum
wire    [23:0]   CVALID;
224 9 ns32kum
 
225
reg             [35:0]   MMU_TAGS [0:255];        // Tag Set for MMU : 256 entries of 36 bits
226
reg             [35:0]   MMU_Q;
227
 
228
reg             [31:0]   MMU_VALID [0:15];        // Valid bits for MMU Tag Set : 16 entries of 32 bits
229
reg             [31:0]   MVALID;
230
 
231
assign  ALT_DAT = AUX_ALT ? DFFE_IOR : CAPDAT ;
232
 
233
assign  RADR    = VIRT_A ? MMU_Q[19:0] : VADR_R[31:12] ;
234
 
235 29 ns32kum
assign  ADR_MX  = PTE_MUX ? PTE_ADR : {RADR[28:12],VADR_R[11:2],USE_CA,CA_SET} ;
236 9 ns32kum
 
237 29 ns32kum
assign  KOLLI_A = DMA_MUX ? DMA_AA : DRAM_A[28:4] ;
238 9 ns32kum
 
239
assign  SET_DAT = CA_SET ? SET_DAT1 : SET_DAT0 ;
240
 
241
assign  VIRT_A  = ~CINVAL[0] & VIRTUELL;
242
 
243
assign  USER    = ~MCR_FLAGS[3] & PSR_USER;
244
 
245 29 ns32kum
assign  ADDR    = KDET ? {KOLLI_A[28:12],KOLLI_AR} : {RADR[28:12],VADR_R[11:4]} ;
246 9 ns32kum
 
247
assign  TAGA    = KOMUX ? KOLLI_A[11:4] : VADR[11:4] ;
248
 
249
assign  INIT_RUN = NEW_PTB_RUN | INIT_CA_RUN;
250
 
251
assign  LAST_MUX = AUX_ALT | AUX_DAT | AUX_QW;
252
 
253
assign  LAST_DAT = LAST_MUX ? ALT_DAT : SET_DAT ;
254
 
255
assign  LD_DRAM_A = ~(DRAM_ACC | PKEEP);
256
 
257
assign  ACC_STAT[4] = IO_ACC;
258
assign  ACC_STAT[5] = CA_HIT;
259
 
260 29 ns32kum
assign  XADDR2 = VADR_R[2] ^ CTRL_QW[1];
261
 
262
always @(posedge BCLK) KOLLI_AR <= KOLLI_A[11:4];
263
 
264 9 ns32kum
always @(posedge BCLK)
265
        if (IO_ACC)
266
                begin
267
                        IO_BE <= ENBYTE;
268
                        IO_DI <= WRDATA;
269 29 ns32kum
                        IO_A  <= {RADR[31:12],VADR_R[11:3],XADDR2,VADR_R[1:0]};
270 9 ns32kum
                end
271
 
272 29 ns32kum
always @(posedge BCLK) if (LD_DRAM_A) DRAM_A[28:0] <= ADR_MX[28:0];
273 9 ns32kum
 
274
always @(posedge BCLK) if (IO_RD) DFFE_IOR <= IO_Q;
275
 
276
always @(posedge BCLK)
277
        begin
278
                DRAM_DI   <= {(PD_MUX ? PTE_DAT[19:16] : ENBYTE),WRDATA[31:16],
279
                                          (PD_MUX ? PTE_DAT[15:0]  : WRDATA[15:0])};
280
                AUX_ALT   <= DFF_QWEXT | IO_RD;
281
                DFF_QWEXT <= IO_RD & SIZE[0] & SIZE[1];
282 49 ns32kum
                VADR_R[23:0] <= VADR[23:0];
283 9 ns32kum
        end
284
 
285 49 ns32kum
assign clr_up = ~(DRAMSZ == 3'd0);
286
always @(posedge BCLK or negedge clr_up)
287
        if (!clr_up) VADR_R[31:24] <= 8'd0;
288
                else VADR_R[31:24] <= VADR[31:24];
289
 
290 29 ns32kum
always @(posedge BCLK) if (MDONE) CAPDAT <= CAP_Q;
291 9 ns32kum
 
292
// +++++++++++++++++++++++++  Cache Valid  +++++++++++++++++++
293
 
294 23 ns32kum
NEU_VALID       VALID_RAM(
295
        .BCLK(BCLK),
296
        .VALIN(DAT_CV),
297
        .WADR(WADR_CV),
298
        .WREN(WE_CV),
299
        .RADR(TAGA[11:7]),
300
        .VALOUT(CVALID) );
301 9 ns32kum
 
302
// +++++++++++++++++++++++++  Tag Set 0  +++++++++++++++++++++
303
 
304
always @(posedge BCLK) TAG0 <= TAGSET_0[TAGA];
305
 
306 29 ns32kum
always @(negedge BCLK) if (WRCRAM0) TAGSET_0[VADR_R[11:4]] <= TAGDAT;
307 9 ns32kum
 
308
// +++++++++++++++++++++++++  Tag Set 1  +++++++++++++++++++++
309
 
310
always @(posedge BCLK) TAG1 <= TAGSET_1[TAGA];
311
 
312 29 ns32kum
always @(negedge BCLK) if (WRCRAM1) TAGSET_1[VADR_R[11:4]] <= TAGDAT;
313 9 ns32kum
 
314 29 ns32kum
// +++++++++++++++++++++++++  DIN MUX  +++++++++++++++++++++++
315
 
316
WRPORT  DINMUX(
317
        .WRITE(WRITE),
318
        .DRAM_Q(DRAM_Q),
319
        .DADDR(DRAM_A[3:2]),
320
        .VADDR(VADR_R[3:2]),
321
        .WRDATA(WRDATA),
322
        .ENBYTE(ENBYTE),
323
        .CAP_Q(CAP_Q),
324
        .WDAT(DAT_SET),
325
        .ENB(BE_SET) );
326
 
327 9 ns32kum
// +++++++++++++++++++++++++  Data Set 0  ++++++++++++++++++++
328
 
329
always @(posedge BCLK)
330
        begin
331 29 ns32kum
                RDDATA0[127:120]        <= DATA0_P[VADR[11:4]];
332
                RDDATA0[119:112]        <= DATA0_O[VADR[11:4]];
333
                RDDATA0[111:104]        <= DATA0_N[VADR[11:4]];
334
                RDDATA0[103:96]         <= DATA0_M[VADR[11:4]];
335
                RDDATA0[95:88]          <= DATA0_L[VADR[11:4]];
336
                RDDATA0[87:80]          <= DATA0_K[VADR[11:4]];
337
                RDDATA0[79:72]          <= DATA0_J[VADR[11:4]];
338
                RDDATA0[71:64]          <= DATA0_I[VADR[11:4]];
339
                RDDATA0[63:56]          <= DATA0_H[VADR[11:4]];
340
                RDDATA0[55:48]          <= DATA0_G[VADR[11:4]];
341
                RDDATA0[47:40]          <= DATA0_F[VADR[11:4]];
342
                RDDATA0[39:32]          <= DATA0_E[VADR[11:4]];
343
                RDDATA0[31:24]          <= DATA0_D[VADR[11:4]];
344
                RDDATA0[23:16]          <= DATA0_C[VADR[11:4]];
345
                RDDATA0[15:8]           <= DATA0_B[VADR[11:4]];
346
                RDDATA0[7:0]             <= DATA0_A[VADR[11:4]];
347 9 ns32kum
        end
348
 
349 29 ns32kum
always @(RDDATA0 or VADR_R)
350
        case (VADR_R[3:2])
351
          2'b00 : SET_DAT0 <= RDDATA0[31:0];
352
          2'b01 : SET_DAT0 <= RDDATA0[63:32];
353
          2'b10 : SET_DAT0 <= RDDATA0[95:64];
354
          2'b11 : SET_DAT0 <= RDDATA0[127:96];
355
        endcase
356
 
357
always @(posedge BCLK)
358 9 ns32kum
        if (WRSET0)
359
                begin
360 29 ns32kum
                        if (BE_SET[15]) DATA0_P[VADR_R[11:4]] <= DAT_SET[127:120];
361
                        if (BE_SET[14]) DATA0_O[VADR_R[11:4]] <= DAT_SET[119:112];
362
                        if (BE_SET[13]) DATA0_N[VADR_R[11:4]] <= DAT_SET[111:104];
363
                        if (BE_SET[12]) DATA0_M[VADR_R[11:4]] <= DAT_SET[103:96];
364
                        if (BE_SET[11]) DATA0_L[VADR_R[11:4]] <= DAT_SET[95:88];
365
                        if (BE_SET[10]) DATA0_K[VADR_R[11:4]] <= DAT_SET[87:80];
366
                        if (BE_SET[9])  DATA0_J[VADR_R[11:4]] <= DAT_SET[79:72];
367
                        if (BE_SET[8])  DATA0_I[VADR_R[11:4]] <= DAT_SET[71:64];
368
                        if (BE_SET[7])  DATA0_H[VADR_R[11:4]] <= DAT_SET[63:56];
369
                        if (BE_SET[6])  DATA0_G[VADR_R[11:4]] <= DAT_SET[55:48];
370
                        if (BE_SET[5])  DATA0_F[VADR_R[11:4]] <= DAT_SET[47:40];
371
                        if (BE_SET[4])  DATA0_E[VADR_R[11:4]] <= DAT_SET[39:32];
372
                        if (BE_SET[3])  DATA0_D[VADR_R[11:4]] <= DAT_SET[31:24];
373
                        if (BE_SET[2])  DATA0_C[VADR_R[11:4]] <= DAT_SET[23:16];
374
                        if (BE_SET[1])  DATA0_B[VADR_R[11:4]] <= DAT_SET[15:8];
375
                        if (BE_SET[0])  DATA0_A[VADR_R[11:4]] <= DAT_SET[7:0];
376 9 ns32kum
                end
377
 
378
// +++++++++++++++++++++++++  Data Set 1  ++++++++++++++++++++
379
 
380
always @(posedge BCLK)
381
        begin
382 29 ns32kum
                RDDATA1[127:120]        <= DATA1_P[VADR[11:4]];
383
                RDDATA1[119:112]        <= DATA1_O[VADR[11:4]];
384
                RDDATA1[111:104]        <= DATA1_N[VADR[11:4]];
385
                RDDATA1[103:96]         <= DATA1_M[VADR[11:4]];
386
                RDDATA1[95:88]          <= DATA1_L[VADR[11:4]];
387
                RDDATA1[87:80]          <= DATA1_K[VADR[11:4]];
388
                RDDATA1[79:72]          <= DATA1_J[VADR[11:4]];
389
                RDDATA1[71:64]          <= DATA1_I[VADR[11:4]];
390
                RDDATA1[63:56]          <= DATA1_H[VADR[11:4]];
391
                RDDATA1[55:48]          <= DATA1_G[VADR[11:4]];
392
                RDDATA1[47:40]          <= DATA1_F[VADR[11:4]];
393
                RDDATA1[39:32]          <= DATA1_E[VADR[11:4]];
394
                RDDATA1[31:24]          <= DATA1_D[VADR[11:4]];
395
                RDDATA1[23:16]          <= DATA1_C[VADR[11:4]];
396
                RDDATA1[15:8]           <= DATA1_B[VADR[11:4]];
397
                RDDATA1[7:0]             <= DATA1_A[VADR[11:4]];
398 9 ns32kum
        end
399
 
400 29 ns32kum
always @(RDDATA1 or VADR_R)
401
        case (VADR_R[3:2])
402
          2'b00 : SET_DAT1 <= RDDATA1[31:0];
403
          2'b01 : SET_DAT1 <= RDDATA1[63:32];
404
          2'b10 : SET_DAT1 <= RDDATA1[95:64];
405
          2'b11 : SET_DAT1 <= RDDATA1[127:96];
406
        endcase
407
 
408
always @(posedge BCLK)
409 9 ns32kum
        if (WRSET1)
410
                begin
411 29 ns32kum
                        if (BE_SET[15]) DATA1_P[VADR_R[11:4]] <= DAT_SET[127:120];
412
                        if (BE_SET[14]) DATA1_O[VADR_R[11:4]] <= DAT_SET[119:112];
413
                        if (BE_SET[13]) DATA1_N[VADR_R[11:4]] <= DAT_SET[111:104];
414
                        if (BE_SET[12]) DATA1_M[VADR_R[11:4]] <= DAT_SET[103:96];
415
                        if (BE_SET[11]) DATA1_L[VADR_R[11:4]] <= DAT_SET[95:88];
416
                        if (BE_SET[10]) DATA1_K[VADR_R[11:4]] <= DAT_SET[87:80];
417
                        if (BE_SET[9])  DATA1_J[VADR_R[11:4]] <= DAT_SET[79:72];
418
                        if (BE_SET[8])  DATA1_I[VADR_R[11:4]] <= DAT_SET[71:64];
419
                        if (BE_SET[7])  DATA1_H[VADR_R[11:4]] <= DAT_SET[63:56];
420
                        if (BE_SET[6])  DATA1_G[VADR_R[11:4]] <= DAT_SET[55:48];
421
                        if (BE_SET[5])  DATA1_F[VADR_R[11:4]] <= DAT_SET[47:40];
422
                        if (BE_SET[4])  DATA1_E[VADR_R[11:4]] <= DAT_SET[39:32];
423
                        if (BE_SET[3])  DATA1_D[VADR_R[11:4]] <= DAT_SET[31:24];
424
                        if (BE_SET[2])  DATA1_C[VADR_R[11:4]] <= DAT_SET[23:16];
425
                        if (BE_SET[1])  DATA1_B[VADR_R[11:4]] <= DAT_SET[15:8];
426
                        if (BE_SET[0])  DATA1_A[VADR_R[11:4]] <= DAT_SET[7:0];
427 9 ns32kum
                end
428
 
429
DCACHE_SM       DC_SM(
430
        .BCLK(BCLK),
431
        .BRESET(BRESET),
432
        .VIRTUELL(VIRTUELL),
433
        .IO_SPACE(IO_SPACE),
434
        .MDONE(MDONE),
435
        .MMU_HIT(MMU_HIT),
436
        .CA_HIT(CA_HIT),
437
        .READ(READ),
438
        .WRITE(WRITE),
439
        .ZTEST(ZTEST),
440
        .RMW(RMW),
441 12 ns32kum
        .QWATWO(QWATWO),
442 9 ns32kum
        .USE_CA(USE_CA),
443
        .PTB_WR(PTB_WR),
444
        .PTB_SEL(PTB_SEL),
445
        .SEL_PTB1(SEL_PTB1),
446
        .IO_READY(IO_READY),
447
        .USER(USER),
448
        .PROTECT(ACC_STAT[3]),
449
        .PROT_ERROR(PROT_ERROR),
450
        .ENWR(ENWR),
451
        .WB_ACC(WB_ACC),
452
        .ADR_EQU(ADR_EQU),
453
        .IC_PREQ(IC_PREQ),
454
        .CAPDAT(CAPDAT[31:0]),
455 29 ns32kum
        .CPU_OUT(DP_Q[60:44]),
456 23 ns32kum
        .DMA_CHK(DMA_CHK),
457 9 ns32kum
        .IC_VA(IC_VA),
458
        .ICTODC(ICTODC),
459
        .VADR_R(VADR_R[31:12]),
460
        .NEW_PTB(NEW_PTB),
461
        .PTB_ONE(PTB_ONE),
462
        .DRAM_ACC(DRAM_ACC),
463
        .DRAM_WR(DRAM_WR),
464
        .IO_ACC(IO_ACC),
465
        .IO_RD(IO_RD),
466
        .IO_WR(IO_WR),
467
        .PTE_STAT(PTE_STAT),
468
        .ABORT(ACC_STAT[1]),
469
        .WR_MRAM(WR_MRAM),
470
        .CUPDATE(CUPDATE),
471
        .AUX_DAT(AUX_DAT),
472
        .PTE_MUX(PTE_MUX),
473
        .ACC_OK(ACC_STAT[0]),
474
        .ABO_LEVEL1(ACC_STAT[2]),
475
        .IACC_STAT(IACC_STAT),
476
        .KOMUX(KOMUX),
477
        .KDET(KDET),
478
        .HIT_ALL(HIT_ALL),
479
        .DMA_MUX(DMA_MUX),
480
        .HLDA(HLDA),
481
        .RWVAL(RWVAL[1:0]),
482
        .RWVFLAG(RWVFLAG),
483
        .IC_SIGS(IC_SIGS),
484
        .MMU_DIN(MMU_DIN),
485
        .PD_MUX(PD_MUX),
486
        .PKEEP(PKEEP),
487
        .PTE_ADR(PTE_ADR),
488
        .PTE_DAT(PTE_DAT));
489
 
490
CA_MATCH        DCA_COMPARE(
491
        .INVAL_L(CINVAL[0]),
492
        .CI(CI),
493
        .MMU_HIT(MMU_HIT),
494
        .WRITE(WRITE),
495
        .KDET(KDET),
496 29 ns32kum
        .ADDR({RADR[31:29],ADDR}),
497 9 ns32kum
        .CFG(CFG),
498
        .ENDRAM(ENDRAM),
499
        .CVALID(CVALID),
500
        .TAG0(TAG0),
501
        .TAG1(TAG1),
502
        .CA_HIT(CA_HIT),
503
        .CA_SET(CA_SET),
504
        .WB_ACC(WB_ACC),
505
        .USE_CA(USE_CA),
506 23 ns32kum
        .DRAMSZ(DRAMSZ),
507 9 ns32kum
        .IO_SPACE(IO_SPACE),
508
        .KILL(KILL),
509
        .DC_ILO(RWVAL[2]),
510
        .UPDATE(UPDATE_C));
511
 
512
DCA_CONTROL     DCA_CTRL(
513
        .BCLK(BCLK),
514
        .BRESET(BRESET),
515
        .CA_SET(CA_SET),
516
        .HIT_ALL(HIT_ALL),
517
        .UPDATE(UPDATE_C),
518
        .VADR_R(ADDR[11:7]),
519
        .DRAM_ACC(DRAM_ACC),
520
        .CUPDATE(CUPDATE),
521
        .KILL(KILL),
522
        .WRITE(WRITE),
523 29 ns32kum
        .USE_CA(DRAM_A[1]),
524
        .INHIBIT(INHIBIT),
525 9 ns32kum
        .INVAL_A(CINVAL[1]),
526 29 ns32kum
        .MDONE(MDONE),
527 9 ns32kum
        .DAT_CV(DAT_CV),
528
        .WADR_CV(WADR_CV),
529
        .WE_CV(WE_CV),
530
        .INIT_CA_RUN(INIT_CA_RUN),
531
        .WRCRAM0(WRCRAM0),
532
        .WRCRAM1(WRCRAM1),
533
        .WRSET0(WRSET0),
534
        .WRSET1(WRSET1));
535
 
536
MMU_MATCH       MMU_COMPARE(
537
        .USER(USER),
538
        .WRITE(WRITE),
539
        .READ(READ),
540
        .RMW(RMW),
541
        .IVAR(IVAR),
542
        .MCR_FLAGS(MCR_FLAGS[2:0]),
543
        .MMU_VA(MMU_Q[35:20]),
544
        .MVALID(MVALID),
545
        .VADR_R(VADR_R[31:12]),
546
        .MMU_HIT(MMU_HIT),
547
        .PROT_ERROR(PROT_ERROR),
548
        .VIRTUELL(VIRTUELL),
549
        .CI(CI),
550
        .SEL_PTB1(SEL_PTB1),
551
        .UPDATE(UPDATE_M));
552
 
553
MMU_UP  MMU_CTRL(
554
        .BCLK(BCLK),
555
        .BRESET(BRESET),
556
        .NEW_PTB(NEW_PTB),
557
        .IVAR(IVAR[1]),
558
        .PTB1(PTB_ONE),
559
        .WR_MRAM(WR_MRAM),
560
        .MVALID(MVALID),
561
        .UPDATE(UPDATE_M),
562
        .VADR(VADR[19:16]),
563
        .VADR_R(VADR_R[19:16]),
564
        .WE_MV(WEMV),
565
        .NEW_PTB_RUN(NEW_PTB_RUN),
566
        .DAT_MV(DAT_MV),
567
        .RADR_MV(RADR_MV),
568
        .WADR_MV(WADR_MV));
569
 
570
// +++++++++++++++++++++++++  MMU Valid  +++++++++++++++++++++
571
 
572
always @(posedge BCLK) MVALID <= MMU_VALID[RADR_MV];
573
 
574
always @(negedge BCLK) if (WEMV) MMU_VALID[WADR_MV] <= DAT_MV;
575
 
576
// +++++++++++++++++++++++++  MMU Tags  ++++++++++++++++++++++
577
 
578
always @(posedge BCLK) MMU_Q <= MMU_TAGS[VADR[19:12]];
579
 
580
always @(negedge BCLK) if (WR_MRAM) MMU_TAGS[VADR_R[19:12]] <= {VADR_R[31:20],MMU_DIN[23:0]};
581
 
582
RD_ALIGNER      RD_ALI(
583
        .BCLK(BCLK),
584
        .ACC_OK(ACC_STAT[0]),
585 29 ns32kum
        .REG_OUT(CTRL_QW[0]),
586 9 ns32kum
        .PACKET(PACKET),
587
        .RDDATA(LAST_DAT),
588
        .SIZE(SIZE),
589
        .CA_HIT(CA_HIT),
590
        .DP_DI(DP_DI),
591
        .AUX_QW(AUX_QW));
592
 
593
WR_ALIGNER      WR_ALI(
594
        .DP_Q(DP_Q),
595
        .PACKET(PACKET),
596
        .SIZE(SIZE),
597
        .ENBYTE(ENBYTE),
598
        .WRDATA(WRDATA));
599
 
600 29 ns32kum
DEBUG_AE  DBGAE(
601 9 ns32kum
        .DBG_IN(DBG_IN),
602
        .READ(READ),
603
        .WRITE(WRITE),
604
        .USER(USER),
605
        .VIRTUELL(VIRTUELL),
606
        .ACC_OK(ACC_STAT[0]),
607
        .VADR_R(VADR_R[31:2]),
608
        .MMU_Q(MMU_Q[19:0]),
609
        .ENBYTE(ENBYTE),
610
        .DBG_HIT(DBG_HIT));
611 29 ns32kum
 
612
FILTCMP  FILT_CMP(
613
        .RADR({RADR[28:12],VADR_R[11:4]}),
614
        .DRAMSZ(DRAMSZ),
615
        .DRAM_A(DRAM_A[28:4]),
616
        .TAGDAT(TAGDAT),
617
        .ADR_EQU(ADR_EQU));
618 9 ns32kum
 
619
endmodule

powered by: WebSVN 2.1.0

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