Skip to content

Commit df8013d

Browse files
committed
Minor docstring clarifications.
* emphasize that `alignment` is a power-of-2 exponent; * give default values of optional keyword arguments.
1 parent f90d9a4 commit df8013d

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

amaranth_soc/csr/bus.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def chunks(self):
383383
Address width. See :class:`Interface`.
384384
data_width : int
385385
Data width. See :class:`Interface`.
386-
alignment : log2 of int
386+
alignment : int, power-of-2 exponent
387387
Register alignment. See :class:`..memory.MemoryMap`.
388388
name : str
389389
Window name. Optional.
@@ -534,7 +534,7 @@ class Decoder(Elaboratable):
534534
Address width. See :class:`Interface`.
535535
data_width : int
536536
Data width. See :class:`Interface`.
537-
alignment : log2 of int
537+
alignment : int, power-of-2 exponent
538538
Window alignment. See :class:`..memory.MemoryMap`.
539539
name : str
540540
Window name. Optional.

amaranth_soc/csr/event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class EventMonitor(Elaboratable):
2525
----------
2626
data_width : int
2727
CSR bus data width. See :class:`..csr.Interface`.
28-
alignment : int
28+
alignment : int, power-of-2 exponent
2929
CSR address alignment. See :class:`..memory.MemoryMap`.
3030
trigger : :class:`..event.Source.Trigger`
3131
Trigger mode. See :class:`..event.Source`.

amaranth_soc/csr/wishbone.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class WishboneCSRBridge(Elaboratable):
2525
----------
2626
csr_bus : :class:`..csr.Interface`
2727
CSR bus driven by the bridge.
28-
data_width : int or None
29-
Wishbone bus data width. If not specified, defaults to ``csr_bus.data_width``.
28+
data_width : int
29+
Wishbone bus data width. Optional. If ``None``, defaults to ``csr_bus.data_width``.
3030
name : str
3131
Window name. Optional.
3232

amaranth_soc/memory.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class MemoryMap:
135135
Address width.
136136
data_width : int
137137
Data width.
138-
alignment : log2 of int
138+
alignment : int, power-of-2 exponent
139139
Range alignment. Each added resource and window will be placed at an address that is
140140
a multiple of ``2 ** alignment``, and its size will be rounded up to be a multiple of
141141
``2 ** alignment``.
@@ -217,7 +217,7 @@ def align_to(self, alignment):
217217
218218
Arguments
219219
---------
220-
alignment : log2 of int
220+
alignment : int, power-of-2 exponent
221221
Address alignment. The start of the implicit next address will be a multiple of
222222
``2 ** max(alignment, self.alignment)``.
223223
@@ -287,15 +287,15 @@ def add_resource(self, resource, *, name, size, addr=None, alignment=None, exten
287287
name : str
288288
Name of the resource. It must not collide with the name of other resources or windows
289289
present in this memory map.
290-
addr : int or None
291-
Address of the resource. If ``None``, the implicit next address will be used.
290+
addr : int
291+
Address of the resource. Optional. If ``None``, the implicit next address will be used.
292292
Otherwise, the exact specified address (which must be a multiple of
293293
``2 ** max(alignment, self.alignment)``) will be used.
294294
size : int
295295
Size of the resource, in minimal addressable units. Rounded up to a multiple of
296296
``2 ** max(alignment, self.alignment)``.
297-
alignment : log2 of int or None
298-
Alignment of the resource. If not specified, the memory map alignment is used.
297+
alignment : int, power-of-2 exponent
298+
Alignment of the resource. Optional. If ``None``, the memory map alignment is used.
299299
extend: bool
300300
Allow memory map extension. If ``True``, the upper bound of the address space is
301301
raised as needed, in order to fit a resource that would otherwise be out of bounds.
@@ -379,13 +379,13 @@ def add_window(self, window, *, addr=None, sparse=None, extend=False):
379379
window : :class:`MemoryMap`
380380
A memory map describing the layout of the window. It is frozen as a side-effect of
381381
being added to this memory map.
382-
addr : int or None
383-
Address of the window. If ``None``, the implicit next address will be used after
384-
aligning it to ``2 ** window.addr_width``. Otherwise, the exact specified address
382+
addr : int
383+
Address of the window. Optional. If ``None``, the implicit next address will be used
384+
after aligning it to ``2 ** window.addr_width``. Otherwise, the exact specified address
385385
(which must be a multiple of ``2 ** window.addr_width``) will be used.
386-
sparse : bool or None
387-
Address translation type. Ignored if the datapath widths of both memory maps are
388-
equal; must be specified otherwise.
386+
sparse : bool
387+
Address translation type. Optional. Ignored if the datapath widths of both memory maps
388+
are equal; must be specified otherwise.
389389
extend : bool
390390
Allow memory map extension. If ``True``, the upper bound of the address space is
391391
raised as needed, in order to fit a window that would otherwise be out of bounds.

amaranth_soc/wishbone/bus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class Decoder(Elaboratable):
184184
Granularity. See :class:`Interface`
185185
features : iter(str)
186186
Optional signal set. See :class:`Interface`.
187-
alignment : log2 of int
187+
alignment : int, power-of-2 exponent
188188
Window alignment. See :class:`..memory.MemoryMap`
189189
name : str
190190
Window name. Optional.

0 commit comments

Comments
 (0)