Skip to content

Commit 705762a

Browse files
committed
Rename PinSignature to IOSignature
Avoids clash with amaranth-soc entity of same name
1 parent 7e1d451 commit 705762a

File tree

8 files changed

+47
-47
lines changed

8 files changed

+47
-47
lines changed

chipflow_lib/pin_lock.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def allocate_pins(name: str, member: Dict[str, Any], pins: List[str], port_name:
5353

5454
if member['type'] == 'interface' and 'annotations' in member \
5555
and PIN_ANNOTATION_SCHEMA in member['annotations']:
56-
logger.debug("matched PinSignature {sig}")
56+
logger.debug("matched IOSignature {sig}")
5757
sig = member['annotations'][PIN_ANNOTATION_SCHEMA]
5858
width = sig['width']
5959
options = sig['options']
@@ -72,7 +72,7 @@ def allocate_pins(name: str, member: Dict[str, Any], pins: List[str], port_name:
7272
logger.debug(f"{pin_map},{_map}")
7373
return pin_map, pins
7474
elif member['type'] == 'port':
75-
logger.warning(f"Port '{name}' has no PinSignature, pin allocation likely to be wrong")
75+
logger.warning(f"Port '{name}' has no IOSignature, pin allocation likely to be wrong")
7676
width = member['width']
7777
pin_map[name] = {'pins': pins[0:width],
7878
'direction': member['dir'],

chipflow_lib/platforms/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
from .sim import *
1111
from .utils import *
1212

13-
__all__ = ['PIN_ANNOTATION_SCHEMA', 'PinSignature',
14-
'OutputPinSignature', 'InputPinSignature', 'BidirPinSignature',
13+
__all__ = ['PIN_ANNOTATION_SCHEMA', 'IOSignature',
14+
'OutputIOSignature', 'InputIOSignature', 'BidirIOSignature',
1515
'load_pinlock', "PACKAGE_DEFINITIONS", 'top_interfaces']

chipflow_lib/platforms/utils.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
from .. import ChipFlowError, _ensure_chipflow_root, _get_cls_by_reference
1818

1919

20-
__all__ = ['PIN_ANNOTATION_SCHEMA', 'PinSignature',
21-
'OutputPinSignature', 'InputPinSignature', 'BidirPinSignature',
20+
__all__ = ['PIN_ANNOTATION_SCHEMA', 'IOSignature',
21+
'OutputIOSignature', 'InputIOSignature', 'BidirIOSignature',
2222
'load_pinlock', "PACKAGE_DEFINITIONS", 'top_interfaces', 'LockFile',
2323
'Package', 'PortMap', 'Port']
2424

@@ -65,11 +65,11 @@ def as_json(self): # type: ignore
6565
PIN_ANNOTATION_SCHEMA = str(_chipflow_schema_uri("pin-annotation", 0))
6666

6767

68-
class PinSignature(wiring.Signature):
68+
class IOSignature(wiring.Signature):
6969
"""An :py:obj:`Amaranth Signature <amaranth.lib.wiring.Signature>` used to decorate wires that would usually be brought out onto a port on the package.
7070
This class is generally not directly used.
7171
Instead, you would typically utilize the more specific
72-
:py:obj:`InputPinSignature`, :py:obj:`OutputPinSignature`, or :py:obj:`BidirPinSignature` for defining pin interfaces.
72+
:py:obj:`InputIOSignature`, :py:obj:`OutputIOSignature`, or :py:obj:`BidirIOSignature` for defining pin interfaces.
7373
7474
:param direction: Input, Output or Bidir
7575
:param width: width of port, default is 1
@@ -129,32 +129,32 @@ def annotations(self, *args):
129129

130130
def __repr__(self):
131131
opts = ', '.join(f"{k}={v}" for k, v in self._options.items())
132-
return f"PinSignature({self._direction}, {self._width}, {opts})"
132+
return f"IOSignature({self._direction}, {self._width}, {opts})"
133133

134134

135-
def OutputPinSignature(width, **kwargs):
135+
def OutputIOSignature(width, **kwargs):
136136
"""This creates an :py:obj:`Amaranth Signature <amaranth.lib.wiring.Signature>` which is then used to decorate package output signals
137137
intended for connection to the physical pads of the integrated circuit package.
138138
139139
:param width: specifies the number of individual output wires within this port, each of which will correspond to a separate physical pad on the integrated circuit package.
140140
:type width: int
141141
:param init: a :ref:`const-castable object <lang-constcasting>` for the initial values of the port
142142
"""
143-
return PinSignature(io.Direction.Output, width=width, **kwargs)
143+
return IOSignature(io.Direction.Output, width=width, **kwargs)
144144

145145

146-
def InputPinSignature(width, **kwargs):
146+
def InputIOSignature(width, **kwargs):
147147
"""This creates an :py:obj:`Amaranth Signature <amaranth.lib.wiring.Signature>` which is then used to decorate package input signals
148148
intended for connection to the physical pads of the integrated circuit package.
149149
150150
:param width: specifies the number of individual input wires within this port, each of which will correspond to a separate physical pad on the integrated circuit package.
151151
:type width: int
152152
:param init: a :ref:`const-castable object <lang-constcasting>` for the initial values of the port
153153
"""
154-
return PinSignature(io.Direction.Input, width=width, **kwargs)
154+
return IOSignature(io.Direction.Input, width=width, **kwargs)
155155

156156

157-
def BidirPinSignature(width, **kwargs):
157+
def BidirIOSignature(width, **kwargs):
158158
"""This creates an :py:obj:`Amaranth Signature <amaranth.lib.wiring.Signature>` which is then used to decorate package bi-directional signals
159159
intended for connection to the physical pads of the integrated circuit package.
160160
@@ -164,7 +164,7 @@ def BidirPinSignature(width, **kwargs):
164164
:type all_have_oe: bool, optional
165165
:param init: a :ref:`const-castable object <lang-constcasting>` for the initial values of the port
166166
"""
167-
return PinSignature(io.Direction.Bidir, width=width, **kwargs)
167+
return IOSignature(io.Direction.Bidir, width=width, **kwargs)
168168

169169

170170
Pin = Union[tuple, str]

chipflow_lib/steps/silicon.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from .. import ChipFlowError
2121
from ..cli import log_level
2222
from ..platforms import SiliconPlatform, top_interfaces, load_pinlock
23-
from ..platforms.utils import PinSignature
23+
from ..platforms.utils import IOSignature
2424

2525

2626
logger = logging.getLogger(__name__)
@@ -52,7 +52,7 @@ def elaborate(self, platform: SiliconPlatform):
5252
for iface_name, member, in iface.items():
5353
for name, port in member.items():
5454
iface = getattr(top[component], iface_name)
55-
wire = (iface if isinstance(iface.signature, PinSignature)
55+
wire = (iface if isinstance(iface.signature, IOSignature)
5656
else getattr(iface, name))
5757
platform.ports[port.port_name].wire(m, wire)
5858
return m

docs/chipflow-commands.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ It implements several subcommands, which can be customised or added to in the ``
1010
---------------------
1111

1212
The ``chipflow pin lock`` command performs pin locking for the current design.
13-
For every new top level interface with containing external pins with a ``PinSignature`` that is discovered, the necessary number of package pins is allocated and the mapping saved in the ``pins.lock`` file.
13+
For every new top level interface with containing external pins with a ``IOSignature`` that is discovered, the necessary number of package pins is allocated and the mapping saved in the ``pins.lock`` file.
1414
This means that, unless the ``pins.lock`` file is deleted or manually modified, the pin assignments of all existing pins will always remain the same.
1515

1616
``chipflow silicon``

tests/fixtures/mock_top.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@
33
from amaranth.lib import wiring
44
from amaranth.lib.wiring import In, Out
55

6-
from chipflow_lib.platforms import InputPinSignature, OutputPinSignature, BidirPinSignature
6+
from chipflow_lib.platforms import InputIOSignature, OutputIOSignature, BidirIOSignature
77

88
__all__ = ["MockTop"]
99

1010
TestSignature1 = wiring.Signature({
11-
"a": In(InputPinSignature(1)),
12-
"b": In(InputPinSignature(5)),
13-
"c": Out(OutputPinSignature(1)),
14-
"d": Out(OutputPinSignature(10)),
15-
"e": In(BidirPinSignature(1)),
16-
"f": In(BidirPinSignature(7)),
11+
"a": In(InputIOSignature(1)),
12+
"b": In(InputIOSignature(5)),
13+
"c": Out(OutputIOSignature(1)),
14+
"d": Out(OutputIOSignature(10)),
15+
"e": In(BidirIOSignature(1)),
16+
"f": In(BidirIOSignature(7)),
1717
})
1818

1919
TestSignature2 = wiring.Signature({
20-
"a": Out(OutputPinSignature(1)),
21-
"b": Out(OutputPinSignature(5)),
22-
"c": In(InputPinSignature(1)),
23-
"d": In(InputPinSignature(10)),
24-
"e": Out(BidirPinSignature(1)),
25-
"f": Out(BidirPinSignature(7)),
20+
"a": Out(OutputIOSignature(1)),
21+
"b": Out(OutputIOSignature(5)),
22+
"c": In(InputIOSignature(1)),
23+
"d": In(InputIOSignature(10)),
24+
"e": Out(BidirIOSignature(1)),
25+
"f": Out(BidirIOSignature(7)),
2626
})
2727

2828

tests/test_utils.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from amaranth.lib import io
99

10-
from chipflow_lib.platforms.utils import PinSignature, OutputPinSignature, InputPinSignature, BidirPinSignature, _PinAnnotation, _PinAnnotationModel
10+
from chipflow_lib.platforms.utils import IOSignature, OutputIOSignature, InputIOSignature, BidirIOSignature, _PinAnnotation, _PinAnnotationModel
1111
from chipflow_lib.platforms.utils import PinList, _group_consecutive_items,_find_contiguous_sequence, _Side
1212

1313

@@ -53,32 +53,32 @@ def test_find_contiguous_sequence():
5353

5454

5555
def test_pin_signature():
56-
sig_bidir = PinSignature(io.Direction.Bidir, width=8)
57-
assert isinstance(sig_bidir, PinSignature)
56+
sig_bidir = IOSignature(io.Direction.Bidir, width=8)
57+
assert isinstance(sig_bidir, IOSignature)
5858
assert sig_bidir._direction == io.Direction.Bidir
5959
assert sig_bidir._width == 8
6060
assert "o" in sig_bidir.members
6161
assert "oe" in sig_bidir.members
6262
assert "i" in sig_bidir.members
6363

64-
sig_output = OutputPinSignature(width=4)
65-
assert isinstance(sig_output, PinSignature)
64+
sig_output = OutputIOSignature(width=4)
65+
assert isinstance(sig_output, IOSignature)
6666
assert sig_output._direction == io.Direction.Output
6767
assert sig_output._width == 4
6868
assert "o" in sig_output.members
6969
assert "oe" not in sig_output.members
7070
assert "i" not in sig_output.members
7171

72-
sig_input = InputPinSignature(width=2)
73-
assert isinstance(sig_input, PinSignature)
72+
sig_input = InputIOSignature(width=2)
73+
assert isinstance(sig_input, IOSignature)
7474
assert sig_input._direction == io.Direction.Input
7575
assert sig_input._width == 2
7676
assert "o" not in sig_input.members
7777
assert "oe" not in sig_output.members
7878
assert "i" in sig_input.members
7979

80-
sig_bidir_fn = BidirPinSignature(width=1)
81-
assert isinstance(sig_bidir_fn, PinSignature)
80+
sig_bidir_fn = BidirIOSignature(width=1)
81+
assert isinstance(sig_bidir_fn, IOSignature)
8282
assert sig_bidir_fn._direction == io.Direction.Bidir
8383
assert sig_bidir_fn._width == 1
8484
assert "o" in sig_bidir_fn.members

tests/test_utils_additional.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
_PinAnnotationModel,
1313
_PinAnnotation,
1414
PIN_ANNOTATION_SCHEMA,
15-
PinSignature,
15+
IOSignature,
1616
_Side,
1717
_BasePackageDef,
1818
_BareDiePackageDef,
@@ -69,12 +69,12 @@ def test_pin_annotation(self):
6969
self.assertEqual(json_data["options"], {})
7070

7171

72-
class TestPinSignature(unittest.TestCase):
72+
class TestIOSignature(unittest.TestCase):
7373
def test_pin_signature_properties(self):
74-
"""Test PinSignature properties"""
74+
"""Test IOSignature properties"""
7575
# Create signature with options
7676
options = {"all_have_oe": True, "init": 0}
77-
sig = PinSignature(io.Direction.Bidir, width=4, all_have_oe=True, init=0)
77+
sig = IOSignature(io.Direction.Bidir, width=4, all_have_oe=True, init=0)
7878

7979
# Test properties
8080
self.assertEqual(sig.direction, io.Direction.Bidir)
@@ -83,15 +83,15 @@ def test_pin_signature_properties(self):
8383

8484
# Test __repr__ - actual representation depends on Direction enum's representation
8585
repr_string = repr(sig)
86-
self.assertIn("PinSignature", repr_string)
86+
self.assertIn("IOSignature", repr_string)
8787
self.assertIn("4", repr_string)
8888
self.assertIn("all_have_oe=True", repr_string)
8989
self.assertIn("init=0", repr_string)
9090

9191
def test_pin_signature_annotations(self):
92-
"""Test PinSignature annotations method"""
92+
"""Test IOSignature annotations method"""
9393
# Create signature
94-
sig = PinSignature(io.Direction.Output, width=8, init=42)
94+
sig = IOSignature(io.Direction.Output, width=8, init=42)
9595

9696
# Create a mock object to pass to annotations
9797
mock_obj = object()

0 commit comments

Comments
 (0)