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/audit-ddr-ram-power-drops.ts

import {readFileSync,writeFileSync} from 'node:fs'
import {resolve} from 'node:path'
import {verifyDdrCapture} from './ddr-capture-provenance'
const dir=process.argv[2];if(!dir)throw Error('Usage: full-host-capture-directory')
const {captureHash,snapshot}=verifyDdrCapture(dir)
if(!snapshot.hostProfiles||!snapshot.pathsByByte)throw Error('Requires full AM3352 RAM host paths')
const maxLengthMm=1.524
const rows=snapshot.pathsByByte.flatMap((paths:any[],byte:number)=>snapshot.terminalsByByte[byte].filter((t:any)=>/^VDD(?:Q)?_|^VSS(?:Q)?_/.test(t.terminal)).map((terminal:any)=>{
 const path=paths.find(p=>p.connection===`U1.ball_${terminal.ball}`);if(!path)throw Error(`Missing ${terminal.terminal}`)
 let length=0,via:any
 for(let i=0;i<path.route.length;i++){const p=path.route[i],a=path.route[i-1];if(p.route_type==='via'){via=p;break}if(a?.route_type==='wire'&&p.route_type==='wire'&&a.layer===p.layer)length+=Math.hypot(p.x-a.x,p.y-a.y)}
 return {byte,terminal:terminal.terminal,ball:terminal.ball,localViaPresent:Boolean(via),lengthToViaOrUnterminatedEdgeMm:length,maximumBallToConnectionViaMm:maxLengthMm,status:via?(length<=maxLengthMm+1e-8?'local-launch-length-pass':'launch-too-long'):'missing-local-connection-via',via:via?{x:via.x,y:via.y,from:via.from_layer,to:via.to_layer}:undefined}
}))
const missing=rows.filter((r:any)=>!r.localViaPresent),tooLong=rows.filter((r:any)=>r.lengthToViaOrUnterminatedEdgeMm>maxLengthMm+1e-8)
const report={captureHash,status:missing.length||tooLong.length?'power-drop-work-required':'local-power-launch-length-pass',source:'TI SPRS717L Table 7-65 row 12 and footnote 9',missingLocalViaCount:missing.length,alreadyOverLengthCount:tooLong.length,rows,scope:'RAM ball-to-first-via geometry only; capacitors connect through their own vias/planes. A pass does not establish supply continuity, current capacity, bypass proximity or PDN performance.'}
writeFileSync(resolve(dir,'power-drop-audit.json'),JSON.stringify(report,null,2)+'\n')
console.log(JSON.stringify({status:report.status,terminals:rows.length,missingLocalViaCount:missing.length,alreadyOverLengthCount:tooLong.length}))
if(missing.length||tooLong.length)process.exitCode=1