Line 42... |
Line 42... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.3 2002/01/28 01:16:00 lampret
|
|
// Changed 'void' nop-ops instead of insn[0] to use insn[16]. Debug unit stalls the tick timer. Prepared new flag generation for add and and insns. Blocked DC/IC while they are turned off. Fixed I/D MMU SPRs layout except WAYs. TODO: smart IC invalidate, l.j 2 and TLB ways.
|
|
//
|
// Revision 1.2 2002/01/14 06:18:22 lampret
|
// Revision 1.2 2002/01/14 06:18:22 lampret
|
// Fixed mem2reg bug in FAST implementation. Updated debug unit to work with new genpc/if.
|
// Fixed mem2reg bug in FAST implementation. Updated debug unit to work with new genpc/if.
|
//
|
//
|
// Revision 1.1 2002/01/03 08:16:15 lampret
|
// Revision 1.1 2002/01/03 08:16:15 lampret
|
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
|
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
|
Line 82... |
Line 85... |
module or1200_dmmu_top(
|
module or1200_dmmu_top(
|
// Rst and clk
|
// Rst and clk
|
clk, rst,
|
clk, rst,
|
|
|
// CPU i/f
|
// CPU i/f
|
dc_en, dmmu_en, supv, dcpu_adr_i, dcpu_cyc_i, dcpu_stb_i, dcpu_we_i,
|
dc_en, dmmu_en, supv, dcpu_adr_i, dcpu_cycstb_i, dcpu_we_i,
|
dcpu_tag_o, dcpu_err_o,
|
dcpu_tag_o, dcpu_err_o,
|
|
|
// SPR access
|
// SPR access
|
spr_cs, spr_write, spr_addr, spr_dat_i, spr_dat_o,
|
spr_cs, spr_write, spr_addr, spr_dat_i, spr_dat_o,
|
|
|
// DC i/f
|
// DC i/f
|
dcdmmu_err_i, dcdmmu_tag_i, dcdmmu_adr_o, dcdmmu_cyc_o, dcdmmu_stb_o, dcdmmu_ci_o
|
dcdmmu_err_i, dcdmmu_tag_i, dcdmmu_adr_o, dcdmmu_cycstb_o, dcdmmu_ci_o
|
);
|
);
|
|
|
parameter dw = `OR1200_OPERAND_WIDTH;
|
parameter dw = `OR1200_OPERAND_WIDTH;
|
parameter aw = `OR1200_OPERAND_WIDTH;
|
parameter aw = `OR1200_OPERAND_WIDTH;
|
|
|
Line 112... |
Line 115... |
//
|
//
|
input dc_en;
|
input dc_en;
|
input dmmu_en;
|
input dmmu_en;
|
input supv;
|
input supv;
|
input [aw-1:0] dcpu_adr_i;
|
input [aw-1:0] dcpu_adr_i;
|
input dcpu_cyc_i;
|
input dcpu_cycstb_i;
|
input dcpu_stb_i;
|
|
input dcpu_we_i;
|
input dcpu_we_i;
|
output [3:0] dcpu_tag_o;
|
output [3:0] dcpu_tag_o;
|
output dcpu_err_o;
|
output dcpu_err_o;
|
|
|
//
|
//
|
Line 133... |
Line 135... |
// DC I/F
|
// DC I/F
|
//
|
//
|
input dcdmmu_err_i;
|
input dcdmmu_err_i;
|
input [3:0] dcdmmu_tag_i;
|
input [3:0] dcdmmu_tag_i;
|
output [aw-1:0] dcdmmu_adr_o;
|
output [aw-1:0] dcdmmu_adr_o;
|
output dcdmmu_cyc_o;
|
output dcdmmu_cycstb_o;
|
output dcdmmu_stb_o;
|
|
output dcdmmu_ci_o;
|
output dcdmmu_ci_o;
|
|
|
//
|
//
|
// Internal wires and regs
|
// Internal wires and regs
|
//
|
//
|
Line 153... |
Line 154... |
wire dtlb_en;
|
wire dtlb_en;
|
wire dtlb_ci;
|
wire dtlb_ci;
|
reg dtlb_done;
|
reg dtlb_done;
|
wire fault;
|
wire fault;
|
wire miss;
|
wire miss;
|
|
reg [31:`OR1200_DMMU_PS] dcpu_vpn_r;
|
|
|
//
|
//
|
// Implemented bits inside match and translate registers
|
// Implemented bits inside match and translate registers
|
//
|
//
|
// dtlbwYmrX: vpn 31-10 v 0
|
// dtlbwYmrX: vpn 31-10 v 0
|
Line 175... |
Line 177... |
// Put all outputs in inactive state
|
// Put all outputs in inactive state
|
//
|
//
|
assign spr_dat_o = 32'h00000000;
|
assign spr_dat_o = 32'h00000000;
|
assign dcdmmu_adr_o = dcpu_adr_i;
|
assign dcdmmu_adr_o = dcpu_adr_i;
|
assign dcpu_tag_o = dcdmmu_tag_i;
|
assign dcpu_tag_o = dcdmmu_tag_i;
|
assign dcdmmu_cyc_o = dcpu_cyc_i;
|
assign dcdmmu_cyc_o = dcpu_cycstb_i;
|
assign dcdmmu_stb_o = dcpu_stb_i;
|
|
assign dcpu_err_o = dcdmmu_err_i;
|
assign dcpu_err_o = dcdmmu_err_i;
|
assign dcdmmu_ci_o = dcpu_adr_i[31];
|
assign dcdmmu_ci_o = `OR1200_DMMU_CI;
|
|
|
`else
|
`else
|
|
|
//
|
//
|
// DTLB SPR access
|
// DTLB SPR access
|
Line 213... |
Line 214... |
//
|
//
|
always @(posedge clk or posedge rst)
|
always @(posedge clk or posedge rst)
|
if (rst)
|
if (rst)
|
dtlb_done <= #1 1'b0;
|
dtlb_done <= #1 1'b0;
|
else if (dtlb_en)
|
else if (dtlb_en)
|
dtlb_done <= #1 dcpu_cyc_i;
|
dtlb_done <= #1 dcpu_cycstb_i;
|
else
|
else
|
dtlb_done <= #1 1'b0;
|
dtlb_done <= #1 1'b0;
|
|
|
|
|
//
|
//
|
// Cut transfer if something goes wrong with translation. If DC is disabled,
|
// Cut transfer if something goes wrong with translation. Also delayed signals because of translation delay.
|
// use delayed signals.
|
|
//
|
//
|
assign dcdmmu_cyc_o = (!dc_en & dmmu_en) ? ~(miss | fault) & dtlb_done & dcpu_cyc_i : (miss | fault) ? 1'b0 : dcpu_cyc_i;
|
assign dcdmmu_cycstb_o = (!dc_en & dmmu_en) ? ~(miss | fault) & dtlb_done & dcpu_cycstb_i : ~(miss | fault) & dcpu_cycstb_i;
|
assign dcdmmu_stb_o = (!dc_en & dmmu_en) ? ~(miss | fault) & dtlb_done & dcpu_stb_i : (miss | fault) ? 1'b0 : dcpu_stb_i;
|
//assign dcdmmu_cycstb_o = (dmmu_en) ? ~(miss | fault) & dcpu_cycstb_i : (miss | fault) ? 1'b0 : dcpu_cycstb_i;
|
|
|
//
|
//
|
// Cache Inhibit
|
// Cache Inhibit
|
//
|
//
|
assign dcdmmu_ci_o = dmmu_en ? dtlb_done & dtlb_ci : dcpu_adr_i[31];
|
assign dcdmmu_ci_o = dmmu_en ? dtlb_done & dtlb_ci : `OR1200_DMMU_CI;
|
|
|
|
//
|
|
// Register dcpu_adr_i's VPN for use when DMMU is not enabled but PPN is expected to come
|
|
// one clock cycle after offset part.
|
|
//
|
|
always @(posedge clk or posedge rst)
|
|
if (rst)
|
|
dcpu_vpn_r <= #1 {31-`OR1200_DMMU_PS{1'b0}};
|
|
else
|
|
dcpu_vpn_r <= #1 dcpu_adr_i[31:`OR1200_DMMU_PS];
|
|
|
//
|
//
|
// Physical address is either translated virtual address or
|
// Physical address is either translated virtual address or
|
// simply equal when DMMU is disabled
|
// simply equal when DMMU is disabled
|
//
|
//
|
|
// assign dcdmmu_adr_o = dmmu_en ? {dtlb_ppn, dcpu_adr_i[`OR1200_DMMU_PS-1:0]} : {dcpu_vpn_r, dcpu_adr_i[`OR1200_DMMU_PS-1:0]};
|
assign dcdmmu_adr_o = dmmu_en ? {dtlb_ppn, dcpu_adr_i[`OR1200_DMMU_PS-1:0]} : dcpu_adr_i;
|
assign dcdmmu_adr_o = dmmu_en ? {dtlb_ppn, dcpu_adr_i[`OR1200_DMMU_PS-1:0]} : dcpu_adr_i;
|
|
|
//
|
//
|
// Output to SPRS unit
|
// Output to SPRS unit
|
//
|
//
|
Line 258... |
Line 268... |
assign miss = dtlb_done & !dtlb_hit;
|
assign miss = dtlb_done & !dtlb_hit;
|
|
|
//
|
//
|
// DTLB Enable
|
// DTLB Enable
|
//
|
//
|
assign dtlb_en = dmmu_en & dcpu_cyc_i & dcpu_stb_i;
|
assign dtlb_en = dmmu_en & dcpu_cycstb_i;
|
|
|
//
|
//
|
// Instantiation of DTLB
|
// Instantiation of DTLB
|
//
|
//
|
or1200_dmmu_tlb or1200_dmmu_tlb(
|
or1200_dmmu_tlb or1200_dmmu_tlb(
|