Files
R8Forge/drv/digits_signed.r8asm
dsh d0fd127048 build: the 32 bit toolchain builds, and 8/16 bit byte tests really pass
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.
2026-11-19 13:41:59 +08:00

24 lines
822 B
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
%include "asm/digits.r8asm"
; clb_digits_signed 的驱动:0 号 cell 放值,1 起是 D 位数字区,之后是 clb_digits 的
; 13 格草稿、取负草稿 T、符号标志 F。
;
; r8forge_derive drv/digits_signed.r8asm -1 0=7 # 11 位: 48 48 48 55 "0007"
; r8forge_derive drv/digits_signed.r8asm -1 0=2047 # 11 位: 45 48 48 48 49 "-0001"
; r8forge_derive drv/digits_signed.r8asm -1 0=1024 # 11 位: 45 49 48 50 52 "-1024"
;
; D = _CELL_SIZE * 30103 / 100000 + 1(11 位下 4、16 位下 5),地址跟着位宽走。
; out 先可能是 45('-'),再是区域 D 格。全扫在 r8forge_byte_op_test 里。
.var D _CELL_SIZE * 30103 / 100000 + 1
.var N 0
.var REG 1
.var S 1 + D
.var T S + 13
.var F T + 1
clb_digits_signed N REG S T F
%for k D
output REG + k
%endfor