Skip to content

Commit db02f69

Browse files
committed
wip
1 parent 28fd8d7 commit db02f69

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

chipflow_lib/platforms/utils.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ class IOSignature(wiring.Signature):
7878
:param direction: Input, Output or Bidir
7979
:param width: width of port, default is 1
8080
:param all_have_oe: controls whether each output wire is associated with an individual Output Enable bit or a single OE bit will be used for entire port, the default value is False, indicating that a single OE bit controls the entire port.
81+
:param allocate_power: Whether a power line should be allocated with this interface
82+
:param power_voltage: Voltage range of the allocated power
8183
:param init: a :ref:`const-castable object <lang-constcasting>` for the initial values of the port
8284
"""
8385

@@ -195,11 +197,17 @@ class JTAGWire(StrEnum):
195197
JTAGWire.TDO: Out(OutputIOSignature(1)),
196198
})
197199

200+
@dataclass
201+
class VoltageRange:
202+
min: Optional[float] = None
203+
max: Optional[float] = None
204+
198205
@dataclass
199206
class PowerPins:
200-
"A matched pair of power pins"
207+
"A matched pair of power pins, with optional notation of the voltage range"
201208
power: Pin
202209
ground: Pin
210+
voltage: VoltageRange
203211
def to_set(self) -> Set[Pin]:
204212
return set(asdict(self).values())
205213

@@ -525,7 +533,8 @@ def register_component(self, name: str, component: wiring.Component) -> None:
525533
@abc.abstractmethod
526534
def allocate_pins(self, lockfile: Optional[LockFile]) -> LockFile:
527535
"""
528-
Allocate package pins to the registered component
536+
Allocate package pins to the registered component.
537+
Pins should be allocated in the most usable way for *users* of the packaged IC.
529538
530539
Returns: `LockFile` data structure represnting the allocation of interfaces to pins
531540
@@ -536,7 +545,12 @@ def allocate_pins(self, lockfile: Optional[LockFile]) -> LockFile:
536545

537546
@property
538547
def bringup_pins(self) -> BringupPins:
539-
"To aid bringup, these are always in the same place for each package type."
548+
"""
549+
To aid bringup, these are always in the same place for each package type.
550+
Should include core power, clock and reset.
551+
552+
Power, clocks and resets needed for non-core are allocated with the port.
553+
"""
540554
...
541555

542556
def _to_string(pins: Pins):
@@ -615,6 +629,7 @@ class QuadPackageDef(BasePackageDef):
615629
This includes the following types of package:
616630
.. csv-table:
617631
:header: "Package", "Description"
632+
"QFN", "quad flat no-leads package. It's assumed the bottom pad is connected to substrate."
618633
"BQFP", "bumpered quad flat package"
619634
"BQFPH", "bumpered quad flat package with heat spreader"
620635
"CQFP", "ceramic quad flat package"
@@ -791,11 +806,13 @@ class GAPackageDef(BasePackageDef):
791806

792807
def model_post_init(self, __context):
793808
def int_to_alpha(i: int):
809+
"Covert int to alpha representation, starting at 1"
810+
valid_letters = "ABCDEFGHJKLMPRSTUVWXY"
794811
out = ''
795812
while i > 0:
796-
char = i % 26
797-
i = i // 26
798-
out = chr(ord('A')+char-1) + out
813+
char = i % len(valid_letters)
814+
i = i // len(valid_letters)
815+
out = valid_letters[char-1] + out
799816
return out
800817

801818
def pins_for_range(h1, h2, w1, w2):

docs/chipflow-toml-guide.rst

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -148,30 +148,13 @@ These pads are declared with the :term:type parameter, along with a name and oth
148148

149149
Note that in this context, the :term:type parameter can only be ``ground`` or ``power``.
150150

151-
The package definition provides default locations for standard pins like power, ground, clocks, and resets. You only need to specify the name and properties.
151+
The package definition provides default locations for pins needed for bringup and test, like core power, ground, clock and reset, along with JTAG. These are called:
152152

153153
[chipflow.silicon.power]
154154
vdd = { type = "power", name = "vdd", voltage = "1.8V" }
155155
gnd = { type = "ground", name = "gnd" }
156156
```
157157

158-
159-
``[silicon.power]``
160-
-------------------
161-
162-
This section outlines the connection of pads to the power supply available for the selected process and package.
163-
These pads are declared with the :term:type parameter, along with a name and other optional information, like voltage.
164-
165-
Note that in this context, the :term:type parameter can only be ``ground`` or ``power``.
166-
167-
[chipflow.silicon.power]
168-
vdd = { type = "power", name = "vdd", voltage = "1.8V" }
169-
gnd = { type = "ground", name = "gnd" }
170-
```
171-
172-
In the new format, the package definition provides default locations for standard pins like power, ground, clocks, and resets. You only need to specify the name and properties.
173-
174-
175158
.. glossary::
176159

177160
loc

0 commit comments

Comments
 (0)