12.11 闭环:二十用例点亮 + 单步观察。

- cases_test:tests/cases/01..20 逐一跑完整管线(解析→链接→类型→码→VM 周期),
  按 EXPECTED.md 期望断言:13 正例运行通过(含双周期可重复)、06 CycleLimit、6 负例报错类别
- BytecodeExecutor --step:采样 I → 逐指令打印 pc/fn/反汇编 + 执行后非零寄存器 → I/Q
- Machine 补 header()/ended()/nregs()/cur_instr() 观察接口
- ctest 11/11(cases_all 20 用例点亮);line1 回放 0/1 组合 Q 正确、单步 I=[0 1]→Q=[1]
This commit is contained in:
2026-08-21 20:31:14 +08:00
parent 00565f035d
commit 66d9c6c548
6 changed files with 308 additions and 41 deletions
+10
View File
@@ -20,6 +20,7 @@
#include <vector>
#include "isa/Image.h"
#include "isa/Instr.h"
namespace vm {
@@ -62,6 +63,9 @@ namespace vm {
/** @brief 最近一次故障(step 返回 false 后查询) */
Fault fault() const;
/** @brief 周期是否已结束(MAIN 的 RET 后为 true */
bool ended() const;
/** @brief 映像头(dt_ms / cycle_limit 等) */
const isa::ImageHeader& header() const;
@@ -87,6 +91,12 @@ namespace vm {
/** @brief 当前帧寄存器值(i < nregs */
int64_t reg(uint8_t i) const;
/** @brief 当前帧寄存器数(函数头 nregs) */
uint32_t nregs() const;
/** @brief 当前指令(pc_ 处;单步/观察用) */
isa::Instr cur_instr() const;
private:
struct Frame {
uint32_t fn_id = 0; // 本帧函数