code wiki / _hdl_build / nx_litho.nx

nx_litho.nx source

↩ module page · 40 lines · 2115 B

1// nx_litho.nx -- LIB: the semiconductor LITHOGRAPHY / chip-fab process twin (omniforge SI garage-litho; the path to 2// printing our OWN CPUs). Models the real process recipe (clean->oxidize->coat-resist->expose-mask->develop->etch-> 3// dope->strip->metallize) and the real PHYSICS: YIELD via the Seeds model Y = 1/(1+AD) (A=die area, D=defect density), 4// transistors per die as a function of feature size, and cost per WORKING chip. Pinned to the real DIY frontier 5// (Zeloof Z2 ~100 transistor NMOS; CMU Hacker Fab 952 transistors @ ~94% yield). This fabricates the chip whose 6// netlist we designed in sim (the RV64IM CPU). never-brick #26: sim model, deterministic (fabricating a NEW chip is 7// not bricking existing hardware). license_tier: ORIGINAL 8import "nx_syscalls.nx" 9const K_MAGIC_1000000: i64 = 1000000 10 11// Seeds yield model in permil: Y = 1/(1+AD). defects_per_die_milli = AD*1000. Y_permil = 1e6 / (1000 + ad_milli). 12func litho_yield_permil(defects_per_die_milli: i64) -> i64 { 13 return K_MAGIC_1000000 / (1000 + defects_per_die_milli) 14} 15 16// expected defects per die (in milli) = die area (units) * defect density. 17func litho_defects_milli(die_area_units: i64, defect_density: i64) -> i64 { 18 return die_area_units * defect_density 19} 20 21// transistors on a die = die_area_um2 / (feature_um^2 * layout_factor). Smaller feature -> more transistors. 22func litho_transistors(die_area_um2: i64, feature_um: i64) -> i64 { 23 let tr_area: i64 = feature_um * feature_um * 4 24 if tr_area <= 0 { return 0 } 25 return die_area_um2 / tr_area 26} 27 28// cost per WORKING chip (cents) = wafer_cost * 1000 / (dies_per_wafer * yield_permil). 29func litho_cost_per_chip(wafer_cost_c: i64, dies: i64, yield_permil: i64) -> i64 { 30 let denom: i64 = dies * yield_permil 31 if denom <= 0 { return 0 - 1 } 32 return wafer_cost_c * 1000 / denom 33} 34 35// run the process recipe: 1 iff EVERY step succeeds (a complete fabrication -> a transistor); 0 if any step missing. 36func litho_run_process(steps_ok: *i64, n: i64) -> i64 { 37 var i: i64 = 0 38 while i < n { if steps_ok[i] == 0 { return 0 } i = i + 1 } 39 return 1 40}