The header scan (Captain Bob, 2026-11-10): 788 source files -- 351 with the
SL-1.0 header, 12 with the old name (docs/working/experiments, kept by
ruling), 31 under someone else's licence (tools/kconfig, Linux's, GPL-2.0:
kept), and 394 with none. Ruled: the SPDX form; capsules (.4th, .f18) and
proofs (.thy) left for a ruling of their own (mkcapsule's 64x16 block format,
content-addressed capsules).
253 files now begin
SPDX-License-Identifier: LicenseRef-Starship-1.0
Copyright (c) 2023-2026 Robert A. James
as a /* */ block (C, headers, assembly, linker scripts) or # lines (scripts,
Makefiles, Kconfig; below a shebang or a coding line); tools/mkcapsule.c,
which had the copyright line, gets the SPDX line only.
Not touched: docs/working/ (archive and old campaign material, as the
ruling kept the experiments); v4/system/post_cases.c (generated by
v4/tools/mkpost.py, "do not edit" -- the generator has the header).
Comments only: the kernel builds on amd64, aarch64, riscv64; make -C v4
test-32: 39 programs, 0 failures; every changed script parses.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
64 lines
2.5 KiB
C
64 lines
2.5 KiB
C
/* SPDX-License-Identifier: LicenseRef-Starship-1.0
|
|
* Copyright (c) 2023-2026 Robert A. James
|
|
*/
|
|
/* cell.h -- v4 cell width as a build parameter.
|
|
*
|
|
* DECOMPOSITION.md D-5: the host node's cell width matches the host CPU
|
|
* (32 on a Zynq-7000 Cortex-A9, 64 on an aarch64 host). JUSTIFICATION.md
|
|
* section 5 makes this the second invariance axis: if K==1.0 holds across
|
|
* cell widths as well as across ISAs, the conservation law is shown not to
|
|
* depend on word size.
|
|
*
|
|
* The compiler capsule is written width-independent against these types.
|
|
* Nothing in v4 may assume a particular V4_CELL_BITS; if you find yourself
|
|
* wanting to, the code belongs in the host node, not the mesh.
|
|
*
|
|
* JUSTIFICATION.md section 5 also fixes the split that matters for the
|
|
* physics: heat and K arithmetic stay 64-bit on every host regardless of
|
|
* cell width, because they must not lose precision when the cell shrinks.
|
|
* That is why this header defines a separate v4_heat_t rather than reusing
|
|
* v4_cell.
|
|
*/
|
|
#ifndef V4_CELL_H
|
|
#define V4_CELL_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifndef V4_CELL_BITS
|
|
#error "V4_CELL_BITS must be defined to 32 or 64 (e.g. -DV4_CELL_BITS=32)."
|
|
#endif
|
|
|
|
#if V4_CELL_BITS == 32
|
|
typedef int32_t v4_cell;
|
|
typedef uint32_t v4_ucell;
|
|
#elif V4_CELL_BITS == 64
|
|
typedef int64_t v4_cell;
|
|
typedef uint64_t v4_ucell;
|
|
#else
|
|
#error "V4_CELL_BITS must be 32 or 64."
|
|
#endif
|
|
|
|
/* Physics/heat arithmetic width. Fixed at 64 by JUSTIFICATION.md section 5:
|
|
* "Heat and K arithmetic remain 64-bit (int64_t in C99 on every host; double
|
|
* cells on a 32-bit node). Changing only the payload width keeps the
|
|
* experiment clean: any difference in K can be attributed to cell width and
|
|
* not to lost precision." The C side is therefore always 64-bit; the
|
|
* double-cell framing is the 32-bit node's problem, not this type's. */
|
|
typedef int64_t v4_heat_t;
|
|
typedef uint64_t v4_uheat_t;
|
|
|
|
/* MSB -- the cell-width top-bit constant.
|
|
*
|
|
* DECOMPOSITION.md section 5.5 (RSHIFT) and section 5.7 (D2/) both call for
|
|
* "MSB, the cell-width top-bit constant" but never define it, which leaves a
|
|
* bit-width-dependent constant to be invented mid-arithmetic. It is defined
|
|
* here once, as a value with exactly the cell's sign bit set and nothing
|
|
* else, so that the sign-test idioms in those two words are width-correct by
|
|
* construction at 32 and at 64. */
|
|
#define V4_MSB (((v4_ucell)1) << (V4_CELL_BITS - 1))
|
|
|
|
/* All-ones, the width-correct "true". FORTH-79 uses -1 for TRUE. */
|
|
#define V4_ALL_ONES ((v4_cell)-1)
|
|
|
|
#endif /* V4_CELL_H */
|