code wiki / (root) / nx_robot_hal_gate.nx

nx_robot_hal_gate.nx

buildroot/runtime/nx_robot_hal_gate.nx

5514 B131 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic robot
docsdependenciesstructsconstsfunctions

about

nx_robot_hal_gate.nx -- R-ROBO-5 GATE: the fail-safe hardware-write driver, never-brick PROVEN MECHANICALLY (the proof #26 demands -- not a promise). VERIFIES: (1) safe-default on init (all outputs 0); (2) clamp HIGH: a huge command lands as exactly HW_SAFE_MAX; (3) clamp LOW: a hugely-negative command lands as exactly HW_SAFE_MIN; (4) pass-through: an in-envelope command lands unchanged; (5) EXHAUSTIVE never-brick: sweep commands incl. extremes (+/-1e9) -- the actual written value is ALWAYS within [HW_SAFE_MIN, HW_SAFE_MAX] (0 escapes -> the mechanical never-brick proof); (6) e-stop latches and forces every output safe (0), and stays safe after; (7) watchdog overrun auto-e-stops (fail-safe on a stalled loop); (8) sensor range-check flags out-of-range readings invalid; (9) NEGATIVE CONTROL: the raw (non-fail-safe) write path DOES escape the envelope -- proving the clamp is what provides the guarantee. 100% sovereign, integer-only. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_robot_hal.nx nx_robot_hal_gate.nx

imports: nx_syscalls.nxnx_robot_hal.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap sw sys_write hwd_new sys_mmap ↻ hwd_out check sw ↻ hwd_drive sn sys_write ↻ sys_mmap ↻ hwd_estop hwd_wd_tick hwd_estop ↻ hwd_estopped hwd_sensor_invalid hwd_drive_raw sys_exit

structs

none

consts

none

functions

18func sw(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: checkmain calls 1: sys_write
19func sn(v: i64) -> i64
called by 1: main calls 2: sys_writesys_mmap
29func check(name: *u8, cond: i64, tot: *i64) -> i64
called by 1: main calls 1: sw
36func main() -> i64