Skip to content

Commit 5f6ea49

Browse files
robtaylorclaude
andcommitted
Fix docstring formatting for sphinx-autoapi compatibility
- Add docstrings to SimInterface and Data TypedDict classes to override inherited dict docstrings that cause RST parsing errors - Fix IOModelOptions Attributes section formatting with consistent line lengths and proper RST inline literal syntax (double backticks) - Fix submodule_metadata docstring to use double backticks for inline literals and proper Args/Yields format - Fix Sky130Port docstring with proper RST link syntax and spacing These changes resolve RST errors and warnings generated by sphinx-autoapi when building documentation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 57ef75e commit 5f6ea49

4 files changed

Lines changed: 49 additions & 21 deletions

File tree

chipflow/platform/io/annotate.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,21 @@ def annotations(self, origin , /): # type: ignore
9797

9898

9999
def submodule_metadata(fragment: Fragment, component_name: str, recursive=False) -> Generator[Tuple[wiring.Component, str| tuple, dict]]:
100-
"""
101-
Generator that finds `component_name` in `fragment` and
102-
then yields the ``wiring.Component``s of that component's submodule, along with their names and metadata
100+
"""Generator that finds ``component_name`` in ``fragment`` and yields metadata.
101+
102+
Yields the ``wiring.Component`` instances of that component's submodule, along
103+
with their names and metadata.
104+
105+
Can only be run once for a given component (or its children).
103106
104-
Can only be run once for a given component (or its children)
107+
Args:
108+
fragment: The fragment to search in.
109+
component_name: The name of the component to find.
110+
recursive: If True, name is a tuple of the hierarchy of names. Otherwise,
111+
name is the string name of the first level component.
105112
106-
If recursive = True, then name is a tuple of the heirarchy of names
107-
otherwise, name is the string name of the first level component
113+
Yields:
114+
Tuple of (component, name, metadata) for each submodule.
108115
"""
109116

110117
subfrag = fragment.find_subfragment(component_name)

chipflow/platform/io/iosignature.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,22 @@ class IOTripPoint(StrEnum):
5050

5151

5252
class IOModelOptions(TypedDict):
53-
"""
54-
Options for an IO pad/pin.
53+
"""Options for an IO pad/pin.
5554
5655
Attributes:
57-
invert: Polarity inversion. If the value is a simple :class:`bool`, it specifies inversion for
58-
the entire port. If the value is an iterable of :class:`bool`, the iterable must have the
59-
same length as the width of ``io``, and the inversion is specified for individual wires.
60-
individual_oe: controls whether each output wire is associated with an individual Output Enable bit
61-
or if a single OE bit will be used for entire port. The default value is False (indicating that a
62-
single OE bit controls the entire port).
63-
power_domain: The name of the I/O power domain. NB there is only one of these, so IO with
64-
multiple power domains must be split up.
65-
clock_domain: the name of the I/O's clock domain (see ``amaranth.hdl.ClockDomain``). NB there
66-
is only one of these, so IO with multiple clocks must be split up.
56+
invert: Polarity inversion. If the value is a simple ``bool``, it specifies
57+
inversion for the entire port. If the value is an iterable of ``bool``,
58+
the iterable must have the same length as the width of ``io``, and the
59+
inversion is specified for individual wires.
60+
individual_oe: Controls whether each output wire is associated with an
61+
individual Output Enable bit or if a single OE bit will be used for
62+
entire port. The default value is False (indicating that a single OE
63+
bit controls the entire port).
64+
power_domain: The name of the I/O power domain. NB there is only one of
65+
these, so IO with multiple power domains must be split up.
66+
clock_domain: The name of the I/O's clock domain (see
67+
``amaranth.hdl.ClockDomain``). NB there is only one of these, so IO
68+
with multiple clocks must be split up.
6769
buffer_in: Should the IO pad have an input buffer?
6870
buffer_out: Should the IO pad have an output buffer?
6971
sky130_drive_mode: Drive mode for output buffer on sky130.

chipflow/platform/io/signatures.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@
2828
DRIVER_MODEL_SCHEMA = str(_chipflow_schema_uri("driver-model", 0))
2929

3030
class SimInterface(TypedDict):
31+
"""Simulation interface metadata for ChipFlow components.
32+
33+
Attributes:
34+
uid: Unique identifier for the interface.
35+
parameters: List of (name, value) tuples for interface parameters.
36+
"""
37+
3138
uid: str
3239
parameters: List[Tuple[str, Any]]
3340

@@ -78,7 +85,15 @@ def __init__(self, *, filename: Path, offset=0):
7885
self.offset = offset
7986

8087
_T_DataClass = TypeVar('_T_DataClass', bound=DataclassProtocol)
88+
89+
8190
class Data(TypedDict, Generic[_T_DataClass]):
91+
"""Container for data associated with a ChipFlow component.
92+
93+
Attributes:
94+
data: The dataclass instance containing component data.
95+
"""
96+
8297
data: _T_DataClass
8398

8499

chipflow/platform/silicon.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,14 @@ def __repr__(self):
208208

209209

210210
class Sky130Port(SiliconPlatformPort):
211-
"""
212-
Specialisation of `SiliconPlatformPort` for the `Skywater sky130_fd_io__gpiov2 IO cell <https://skywater-pdk.readthedocs.io/en/main/contents/libraries/sky130_fd_io/docs/user_guide.html>`_
211+
"""Specialisation of ``SiliconPlatformPort`` for the Skywater sky130_fd_io__gpiov2 IO cell.
212+
213+
See the `Skywater PDK documentation
214+
<https://skywater-pdk.readthedocs.io/en/main/contents/libraries/sky130_fd_io/docs/user_guide.html>`_
215+
for more details.
213216
214-
Includes wires and configuration for `Drive Modes <IODriveMode>`, `Input buffer trip point <IOTripPoint>`and buffer control
217+
Includes wires and configuration for drive modes (see ``Sky130DriveMode``),
218+
input buffer trip point (see ``IOTripPoint``), and buffer control.
215219
"""
216220

217221
_DriveMode_map = {

0 commit comments

Comments
 (0)