Line 95... |
Line 95... |
`define OR1200_MONITOR_LOOKUP
|
`define OR1200_MONITOR_LOOKUP
|
`endif
|
`endif
|
|
|
//
|
//
|
// Memory coherence checking (double check instruction in fetch stage against
|
// Memory coherence checking (double check instruction in fetch stage against
|
// what is in memory.)
|
// what is in memory.) Useful for cache controller development.
|
//
|
//
|
//`define MEM_COHERENCE_CHECK
|
//`define MEM_COHERENCE_CHECK
|
|
|
//
|
//
|
// Top of OR1200 inside test bench
|
// Top of OR1200 inside test bench
|
Line 501... |
Line 501... |
`define RAM_WB_TOP `DUT_TOP.ram_wb0.ram_wb_b3_0
|
`define RAM_WB_TOP `DUT_TOP.ram_wb0.ram_wb_b3_0
|
task get_insn_from_wb_ram;
|
task get_insn_from_wb_ram;
|
input [31:0] addr;
|
input [31:0] addr;
|
output [31:0] insn;
|
output [31:0] insn;
|
begin
|
begin
|
insn = `RAM_WB_TOP.get_mem32(addr);
|
insn = `RAM_WB_TOP.get_mem32(addr[31:2]);
|
end
|
end
|
endtask // get_insn_from_wb_ram
|
endtask // get_insn_from_wb_ram
|
`endif
|
`endif
|
|
|
`ifdef VERSATILE_SDRAM
|
`ifdef VERSATILE_SDRAM
|
Line 772... |
Line 772... |
|
|
check_for_immu_entry(`PC_TO_CHECK, physical_pc, tlb_miss);
|
check_for_immu_entry(`PC_TO_CHECK, physical_pc, tlb_miss);
|
|
|
// Check if it's a new PC - will also get triggered if the
|
// Check if it's a new PC - will also get triggered if the
|
// instruction has changed since we last checked it
|
// instruction has changed since we last checked it
|
if (((physical_pc !== last_addr) || (last_mem_word != `INSN_TO_CHECK))
|
if (((physical_pc !== last_addr) ||
|
& !tlb_miss)
|
(last_mem_word != `INSN_TO_CHECK)) & !tlb_miss)
|
begin
|
begin
|
// Decode stage not void, check instruction
|
// Decode stage not void, check instruction
|
// get PC
|
// get PC
|
get_insn_from_memory(physical_pc, mem_word);
|
get_insn_from_memory(physical_pc, mem_word);
|
|
|
if (mem_word !== `INSN_TO_CHECK)
|
if (mem_word !== `INSN_TO_CHECK)
|
begin
|
begin
|
$fdisplay(fgeneral, "%t: Instruction mismatch for PC 0x%h (phys. 0x%h) - memory had 0x%h, CPU had 0x%h", $time, `PC_TO_CHECK, physical_pc, mem_word, `INSN_TO_CHECK);
|
$fdisplay(fgeneral, "%t: Instruction mismatch for PC 0x%h (phys. 0x%h) - memory had 0x%h, CPU had 0x%h",
|
$display("%t: Instruction mismatch for PC 0x%h (phys. 0x%h) - memory had 0x%h, CPU had 0x%h", $time, `PC_TO_CHECK, physical_pc, mem_word, `INSN_TO_CHECK);
|
$time, `PC_TO_CHECK, physical_pc, mem_word,
|
#200
|
`INSN_TO_CHECK);
|
|
$display("%t: Instruction mismatch for PC 0x%h (phys. 0x%h) - memory had 0x%h, CPU had 0x%h",
|
|
$time, `PC_TO_CHECK, physical_pc, mem_word,
|
|
`INSN_TO_CHECK);
|
|
#200;
|
$finish;
|
$finish;
|
end
|
end
|
last_addr = physical_pc;
|
last_addr = physical_pc;
|
last_mem_word = mem_word;
|
last_mem_word = mem_word;
|
|
|