Line 34... |
Line 34... |
//
|
//
|
// Modules contained in this file:
|
// Modules contained in this file:
|
// 1. KOLDETECT Collision Detection Unit
|
// 1. KOLDETECT Collision Detection Unit
|
// 2. ICACHE_SM Instruction Cache State Machine
|
// 2. ICACHE_SM Instruction Cache State Machine
|
//
|
//
|
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
//
|
//
|
// 1. KOLDETECT Collision Detection Unit
|
// 1. KOLDETECT Collision Detection Unit
|
//
|
//
|
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
module KOLDETECT ( BCLK, BRESET, DRAM_WR, CVALID, ADDR, TAG0, TAG1 , CFG , C_VALID, READ_I, ACC_OK,
|
module KOLDETECT ( BCLK, BRESET, DRAM_WR, CVALID, ADDR, TAG0, TAG1 , CFG , C_VALID, READ_I, ACC_OK, HOLD, KDET, INVAL_A, ENA_HK,
|
NEWCVAL, KOLLISION, STOP_ICRD, RUN_ICRD, KILL, KILLADR, ICTODC, STOP_CINV );
|
NEWCVAL, KOLLISION, STOP_ICRD, RUN_ICRD, KILL, KILLADR, ICTODC, STOP_CINV );
|
|
|
input BCLK;
|
input BCLK;
|
input BRESET;
|
input BRESET;
|
input DRAM_WR;
|
input DRAM_WR;
|
Line 94... |
Line 94... |
wire [7:0] new_0,new_1;
|
wire [7:0] new_0,new_1;
|
wire dma_mode,ic_dma;
|
wire dma_mode,ic_dma;
|
wire free,ende;
|
wire free,ende;
|
wire init_b;
|
wire init_b;
|
|
|
always @(posedge BCLK) do_koll <= DRAM_WR & CFG[0]; // one cycle pulse, without Cache Enable no col
|
always @(posedge BCLK) do_koll <= DRAM_WR & CFG[0]; // one cycle pulse, without Cache Enable no collision
|
always @(posedge BCLK) addr_r <= ADDR;
|
always @(posedge BCLK) addr_r <= ADDR;
|
|
|
// similar logic like in CA_MATCH
|
// similar logic like in CA_MATCH
|
|
|
assign set_0 = C_VALID[7:0];
|
assign set_0 = C_VALID[7:0];
|
Line 156... |
Line 156... |
2'b00 : fifo_c = adrfifo[35:27];
|
2'b00 : fifo_c = adrfifo[35:27];
|
endcase
|
endcase
|
|
|
// Control
|
// Control
|
|
|
assign last_match = counter[2] & (fifo_c == {addr_r[11:4],found_1}); // if Match with last Entry no
|
assign last_match = counter[2] & (fifo_c == {addr_r[11:4],found_1}); // if Match with last Entry no new Entry
|
|
|
assign wr_entry = kolli & ~last_match;
|
assign wr_entry = kolli & ~last_match;
|
|
|
always @(posedge BCLK)
|
always @(posedge BCLK)
|
casex ({init_b,wr_entry,do_kill,counter})
|
casex ({init_b,wr_entry,do_kill,counter})
|
6'b0_xx_xxx : counter <= 3'b000;
|
6'b0_xx_xxx : counter <= 3'b000;
|
6'b1_00_xxx : counter <= counter;
|
6'b1_00_xxx : counter <= counter;
|
6'b1_11_xxx : counter <= counter;
|
6'b1_11_xxx : counter <= counter;
|
6'b1_10_000 : counter <= 3'b100;
|
6'b1_10_000 : counter <= 3'b100;
|
6'b1_10_1xx : counter <= (counter[1:0] == 2'b11) ? 3'b111 : {counter[2],(counter[1:0] + 2'b01)};
|
6'b1_10_1xx : counter <= (counter[1:0] == 2'b11) ? 3'b111 : {counter[2],(counter[1:0] + 2'b01)}; // Overflow avoid
|
6'b1_01_1xx : counter <= (counter[1:0] == 2'b00) ? 3'b000 : {counter[2],(counter[1:0] + 2'b11)};
|
6'b1_01_1xx : counter <= (counter[1:0] == 2'b00) ? 3'b000 : {counter[2],(counter[1:0] + 2'b11)};
|
default : counter <= counter;
|
default : counter <= counter;
|
endcase
|
endcase
|
|
|
// DMA Access
|
// DMA Access
|
Line 208... |
Line 208... |
|
|
always @(posedge BCLK) pipe <= STOP_ICRD;
|
always @(posedge BCLK) pipe <= STOP_ICRD;
|
|
|
assign RUN_ICRD = ~(STOP_ICRD | pipe); // Release for IC_READ
|
assign RUN_ICRD = ~(STOP_ICRD | pipe); // Release for IC_READ
|
|
|
always @(posedge BCLK) do_kill <= STOP_ICRD & ~dma_mode & ~do_kill; // Write pulse in Cache Valid R
|
always @(posedge BCLK) do_kill <= STOP_ICRD & ~dma_mode & ~do_kill; // Write pulse in Cache Valid RAM, 1 cycle on, 1 cycle off
|
|
|
assign KILL = do_kill | (KDET & dma_kolli);
|
assign KILL = do_kill | (KDET & dma_kolli);
|
|
|
// Valid Daten prepare : different sources for DMA and DCACHE Kohaerenz
|
// Valid Daten prepare : different sources for DMA and DCACHE Kohaerenz
|
|
|
Line 241... |
Line 241... |
// multiple signals are needed in DCACHE :
|
// multiple signals are needed in DCACHE :
|
assign ICTODC = {dma,ic_dma,~(counter[2:1] == 2'b11)};
|
assign ICTODC = {dma,ic_dma,~(counter[2:1] == 2'b11)};
|
|
|
endmodule
|
endmodule
|
|
|
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
//
|
//
|
// 2. ICACHE_SM Instruction Cache State Machine
|
// 2. ICACHE_SM Instruction Cache State Machine
|
//
|
//
|
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
module ICACHE_SM ( BCLK, BRESET, IO_SPACE, MDONE, IO_READY, MMU_HIT, CA_HIT, READ, PTE_ACC,
|
module ICACHE_SM ( BCLK, BRESET, IO_SPACE, MDONE, IO_READY, MMU_HIT, CA_HIT, READ, PTE_ACC,
|
USE_CA, PTB_WR, PTB_SEL, USER, PROT_ERROR,
|
USE_CA, PTB_WR, PTB_SEL, USER, PROT_ERROR,
|
DRAM_ACC, IO_RD, IO_ACC, IC_PREQ, ACC_OK, HIT_ALL, CUPDATE, AUX_DAT, NEW_PTB, PTB_ONE );
|
DRAM_ACC, IO_RD, IO_ACC, IC_PREQ, ACC_OK, HIT_ALL, CUPDATE, AUX_DAT, NEW_PTB, PTB_ONE );
|
|
|
input BCLK;
|
input BCLK;
|
Line 326... |
Line 326... |
|
|
assign CUPDATE = card_flag & USE_CA & MDONE; // USE_CA = ~CI & ~LDC;
|
assign CUPDATE = card_flag & USE_CA & MDONE; // USE_CA = ~CI & ~LDC;
|
|
|
always @(posedge BCLK) rd_rdy <= card_flag & MDONE;
|
always @(posedge BCLK) rd_rdy <= card_flag & MDONE;
|
|
|
// The cache RAM can not provide fast enough the data after an Update. In this case a secondary dat
|
// The cache RAM can not provide fast enough the data after an Update. In this case a secondary data path is activated
|
assign AUX_DAT = rd_rdy;
|
assign AUX_DAT = rd_rdy;
|
|
|
// DRAM Interface :
|
// DRAM Interface :
|
|
|
always @(posedge BCLK) if (dram_go) DRAM_ACC <= 1'b1;
|
always @(posedge BCLK) if (dram_go) DRAM_ACC <= 1'b1;
|
Line 341... |
Line 341... |
always @(posedge BCLK)
|
always @(posedge BCLK)
|
begin
|
begin
|
if (IO_ACC) IO_RD <= READ; else IO_RD <= IO_RD & ~IO_READY & BRESET;
|
if (IO_ACC) IO_RD <= READ; else IO_RD <= IO_RD & ~IO_READY & BRESET;
|
end
|
end
|
|
|
assign io_busy = IO_RD | rd_done; // access is gone in next clock cycle, therefore blocked with "rd
|
assign io_busy = IO_RD | rd_done; // access is gone in next clock cycle, therefore blocked with "rd_done"
|
|
|
always @(posedge BCLK) rd_done <= READ & IO_READY; // For READ one clock later for data to come thr
|
always @(posedge BCLK) rd_done <= READ & IO_READY; // For READ one clock later for data to come through
|
|
|
// global feedback to opcode fetch unit : you can continue
|
// global feedback to opcode fetch unit : you can continue
|
|
|
assign ACC_OK = IO_SPACE ? rd_done : (READ & MMU_HIT & rd_ende);
|
assign ACC_OK = IO_SPACE ? rd_done : (READ & MMU_HIT & rd_ende);
|
|
|