Skip to content

Commit 323122b

Browse files
committed
docs: add Attribute and Members sections, and :py: role.
1 parent e8af949 commit 323122b

File tree

5 files changed

+75
-71
lines changed

5 files changed

+75
-71
lines changed

amaranth_soc/csr/bus.py

+19-19
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,16 @@ class Signature(wiring.Signature):
7474
access : :class:`Element.Access`
7575
Register access mode.
7676
77-
Attributes
78-
----------
79-
r_data : :pc:`unsigned(width)`
77+
Members
78+
-------
79+
r_data : :py:`unsigned(width)`
8080
Read data. Must be always valid, and is sampled when ``r_stb`` is asserted.
81-
r_stb : :pc:`unsigned(1)`
81+
r_stb : :py:`unsigned(1)`
8282
Read strobe. Registers with read side effects should perform the read side effect when
8383
this strobe is asserted.
84-
w_data : :pc:`unsigned(width)`
84+
w_data : :py:`unsigned(width)`
8585
Write data. Valid only when ``w_stb`` is asserted.
86-
w_stb : :pc:`unsigned(1)`
86+
w_stb : :py:`unsigned(1)`
8787
Write strobe. Registers should update their value or perform the write side effect when
8888
this strobe is asserted.
8989
@@ -215,21 +215,21 @@ class Signature(wiring.Signature):
215215
data_width : :class:`int`
216216
Data width. Registers are accessed in ``data_width`` sized chunks.
217217
218-
Attributes
219-
----------
220-
addr : :pc:`unsigned(addr_width)`
218+
Members
219+
-------
220+
addr : :py:`unsigned(addr_width)`
221221
Address for reads and writes.
222-
r_data : :pc:`unsigned(data_width)`
222+
r_data : :py:`unsigned(data_width)`
223223
Read data. Valid on the next cycle after ``r_stb`` is asserted. Otherwise, zero. (Keeping
224224
read data of an unused interface at zero simplifies multiplexers.)
225-
r_stb : :pc:`unsigned(1)`
225+
r_stb : :py:`unsigned(1)`
226226
Read strobe. If ``addr`` points to the first chunk of a register, captures register value
227227
and causes read side effects to be performed (if any). If ``addr`` points to any chunk
228228
of a register, latches the captured value to ``r_data``. Otherwise, latches zero
229229
to ``r_data``.
230-
w_data : :pc:`unsigned(data_width)`
230+
w_data : :py:`unsigned(data_width)`
231231
Write data. Must be valid when ``w_stb`` is asserted.
232-
w_stb : :pc:`unsigned(1)`
232+
w_stb : :py:`unsigned(1)`
233233
Write strobe. If ``addr`` points to the last chunk of a register, writes captured value
234234
to the register and causes write side effects to be performed (if any). If ``addr`` points
235235
to any chunk of a register, latches ``w_data`` to the captured value. Otherwise, does
@@ -453,9 +453,9 @@ class Multiplexer(wiring.Component):
453453
Maximum number of CSR registers that can share a chunk of a shadow register.
454454
Optional. If ``None``, any number of CSR registers can share a shadow chunk.
455455
456-
Attributes
457-
----------
458-
bus : :class:`Interface`
456+
Members
457+
-------
458+
bus : :class:`Signature`
459459
CSR bus providing access to registers.
460460
"""
461461

@@ -759,9 +759,9 @@ class Decoder(wiring.Component):
759759
name : :class:`str`
760760
Window name. Optional. See :class:`.MemoryMap`.
761761
762-
Attributes
763-
----------
764-
bus : :class:`Interface`
762+
Members
763+
-------
764+
bus : :class:`Signature`
765765
CSR bus providing access to subordinate buses.
766766
"""
767767
def __init__(self, *, addr_width, data_width, alignment=0, name=None):

amaranth_soc/csr/reg.py

