Line 132... |
Line 132... |
//
|
//
|
// Limitation: only a small subset of register file RAMs
|
// Limitation: only a small subset of register file RAMs
|
// are supported
|
// are supported
|
//
|
//
|
task display_arch_state;
|
task display_arch_state;
|
|
input exception;
|
|
|
reg [5:0] i;
|
reg [5:0] i;
|
reg [31:0] r;
|
reg [31:0] r;
|
integer j;
|
integer j;
|
begin
|
begin
|
`ifdef OR1200_MONITOR_EXEC_STATE
|
`ifdef OR1200_MONITOR_EXEC_STATE
|
ref = ref + 1;
|
ref = ref + 1;
|
`ifdef OR1200_MONITOR_LOOKUP
|
`ifdef OR1200_MONITOR_LOOKUP
|
$fdisplay(flookup, "Instruction %d: %t", insns, $time);
|
$fdisplay(flookup, "Instruction %d: %t", insns, $time);
|
`endif
|
`endif
|
|
if(exception)
|
|
$fwrite(fexe, "\nEXECUTED(%d): %h: %h (exception)", insns,
|
|
`OR1200_TOP.`CPU_cpu.`CPU_except.ex_pc,
|
|
`OR1200_TOP.`CPU_cpu.`CPU_ctrl.ex_insn);
|
|
else
|
$fwrite(fexe, "\nEXECUTED(%d): %h: %h", insns,
|
$fwrite(fexe, "\nEXECUTED(%d): %h: %h", insns,
|
`OR1200_TOP.`CPU_cpu.`CPU_except.wb_pc,
|
`OR1200_TOP.`CPU_cpu.`CPU_except.wb_pc,
|
`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn);
|
`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn);
|
`ifdef OR1200_MONITOR_EXEC_LOG_DISASSEMBLY
|
`ifdef OR1200_MONITOR_EXEC_LOG_DISASSEMBLY
|
|
if(!exception) begin
|
$fwrite(fexe,"\t");
|
$fwrite(fexe,"\t");
|
// Decode the instruction, print it out
|
// Decode the instruction, print it out
|
or1200_print_op(`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn);
|
or1200_print_op(`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn);
|
|
end
|
`endif
|
`endif
|
for(i = 0; i < 32; i = i + 1) begin
|
for(i = 0; i < 32; i = i + 1) begin
|
if (i % 4 == 0)
|
if (i % 4 == 0)
|
$fdisplay(fexe);
|
$fdisplay(fexe);
|
get_gpr(i, r);
|
get_gpr(i, r);
|
Line 165... |
Line 174... |
r = `OR1200_TOP.`CPU_cpu.`CPU_sprs.eear;
|
r = `OR1200_TOP.`CPU_cpu.`CPU_sprs.eear;
|
$fwrite(fexe, "EEAR0: %h ", r);
|
$fwrite(fexe, "EEAR0: %h ", r);
|
r = `OR1200_TOP.`CPU_cpu.`CPU_sprs.esr;
|
r = `OR1200_TOP.`CPU_cpu.`CPU_sprs.esr;
|
$fdisplay(fexe, "ESR0 : %h", r);
|
$fdisplay(fexe, "ESR0 : %h", r);
|
`endif // `ifdef OR1200_MONITOR_EXEC_STATE
|
`endif // `ifdef OR1200_MONITOR_EXEC_STATE
|
`ifdef OR1200_DISPLAY_EXECUTED
|
|
ref = ref + 1;
|
|
`ifdef OR1200_MONITOR_LOOKUP
|
|
$fdisplay(flookup, "Instruction %d: %t", insns, $time);
|
|
`endif
|
|
$fwrite(fexe, "\nEXECUTED(%d): %h: %h", insns, `OR1200_TOP.`CPU_cpu.`CPU_except.wb_pc, `OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn);
|
|
`endif
|
|
insns = insns + 1;
|
insns = insns + 1;
|
end
|
end
|
endtask // display_arch_state
|
endtask // display_arch_state
|
|
|
/* Keep a trace buffer of the last lot of instructions and addresses
|
/* Keep a trace buffer of the last lot of instructions and addresses
|
Line 231... |
Line 233... |
end
|
end
|
|
|
end
|
end
|
endtask // monitor_for_crash
|
endtask // monitor_for_crash
|
|
|
|
|
//
|
|
// Write state of the OR1200 registers into a file; version for exception
|
|
//
|
|
task display_arch_state_except;
|
|
reg [5:0] i;
|
|
reg [31:0] r;
|
|
integer j;
|
|
begin
|
|
`ifdef OR1200_MONITOR_EXEC_STATE
|
|
ref = ref + 1;
|
|
`ifdef OR1200_MONITOR_LOOKUP
|
|
$fdisplay(flookup, "Instruction %d: %t", insns, $time);
|
|
`endif
|
|
$fwrite(fexe, "\nEXECUTED(%d): %h: %h (exception)", insns, `OR1200_TOP.`CPU_cpu.`CPU_except.ex_pc, `OR1200_TOP.`CPU_cpu.`CPU_ctrl.ex_insn);
|
|
for(i = 0; i < 32; i = i + 1) begin
|
|
if (i % 4 == 0)
|
|
$fdisplay(fexe);
|
|
get_gpr(i, r);
|
|
$fwrite(fexe, "GPR%d: %h ", i, r);
|
|
end
|
|
$fdisplay(fexe);
|
|
r = `OR1200_TOP.`CPU_cpu.`CPU_sprs.sr;
|
|
$fwrite(fexe, "SR : %h ", r);
|
|
r = `OR1200_TOP.`CPU_cpu.`CPU_sprs.epcr;
|
|
$fwrite(fexe, "EPCR0: %h ", r);
|
|
r = `OR1200_TOP.`CPU_cpu.`CPU_sprs.eear;
|
|
$fwrite(fexe, "EEAR0: %h ", r);
|
|
r = `OR1200_TOP.`CPU_cpu.`CPU_sprs.esr;
|
|
$fdisplay(fexe, "ESR0 : %h", r);
|
|
insns = insns + 1;
|
|
`endif // `ifdef OR1200_MONITOR_EXEC_STATE
|
|
`ifdef OR1200_DISPLAY_EXECUTED
|
|
ref = ref + 1;
|
|
`ifdef OR1200_MONITOR_LOOKUP
|
|
$fdisplay(flookup, "Instruction %d: %t", insns, $time);
|
|
`endif
|
|
$fwrite(fexe, "\nEXECUTED(%d): %h: %h (exception)", insns,
|
|
`OR1200_TOP.`CPU_cpu.`CPU_except.ex_pc,
|
|
`OR1200_TOP.`CPU_cpu.`CPU_ctrl.ex_insn);
|
|
insns = insns + 1;
|
|
`endif
|
|
|
|
end
|
|
endtask
|
|
|
|
integer iwb_progress;
|
integer iwb_progress;
|
reg [31:0] iwb_progress_addr;
|
reg [31:0] iwb_progress_addr;
|
//
|
//
|
// WISHBONE bus checker
|
// WISHBONE bus checker
|
//
|
//
|
Line 381... |
Line 337... |
if (((`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn[31:26] != `OR1200_OR32_NOP)
|
if (((`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn[31:26] != `OR1200_OR32_NOP)
|
| !`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn[16])
|
| !`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn[16])
|
& !(`OR1200_TOP.`CPU_cpu.`CPU_except.except_flushpipe &
|
& !(`OR1200_TOP.`CPU_cpu.`CPU_except.except_flushpipe &
|
`OR1200_TOP.`CPU_cpu.`CPU_except.ex_dslot))
|
`OR1200_TOP.`CPU_cpu.`CPU_except.ex_dslot))
|
begin
|
begin
|
display_arch_state;
|
display_arch_state(0);
|
monitor_for_crash;
|
monitor_for_crash;
|
end
|
end
|
else
|
else
|
if (`OR1200_TOP.`CPU_cpu.`CPU_except.except_flushpipe)
|
if (`OR1200_TOP.`CPU_cpu.`CPU_except.except_flushpipe)
|
display_arch_state_except;
|
display_arch_state(1);
|
// small hack to stop simulation (l.nop 1):
|
// small hack to stop simulation (l.nop 1):
|
if (`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn == 32'h1500_0001) begin
|
if (`OR1200_TOP.`CPU_cpu.`CPU_ctrl.wb_insn == 32'h1500_0001) begin
|
get_gpr(3, r3);
|
get_gpr(3, r3);
|
$fdisplay(fgeneral, "%t: l.nop exit (%h)", $time, r3);
|
$fdisplay(fgeneral, "%t: l.nop exit (%h)", $time, r3);
|
`ifdef OR1200_MONITOR_VERBOSE_NOPS
|
`ifdef OR1200_MONITOR_VERBOSE_NOPS
|