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

tests/ddr-dq0-retuning.test.ts

import{test,expect}from'bun:test'
import{existsSync,readFileSync}from'node:fs'
import{validateDeclaredDdrReplacements}from'../scripts/improve-ddr-a9-power-launches'
test.skipIf(!existsSync('dist/ddr-dq0-retuned/candidate.circuit.json'))('DQ0 tuning preserves both physical vias and all other copper while passing topology/selfcontact gates',()=>{
 const d='dist/ddr-dq0-retuned',read=(p:string)=>JSON.parse(readFileSync(p,'utf8')),r=read(d+'/report.json'),m=read(d+'/original-copper-replacements.json'),q=m.replacements[0],parent=read(m.parentDirectory+'/candidate.circuit.json'),child=read(d+'/candidate.circuit.json')
 expect(validateDeclaredDdrReplacements(parent,child,m).declaredReplacementCount).toBe(1);expect(r.accepted).toBe(true);expect(r.measuredMm).toBeCloseTo(28.423158,8);expect(r.measuredMm-r.beforeMm).toBeCloseTo(3.2116912515,8)
 expect(q.after.route[0]).toEqual(q.before.route[0]);expect(q.after.route.at(-1)).toEqual(q.before.route.at(-1));const vias=q.after.route.filter((p:any)=>p.route_type==='via');expect(vias).toHaveLength(2);expect(vias).toEqual(q.before.route.filter((p:any)=>p.route_type==='via'));expect(q.after.route.filter((p:any)=>p.route_type==='wire').every((p:any)=>p.width===.12)).toBe(true)
 expect(r.topology.valid).toBe(true);expect(r.selfContacts.valid).toBe(true);expect(r.topology.physical.errors).toHaveLength(0);expect(r.topology.physical.violations).toHaveLength(0);expect(r.topology.physical.connectivity.filter((c:any)=>c.connected)).toHaveLength(11);expect(r.allAngles.valid).toBe(true);expect(r.allJunctions.valid).toBe(true);expect(r.terminal.valid).toBe(true)
})
test.skipIf(!existsSync('dist/ddr-eleven-byte0-dq0-timing/report.json'))('finalDQ0 bundle preserves parent artifacts and verifies actual strobe mean plus56launches',()=>{
 const d='dist/ddr-eleven-byte0-dq0-timing',read=(p:string)=>JSON.parse(readFileSync(p,'utf8')),r=read(d+'/report.json'),m=read(d+'/original-copper-replacements.json'),power=read(d+'/ram-power-launch-audit.json')
 for(const n of['ram-byte0-facing-progress.trace-paths.json','source-provenance.json'])expect(readFileSync(d+'/'+n).equals(readFileSync(m.parentDirectory+'/'+n))).toBe(true)
 expect(readFileSync(d+'/parent-original-copper-replacements.json').equals(readFileSync(m.parentDirectory+'/original-copper-replacements.json'))).toBe(true)
 expect(r.dq0Evidence.actualFullPlanarMm).toBeCloseTo(r.dq0Evidence.actualDqs0MeanMm,7);expect(power.launchQualified).toBe(56);expect(power.planeConnected).toBe(56);expect(r.connectedHostCount).toBe(11);expect(r.preservedHostCount).toBe(10);expect(read(d+'/routing-input.json').traces).toEqual(read(d+'/host-bundle.json').traces);const {traces:oldTraces,...oldInput}=read(m.parentDirectory+'/routing-input.json'),{traces:newTraces,...newInput}=read(d+'/routing-input.json');expect(newInput).toEqual(oldInput);expect(readFileSync(d+'/parent-exit-contract.json').equals(readFileSync(m.parentDirectory+'/exit-contract.json'))).toBe(true)
})