+19-19
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,23 @@ def writable(self):
7070
class Signature(wiring.Signature):
7171
"""CSR register field port signature.
7272
73-
Parameters
74-
----------
73+
Arguments
74+
---------
7575
shape : :ref:`shape-castable <lang-shapecasting>`
7676
Shape of the field.
7777
access : :class:`FieldPort.Access`
7878
Field access mode.
7979
80-
Attributes
81-
----------
82-
r_data : :pc:`unsigned(shape)`
80+
Members
81+
-------
82+
r_data : :py:`unsigned(shape)`
8383
Read data. Must always be valid, and is sampled when ``r_stb`` is asserted.
84-
r_stb : :pc:`unsigned(1)`
84+
r_stb : :py:`unsigned(1)`
8585
Read strobe. Fields with read side effects should perform them when this strobe is
8686
asserted.
87-
w_data : :pc:`unsigned(shape)`
87+
w_data : :py:`unsigned(shape)`
8888
Write data. Valid only when ``w_stb`` is asserted.
89-
w_stb : :pc:`unsigned(1)`
89+
w_stb : :py:`unsigned(1)`
9090
Write strobe. Fields should update their value or perform the write side effect when
9191
this strobe is asserted.
9292
@@ -256,9 +256,9 @@ class FieldAction(wiring.Component):
256256
Signature members. Optional, defaults to ``()``. A :class:`FieldPort.Signature` member
257257
named 'port' and oriented as input is always present in addition to these members.
258258
259-
Attributes
260-
----------
261-
port : :class:`FieldPort`
259+
Members
260+
-------
261+
port : :class:`FieldPort.Signature`
262262
Field port.
263263
264264
Raises
@@ -403,8 +403,8 @@ def flatten(self):
403403
class FieldActionArray(Sequence):
404404
"""An array of CSR register fields.
405405
406-
Parameters
407-
----------
406+
Arguments
407+
---------
408408
fields : :class:`list` of (:class:`Field` or :class:`dict` or :class:`list`)
409409
Register fields. Fields are instantiated according to their type:
410410
@@ -491,9 +491,9 @@ class Register(wiring.Component):
491491
depending on its type (:class:`dict`, :class:`list`, or :class:`Field`).
492492
{arguments}
493493
494-
Attributes
495-
----------
496-
element : :class:`Element`
494+
Members
495+
-------
496+
element : :class:`Element.Signature`
497497
Interface between this :class:`Register` and a CSR bus primitive.
498498
499499
Attributes
@@ -890,9 +890,9 @@ class Bridge(wiring.Component):
890890
memory_map : :class:`.MemoryMap`
891891
Memory map of CSR registers.
892892
893-
Attributes
894-
----------
895-
bus : :class:`..bus.Interface`
893+
Members
894+
-------
895+
bus : :class:`..bus.Signature`
896896
CSR bus providing access to the contents of ``memory_map``.
897897
898898
Raises

amaranth_soc/gpio.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ class PinMode(enum.Enum, shape=unsigned(2)):
4343
class PinSignature(wiring.Signature):
4444
"""GPIO pin signature.
4545
46-
Attributes
47-
----------
48-
i : :pc:`unsigned(1)`
46+
Members
47+
-------
48+
i : :py:`unsigned(1)`
4949
Input.
50-
o : :pc:`unsigned(1)`
50+
o : :py:`unsigned(1)`
5151
Output.
52-
oe : :pc:`unsigned(1)`
52+
oe : :py:`unsigned(1)`
5353
Output enable.
5454
"""
5555
def __init__(self):
@@ -77,13 +77,13 @@ class Peripheral(wiring.Component):
7777
Number of synchronization stages between pin inputs and the :class:`~Peripheral.Input`
7878
register. Optional. Defaults to ``2``.
7979
80-
Attributes
81-
----------
82-
bus : :class:`.csr.bus.Interface`
80+
Members
81+
-------
82+
bus : :class:`.csr.bus.Signature`
8383
CSR bus interface providing access to registers.
84-
pins : :class:`list` of :class:`wiring.PureInterface` of :class:`PinSignature`
84+
pins : :class:`PinSignature` array of size ``pin_count``
8585
GPIO pin interfaces.
86-
alt_mode : :pc:`unsigned(pin_count)`
86+
alt_mode : :py:`unsigned(pin_count)`
8787
Indicates which members of the :attr:`Peripheral.pins` array are in alternate mode.
8888
8989
Raises

amaranth_soc/wishbone/bus.py

