From ac60cdaef958b7e5784d4b5f4968606e5b514b76 Mon Sep 17 00:00:00 2001 From: dsh Date: Tue, 24 Nov 2026 19:59:06 +0800 Subject: [PATCH] hardware: the instruction lamps show the instruction at ip, not the last one Clarifying what the INSTRUCTION row means: it is the opcode at the program counter, so while running it is the instruction executing and while stopped it is the next one to execute -- which is what you want when single stepping. On halt the lamps are gated off, because past the end the ROM reads zeros and opcode 0 is a move, which would show a lie. That choice also keeps the panel rule intact: ip is state, and the last executed instruction would be history, the same category as the step counter that was removed. A last instruction display would need a 74LS273 latch and an end of instruction strobe, and would lag by one during RUN, mixing state and history on one panel. Recorded in panel.md together with the halt detail. --- hardware/panel.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hardware/panel.md b/hardware/panel.md index f9b45d9..3b917c7 100644 --- a/hardware/panel.md +++ b/hardware/panel.md @@ -53,6 +53,21 @@ (也考虑过:矩阵左侧 8 + 上方 8 颗红氖做十字光标 —— 交点即指针;或者每格一颗红氖环的第二套矩阵。前者 16 颗、后者 80 颗,都不如 6 颗二进制直白。) +### 3.2 INSTRUCTION 灯排显示哪一条 + +**显示 `ip` 处的指令**(不是"上一条")。因为 `ip` 是状态,"上一条"是历史 —— 和删掉步数计数器 +是同一条理由。 + +| 状态 | 灯排 | +|---|---| +| RUN | 正在执行的那条(取指与执行同条) | +| 停下(单步后 / HALT) | **下一条**要执行的(`ip` 指向它) | +| `ip == LEN`(停机) | **全灭**:用 `halted` 门掉灯使能 | + +硬件几乎白送:`74LS138` 直接译 ROM 的 `D2..D0`,`ip` 不变时数据线稳定,不需要锁存器 ✓。 + +要显示"上一条"就得多一片 **74LS273** + 微码在每条指令末尾发 `OPCODE_LATCH`;代价是 RUN 时 +显示滞后一条、语义混成"状态 + 历史",不建议。 ## 4. 电气 | 项 | 值 |