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-memory-cache-board-comparison.test.ts
import{test,expect}from'bun:test'
import{compareDdrMemoryCachePathToBoard as compare}from'../scripts/ddr-memory-cache-board-comparison'
function fixture(signal='DQ7',ball='E7'){
const pin={ball,signal,terminal:signal,routed:true,x:0,y:0},path={connection:`U1.ball_${ball}`,route:[{route_type:'wire',x:0,y:0,layer:'top',width:.12},{route_type:'wire',x:1,y:0,layer:'top',width:.12}]},candidate=[{type:'pcb_smtpad',pcb_port_id:'pcbport',x:0,y:0,layer:'top'},{type:'pcb_port',pcb_port_id:'pcbport',source_port_id:'port'},{type:'source_port',source_port_id:'port',name:`ball_${ball}`},{type:'source_trace',source_trace_id:'source',connected_source_port_ids:['port']},{type:'pcb_trace',pcb_trace_id:'saved',source_trace_id:'source',route:[{route_type:'wire',x:0,y:0,layer:'top',width:.12},{route_type:'wire',x:-1,y:0,layer:'top',width:.12}]}]as any[]
return{pin,path,candidate,placement:{x:0,y:0,rotation:180}}
}
test('stale E7 DQ7 cache is rejected rather than relabeled as power support',()=>{const f=fixture();expect(compare(f.path,f.pin,0,f.placement,f.candidate)).toEqual([]);f.candidate.at(-1).route[1].x=-1.2;expect(()=>compare(f.path,f.pin,0,f.placement,f.candidate)).toThrow('Stale signal cache 0/E7 (DQ7)')})
test('explicit VDD/VDDQ/VSS/VSSQ replacements are disclosed with ownership and geometry hashes',()=>{for(const signal of['VDD','VDDQ','VSS','VSSQ']){const f=fixture(signal,'F8');f.candidate.at(-1).route[1].x=-.5;const result=compare(f.path,f.pin,1,f.placement,f.candidate);expect(result).toHaveLength(1);expect(result[0]).toMatchObject({ball:'F8',signal,sourcePortId:'port',sourceTraceId:'source',actualTraceId:'saved'});expect(result[0]!.cacheGeometrySha256).not.toBe(result[0]!.actualGeometrySha256)}})
test('coincident foreign trace or wrong source ball cannot authorize a cache replacement',()=>{const f=fixture('VDD','F8');f.candidate.at(-1).source_trace_id='foreign';expect(()=>compare(f.path,f.pin,0,f.placement,f.candidate)).toThrow('source-owned');f.candidate.at(-1).source_trace_id='source';f.candidate[2].name='ball_E7';expect(()=>compare(f.path,f.pin,0,f.placement,f.candidate)).toThrow('source ball identity')})