feat(saolei): 交互玩扫雷每一步自动出 PNG

- play_saolei.tcl: k 每执行一个按键动作就存 shots/NNN_<按键>.png,并覆盖
  shots/latest.png(在 VS Code 里开着 latest.png 即可每步自动刷新);新增 view 命令
- fb2png.py: 新增 --quiet(只写 PNG 不打印,供脚本批量截图)
- tb_saolei*.v: 仅格式调整(case 分支拆行),无语义变化
实测:k cuuuuc -> shots/001_c.png ... 006_c.png,每张 640x480 正常
This commit is contained in:
2026-09-19 20:01:28 +08:00
parent 132c9202f6
commit 713ee99941
4 changed files with 113 additions and 38 deletions
+29 -15
View File
@@ -127,12 +127,16 @@ module tb_saolei;
// irq_rise: 该线的上升沿次数(CPU 按上升沿响应中断)
integer ptr_ev = 0, irq_hi = 0, irq_rise = 0;
reg irq_prev_q;
initial irq_prev_q = 1'b0;
initial
irq_prev_q = 1'b0;
always @(posedge dut.clk_cpu) begin
if (dut.g_btn.u_ptr.ev_valid_o) ptr_ev = ptr_ev + 1;
if (dut.irq_vec[0]) irq_hi = irq_hi + 1;
if (dut.g_btn.u_ptr.ev_valid_o)
ptr_ev = ptr_ev + 1;
if (dut.irq_vec[0])
irq_hi = irq_hi + 1;
irq_prev_q <= dut.irq_vec[0];
if (dut.irq_vec[0] && !irq_prev_q) irq_rise = irq_rise + 1;
if (dut.irq_vec[0] && !irq_prev_q)
irq_rise = irq_rise + 1;
end
// 每毫秒打一行,观察事件链路
@@ -171,7 +175,7 @@ module tb_saolei;
jmp_log = jmp_log + 1;
end
if ((dut.u_cpu.pc_q >= 32'h0000_0194 && dut.u_cpu.pc_q < 32'h0000_0200) ||
(dut.u_cpu.pc_q >= 32'h0000_0218 && dut.u_cpu.pc_q < 32'h0000_0300))
(dut.u_cpu.pc_q >= 32'h0000_0218 && dut.u_cpu.pc_q < 32'h0000_0300))
$display("[gap] %0t ns: PC 0x%03h -> 0x%03h (跳进空洞)", $time, pc_prev, dut.u_cpu.pc_q);
end
end
@@ -284,19 +288,29 @@ module tb_saolei;
input integer gap_us;
begin
case (which)
0: go = 1'b1;
1: btnu = 1'b1;
2: btnd = 1'b1;
3: btnl = 1'b1;
default: btnr = 1'b1;
0:
go = 1'b1;
1:
btnu = 1'b1;
2:
btnd = 1'b1;
3:
btnl = 1'b1;
default:
btnr = 1'b1;
endcase
#(hold_us * 1000);
case (which)
0: go = 1'b0;
1: btnu = 1'b0;
2: btnd = 1'b0;
3: btnl = 1'b0;
default: btnr = 1'b0;
0:
go = 1'b0;
1:
btnu = 1'b0;
2:
btnd = 1'b0;
3:
btnl = 1'b0;
default:
btnr = 1'b0;
endcase
#(gap_us * 1000);
end