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/bounds.test.ts

import { test, expect } from 'bun:test'
import { LAYOUT_PROFILES, getAM3352Bounds, type LayoutProfile } from '../src/profiles'
import { getAM3352TracePaths } from '../src/saved-paths'

for(const profile of Object.keys(LAYOUT_PROFILES) as LayoutProfile[]) {
 test(`${profile}: rectangular terminal bounds contain source geometry and complete via copper`,()=>{
  const settings=LAYOUT_PROFILES[profile]
  const bounds=getAM3352Bounds(profile)
  expect(settings.fanoutWidthMm).toBeCloseTo(bounds.maxX-bounds.minX,8)
  expect(settings.fanoutHeightMm).toBeCloseTo(bounds.maxY-bounds.minY,8)
  // Immutable support-copper envelope from 488 real pads, 133 fixed vias,
  // and 173 fixed routes (scripts/check-fixed-envelope.ts has the witnesses).
  expect(bounds.minX).toBeLessThanOrEqual(-8.2)
  expect(bounds.maxX).toBeGreaterThanOrEqual(8.2)
  expect(bounds.minY).toBeLessThanOrEqual(-8.2)
  expect(bounds.maxY).toBeGreaterThanOrEqual(8.38)
  for(const path of getAM3352TracePaths(profile))for(const point of path.route){
   const radius=point.route_type==='via'?Number(point.via_diameter)/2:0
   const x=Number(point.x),y=Number(point.y)
   expect(x-radius).toBeGreaterThanOrEqual(bounds.minX-1e-7)
   expect(x+radius).toBeLessThanOrEqual(bounds.maxX+1e-7)
   expect(y-radius).toBeGreaterThanOrEqual(bounds.minY-1e-7)
   expect(y+radius).toBeLessThanOrEqual(bounds.maxY+1e-7)
  }
  // Wire terminal centers lie on these bounds. Their round end caps extend
  // by half the final trace width; these are not board-edge copper bounds.
 })
}