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.test.ts
import { describe, expect, test } from 'bun:test'
import { auditAM3352Ddr, ddrNetClass, type DdrPath } from '../src/ddr'
import paths from '../src/generated/native.trace-paths.json'
describe('DDR compliance audit', () => {
test('classifies both byte lanes without treating VREF/VTP/RESET as timed address signals', () => {
expect(ddrNetClass('DDR_D15')).toBe('DQ1')
expect(ddrNetClass('DDR_DQM0')).toBe('DQ0')
expect(ddrNetClass('DDR_DQSn1')).toBe('DQS1')
for (const name of ['DDR_VTP', 'DDR_VREF', 'DDR_RESETn']) expect(ddrNetClass(name)).toBeUndefined()
})
test('never claims a local escape proves a complete DDR interface', () => {
const report = auditAM3352Ddr(paths)
expect(report.compliant).toBe(false)
expect(report.unverified.length).toBeGreaterThan(0)
expect(report.signals.length).toBe(49)
expect(report.byteLanes.every(l => l.signals.length === 11)).toBe(true)
})
test('detects a missing DDR path and deliberate subminimum trace', () => {
const modified: DdrPath[] = structuredClone(paths)
const clock = modified.find(p => p.connection === 'U1.D1')!
clock.route.find(p => p.route_type === 'wire')!.width = 0.05
const report = auditAM3352Ddr(modified.filter(p => p.connection !== 'U1.D2'))
expect(report.failures.some(f => f.code === 'trace-width' && f.signal === 'DDR_CKn')).toBe(true)
expect(report.failures.some(f => f.code === 'coverage' && f.signal === 'DDR_CK')).toBe(true)
})
test('detects deliberately broken layer transition and reference stackup', () => {
const modified: DdrPath[] = structuredClone(paths)
const clock = modified.find(p => p.connection === 'U1.D1')!
clock.route[1]!.layer = 'bottom'
const report = auditAM3352Ddr(modified, { layers: ['top', 'bottom'], planes: [] })
expect(report.failures.some(f => f.code === 'missing-via')).toBe(true)
expect(report.failures.some(f => f.code === 'missing-reference-plane')).toBe(true)
expect(report.failures.some(f => f.code === 'reference-adjacency')).toBe(true)
})
})