Events¶
- class torii.lib.soc.event.EventMap None ¶
Event map.
An event map is a description of a set of events. It is built by adding event sources and can be queried later to determine their index. Event indexing is done implicitly by increment, starting at 0.
- freeze() None ¶
Freeze the event map.
Once the event map is frozen, sources cannot be added anymore.
- add(src: Source) None ¶
Add an event source.
- Parameters:
src (Source) – Event source.
- Raises:
ValueError – If the event map is frozen.
- class torii.lib.soc.event.Monitor(event_map: EventMap, *, trigger: Trigger = 'level') None ¶
Event monitor.
A monitor for subordinate event sources.
- Parameters:
event_map (EventMap) – Event map.
trigger (Source.Trigger) – Trigger mode. See
Source
.
- Attributes:
src (Source) – Event source. Its input is asserted when a subordinate event is enabled and pending.
enable (Signal(event_map.size), bit mask, in) – Enabled events.
pending (Signal(event_map.size), bit mask, out) – Pending events.
clear (Signal(event_map.size), bit mask, in) – Clear selected pending events.
- class torii.lib.soc.event.Source(*, trigger: Trigger = 'level', name: str | None = None, src_loc_at: int = 0) None ¶
Event source interface.
- Parameters:
trigger (Source.Trigger) – Trigger mode. An event can be edge- or level-triggered by the input line.
name (str) – Name of the underlying record.
- Attributes:
i (Signal()) – Input line. Sampled in order to detect an event.
trg (Signal()) – Event trigger. Asserted when an event occurs, according to the trigger mode.
- property event_map: EventMap¶
Event map.
- Returns:
EventMap – An
EventMap
describing subordinate event sources.- Raises:
NotImplementedError – If the source does not have an event map.