Skip to main content

Module validate

Module validate 

Source
Expand description

Architecture-dependent validation for the vihaco-backed ISA.

These checks gate a Program against an ArchSpec. They are arch-dependent by design: when no arch spec is supplied (validate called with None), every check here is skipped and an empty error list is returned — an arch-free program is considered fine at this layer.

validate runs the arch-dependent capability + address checks below. validate_structure adds arch-independent structural checks, and simulate_stack adds optional stack-type simulation (underflow, type mismatches, and lane/location group validation).

§Capability checks

  • feed_forward → CPU control flow. Without mid-circuit classical feedback the hardware can only run straight-line code, so any nested [vihaco_cpu] branch/call (br, cond_br, call, call_indirect) is rejected. (This rule exists because the Cpu variant makes those opcodes representable in a lanes program.)
  • feed_forward → multiple measurements. Without feed-forward at most one measure may appear.
  • atom_reloadingfill. Without atom reloading, refilling atoms after the initial fill is unsupported.

§Address checks

Every const_loc / const_lane / const_zone operand is decoded and checked against the architecture’s topology via ArchSpec::check_location / check_lane / check_zone — invalid zones, words, sites, lanes, and AOD constraints are reported with the arch layer’s own message.

Modules§

tag
Value type tags tracked by the simulate_stack type simulator. These mirror the stack value kinds the runtime distinguishes.

Enums§

ValidationError
An arch-dependent validation failure, tagged with the offending instruction’s program counter.

Functions§

simulate_stack
Run the type-level stack simulation over a program. Collects underflow and type-mismatch errors, plus lane/location group errors (validated against arch when provided, else duplicate-only).
validate
Validate a program’s arch-dependent constraints (capabilities + addresses).
validate_structure
Validate a program’s arch-independent structural rules: new_array operand bounds, initial_fill ordering, and terminator/reachability. These never consult an arch spec, so they always run.