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: ICACHE.v
|
// Filename: ICACHE.v
|
// Version: 1.0
|
// Version: 2.0
|
// Date: 30 May 2015
|
// History: 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 35... |
Line 36... |
// Modules contained in this file:
|
// Modules contained in this file:
|
// ICACHE the instruction cache of M32632
|
// ICACHE the instruction cache of M32632
|
//
|
//
|
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
module ICACHE( BCLK, MCLK, MDONE, BRESET, READ_I, IO_READY, PSR_USER, DATA_HOLD, PTB_WR, PTB_SEL, DRAM_WR,
|
module ICACHE( BCLK, MCLK, DRAMSZ, MDONE, BRESET, READ_I, IO_READY, PSR_USER, DATA_HOLD, PTB_WR, PTB_SEL, DRAM_WR,
|
KDET, HOLD, CFG, DRAM_Q, CINVAL, IC_SIGS, IO_Q, IVAR, KOLLI_A, MCR_FLAGS, MMU_DIN, VADR, WADDR,
|
KDET, HOLD, CFG, DRAM_Q, CINVAL, IC_SIGS, IO_Q, IVAR, KOLLI_A, MCR_FLAGS, MMU_DIN, VADR, WADDR,
|
WCTRL, IO_RD, DRAM_ACC, INIT_RUN, PROT_ERROR, ACC_OK, IC_PREQ, KOLLISION, ENA_HK, STOP_CINV,
|
WCTRL, IO_RD, DRAM_ACC, INIT_RUN, PROT_ERROR, ACC_OK, IC_PREQ, KOLLISION, ENA_HK, STOP_CINV,
|
DRAM_A, IC_DQ, IC_VA, ICTODC, IO_A, ENDRAM );
|
DRAM_A, IC_DQ, IC_VA, ICTODC, IO_A, ENDRAM );
|
|
|
input BCLK;
|
input BCLK;
|
input MCLK;
|
input MCLK;
|
|
input [2:0] DRAMSZ;
|
input MDONE;
|
input MDONE;
|
input BRESET;
|
input BRESET;
|
input READ_I;
|
input READ_I;
|
input IO_READY;
|
input IO_READY;
|
input PSR_USER;
|
input PSR_USER;
|
Line 153... |
Line 155... |
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 168... |
Line 169... |
reg [15:0] KTAG0;
|
reg [15:0] KTAG0;
|
|
|
reg [15:0] KTAGSET_1 [0:255]; // Kollision Tag Set for Data Set 1 : 256 entries of 16 bits
|
reg [15:0] KTAGSET_1 [0:255]; // Kollision Tag Set for Data Set 1 : 256 entries of 16 bits
|
reg [15:0] KTAG1;
|
reg [15:0] KTAG1;
|
|
|
reg [23:0] KCA_VALID [0:31]; // Kollision Valid bits for Data Set 0 and 1 : 32 entries of 24 bits
|
wire [23:0] KCVALID;
|
reg [23:0] KCVALID;
|
|
|
|
assign READ = READ_I & ~HOLD_ON & RUN_ICRD;
|
assign READ = READ_I & ~HOLD_ON & RUN_ICRD;
|
assign WRITE = 1'b0;
|
assign WRITE = 1'b0;
|
assign RMW = 1'b0;
|
assign RMW = 1'b0;
|
|
|
Line 227... |
Line 227... |
|
|
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[V_ADR[11:7]];
|
NEU_VALID VALID_RAM(
|
|
.BCLK(BCLK),
|
always @(negedge BCLK) if (WE_CV) CA_VALID[ACV] <= D_CV;
|
.VALIN(D_CV),
|
|
.WADR(ACV),
|
|
.WREN(WE_CV),
|
|
.RADR(V_ADR[11:7]),
|
|
.VALOUT(CVALID) );
|
|
|
// +++++++++++++++++++++++++ Tag Set 0 +++++++++++++++++++++
|
// +++++++++++++++++++++++++ Tag Set 0 +++++++++++++++++++++
|
|
|
always @(posedge BCLK) TAG0 <= TAGSET_0[VADR[11:4]];
|
always @(posedge BCLK) TAG0 <= TAGSET_0[VADR[11:4]];
|
|
|
Line 261... |
Line 265... |
.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(1'b0),
|
.KDET(1'b0),
|
.ADDR({RADR[27:12],VADR_R[11:4]}),
|
.ADDR({RADR[31:12],VADR_R[11:4]}),
|
.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(),
|
.USE_CA(USE_CA),
|
.USE_CA(USE_CA),
|
.IOSEL(RADR[31:28]),
|
.DRAMSZ(DRAMSZ),
|
.IO_SPACE(IO_SPACE),
|
.IO_SPACE(IO_SPACE),
|
.DC_ILO(1'b0),
|
.DC_ILO(1'b0),
|
.KILL(KILL_C),
|
.KILL(KILL_C),
|
.UPDATE(UPDATE_C));
|
.UPDATE(UPDATE_C));
|
|
|
Line 329... |
Line 333... |
.IC_PREQ(IC_PREQ),
|
.IC_PREQ(IC_PREQ),
|
.HIT_ALL(HIT_ALL));
|
.HIT_ALL(HIT_ALL));
|
|
|
// +++++++++++++++++++++++++ Kollision Valid +++++++++++++++
|
// +++++++++++++++++++++++++ Kollision Valid +++++++++++++++
|
|
|
always @(posedge BCLK) KCVALID <= KCA_VALID[KOLLI_A[11:7]];
|
NEU_VALID KOL_VAL(
|
|
.BCLK(BCLK),
|
always @(negedge BCLK) if (WE_CV) KCA_VALID[ACV] <= D_CV;
|
.VALIN(D_CV),
|
|
.WADR(ACV),
|
|
.WREN(WE_CV),
|
|
.RADR(KOLLI_A[11:7]),
|
|
.VALOUT(KCVALID) );
|
|
|
// +++++++++++++++++++++++++ Kollision Tag Set 0 +++++++++++
|
// +++++++++++++++++++++++++ Kollision Tag Set 0 +++++++++++
|
|
|
always @(posedge BCLK) KTAG0 <= KTAGSET_0[KOLLI_A[11:4]];
|
always @(posedge BCLK) KTAG0 <= KTAGSET_0[KOLLI_A[11:4]];
|
|
|