seveibar/am3352-ram-dogbone-and-single-layer-route-test
AM3352BZCZ100 processor connected to a W631GG6MB-12 DDR3 memory chip through a routed, length-matched 16-bit DDR interface with clock/data-strobe pairs and control/address signals.
- Version
- 0.0.9
- License
- unset
- Stars
- 0
scripts/coupled-plan.test.ts
import { expect, test } from 'bun:test'
import input from '../validation/routing-input.json'
import { materializePlan,checkTiming } from '../routing/coupled-plan'
test('all 47 paths have two endpoint vias and pass retained skew limits',()=>{
const traces=materializePlan(input,'simplified');expect(traces.length).toBe(47);checkTiming(input,traces)
for(const t of traces)expect(t.route.filter(p=>p.route_type==='via').length).toBe(2)
})
test('a changed placement cannot silently reuse the geometric plan',()=>{
const moved=structuredClone(input);moved.connections[0].pointsToConnect[0].x+=.01
expect(()=>materializePlan(moved,'tuned')).toThrow('placement changed')
})
test('changed width and board bounds require replanning',()=>{
const wide=structuredClone(input);wide.connections[0].width=.2
expect(()=>materializePlan(wide,'tuned')).toThrow('width changed')
const resized=structuredClone(input);resized.bounds.maxX+=1
expect(()=>materializePlan(resized,'tuned')).toThrow('bounds changed')
})
test('ordinary-turn cleanup preserves every tuned trace length',()=>{
const before=materializePlan(input,'tuned'),after=materializePlan(input,'simplified')
const length=(t:any)=>t.route.slice(1).reduce((n:number,p:any,i:number)=>{const q=t.route[i];return n+(p.route_type==='wire'&&q.route_type==='wire'&&p.layer===q.layer?Math.hypot(p.x-q.x,p.y-q.y):0)},0)
for(let i=0;i<before.length;i++)expect(Math.abs(length(before[i])-length(after[i]))).toBeLessThan(1e-7)
checkTiming(input,before);checkTiming(input,after)
})
test('turn cleanup retains both members of every differential pair',()=>{
const before=materializePlan(input,'tuned'),after=materializePlan(input,'simplified')
for(const n of [15,16,27,26,32,33]){
const name=`source_trace_${n}`
expect(after.find(t=>t.source_trace_id===name)).toEqual(before.find(t=>t.source_trace_id===name))
}
})