code wiki / _hdl_build / nx_pattern_emit11_demo.nx

nx_pattern_emit11_demo.nx source

↩ module page · 27 lines · 1374 B

1// nx_pattern_emit11_demo.nx -- the TEAM authors a PREDICTOR_CODER hands-off: the Builder's 2// emitter writes _pe_lpc2 (the NV1 LPC residual core shape: order 2, Int16 bound) + its test; 3// the ENGINEER then builds+runs the authored test in the gate script. Also proves the 4// refusal rails: order 5 and vmax 8 specs are REFUSED (no file written, returns 0). 5// license_tier: ORIGINAL 6import "nx_pattern_emit11.nx" 7const K_MAGIC_32767: i64 = 32767 8 9func main() -> i64 { 10 let ok: i64 = pe11_author_predictor_coder("_pe_lpc2" as *u8, 11 "runtime/_hdl_build/_pe_lpc2.nx" as *u8, 12 "runtime/_hdl_build/_pe_lpc2_test.nx" as *u8, 2, K_MAGIC_32767) 13 p11_w(1, "PE11 AUTHORED=" as *u8); p11_wn(1, ok); p11_w(1, " (_pe_lpc2 order=2 vmax=32767)\n" as *u8) 14 let r1: i64 = pe11_author_predictor_coder("_pe_bad1" as *u8, 15 "/tmp/_pe_bad1.nx" as *u8, "/tmp/_pe_bad1_test.nx" as *u8, 5, K_MAGIC_32767) 16 let r2: i64 = pe11_author_predictor_coder("_pe_bad2" as *u8, 17 "/tmp/_pe_bad2.nx" as *u8, "/tmp/_pe_bad2_test.nx" as *u8, 2, 8) 18 p11_w(1, "PE11 REFUSALS order5=" as *u8); p11_wn(1, r1) 19 p11_w(1, " vmax8=" as *u8); p11_wn(1, r2); p11_w(1, " (0 = refused, the rail)\n" as *u8) 20 var pass: i64 = 1 21 if ok != 1 { pass = 0 } 22 if r1 != 0 { pass = 0 } 23 if r2 != 0 { pass = 0 } 24 if pass == 1 { sys_exit(0) } 25 sys_exit(1) 26 return 1 27}