// ============================================================================
// phi_lattice.h — C declarations for the real asm substrate (phi_lattice.asm).
// Freestanding-safe: only stdint.h, no libc calls made by the asm itself.
// ============================================================================
#ifndef HDGL_PHI_LATTICE_H
#define HDGL_PHI_LATTICE_H

#include <stdint.h>

#define PHI_LATTICE_SLOTS 128

#ifdef __cplusplus
extern "C" {
#endif

// one prismatic-recursion step over all 128 slots, driven by *tick.
void phi_lattice_tick(uint32_t* lattice, uint64_t* tick);

// 1 if the lattice has reached consensus (LOCK: max deviation < mean/2).
int  phi_lattice_consensus(uint32_t* lattice);

#ifdef __cplusplus
}
#endif

#endif
