finish(maybe...)

This commit is contained in:
2026-04-14 21:30:38 +08:00
parent 785e92ec8b
commit 2c61ef07ff
172 changed files with 202485 additions and 68 deletions
+86 -13
View File
@@ -5,12 +5,13 @@
## 0. 需求冻结(已确认)
- [x] 模式:单次地址翻译可视化 + 批量访问统计
- [x] 系统位数:仅支持 `32 / 48 / 64`
- [x] 页大小输入:仅支持 `2^n KB`
- [x] 计算机位数:固定 `32-bit`
- [x] 虚拟地址有效位:固定 `24-bit`
- [x] 页大小:固定 `4 KB`
- [x] 访问次数 `N`:可配置
- [x] TLB:全相联 + LRU,条目数可配置,默认 `16`
- [x] TLB:固定 `8` 条全相联 + LRU
- [x] 页表:固定二级页表(稀疏结构)
- [x] 物理内存输入:`MB`(自动换算帧数)
- [x] 物理内存:固定 `1 MB`(自动换算帧数)
- [x] 缺页替换:FIFO
- [x] 指标:TLB 命中率 / 页表命中率 / 缺页次数 / 平均访问开销
- [x] 交互:单步 / 连续播放 / 重置
@@ -40,10 +41,11 @@
### 输入字段(MVP)
- [x] `vaBits`:`32|48|64`
- [x] `pageSizeKB`:`2^n`
- [x] `physicalMemoryMB`:正整数
- [x] `tlbEntries`:正整数,默认 `16`
- [x] `machineBits`:固定 `32`
- [x] `vaBits`:固定 `24`
- [x] `pageSizeKB`:固定 `4`
- [x] `physicalMemoryMB`:固定 `1`
- [x] `tlbEntries`:固定 `8`
- [x] `accessCount`:正整数
- [x] `pageFaultPenalty`:默认 `100`(抽象开销单位)
@@ -77,7 +79,7 @@
### 完成标准
- [x] 控制台可打印每次地址拆分结果
- [x] 32/48/64 三种位数下拆分结果均正确
- [x] 固定 24 位 VA 场景下拆分结果正确
## 4. Step 3 - TLB(全相联 + LRU)
@@ -163,13 +165,84 @@
### TODO
- [ ] 新建主场景 `Main.unity`
- [ ] 参数面板:位数/页大小/物理内存/TLB条目/N/开销参数
- [ ] 参数面板:固定规格展示(位数/页大小/物理内存/TLB)+ 可调参数(N/开销/地址模式)
- [ ] 控制按钮:`单步`、`连续播放`、`暂停`、`重置`
- [ ] 流程节点 UI:当前步骤高亮(颜色 + 轻动画)
- [ ] 表格区:TLB、页表关键条目、FIFO 队列
- [ ] 日志时间线:每次访问的关键事件文本
- [ ] 指标区:四项核心指标实时显示
### 字段绑定对照(Step 7)
- [ ] `SimulationUiController.configInputView` -> 挂有 `SimulationConfigInputView` 的对象
- [ ] `SimulationUiController.controlView` -> 挂有 `SimulationControlView` 的对象
- [ ] `SimulationUiController.dashboardView` -> 挂有 `SimulationDashboardView` 的对象
- [ ] `SimulationUiController.tablesView` -> 挂有 `SimulationTablesView` 的对象
- [ ] `SimulationUiController.traceView` -> 挂有 `SimulationTraceView` 的对象(拆分/分支解释)
- [ ] `SimulationUiController.compactEventView` -> 主视图短事件流(建议 5-8 条)
- [ ] `SimulationUiController.detailTimelineView` -> 详细日志时间线(可放在抽屉中)
- [ ] `SimulationUiController.processHeaderView` -> 流程主标题与当前事件
- [ ] `SimulationUiController.flowAnimator` -> 挂有 `StepFlowAnimator` 的对象
- [ ] `SimulationUiController.detailDrawerView` -> 挂有 `SimulationDetailDrawerView` 的对象
- [ ] `SimulationUiController.playIntervalSeconds` -> 连续播放间隔秒数
- [ ] `SimulationConfigInputView.fixedCoreSpecText` -> 固定核心规格说明文本(32位机/24位VA/4KB页/1MB物理内存/TLB 8条全相联)
- [ ] `SimulationConfigInputView.machineBitsInput` -> 计算机位数显示输入框(只读,固定32)
- [ ] `SimulationConfigInputView.vaBitsDropdown` -> 虚拟地址位数下拉(只读,固定24)
- [ ] `SimulationConfigInputView.pageSizeKBInput` -> 页大小 KB 输入框(只读,固定4)
- [ ] `SimulationConfigInputView.physicalMemoryMBInput` -> 物理内存 MB 输入框(只读,固定1)
- [ ] `SimulationConfigInputView.tlbEntriesInput` -> TLB 条目数输入框(只读,固定8)
- [ ] `SimulationConfigInputView.accessCountInput` -> 访问次数 N 输入框
- [ ] `SimulationConfigInputView.pageFaultPenaltyInput` -> 缺页惩罚输入框
- [ ] `SimulationConfigInputView.addressModeDropdown` -> 地址模式下拉(Random/SequentialArrayLoop)
- [ ] `SimulationConfigInputView.arrayLengthBytesInput` -> 数组总长度(bytes)
- [ ] `SimulationConfigInputView.arrayElementBytesInput` -> 数组元素大小(bytes)
- [ ] `SimulationConfigInputView.arrayBaseAddressInput` -> 数组基址(十进制)
- [x] `SimulationControlView.stepButton` -> `单步` 按钮
- [x] `SimulationControlView.playButton` -> `连续播放` 按钮
- [x] `SimulationControlView.pauseButton` -> `暂停` 按钮
- [x] `SimulationControlView.resetButton` -> `重置` 按钮
- [x] `SimulationDashboardView.stateSummaryText` -> 当前步骤/地址拆分/命中状态文本
- [x] `SimulationDashboardView.statsText` -> 统计指标文本
- [x] `SimulationDashboardView.errorText` -> 参数错误提示文本
- [x] `SimulationTablesView.tlbText` -> TLB 表格文本区
- [x] `SimulationTablesView.pageTableText` -> 页表关键条目文本区
- [x] `SimulationTablesView.fifoText` -> FIFO 队列文本区
- [ ] `SimulationTraceView.splitTraceText` -> 地址拆分可视化文本
- [ ] `SimulationTraceView.pageTableTraceText` -> 多级页表查询路径文本
- [ ] `SimulationTraceView.decisionReasonText` -> 当前分支原因文本
- [ ] `SimulationTraceView.pathSummaryText` -> 当前访问路径摘要文本
- [x] `SimulationTimelineView.logContainer` -> 日志内容容器(建议 VerticalLayoutGroup)
- [x] `SimulationTimelineView.logItemPrefab` -> 单条日志 TMP_Text 预制体
- [x] `SimulationTimelineView.logScrollRect` -> 日志滚动视图
- [x] `SimulationTimelineView.maxLogEntries` -> 日志最大保留条数(建议 `200`)
- [x] `SimulationProcessHeaderView.currentStepText` -> 当前步骤文本(流程主区)
- [x] `SimulationProcessHeaderView.currentEventText` -> 当前关键事件文本(流程主区)
- [x] `SimulationDetailDrawerView.drawerRoot` -> 细节抽屉根节点
- [x] `SimulationDetailDrawerView.dashboardTabRoot` -> Dashboard 页签内容根节点
- [x] `SimulationDetailDrawerView.tablesTabRoot` -> Tables 页签内容根节点
- [x] `SimulationDetailDrawerView.eventsTabRoot` -> Events 页签内容根节点(detailEventFlow)
- [x] `SimulationDetailDrawerView.openOnStart` -> 抽屉是否默认展开
- [x] `SimulationDetailDrawerView.dashboardTabButton` -> Drawer 内 Dashboard Tab 按钮
- [x] `SimulationDetailDrawerView.tablesTabButton` -> Drawer 内 Tables Tab 按钮
- [x] `SimulationDetailDrawerView.eventsTabButton` -> Drawer 内 Events Tab 按钮
- [x] `SimulationDetailDrawerView.closeDrawerButton` -> Drawer 内关闭按钮
- [ ] 主界面 Info 按钮 -> `SimulationUIController.OpenDetailDrawer()`
- [ ] `StepFlowAnimator.stepNodes(7项)` -> `GenerateVA/SplitVA/LookupTLB/LookupPageTable/HandlePageFault/ComposePA/Finalize` 节点
- [ ] `StepFlowAnimator.stepNodes[].target` -> 节点 `RectTransform`
- [ ] `StepFlowAnimator.stepNodes[].canvasGroup` -> 节点 `CanvasGroup`
- [ ] `StepFlowAnimator.stepNodes[].background` -> 节点背景 `Image`
- [ ] `StepFlowAnimator.accessPulseTarget` -> 完整访问完成时做脉冲动画的容器节点
### 完成标准
- [ ] UI 上可完整观察一次访问的每个阶段
@@ -180,11 +253,11 @@
### 测试清单
- [ ] 参数边界:最小/最大可接受输入
- [ ] 位数覆盖:32/48/64 各跑一轮
- [ ] 页大小覆盖:多个 `2^n KB` 值
- [ ] 固定规格回归:`32位机 + 24位VA + 4KB页 + 1MB物理内存`
- [ ] 固定规格下参数覆盖:访问次数 / 缺页惩罚 / 地址生成模式
- [ ] 小样本可视化:`N=10`
- [ ] 大样本稳定性:`N=10000`
- [ ] TLB 容量边界:`1`、`16`、大值
- [ ] TLB 固定容量验证:`8` 条全相联 + LRU 顺序正确
- [ ] 物理内存极小场景:高缺页率验证 FIFO
### 验收标准
Binary file not shown.