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/check-profile-junctions.ts
/** Check every public rendered profile, including edge contacts and fixed support. */
import assert from 'node:assert/strict'
import {readFileSync,writeFileSync,mkdirSync} from 'node:fs'
import {createHash} from 'node:crypto'
import {auditDdrTraceJunctions} from './check-ddr-system-copper'
import {auditRouteAngles} from './check-route-angles'
import {LAYOUT_PROFILES} from '../src/profiles'
export function auditRenderedProfileAngles(circuit:any[]){
const junctions=auditDdrTraceJunctions(circuit),renderedRouteAngles=auditRouteAngles(circuit.filter((e:any)=>e.type==='pcb_trace'))
return{...junctions,valid:junctions.valid&&renderedRouteAngles.valid,renderedRouteAngles}
}
export function assertRenderedProfileAngles(circuit:any[]){
const report=auditRenderedProfileAngles(circuit)
assert.ok(report.valid,`Rendered route/junction rule failed: ${JSON.stringify({errors:report.errors,angles:report.renderedRouteAngles.violations,joins:report.joinedBends}).slice(0,2400)}`)
return report
}
if(import.meta.main){
const reports=[]
for(const profile of Object.keys(LAYOUT_PROFILES)){
const path=`src/generated/${profile}.circuit.json`,text=readFileSync(path,'utf8'),circuit=JSON.parse(text),report=auditRenderedProfileAngles(circuit)
reports.push({profile,path,sha256:createHash('sha256').update(text).digest('hex'),traceCount:circuit.filter((e:any)=>e.type==='pcb_trace').length,...report})
console.log(`${profile}: ${report.valid?'PASS':'FAIL'} all rendered trace angles and copper junctions; ${report.errors.length} errors, ${report.renderedRouteAngles.violations.length} route angle violations, ${report.joinedBends.length} invalid joins`)
}
mkdirSync('dist',{recursive:true})
writeFileSync('dist/profile-junction-audit.json',JSON.stringify(reports,null,2)+'\n')
if(reports.some(r=>!r.valid))process.exitCode=1
}