0hmX/am3352
This code suite comprises TypeScript scripts that analyze, verify, and assemble complex DDR memory interface hardware, focusing on physical routing, via and pad placement, electrical clearance, and physical constraints, often involving precise geometric calculations and consistent provenance tracking.
- Version
- 1.0.5
- License
- unset
- Stars
- 0
scripts/prepare-ddr-accepted-host-parent.ts
/** Turn a verified host solver result into a hash-bound isolated routing parent. */
import{readFileSync,writeFileSync,mkdirSync}from'node:fs';import{resolve}from'node:path';import{objectHash as hash}from'./improve-ddr-a9-power-launches';import{auditCompositeHostTopology}from'./ddr-composite-routing-context';
const[pArg,sArg,oArg]=process.argv.slice(2),parent=resolve(pArg),solver=resolve(sArg),out=resolve(oArg),read=(p:string)=>JSON.parse(readFileSync(p,'utf8')),before=read(parent+'/candidate.circuit.json'),prior=read(parent+'/report.json'),candidate=read(solver+'/candidate.circuit.json'),r=read(solver+'/report.json'),host=read(solver+'/host-bundle.json'),input=read(solver+'/routing-input.json'),added=read(solver+'/raw-traces.json');if(!r.accepted||hash(before)!==prior.candidateCircuitSha256||hash([...before,...added])!==hash(candidate)||added.length!==1)throw Error('Exact one-host assembly differs');const topology=auditCompositeHostTopology(candidate,host.traces,input.connections);if(!topology.valid)throw Error('Actual topology fails');mkdirSync(out,{recursive:true});const write=(n:string,v:any)=>writeFileSync(out+'/'+n,JSON.stringify(v,null,2)+'\n'),manifest={captureHash:r.captureHash,parentDirectory:parent,parentCircuitSha256:hash(before),candidateCircuitSha256:hash(candidate),replacements:[],removals:[],additions:added};for(const[n,v]of [['candidate.circuit.json',candidate],['host-bundle.json',host],['routing-input.json',input],['original-copper-replacements.json',manifest]])write(n as string,v);write('report.json',{...prior,candidateCircuitSha256:hash(candidate),hostTracesSha256:hash(host.traces),hostBundleSha256:hash(host),originalCopperReplacementsSha256:hash(manifest),connectedHostCount:host.traces.length,physical:r.physical,topology,allAngles:r.allAngles,allJunctions:r.allJunctions,newHostEvidence:r,scope:'Isolated co-design host added; explicit earlier host retirements remain pending. Not a completed interface.'});for(const n of ['ram-byte0-facing-progress.trace-paths.json','ram-byte1-facing-progress.trace-paths.json','source-provenance.json'])write(n,read(parent+'/'+n));for(const n of ['exit-contract.json','ram-byte1-exit-contract.json'])write(n,{...read(parent+'/'+n),candidateCircuitSha256:hash(candidate)});for(const args of [['scripts/audit-ddr-global-power-launches.ts',out,'dist/ddr-system/host-taps-54af3e346b5e'],['scripts/audit-ddr-current-byte-budgets.ts','dist/ddr-system/host-taps-54af3e346b5e',out,out+'/current-byte-budgets.json']]){const p=Bun.spawn(['bun',...args],{stdout:'ignore',stderr:'inherit'});if(await p.exited!==0)throw Error('Fresh audit failed')};if(hash(read(parent+'/candidate.circuit.json'))!==hash(before))throw Error('Parent changed');console.log(JSON.stringify({out,candidateSha:hash(candidate),hosts:host.traces.length}))