Files
R8Forge/include/r8forge/geometry.hh
T
dsh a69260522b geometry: kDefaultCellSize now really reads R8FORGE_CELL_SIZE
The build option was plumbed all the way to the compiler (the generated vcxproj
carries R8FORGE_CELL_SIZE=17) but geometry.hh still said = 11, so every width
built an 11 bit toolchain -- which is why the first matrix run printed identical
tapes for all nine widths.  My earlier '16 and 32 verified' claims were therefore
measurements of 11 bit binaries: synth_test and full_add are bit level blocks whose
tape does not depend on the width, so they never noticed.

Now at -DR8FORGE_CELL_SIZE=17: asm/test.r8asm 108789 characters (64513 at 11),
examples/calc.r8asm 112795 (62585), and one session prints '> 000046' -- D is 6 at
17 bits, which is exactly floor(17*log10 2)+1.

tests/widths.ps1 now prints the flagship and calculator tape lengths, because that
is the evidence that a width took effect; an unchanged 64513 means it did not.
2026-11-15 17:32:55 +08:00

16 lines
794 B
C++

#pragma once
#include <cstddef>
#include <cstdint>
// Machine geometry the tools use unless something says otherwise: how wide a
// cell is in bits, and how many cells the tape holds. The instruction set does
// not fix either (ROR just rotates inside a cell and the tape is a ring), so
// these are the only places the old 8 bit / 256 cell assumptions live.
inline constexpr size_t kDefaultCellSize = R8FORGE_CELL_SIZE; // build option: -DR8FORGE_CELL_SIZE=<1..32>
inline constexpr size_t kDefaultMemoryCells = 259;
// The VMs store a cell in uint32_t, so 32 bits is the ceiling -- and `1u << 32`
// would be undefined, hence the special case instead of a plain shift.
inline constexpr uint32_t kDefaultCellMask =
kDefaultCellSize >= 32 ? 0xFFFFFFFFu : (1u << kDefaultCellSize) - 1u;