code wiki / _hdl_build / _pe14_probe.nx
_pe14_probe.nx source
↩ module page · 41 lines · 1728 B
1// _pe14_probe.nx -- bootstrap probe: drive pe14 (PERMIL_VERDICT, shape 20) to author a
2// verdict organ from a DATA spec, hands-off. Two specs prove DATA -> DIFFERENT organ.
3// spec A = the WP-exceed scoreboard: total=14 buckets, bands RED(0)/ONLADDER(1)/EXCEED(2).
4import "nx_pattern_emit14.nx"
5import "nx_syscalls.nx"
6
7func main() -> i64 {
8 let a: *i64 = sys_mmap(8 * 16) as *i64
9 a[0] = 14
10 a[1] = 3
11 a[2] = 0; a[3] = 0
12 a[4] = 500; a[5] = 1
13 a[6] = 1000; a[7] = 2
14 let oka: i64 = pe14_author_permil_verdict("_pv_wp" as *u8, "runtime/_hdl_build/_pv_wp.nx" as *u8, "runtime/_hdl_build/_pv_wp_test.nx" as *u8, a)
15
16 // spec B = a DIFFERENT shape from DATA only (no new tutor code): total=24 analytics features,
17 // bands FAIL(0)/PARTIAL(7)/STRONG(9) at permil 0/300/750 -> proves the SAME emitter, new DATA.
18 let b: *i64 = sys_mmap(8 * 16) as *i64
19 b[0] = 24
20 b[1] = 3
21 b[2] = 0; b[3] = 0
22 b[4] = 300; b[5] = 7
23 b[6] = 750; b[7] = 9
24 let okb: i64 = pe14_author_permil_verdict("_pv_an" as *u8, "runtime/_hdl_build/_pv_an.nx" as *u8, "runtime/_hdl_build/_pv_an_test.nx" as *u8, b)
25
26 // refusal rail: a descending-threshold spec MUST be refused (nothing written)
27 let c: *i64 = sys_mmap(8 * 16) as *i64
28 c[0] = 10
29 c[1] = 2
30 c[2] = 800; c[3] = 1
31 c[4] = 200; c[5] = 0
32 let okc: i64 = pe14_author_permil_verdict("_pv_bad" as *u8, "runtime/_hdl_build/_pv_bad.nx" as *u8, "runtime/_hdl_build/_pv_bad_test.nx" as *u8, c)
33
34 if oka == 1 { if okb == 1 { if okc == 0 {
35 sys_write(1, "PE14-PROBE ok: A+B authored, bad REFUSED\n" as *u8, 40)
36 sys_exit(0)
37 } } }
38 sys_write(1, "PE14-PROBE FAIL\n" as *u8, 15)
39 sys_exit(1)
40 return 1
41}