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

src/ProfilePreview.tsx

import {edgeContacts} from './saved-paths'
import { LAYOUT_PROFILES, getAM3352Bounds, getAM3352PowerPlanes, type LayoutProfile } from './profiles'
import { Fragment } from 'react'
import {AM3352Module,getAM3352TracePaths} from './index'
import {AM3352_SIGNAL_CONNECTIONS,AM3352_DIFFERENTIAL_PAIRS} from './layout'
import {AM3352_PINS} from './pin-map'
export default ({layoutProfile='native',pcbX=0,pcbY=0,pcbRotation=0,boardSize}:{layoutProfile?:LayoutProfile,pcbX?:number,pcbY?:number,pcbRotation?:number,boardSize?:number}={})=>{
 const settings=LAYOUT_PROFILES[layoutProfile]
 const bounds=getAM3352Bounds(layoutProfile)
 const radius=Math.max(...Object.values(bounds).map(Math.abs))
 const powerPlanes=getAM3352PowerPlanes(layoutProfile)
 const am3352TracePaths=getAM3352TracePaths(layoutProfile)
 return <board width={boardSize??Math.max(34,radius*2+12)} height={boardSize??Math.max(34,radius*2+12)} layers={settings.layerCount} schematicDisabled
 defaultTraceWidth={settings.traceWidthMm} minTraceWidth={.08128} minViaPadDiameter={.4} minViaHoleDiameter={.2}
 minPadEdgeToPadEdgeClearance={.0762} minTraceToPadEdgeClearance={.0762} minViaEdgeToPadEdgeClearance={.0762}
 allowBlindAndBuriedVias={false} autorouter={{allowViaInPad:false,algorithmFn:edgeContacts}}>
 <AM3352Module layoutProfile={layoutProfile} pcbX={pcbX} pcbY={pcbY} pcbRotation={pcbRotation} />
 {[...new Set(powerPlanes.map(p=>p.netName))].map(name=><Fragment key={name}><net name={name}/></Fragment>)}
 {powerPlanes.map(p=><Fragment key={`${p.netName}:${p.layer}`}><copperpour layer={p.layer} connectsTo={`net.${p.netName}`} clearance={settings.clearanceMm} boardEdgeMargin={.2}/></Fragment>)}
 {AM3352_SIGNAL_CONNECTIONS.map(c=>{
  const pin=AM3352_PINS[c.pinNumber-1]!
  const end=am3352TracePaths.find(p=>p.connection===`U1.${pin.ballName}`)!.route.at(-1)!
  const angle=pcbRotation*Math.PI/180
  const x=pcbX+end.x*Math.cos(angle)-end.y*Math.sin(angle), y=pcbY+end.x*Math.sin(angle)+end.y*Math.cos(angle)
  const layer=end.route_type==='wire'?end.layer:end.to_layer
  return <Fragment key={c.traceName}>
   <chip name={`EDGE_${pin.ballName}`} pcbX={x} pcbY={y} footprint={<footprint><smtpad portHints={['pin1']} pcbX={0} pcbY={0} width={settings.traceWidthMm} height={settings.traceWidthMm} shape="rect" layer={layer}/></footprint>} />
   <trace name={c.traceName} from={`net.AM3352_SAVED_SIGNAL_${pin.ballName}`} to={`EDGE_${pin.ballName}.pin1`}/>
  </Fragment>
 })}
 {AM3352_DIFFERENTIAL_PAIRS.map(p=><Fragment key={p.name}><differentialpair name={p.name} positiveConnection={p.positiveConnection} negativeConnection={p.negativeConnection} maxLengthSkew={p.lengthTolerance}/></Fragment>)}
</board>

}