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-b9-shared-power-launches.test.ts

import{test,expect}from'bun:test'
import{readFileSync,existsSync}from'node:fs'
import{b9SharedRoute}from'../scripts/improve-ddr-b9-shared-power-launches'
import{validateDeclaredDdrReplacements}from'../scripts/improve-ddr-a9-power-launches'
test('shared B9 approach is octilinear, one45bend, under1.524mm and adds no via',()=>{
 const r=b9SharedRoute({route_type:'wire',x:0,y:0,width:.12,layer:'top',start_pcb_port_id:'p'},{x:-.55,y:-.8001})
 expect(r.length).toBeCloseTo(1.0279174593,9);expect(r.route).toHaveLength(3);expect(r.route[1]).toMatchObject({x:-.55,y:-.55});expect(r.route.every(p=>p.route_type==='wire')).toBe(true);expect(r.route[0].start_pcb_port_id).toBe('p')
})
test('shared approach rejects excessive length and wrong layer',()=>{expect(()=>b9SharedRoute({x:0,y:0,layer:'top'},{x:2,y:3})).toThrow();expect(()=>b9SharedRoute({x:0,y:0,layer:'inner2'},{x:.5,y:.8})).toThrow()})
test.skipIf(!existsSync('dist/ddr-integrated-ten-power54/ram-power-launch-audit.json'))('power54 preserves exact nested support and actual52 launches while adding only two B9 routes',()=>{
 const read=(p:string)=>JSON.parse(readFileSync(p,'utf8')),base='dist/ddr-integrated-ten',p52=base+'-power52',dir=base+'-power54',parent=read(p52+'/candidate.circuit.json'),child=read(dir+'/candidate.circuit.json'),manifest=read(dir+'/original-copper-replacements.json'),audit=read(dir+'/ram-power-launch-audit.json'),report=read(dir+'/report.json')
 expect(validateDeclaredDdrReplacements(read(base+'/candidate.circuit.json'),parent,read(p52+'/original-copper-replacements.json')).valid).toBe(true);expect(validateDeclaredDdrReplacements(parent,child,manifest).declaredReplacementCount).toBe(2)
 expect(readFileSync(dir+'/host-bundle.json').equals(readFileSync(p52+'/host-bundle.json'))).toBe(true)
 expect(audit.launchQualified).toBe(54);expect(audit.planeConnected).toBe(54);expect(audit.total).toBe(60)
 for(const r of audit.rows.filter((r:any)=>r.terminal==='VDDQ_B9')){expect(r.actualPadToContactViaMm).toBeCloseTo(1.0279174593,9);expect(r.connectionVia.annulusSamplesInPlane).toBe(32);expect(audit.rows.filter((n:any)=>n.connectionVia&&Math.hypot(n.connectionVia.x-r.connectionVia.x,n.connectionVia.y-r.connectionVia.y)<1e-7)).toHaveLength(2)}
 expect(report.physical.errors).toHaveLength(0);expect(report.physical.violations).toHaveLength(0);expect(report.physical.angles.valid).toBe(true);expect(report.physical.joinedBends).toHaveLength(0);expect(report.physical.connectivity.filter((c:any)=>c.connected)).toHaveLength(10)
})