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/shorten-ddr-address-escapes.ts
/** Compact two-x8 host fix. Reapply after regenerating the ddr_left cache.
* Validates all saved/fixed copper and tight bounds before changing the cache. */
import {readFileSync,writeFileSync} from 'node:fs'
import {validateDdrProfile} from './validate-ddr-profiles'
const file='src/generated/ddr_left.trace-paths.json',paths=JSON.parse(readFileSync(file,'utf8'))
const path=(ball:string)=>{const p=paths.find((p:any)=>p.connection===`U1.${ball}`);if(!p)throw Error(`Missing ${ball}`);return p}
const wire=(x:number,y:number,layer:string)=>({route_type:'wire',x,y,width:.1016,layer})
const a6=path('D5'),a8=path('D4'),ba0=path('C4')
for(const [p,x,y,layer] of [[a6,-4,4.8,'inner6'],[a8,-4.8,4.8,'inner6'],[ba0,-4.8,5.6,'inner2']] as const){
const via=p.route[2];if(via.route_type!=='via'||Math.hypot(via.x-x,via.y-y)>1e-7||via.to_layer!==layer)throw Error(`Changed launch at ${p.connection}; re-evaluate geometry`)
}
const endX=a6.route.at(-1).x
if(Math.abs(endX+9.31)>1e-7)throw Error('CPU boundary changed; re-evaluate the corridor')
a6.route=[...a6.route.slice(0,4),wire(-3.6,5.2,'inner6'),wire(-3.6,8.8,'inner6'),wire(-4,9.2,'inner6'),wire(endX,9.2,'inner6')]
// Keep the original via launch; lower only the outer detour and exit.
a8.route=[...a8.route.slice(0,8),wire(-4.4,8.28,'inner6'),wire(-4.4,8.58,'inner6'),wire(-4.8,8.98,'inner6'),wire(endX,8.98,'inner6')]
ba0.route=[...ba0.route.slice(0,6),wire(-5.182,6.5968,'inner2'),wire(-5.3852,6.8,'inner2'),wire(endX,6.8,'inner2')]
const report=validateDdrProfile('ddr_left',paths)
if(!process.argv.includes('--check'))writeFileSync(file,JSON.stringify(paths,null,2)+'\n')
console.log({status:process.argv.includes('--check')?'validated':'saved',allCopperDrc:report.allCopperDrc.valid,ddrDrc:report.ddrCopperDrc.valid,bounds:report.bounds,changedSignals:['DDR_A6','DDR_A8','DDR_BA0']})