@@ -114,6 +114,16 @@ def BidirPinSignature(width, **kwargs):
114
114
PinList = List [Pin ]
115
115
Pins = Union [PinSet , PinList ]
116
116
117
+ class PowerPins (enum .Enum ):
118
+ POWER = "power"
119
+ GROUND = "ground"
120
+
121
+ class JTAGPins (enum .Enum ):
122
+ TRST = "trst"
123
+ TCK = "tck"
124
+ TMS = "tms"
125
+ TDI = "tdi"
126
+ TDO = "tdo"
117
127
118
128
class _Side (enum .IntEnum ):
119
129
N = 1
@@ -206,18 +216,70 @@ class _BasePackageDef(pydantic.BaseModel, abc.ABC):
206
216
@property
207
217
@abc .abstractmethod
208
218
def pins (self ) -> PinSet :
219
+ "Returns the full set of pins for the package"
209
220
...
210
221
211
222
@abc .abstractmethod
212
223
def allocate (self , available : PinSet , width : int ) -> PinList :
224
+ """
225
+ Allocates pins as close to each other as possible from available pins.
226
+
227
+ Args:
228
+ available: set of available pins
229
+ width: number of pins to allocate
230
+
231
+ Returns:
232
+ An ordered list of pins
233
+ """
234
+ ...
235
+
236
+ @property
237
+ @abc .abstractmethod
238
+ def power (self ) -> Dict [PowerType , Pin ]:
239
+ """
240
+ The set of power pins for the package
241
+ """
242
+ ...
243
+
244
+ @property
245
+ @abc .abstractmethod
246
+ def resets (self ) -> Dict [int , Pin ]:
247
+ """
248
+ Numbered set of reset pins for the package
249
+ """
213
250
...
214
251
252
+ @property
253
+ @abc .abstractmethod
254
+ def clocks (self ) -> Dict [int , Pin ]:
255
+ """
256
+ Numbered set of clock pins for the package
257
+ """
258
+ ...
259
+
260
+ @property
261
+ @abc .abstractmethod
262
+ def jtag (self ) -> Dict [JTAGPin , Pin ]:
263
+ """
264
+ Map of JTAG pins for the package
265
+ """
266
+ ...
267
+
268
+ @property
269
+ @abc .abstractmethod
270
+ def heartbeat (self ) -> Dict (int , Pin ):
271
+ """
272
+ Numbered set of heartbeat pins for the package
273
+ """
274
+
215
275
def to_string (pins : Pins ):
216
276
return ['' .join (map (str , t )) for t in pins ]
217
277
218
278
def sortpins (self , pins : Pins ) -> PinList :
219
279
return list (pins ).sort ()
220
280
281
+
282
+
221
283
222
284
class _BareDiePackageDef (_BasePackageDef ):
223
285
"""Definition of a package with pins on four sides, labelled north, south, east, west
0 commit comments