Skip to content

Commit 1cbea3a

Browse files
committed
wip: enable a a bidir port to have either one output enable, or one for each wire
1 parent 1110b59 commit 1cbea3a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

chipflow_lib/platforms/utils.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,23 @@ def as_json(self): # type: ignore
6565

6666
class PinSignature(wiring.Signature):
6767
"""Amaranth Signtaure used to decorate wires that would
68-
usually be brought out onto a pin on the package.
68+
usually be brought out onto a port on the package.
69+
70+
direction: Input, Output or Bidir
71+
width: width of port
72+
all_have_oe: For Bidir ports, should Output Enable be per wire or for the whole port
73+
init: a :ref:`const-castable object <lang-constcasting>` for the initial values of the port
6974
"""
7075

71-
def __init__(self, direction, width=1, init=None):
76+
def __init__(self, direction: io.Direction, width: int = 1, all_have_oe: bool = False, init = None):
7277
self._direction = direction
7378
self._width = width
7479
self._init = init
7580
match direction:
7681
case io.Direction.Bidir:
7782
sig = {
7883
"o": Out(width),
79-
"oe": Out(1),
84+
"oe": Out(width if all_have_oe else 1),
8085
"i": In(width)
8186
}
8287
case io.Direction.Input:

0 commit comments

Comments
 (0)