code wiki / _hdl_build / nx_pattern_emit2_demo.nx

nx_pattern_emit2_demo.nx source

↩ module page · 24 lines · 1276 B

1// nx_pattern_emit2_demo.nx -- the TEAM authoring COMPARATOR + THRESHOLD_TABLE cores (no Claude logic). 2// Authors a comparator and a real material-profile capacity table (the printer's jam-physics shape: 3// 190C->6000, 210C->10000, 230C->13000 milli-mm3/s) to disk. Engineer verifies the authored tests. 4import "nx_pattern_emit.nx" 5import "nx_syscalls.nx" 6const K_MAGIC_6000: i64 = 6000 7const K_MAGIC_10000: i64 = 10000 8const K_MAGIC_13000: i64 = 13000 9 10func pd_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 11 12func main() -> i64 { 13 let a: i64 = pe_author(3, "_pe_cmp" as *u8, 14 "runtime/_hdl_build/_pe_cmp.nx" as *u8, 15 "runtime/_hdl_build/_pe_cmp_test.nx" as *u8, 0, 0) 16 // a real capacity table the printer arc would use (temp C -> max flow milli-mm3/s) 17 let b: i64 = pe_author_threshold("_pe_cap" as *u8, 18 "runtime/_hdl_build/_pe_cap.nx" as *u8, 19 "runtime/_hdl_build/_pe_cap_test.nx" as *u8, 20 190, K_MAGIC_6000, 210, K_MAGIC_10000, 230, K_MAGIC_13000) 21 if a == 1 { if b == 1 { pd_w("TEAM AUTHORED CORES: _pe_cmp (comparator) + _pe_cap (threshold-table capacity curve) -- verify with Engineer\n" as *u8); sys_exit(0) } } 22 pd_w("author failed\n" as *u8); sys_exit(1) 23 return 1 24}