From 6185f39f34f988ebbd56210633c1d209bc49181a Mon Sep 17 00:00:00 2001 From: dsh Date: Fri, 20 Nov 2026 15:49:27 +0800 Subject: [PATCH] hardware: spell out what the program medium has to satisfy Nothing is committed to flash yet, so section 9 now records the constraint that decides it: the [ skip scans forward but the ] jump scans backward, so whatever holds the tape must support random access, or the machine has to copy the whole tape into RAM at boot. That is why a serial SPI flash cannot execute directly: it only streams forward. A parallel flash or EEPROM with an address bus can be the tape itself (29C010 at 70-150 ns is comfortable at 1 MHz), and on an FPGA the tape simply lives in block RAM next to the bitstream, no external chip at all. The packed image the taper pack tool will emit is medium independent on purpose: the same bytes initialise block RAM, program an EEPROM and drive the RTL testbench, so M0 does not have to wait for the medium decision. Paper tape stays a demo medium only: at 2.54 mm pitch the 577 instruction hello tape is about 1.5 m, and the calculator tape would be 130 m. --- docs/hardware.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/hardware.md b/docs/hardware.md index cd242d1..11b78cb 100644 --- a/docs/hardware.md +++ b/docs/hardware.md @@ -213,10 +213,19 @@ rnz, 最低位 == 1: ip-- ; 深度=0 * **已定**:位宽 = **8**、环 = **64 格**;因此数据 RAM 64 字节、`.`/`,` 就是字节 I/O、8 位计算器 51 378 条 (回到 65536 以内)、全家桶 99 824 步。 * **选哪一档**(A / B / C)—— 还没定,影响后面所有细节。 -* **程序存储器**:内部 RAM、片外 flash/EEPROM、还是卡带装载。 +* **程序介质** —— **还没定**。打包格式(3 bit/条)与介质无关,但介质决定架构形状: + + | 介质 | 谁用 | 随机访问 | 说明 | + |---|---|---|---| + | FPGA 内部 BRAM | A | ✓ | 镜像跟 bitstream 一起烧进去,**不需要任何外部芯片**;8 位全家桶 16.4 KB,Tang Nano 9K 的 58 KB 装得下 | + | 并行 flash / EEPROM(29C010、39SF010、28C256…) | B | ✓(地址总线 + 数据总线) | 一片就是"纸带":地址给出 `ip` 那个字节,取低 3 bit;70~150 ns,配 1 MHz 时钟宽裕 | + | 串行 SPI NOR flash(W25Q 那类) | A/B | ✗ 只能顺序读,`]` 要往回跳 | 得先**整条拷进 RAM**再执行( loader + 64 KB PSRAM/BRAM);好处是能换"卡带" | + | 纸带 / 卡带 | C、演示 | ✗ | 只当装载介质:2.54 mm 孔距下 `hello`(577 条)约 1.5 m,计算器那 5 万条要 130 m ✗ | + + **硬约束**:`[` 的跳过是**前向**扫描、`]` 的跳回是**后向**扫描(§2 的伪码),所以执行介质 + 必须有随机访问 —— 或者启动时整条拷进 RAM。这就是为什么"串行 flash 直连执行"不可行, + 而"并行 ROM 直连"和"flash → RAM 装载"都行。 * **要不要"纸带"这个物理形态**:演示级纸带(≤ ~2000 条,2.54 mm 孔距约 5 m)可以做, 大程序进 ROM(8 位全家桶 16.4 KB)。 * **第一步**:M0 —— `r8forge tape pack` + `hardware/rot8.v` 的 testbench 对拍。不依赖任何 - 硬件采购,三档共用同一份黄金模型。 -* **第一步做什么**:我建议先写 M0 —— `r8forge tape pack` + 一份 `hardware/rot8.v` 的 - testbench 对拍。它不依赖任何硬件采购,而且做完之后 A/B/C 三档共用同一份"黄金模型"。 + 硬件采购,也不需要先定介质(打包输出同时喂 BRAM 初始化、EEPROM 烧写器和 testbench)。