Two separate things hid behind "32 bit works": * tests/byte_op_test.cc could not compile at 32 bits at all (`1 << 32` in a constexpr plus an int typed mask), so the whole 32 bit build stopped there -- only `r8forge` and the core library came out. kCellMod is now clamped at 31+ bits and main() prints "skipped" above 16 bits (every sweep there is 2^W rows) and exits green. All ten targets build at 32 bits with MSVC, and the same tree builds clean on a Gentoo box with GCC 16 -- the missing <cstring> in asm_test.cc that stopped GCC first is in the previous commit. * the digit drivers hardcoded a 4 cell window, so byte_op_test's digits / digits_signed / undigits failed at every other width (16 bits wants 5 digits, 8 bits 3). drv/digits.r8asm, drv/digits_signed.r8asm and drv/undigits_byte.r8asm now derive D = _CELL_SIZE * 30103 / 100000 + 1 and space their cells by it, and the C++ side uses the same kDigits instead of a literal 4 (including the T/F cells clb_digits_signed leaves behind). With that, byte_op_test passes at 8, 11 and 16 bits (the 16 bit run takes about 450 s) and above 16 it skips. Two more width bugs fell out on the way: the divmod divisor sweep used 1000 and 2047 unconditionally (they wrap at 8 bits), and the undigits garbage guard OR'ed in bits above the cell, which at 8 bits turned '0'+digit into a value over 255. test_divmod_signed also divided by the recovered divisor without re-checking it, and at 8 bits the boundary value 1024 wraps to 0 -- that was a hard crash (divide by zero), not a failure. CMakeLists.txt now refuses -DR8FORGE_CELL_SIZE outside 1..32 at configure time; the range used to be a comment, so an out of range width was discovered as a compiler error in whichever file shifted by it first. geometry.hh and SPEC section 13 record that 32 is the ceiling because every VM stores a cell in uint32_t -- going further means widening all five VMs, the assembler's immediate type and ROT-8-viz's rot8_data. Also recorded there: the %synth cache is keyed by the truth table, not the width, so a 32 bit build hits the committed entries (0.4 s for the flagship tape of 227075 characters). A full cold rebuild takes ~500 s on a 44 thread machine, 479 s of which is the single 6 parameter full adder table.
18 lines
643 B
Plaintext
18 lines
643 B
Plaintext
; clb_undigits 的驱动:0 起是 D 个数字格(低 7 位 ASCII),紧跟着是结果格,再往后是草稿。
|
||
;
|
||
; r8forge_derive drv/undigits_byte.r8asm -1 0=49 1=50 2=51 3=52 # 11 位: out 1234
|
||
; r8forge_derive drv/undigits_byte.r8asm -1 0=48 1=48 2=48 3=55 # 11 位: out 7
|
||
;
|
||
; 位数和 clb_digits 一致(_CELL_SIZE*30103/100000+1,11 位下 4、16 位下 5),
|
||
; 所以 REG、N、S 的地址都跟着 D 走 —— 写死 4 格的话 16 位下数字会撞进结果格。
|
||
%include "asm/undigits.r8asm"
|
||
|
||
.var D _CELL_SIZE * 30103 / 100000 + 1
|
||
.var REG 0
|
||
.var N D
|
||
.var S D + 1
|
||
|
||
clb_undigits REG N S
|
||
|
||
output N
|