12.10 双可执行接线:编译产出 sidecar,BytecodeExecutor 跑周期。

- STCompiler -o:另写 <name>.runtime.toml(io 绑定 var→槽号→channel/bit,槽号来自链接结果)
- BytecodeExecutor <name>.stb [--cycles N] [--replay <file>]:加载 .stb + sidecar,
  逐周期采样 I(回放行按 io.input 顺序)→ 跑周期 → 打印 I/Q;故障打印 FAULT 退出码 1
- 手写 sidecar 解析(冻结 TOML 子集);Machine 暴露 header()(dt_ms/cycle_limit)
- 验证:line1 回放 0/1 组合 Q 正确(急停/start 语义)、用例 06 CycleLimit FAULT;ctest 10/10
This commit is contained in:
2026-08-21 20:26:28 +08:00
parent 8c0fc4fe98
commit 00565f035d
5 changed files with 267 additions and 4 deletions
+3
View File
@@ -62,6 +62,9 @@ namespace vm {
/** @brief 最近一次故障(step 返回 false 后查询) */
Fault fault() const;
/** @brief 映像头(dt_ms / cycle_limit 等) */
const isa::ImageHeader& header() const;
/** @brief 当前指令下标(相对当前函数字节码段) */
uint32_t pc() const;
+1
View File
@@ -78,6 +78,7 @@ bool Machine::step() {
}
Fault Machine::fault() const { return fault_; }
const isa::ImageHeader& Machine::header() const { return image_.header(); }
uint32_t Machine::pc() const { return pc_; }
uint32_t Machine::fn_id() const { return cur_frame().fn_id; }
uint32_t Machine::cycle_count() const { return cycle_count_; }