+22-22
Original file line numberDiff line numberDiff line change
@@ -60,39 +60,39 @@ class Signature(wiring.Signature):
6060
Selects additional signals that will be a part of this interface.
6161
Optional.
6262
63-
Attributes
64-
----------
65-
adr : :pc:`unsigned(addr_width)`
63+
Members
64+
-------
65+
adr : :py:`unsigned(addr_width)`
6666
Corresponds to Wishbone signal ``ADR_O`` (initiator) or ``ADR_I`` (target).
67-
dat_w : :pc:`unsigned(data_width)`
67+
dat_w : :py:`unsigned(data_width)`
6868
Corresponds to Wishbone signal ``DAT_O`` (initiator) or ``DAT_I`` (target).
69-
dat_r : :pc:`unsigned(data_width)`
69+
dat_r : :py:`unsigned(data_width)`
7070
Corresponds to Wishbone signal ``DAT_I`` (initiator) or ``DAT_O`` (target).
71-
sel : :pc:`unsigned(data_width // granularity)`
71+
sel : :py:`unsigned(data_width // granularity)`
7272
Corresponds to Wishbone signal ``SEL_O`` (initiator) or ``SEL_I`` (target).
73-
cyc : :pc:`unsigned(1)`
73+
cyc : :py:`unsigned(1)`
7474
Corresponds to Wishbone signal ``CYC_O`` (initiator) or ``CYC_I`` (target).
75-
stb : :pc:`unsigned(1)`
75+
stb : :py:`unsigned(1)`
7676
Corresponds to Wishbone signal ``STB_O`` (initiator) or ``STB_I`` (target).
77-
we : :pc:`unsigned(1)`
77+
we : :py:`unsigned(1)`
7878
Corresponds to Wishbone signal ``WE_O`` (initiator) or ``WE_I`` (target).
79-
ack : :pc:`unsigned(1)`
79+
ack : :py:`unsigned(1)`
8080
Corresponds to Wishbone signal ``ACK_I`` (initiator) or ``ACK_O`` (target).
81-
err : :pc:`unsigned(1)`
81+
err : :py:`unsigned(1)`
8282
Optional. Corresponds to Wishbone signal ``ERR_I`` (initiator) or ``ERR_O`` (target).
83-
rty : :pc:`unsigned(1)`
83+
rty : :py:`unsigned(1)`
8484
Optional. Corresponds to Wishbone signal ``RTY_I`` (initiator) or ``RTY_O`` (target).
85-
stall : :pc:`unsigned(1)`
85+
stall : :py:`unsigned(1)`
8686
Optional. Corresponds to Wishbone signal ``STALL_I`` (initiator) or ``STALL_O`` (target).
87-
lock : :pc:`unsigned(1)`
87+
lock : :py:`unsigned(1)`
8888
Optional. Corresponds to Wishbone signal ``LOCK_O`` (initiator) or ``LOCK_I`` (target).
8989
Amaranth-SoC Wishbone support assumes that initiators that don't want bus arbitration to
9090
happen in between two transactions need to use ``lock`` feature to guarantee this. An
9191
initiator without the ``lock`` feature may be arbitrated in between two transactions even
9292
if ``cyc`` is kept high.
93-
cti : :pc:`unsigned(1)`
93+
cti : :py:`unsigned(1)`
9494
Optional. Corresponds to Wishbone signal ``CTI_O`` (initiator) or ``CTI_I`` (target).
95-
bte : :pc:`unsigned(1)`
95+
bte : :py:`unsigned(1)`
9696
Optional. Corresponds to Wishbone signal ``BTE_O`` (initiator) or ``BTE_I`` (target).
9797
9898
Raises
@@ -377,9 +377,9 @@ class Decoder(wiring.Component):
377377
name : :class:`str`
378378
Window name. Optional. See :class:`.MemoryMap`.
379379
380-
Attributes
381-
----------
382-
bus : :class:`Interface`
380+
Members
381+
-------
382+
bus : :class:`Signature`
383383
Wishbone bus providing access to subordinate buses.
384384
"""
385385
def __init__(self, *, addr_width, data_width, granularity=None, features=frozenset(),
@@ -543,9 +543,9 @@ class Arbiter(wiring.Component):
543543
features : iterable of :class:`Feature`
544544
Optional signal set. See :class:`Signature`.
545545
546-
Attributes
547-
----------
548-
bus : :class:`Interface`
546+
Members
547+
-------
548+
bus : :class:`Signature`
549549
Shared Wishbone bus.
550550
"""
551551
def __init__(self, *, addr_width, data_width, granularity=None, features=frozenset()):

docs/conf.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,17 @@
3939
napoleon_use_ivar = True
4040
napoleon_include_init_with_doc = True
4141
napoleon_include_special_with_doc = True
42+
napoleon_custom_sections = [
43+
("Attributes", "params_style"), # by default displays as "Variables", which is confusing
44+
("Members", "params_style"), # `lib.wiring` signature members
45+
]
4246

4347
html_theme = "sphinx_rtd_theme"
4448
html_static_path = ["_static"]
4549
html_css_files = ["custom.css"]
4650
html_logo = "_static/logo.png"
4751

4852
rst_prolog = """
49-
.. role:: pc(code)
53+
.. role:: py(code)
5054
:language: python
5155
"""

0 commit comments

Comments
 (0)