All five R8Forge machines stored a cell in uint16_t, so anything above 16 bits
was silently truncated even though geometry.hh (and the viz) allow 1..32; and
`(1 << cell_size) - 1` for _CELL_MAX was undefined at 32.
* cells and out/input buffers are uint32_t in derive, tape_run, byte_op_test,
examples_test and synth_test (r8veritas*.hh keep their uint16_t search
state -- that is node ids, unrelated)
* kDefaultCellMask and the injected _CELL_MAX special-case 32 instead of
shifting by 32
* width is now a build option: -DR8FORGE_CELL_SIZE=<1..32> (CMake cache var,
added as a compile definition), so a whole toolchain of another width is one
configure away; build*/ is ignored so those trees do not leak into git
Verified: 11 bits unchanged (tape 64513, byte_op ok); a 16 bit build passes
synth_test 8/8 and byte_op_test (65536 exhaustive pairs); a 32 bit build passes
synth_test, verify_clb_bit_add_nc and assembles full_add to the same 95 chars.
Exhaustive 32 bit is 2^64 pairs -- that stays sampled, not verified.
SPEC 13 checklist now says five VMs / uint32_t / the 32 bit mask case.
16 lines
732 B
C++
16 lines
732 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 = 11;
|
|
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;
|