luna_soc.gateware.core.usb2.device module

Contains the organizing gateware used to add USB Device functionality to your own designs; including the core USBDevice class.

class luna_soc.gateware.core.usb2.device.Peripheral(*args, src_loc_at=0, **kwargs)[source]

Bases: Component

SoC controller for a USBDevice.

Breaks our USBDevice control and status signals out into registers so a CPU / Wishbone master can control our USB device.

The attributes below are intended to connect to a USBDevice. Typically, they’d be created by using the .controller() method on a USBDevice object, which will automatically connect all relevant signals.

Attributes

connect: Signal(), output

High when the USBDevice should be allowed to connect to a host.

class Control(*args, src_loc_at=0, **kwargs)[source]

Bases: Register

A CSR register.

Parameters

fieldsdict or list or Field

Collection of register fields. If None (default), a dict is populated from Python variable annotations. fields is used to create a FieldActionMap, FieldActionArray, or FieldAction, depending on its type (dict, list, or Field).

Interface attributes

elementElement

Interface between this register and a CSR bus primitive.

Attributes

fieldFieldActionMap or FieldActionArray or FieldAction

Collection of field instances.

fFieldActionMap or FieldActionArray or FieldAction

Shorthand for Register.field.

Raises

TypeError

If fields is neither None, a dict, a list, or a Field.

ValueError

If fields is not None and at least one variable annotation is a Field.

ValueError

If element.access is not readable and at least one field is readable.

ValueError

If element.access is not writable and at least one field is writable.

connect: <amaranth_soc.csr.reg.Field object at 0x7f6321325550>
full_speed_only: <amaranth_soc.csr.reg.Field object at 0x7f6320af1ee0>
low_speed_only: <amaranth_soc.csr.reg.Field object at 0x7f6320af0a70>
class Status(*args, src_loc_at=0, **kwargs)[source]

Bases: Register

A CSR register.

Parameters

fieldsdict or list or Field

Collection of register fields. If None (default), a dict is populated from Python variable annotations. fields is used to create a FieldActionMap, FieldActionArray, or FieldAction, depending on its type (dict, list, or Field).

Interface attributes

elementElement

Interface between this register and a CSR bus primitive.

Attributes

fieldFieldActionMap or FieldActionArray or FieldAction

Collection of field instances.

fFieldActionMap or FieldActionArray or FieldAction

Shorthand for Register.field.

Raises

TypeError

If fields is neither None, a dict, a list, or a Field.

ValueError

If fields is not None and at least one variable annotation is a Field.

ValueError

If element.access is not readable and at least one field is readable.

ValueError

If element.access is not writable and at least one field is writable.

speed: <amaranth_soc.csr.reg.Field object at 0x7f6320b0e870>
attach(device: USBDevice)[source]

Returns a list of statements necessary to connect this to a USB controller.

The returned values makes all of the connections necessary to provide control and fetch status from the relevant USB device. These can be made either combinationally or synchronously, but combinational is recommended; as these signals are typically fed from a register anyway.

Parameters

device: USBDevice

The USBDevice object to be controlled.

elaborate(platform)[source]