Line 2... |
Line 2... |
//
|
//
|
// This file is part of the M32632 project
|
// This file is part of the M32632 project
|
// http://opencores.org/project,m32632
|
// http://opencores.org/project,m32632
|
//
|
//
|
// Filename: DCACHE.v
|
// Filename: DCACHE.v
|
// Version: 1.1 bug fix
|
// Version: 2.0
|
// History: 1.0 first release of 30 Mai 2015
|
// History: 1.1 bug fix of 7 October 2015
|
// Date: 7 October 2015
|
// 1.0 first release of 30 Mai 2015
|
|
// Date: 14 August 2016
|
//
|
//
|
// Copyright (C) 2015 Udo Moeller
|
// Copyright (C) 2016 Udo Moeller
|
//
|
//
|
// This source file may be used and distributed without
|
// This source file may be used and distributed without
|
// restriction provided that this copyright statement is not
|
// restriction provided that this copyright statement is not
|
// removed from the file and that any derivative work contains
|
// removed from the file and that any derivative work contains
|
// the original copyright notice and the associated disclaimer.
|
// the original copyright notice and the associated disclaimer.
|
Line 36... |
Line 37... |
// Modules contained in this file:
|
// Modules contained in this file:
|
// DCACHE the data cache of M32632
|
// DCACHE the data cache of M32632
|
//
|
//
|
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
module DCACHE( BCLK, MCLK, WRCFG, MDONE, BRESET, PTB_WR, PTB_SEL, IO_READY, REG_OUT, PSR_USER, WRITE, READ, RMW, QWATWO,
|
module DCACHE( BCLK, MCLK, WRCFG, DRAMSZ, MDONE, BRESET, PTB_WR, PTB_SEL, IO_READY, REG_OUT, PSR_USER, WRITE, READ, RMW,
|
WAMUX, ENWR, IC_PREQ, FILLRAM, CFG, CINVAL, DMA_AA, DP_Q, DRAM_Q, IC_VA, ICTODC, IO_Q, IVAR, MCR_FLAGS,
|
QWATWO, WAMUX, ENWR, IC_PREQ, DMA_CHK, CFG, CINVAL, DMA_AA, DP_Q, DRAM_Q, IC_VA, ICTODC, IO_Q, IVAR,
|
PACKET, SIZE, VADR, WADDR, WCTRL, IO_RD, IO_WR, DRAM_ACC, DRAM_WR, INIT_RUN, PTE_STAT, KDET, HLDA,
|
MCR_FLAGS, PACKET, SIZE, VADR, WADDR, WCTRL, IO_RD, IO_WR, DRAM_ACC, DRAM_WR, INIT_RUN, PTE_STAT, KDET,
|
ACC_STAT, DP_DI, DRAM_A, DRAM_DI, IACC_STAT, IC_SIGS, IO_A, IO_BE, IO_DI, KOLLI_A, MMU_DIN, ZTEST,
|
HLDA, ACC_STAT, DP_DI, DRAM_A, DRAM_DI, IACC_STAT, IC_SIGS, IO_A, IO_BE, IO_DI, KOLLI_A, MMU_DIN, ZTEST,
|
RWVAL, RWVFLAG, DBG_IN, DBG_HIT, ENDRAM );
|
RWVAL, RWVFLAG, DBG_IN, DBG_HIT, ENDRAM );
|
|
|
input BCLK;
|
input BCLK;
|
input MCLK;
|
input MCLK;
|
input WRCFG;
|
input WRCFG;
|
|
input [2:0] DRAMSZ;
|
input MDONE;
|
input MDONE;
|
input BRESET;
|
input BRESET;
|
input PTB_WR;
|
input PTB_WR;
|
input PTB_SEL;
|
input PTB_SEL;
|
input IO_READY;
|
input IO_READY;
|
Line 60... |
Line 62... |
input RMW;
|
input RMW;
|
input QWATWO;
|
input QWATWO;
|
input WAMUX;
|
input WAMUX;
|
input ENWR;
|
input ENWR;
|
input IC_PREQ;
|
input IC_PREQ;
|
input FILLRAM;
|
input DMA_CHK;
|
input [1:0] CFG;
|
input [1:0] CFG;
|
input [1:0] CINVAL;
|
input [1:0] CINVAL;
|
input [27:4] DMA_AA;
|
input [27:4] DMA_AA;
|
input [63:0] DP_Q;
|
input [63:0] DP_Q;
|
input [31:0] DRAM_Q;
|
input [31:0] DRAM_Q;
|
Line 187... |
Line 189... |
reg [15:0] TAG0;
|
reg [15:0] TAG0;
|
|
|
reg [15:0] TAGSET_1 [0:255]; // Tag Set for Data Set 1 : 256 entries of 16 bits
|
reg [15:0] TAGSET_1 [0:255]; // Tag Set for Data Set 1 : 256 entries of 16 bits
|
reg [15:0] TAG1;
|
reg [15:0] TAG1;
|
|
|
reg [23:0] CA_VALID [0:31]; // Valid bits for Data Set 0 and 1 : 32 entries of 24 bits
|
wire [23:0] CVALID;
|
reg [23:0] CVALID;
|
|
|
|
reg [35:0] MMU_TAGS [0:255]; // Tag Set for MMU : 256 entries of 36 bits
|
reg [35:0] MMU_TAGS [0:255]; // Tag Set for MMU : 256 entries of 36 bits
|
reg [35:0] MMU_Q;
|
reg [35:0] MMU_Q;
|
|
|
reg [31:0] MMU_VALID [0:15]; // Valid bits for MMU Tag Set : 16 entries of 32 bits
|
reg [31:0] MMU_VALID [0:15]; // Valid bits for MMU Tag Set : 16 entries of 32 bits
|
Line 258... |
Line 259... |
|
|
always @(posedge MCLK) if (WCTRL[2]) CAPDAT <= DRAM_Q;
|
always @(posedge MCLK) if (WCTRL[2]) CAPDAT <= DRAM_Q;
|
|
|
// +++++++++++++++++++++++++ Cache Valid +++++++++++++++++++
|
// +++++++++++++++++++++++++ Cache Valid +++++++++++++++++++
|
|
|
always @(posedge BCLK) CVALID <= CA_VALID[TAGA[11:7]];
|
NEU_VALID VALID_RAM(
|
|
.BCLK(BCLK),
|
always @(negedge BCLK) if (WE_CV) CA_VALID[WADR_CV] <= DAT_CV;
|
.VALIN(DAT_CV),
|
|
.WADR(WADR_CV),
|
|
.WREN(WE_CV),
|
|
.RADR(TAGA[11:7]),
|
|
.VALOUT(CVALID) );
|
|
|
// +++++++++++++++++++++++++ Tag Set 0 +++++++++++++++++++++
|
// +++++++++++++++++++++++++ Tag Set 0 +++++++++++++++++++++
|
|
|
always @(posedge BCLK) TAG0 <= TAGSET_0[TAGA];
|
always @(posedge BCLK) TAG0 <= TAGSET_0[TAGA];
|
|
|
Line 339... |
Line 344... |
.WB_ACC(WB_ACC),
|
.WB_ACC(WB_ACC),
|
.ADR_EQU(ADR_EQU),
|
.ADR_EQU(ADR_EQU),
|
.IC_PREQ(IC_PREQ),
|
.IC_PREQ(IC_PREQ),
|
.CAPDAT(CAPDAT[31:0]),
|
.CAPDAT(CAPDAT[31:0]),
|
.CPU_OUT(DP_Q[59:44]),
|
.CPU_OUT(DP_Q[59:44]),
|
.FILLRAM(FILLRAM),
|
.DMA_CHK(DMA_CHK),
|
.IC_VA(IC_VA),
|
.IC_VA(IC_VA),
|
.ICTODC(ICTODC),
|
.ICTODC(ICTODC),
|
.VADR_R(VADR_R[31:12]),
|
.VADR_R(VADR_R[31:12]),
|
.NEW_PTB(NEW_PTB),
|
.NEW_PTB(NEW_PTB),
|
.PTB_ONE(PTB_ONE),
|
.PTB_ONE(PTB_ONE),
|
Line 379... |
Line 384... |
.INVAL_L(CINVAL[0]),
|
.INVAL_L(CINVAL[0]),
|
.CI(CI),
|
.CI(CI),
|
.MMU_HIT(MMU_HIT),
|
.MMU_HIT(MMU_HIT),
|
.WRITE(WRITE),
|
.WRITE(WRITE),
|
.KDET(KDET),
|
.KDET(KDET),
|
.ADDR(ADDR),
|
.ADDR({RADR[31:28],ADDR}),
|
.CFG(CFG),
|
.CFG(CFG),
|
.ENDRAM(ENDRAM),
|
.ENDRAM(ENDRAM),
|
.CVALID(CVALID),
|
.CVALID(CVALID),
|
.TAG0(TAG0),
|
.TAG0(TAG0),
|
.TAG1(TAG1),
|
.TAG1(TAG1),
|
.CA_HIT(CA_HIT),
|
.CA_HIT(CA_HIT),
|
.CA_SET(CA_SET),
|
.CA_SET(CA_SET),
|
.WB_ACC(WB_ACC),
|
.WB_ACC(WB_ACC),
|
.USE_CA(USE_CA),
|
.USE_CA(USE_CA),
|
.IOSEL(RADR[31:28]),
|
.DRAMSZ(DRAMSZ),
|
.IO_SPACE(IO_SPACE),
|
.IO_SPACE(IO_SPACE),
|
.KILL(KILL),
|
.KILL(KILL),
|
.DC_ILO(RWVAL[2]),
|
.DC_ILO(RWVAL[2]),
|
.UPDATE(UPDATE_C));
|
.UPDATE(UPDATE_C));
|
|
|