diff --git a/include/r8forge/geometry.hh b/include/r8forge/geometry.hh index dd0f609..944cc50 100644 --- a/include/r8forge/geometry.hh +++ b/include/r8forge/geometry.hh @@ -7,7 +7,7 @@ // 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 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. diff --git a/tests/widths.ps1 b/tests/widths.ps1 index cce7519..4dd68ae 100644 --- a/tests/widths.ps1 +++ b/tests/widths.ps1 @@ -1,4 +1,4 @@ -# Build the toolchain at a set of cell widths and run what is meaningful there. +# Build the toolchain at a set of cell widths and run what is meaningful there. # # powershell -File tests\widths.ps1 # 1,2,7,8,11,16,17,31,32 # powershell -File tests\widths.ps1 -Widths 8,11,32 # just these @@ -30,10 +30,19 @@ foreach ($w in $Widths) { if ($LASTEXITCODE -ne 0) { Write-Host " widthfree tests FAILED"; $failed += $w } else { Write-Host " widthfree tests ok" } + # Tape lengths are the honest evidence that the width took effect: the + # flagship is full of %rep _CELL_SIZE, so it must grow with the width. + $r8 = Join-Path $dir "Release\r8forge.exe" + $flagship = (& $r8 "asm/test.r8asm" --quiet 2>$null | Out-String).Length + Write-Host (" flagship tape: $flagship chars (11 bit: 64513)") + $derive = Join-Path $dir "Release\r8forge_derive.exe" + $calc = (& $r8 "examples/calc.r8asm" --quiet 2>$null | Out-String).Length $out = & $derive "examples/calc.r8asm" 0 -i "12 34 + ." 2>$null | Out-String - if ($LASTEXITCODE -eq 0) { Write-Host (" calc: " + ($out.Trim() -replace '\s+', ' ')) } - else { Write-Host " calc: does not run at this width" } + if ($LASTEXITCODE -eq 0) { + Write-Host (" calc: $calc chars" + $(if ($calc -gt 65536) { " (over the viz limit)" } else { "" })) + Write-Host (" calc run: " + ($out.Trim() -replace '\s+', ' ')) + } else { Write-Host " calc: does not run at this width" } Remove-Item -Recurse -Force $dir }