feat: PinMAP转PinList v1.2.0 - 新增PinList转PinMAP反向转换功能
This commit is contained in:
@@ -46,6 +46,31 @@ class ValidationResult:
|
||||
warnings: list[ValidationError] = field(default_factory=list)
|
||||
|
||||
|
||||
@dataclass
|
||||
class PinListEntry:
|
||||
"""A single pin entry from the PinList."""
|
||||
number: int # Pin 序号(B 列)
|
||||
name: str # PinName(A 列,可能为空)
|
||||
|
||||
|
||||
@dataclass
|
||||
class EdgePins:
|
||||
"""Pins assigned to one edge of the PinMAP."""
|
||||
edge: str # "left" | "bottom" | "right" | "top"
|
||||
pins: list[tuple[int, str]] # [(number, name), ...]
|
||||
cells: list[tuple[int, int]] # 对应的单元格坐标 (row, col) 0-based
|
||||
|
||||
|
||||
@dataclass
|
||||
class PinMAPLayout:
|
||||
"""计算出的 PinMAP 布局。"""
|
||||
package_info: str
|
||||
rows: int
|
||||
cols: int
|
||||
edges: dict[str, EdgePins] # left/bottom/right/top
|
||||
cells: dict[str, str] # 单元格数据 {"A2": "1", "B2": "Pin1", ...}
|
||||
|
||||
|
||||
# ── Custom exceptions ──────────────────────────────────────────────
|
||||
|
||||
class PinMapError(Exception):
|
||||
@@ -58,3 +83,7 @@ class FileFormatError(PinMapError):
|
||||
|
||||
class StructureError(PinMapError):
|
||||
"""Raised when the PinMAP structure is invalid or unrecognisable."""
|
||||
|
||||
|
||||
class LayoutError(PinMapError):
|
||||
"""布局计算错误(尺寸无效、Pin 数量不匹配等)。"""
|
||||
|
||||
Reference in New Issue
Block a user