Skip to content

Commit 39dd1c6

Browse files
committed
(cc)
1 parent fa42d78 commit 39dd1c6

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

cores/gba/rtl/cpu/CPU.sv

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,22 @@ module ARM7TMDI (
494494
end else begin
495495
$display("[CPU] addr=%0d", bus.addr);
496496

497+
if (control_signals.pipeline_advance && pc_modified) begin
498+
bus.addr <= alu_bus.result & ~32'd1;
499+
$display(
500+
"Pipeline advance with ALU writeback to PC, setting address bus to ALU result: 0x%08x",
501+
alu_bus.result);
502+
end else if (control_signals.pipeline_advance && flush_req_pending) begin
503+
bus.addr <= read_reg(regs, cpu_mode, 15);
504+
$display(
505+
"Pipeline advance with pending flush request, setting address bus to PC value: 0x%08x",
506+
read_reg(regs, cpu_mode, 15));
507+
end else if (control_signals.set_thumb_mode) begin
508+
bus.addr <= B_bus & ~32'd1;
509+
$display(
510+
"Setting address bus to new Thumb mode PC value due to set_thumb_mode control signal, B_bus=0x%08x, addr=0x%08x",
511+
B_bus, bus.addr);
512+
end else begin
497513
unique case (control_signals.addr_bus_src)
498514
ADDR_SRC_NONE: begin
499515
// bus.addr <= 32'd0;
@@ -532,6 +548,7 @@ module ARM7TMDI (
532548
endcase
533549
end
534550
endcase
551+
end
535552
end
536553
end
537554

0 commit comments

Comments
 (0)