code wiki / _hdl_build / nx_litho_gate.nx
nx_litho_gate.nx source
↩ module page · 59 lines · 4093 B
1// nx_litho_gate.nx -- GATE: the chip-fab litho twin, pinned to the real DIY frontier (CMU Hacker Fab).
2// T1 PROCESS -- the 9-step recipe (clean->oxidize->coat->expose->develop->etch->dope->strip->metallize) completes -> a transistor.
3// T2 YIELD -- Seeds model on a CMU-class small die = 943 permil (~94%, matching CMU Hacker Fab's real yield).
4// T3 TRANSISTORS-- 952 transistors at ~10 um feature on the die (CMU Hacker Fab's real device count).
5// T4 FRONTIER -- shrink feature 10 um -> 5 um -> 3808 transistors (4x): the path from a flip-flop toward a real CPU.
6// T5 COST -- cost per WORKING chip = wafer cost / (dies * yield) = 53c.
7// T6 LIAR-KILL -- skip the dope step -> NO transistor; a bigger die -> lower yield (769 permil). The physics bites.
8// GREEN iff all. Sovereign nx_cc->nxasm. Fabricates the RV64IM CPU we designed in sim -> printing our own chips.
9// expect_exit: 0 license_tier: ORIGINAL
10import "nx_litho.nx"
11import "nx_syscalls.nx"
12
13func w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
14func wn(v: i64) -> i64 { var m: i64=v; if m<0{w("-" as *u8);m=0-m} let t:*u8=sys_mmap(24); var k:i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i:i64=0; let o:*u8=sys_mmap(24); while i<k{o[i]=t[k-1-i];i=i+1} sys_write(1,o,k); return 0 }
15
16func main() -> i64 {
17 w("=== nx_litho_gate: chip-fab LITHO twin (our own CPUs; pinned to CMU Hacker Fab) ===\n" as *u8)
18 var pass: i64 = 0; var total: i64 = 0
19
20 // T1 process recipe (9 steps)
21 let steps: *i64=sys_mmap(8*16) as *i64
22 var i: i64 = 0
23 while i < 9 { steps[i]=1; i=i+1 }
24 let made: i64 = litho_run_process(steps, 9)
25 total=total+1; if made==1 { pass=pass+1; w(" [PASS] " as *u8) } else { w(" [FAIL] " as *u8) }
26 w("T1 process: clean->oxidize->coat->expose->develop->etch->dope->strip->metallize complete -> transistor=" as *u8); wn(made); w("\n" as *u8)
27
28 // T2 yield (CMU-class small die)
29 let defects: i64 = litho_defects_milli(10, 6) // die-area units * defect density -> 60 milli
30 let yld: i64 = litho_yield_permil(defects)
31 total=total+1; if yld==943 { pass=pass+1; w(" [PASS] " as *u8) } else { w(" [FAIL] " as *u8) }
32 w("T2 yield: " as *u8); wn(yld); w(" permil (~94%, Seeds model, matches CMU Hacker Fab)\n" as *u8)
33
34 // T3 transistors
35 let tr: i64 = litho_transistors(380800, 10)
36 total=total+1; if tr==952 { pass=pass+1; w(" [PASS] " as *u8) } else { w(" [FAIL] " as *u8) }
37 w("T3 transistors: " as *u8); wn(tr); w(" @ 10um feature (CMU Hacker Fab real device count)\n" as *u8)
38
39 // T4 frontier: shrink feature
40 let tr2: i64 = litho_transistors(380800, 5)
41 total=total+1; if tr2==3808 { pass=pass+1; w(" [PASS] " as *u8) } else { w(" [FAIL] " as *u8) }
42 w("T4 frontier: 10um->5um -> " as *u8); wn(tr2); w(" transistors (4x; the path toward a real CPU)\n" as *u8)
43
44 // T5 cost per working chip
45 let cpc: i64 = litho_cost_per_chip(5000, 100, yld) // $50 wafer, 100 dies, 943 permil yield
46 total=total+1; if cpc==53 { pass=pass+1; w(" [PASS] " as *u8) } else { w(" [FAIL] " as *u8) }
47 w("T5 cost/chip: " as *u8); wn(cpc); w("c ($50 wafer / 100 dies / 94% yield)\n" as *u8)
48
49 // T6 liar-kill: skip dope + bigger die
50 steps[6] = 0
51 let made2: i64 = litho_run_process(steps, 9)
52 let yld_big: i64 = litho_yield_permil(litho_defects_milli(50, 6)) // 300 milli -> lower yield
53 total=total+1; if made2==0 { if yld_big==769 { pass=pass+1; w(" [PASS] " as *u8) } else { w(" [FAIL] " as *u8) } } else { w(" [FAIL] " as *u8) }
54 w("T6 liar-kill: skip dope -> transistor=" as *u8); wn(made2); w(" ; bigger die -> yield " as *u8); wn(yld_big); w(" permil (physics bites)\n" as *u8)
55
56 w("\n=== nx_litho_gate " as *u8); wn(pass); w("/" as *u8); wn(total)
57 if pass == total { w(" GREEN (litho fab twin: real process recipe + Seeds yield + transistor scaling + cost, pinned to CMU Hacker Fab; the path to our own CPUs)\n" as *u8); sys_exit(0); return 0 }
58 w(" RED\n" as *u8); sys_exit(1); return 1
59}