Orientation
Type Orientation and Port Directions.
Types can have an orientation (:any:Orientation) and ports have a :any:Direction.
Orient
A member in a structural type can have an orientation:
- forward (
FWD) from source to sink - backward (
BWD) from sink to source
from tabulate import tabulate import ucdp as u orientations = (u.FWD, u.BWD) overview = [(d, d.mode, d.name, d.suffix) for d in orientations] print(tabulate(overview, ("Orient", ".mode", ".name", ".suffix"))) Orient .mode .name .suffix
FWD 1 FWD BWD -1 BWD
Direction
Ports have a direction:
- input (
IN) - output (
OUT) - inout (
INOUT) - input-monitor (
INM) - output-monitor (
OUTM)
from tabulate import tabulate import ucdp as u directions = (u.IN, u.OUT, u.INOUT) overview = [(d, d.mode, d.name, d.suffix) for d in directions] print(tabulate(overview, ("Direction", ".mode", ".name", ".suffix"))) Direction .mode .name .suffix
IN 1 IN _i OUT -1 OUT _o INOUT 0 INOUT _io
Common Features
You can calculate with :any:Orientation ...
FWD * FWD FWD FWD * BWD BWD
... and :any:Direction
IN * FWD IN IN * BWD OUT IN * FWD * BWD * FWD OUT IN * BWD * BWD IN OUT * FWD OUT OUT * BWD IN INOUT * FWD INOUT INOUT * BWD INOUT FWD * OUT BWD
:any:Orientation and :any:Direction are singletons. There is just one instance of each.
IN is IN True IN is (IN * BWD * BWD) True
:any:Orientation and :any:Direction can be compared:
IN == IN True IN == OUT False IN == FWD False
API
AOrientation
Bases: LightObject
Abstract Orientation.
Orientation
Bases: AOrientation
Type Orientation.
import ucdp as u u.Orientation.cast(1) FWD u.Orientation.cast(u.FWD) FWD u.Orientation.cast(u.IN) FWD
Direction
Bases: AOrientation
Port Direction.