Wishbone bus
Warning
This manual is a work in progress and is seriously incomplete!
The amaranth_soc.wishbone.bus module provides Wishbone bus primitives.
- class amaranth_soc.wishbone.bus.CycleType
Wishbone Registered Feedback cycle type.
- CLASSIC = 0
- CONST_BURST = 1
- INCR_BURST = 2
- END_OF_BURST = 7
- class amaranth_soc.wishbone.bus.BurstTypeExt
Wishbone Registered Feedback burst type extension.
- LINEAR = 0
- WRAP_4 = 1
- WRAP_8 = 2
- WRAP_16 = 3
- class amaranth_soc.wishbone.bus.Feature
Optional Wishbone interface signals.
- ERR = 'err'
- RTY = 'rty'
- STALL = 'stall'
- LOCK = 'lock'
- CTI = 'cti'
- BTE = 'bte'
- class amaranth_soc.wishbone.bus.Signature
Wishbone interface signature.
See the Wishbone specification for description of the Wishbone signals. The
RST_IandCLK_Isignals are provided as a part of the clock domain that drives the interface.- Parameters:
addr_width (int) – Width of the address signal.
data_width (
8,16,32or64) – Width of the data signals (“port size” in Wishbone terminology).granularity (
8,16,32,64orNone) – Granularity of select signals (“port granularity” in Wishbone terminology). Optional. IfNone(by default), the granularity is equal todata_width.features (iter(
Feature)) – Selects additional signals that will be a part of this interface. Optional.attributes (Interface)
--------------------
depending (The correspondence between the Amaranth-SoC signals and the Wishbone signals changes)
target. (on whether the interface acts as an initiator or a)
adr (Signal(addr_width)) – Corresponds to Wishbone signal
ADR_O(initiator) orADR_I(target).dat_w (Signal(data_width)) – Corresponds to Wishbone signal
DAT_O(initiator) orDAT_I(target).dat_r (Signal(data_width)) – Corresponds to Wishbone signal
DAT_I(initiator) orDAT_O(target).sel (Signal(data_width // granularity)) – Corresponds to Wishbone signal
SEL_O(initiator) orSEL_I(target).cyc (Signal()) – Corresponds to Wishbone signal
CYC_O(initiator) orCYC_I(target).stb (Signal()) – Corresponds to Wishbone signal
STB_O(initiator) orSTB_I(target).we (Signal()) – Corresponds to Wishbone signal
WE_O(initiator) orWE_I(target).ack (Signal()) – Corresponds to Wishbone signal
ACK_I(initiator) orACK_O(target).err (Signal()) – Optional. Corresponds to Wishbone signal
ERR_I(initiator) orERR_O(target).rty (Signal()) – Optional. Corresponds to Wishbone signal
RTY_I(initiator) orRTY_O(target).stall (Signal()) – Optional. Corresponds to Wishbone signal
STALL_I(initiator) orSTALL_O(target).lock (Signal()) – Optional. Corresponds to Wishbone signal
LOCK_O(initiator) orLOCK_I(target). Amaranth-SoC Wishbone support assumes that initiators that don’t want bus arbitration to happen in between two transactions need to uselockfeature to guarantee this. An initiator without thelockfeature may be arbitrated in between two transactions even ifcycis kept high.cti (Signal()) – Optional. Corresponds to Wishbone signal
CTI_O(initiator) orCTI_I(target).bte (Signal()) – Optional. Corresponds to Wishbone signal
BTE_O(initiator) orBTE_I(target).
- addr_width
- data_width
- granularity
- features
- create(*, path=None, src_loc_at=0)
Create a compatible interface.
See
wiring.Signature.create()for details.- Return type:
An
Interfaceobject using this signature.
- __eq__(other)
Compare signatures.
Two signatures are equal if they have the same address width, data width, granularity and features.
- class amaranth_soc.wishbone.bus.Interface
Wishbone bus interface.
Note that the data width of the underlying memory map of the interface is equal to port granularity, not port size. If port granularity is less than port size, then the address width of the underlying memory map is extended to reflect that.
- Parameters:
addr_width (
int) – Width of the address signal. SeeSignature.data_width (
int) – Width of the data signals. SeeSignature.granularity (
int) – Granularity of select signals. Optional. SeeSignature.features (iter(
Feature)) – Describes additional signals of this interface. Optional. SeeSignature.path (iter(
str)) – Path to this Wishbone interface. Optional. Seewiring.PureInterface.
- Attributes:
memory_map (
MemoryMap) – Memory map of the bus. Optional.
- addr_width
- data_width
- granularity
- features
- memory_map
- class amaranth_soc.wishbone.bus.Decoder
Wishbone bus decoder.
An address decoder for subordinate Wishbone buses.
- Parameters:
- Attributes:
bus (
Interface) – Wishbone bus providing access to subordinate buses.
- align_to(alignment)
Align the implicit address of the next window.
See
MemoryMap.align_to()for details.
- add(sub_bus, *, name=None, addr=None, sparse=False)
Add a window to a subordinate bus.
The decoder can perform either sparse or dense address translation. If dense address translation is used (the default), the subordinate bus must have the same data width as the decoder; the window will be contiguous. If sparse address translation is used, the subordinate bus may have data width less than the data width of the decoder; the window may be discontiguous. In either case, the granularity of the subordinate bus must be equal to or less than the granularity of the decoder.
See
MemoryMap.add_resource()for details.
- class amaranth_soc.wishbone.bus.Arbiter
Wishbone bus arbiter.
A round-robin arbiter for initiators accessing a shared Wishbone bus.
- Parameters:
- Attributes:
bus (
Interface) – Shared Wishbone bus.
- add(intr_bus)
Add an initiator bus to the arbiter.
The initiator bus must have the same address width and data width as the arbiter. The granularity of the initiator bus must be greater than or equal to the granularity of the arbiter.