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-facing-progress.test.ts

import{test,expect}from'bun:test'
import{appendVerifiedFacingHost,buildFacingRamCache}from'../scripts/assemble-ddr-facing-progress'
test('composite host append retains exact old host copper and rejects substitutions',()=>{const a={type:'pcb_trace',pcb_trace_id:'a',route:[1]},b={type:'pcb_trace',pcb_trace_id:'b',route:[2]};expect(appendVerifiedFacingHost([a],[a],[a,b])).toEqual([a,b]);expect(()=>appendVerifiedFacingHost([a],[a],[{...a,route:[9]},b])).toThrow('Existing host changed');expect(()=>appendVerifiedFacingHost([a,b],[a],[a,b])).toThrow('Ambiguous new host')})
test('72-path export changes only B7/E7 and rejects envelope growth',()=>{const route=[{route_type:'wire',x:0,y:0,layer:'inner2',width:.12},{route_type:'wire',x:1,y:0,layer:'inner2',width:.12}],paths=Array.from({length:72},(_,i)=>({connection:`U1.ball_${i===0?'B7':i===1?'E7':`P${i}`}`,route:structuredClone(route)})),snapshot={placements:[{pcbRotation:180,pcbX:0,pcbY:0}],pathsByByte:[paths]},trace={route:route.map(p=>({...p,x:-p.x,layer:'inner4'}))},replacements=[{ball:'B7',trace},{ball:'E7',trace}],result=buildFacingRamCache(snapshot,replacements);expect(result.paths.length).toBe(72);expect(result.paths[0].route[0].layer).toBe('inner4');expect(result.paths.slice(2)).toEqual(paths.slice(2));expect(paths[0].route[0].layer).toBe('inner2');expect(()=>buildFacingRamCache(snapshot,[{ball:'B7',trace},{ball:'B7',trace}])).toThrow();expect(()=>buildFacingRamCache(snapshot,[{ball:'B7',trace:{route:trace.route.map(p=>({...p,x:p.x*2}))}},{ball:'E7',trace}])).toThrow('RAM envelope grew')})