packet
Packetized data streams.
Dispatcher
Bases: Component
Dispatcher for packet streams.
The first matching output interface is selected for each input packet.
Source code in katsuo/stream/packet/dispatcher.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
get_output(predicate)
Returns a new input stream interface.
Must be called before the component is elaborated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
predicate
|
A function that takes a packet and returns a signal indicating whether this output should handle the packet. |
required |
Source code in katsuo/stream/packet/dispatcher.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
Packet
Bases: StructLayout
Payload shape for a packetized data stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_shape
|
ShapeLike
|
Shape of a data token. |
8
|
header_shape
|
ShapeLike | None
|
Shape of the optional header field. |
None
|
semantics
|
Semantics
|
Semantics of the packetized data stream. |
LAST
|
Source code in katsuo/stream/packet/__init__.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
Semantics
Bases: Enum
Semantics of the packetized data stream.
Source code in katsuo/stream/packet/__init__.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
END = enum.auto()
class-attribute
instance-attribute
Payload has an end field that's asserted during a separate transfer after the last data transfer of a packet.
FIRST_END = enum.auto()
class-attribute
instance-attribute
Payload has a first field that's asserted during the first data transfer of a packet in addition to the end field.
FIRST_LAST = enum.auto()
class-attribute
instance-attribute
Payload has a first field that's asserted during the first data transfer of a packet in addition to the last field.
LAST = enum.auto()
class-attribute
instance-attribute
Payload has a last field that's asserted during the last data transfer of a packet.
has_end
property
True if the semantics includes an end field.
has_first
property
True if the semantics includes a first field.
has_last
property
True if the semantics includes a last field.
PacketQueue
Bases: Component
FIFO queue for packetized data streams.
A packet will only be released on the output side once it is fully received on the input side.
If the input semantics includes the first signal, a partially received packet will be discarded when a new packet starts.
If the max_inflight parameter is set, the queue includes acknowledgment and replay functionality to allow retransmission of unacknowledged packets.
This makes the queue suitable for the following use cases: - Ingress buffering where packets may be dropped partway on error conditions. - Egress buffering where packets must be sent as contiguous bursts. - Egress buffering with retransmission capabilities.
Behavior is undefined if a packet larger than the queue depth is received.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
ShapeLike
|
Shape of the packetized data stream. |
required |
depth
|
int
|
Depth of the FIFO queue. |
required |
i_semantics
|
Semantics
|
Packet semantics of the input stream. |
required |
o_semantics
|
Semantics
|
Packet semantics of the output stream. |
required |
max_inflight
|
int | None
|
Maximum number of in-flight packets for replay functionality. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
i |
stream
|
Input stream. |
o |
stream
|
Output stream. |
ack |
in
|
Acknowledgment signal for completed packets (if |
replay |
in
|
Replay signal to resend unacknowledged packets (if |
Source code in katsuo/stream/packet/queue.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
PacketView
Bases: View
View of a packetized data stream payload.
Source code in katsuo/stream/packet/__init__.py
78 79 80 81 82 83 84 85 86 87 88 89 | |
d
property
Shorthand for .data.
h
property
Shorthand for .header.
PriorityArbiter
Bases: Component
Arbiter for packet streams with fixed priority.
Priority is determined by the order in which input interfaces are requested. The first requested interface has the highest priority.
Source code in katsuo/stream/packet/arbiter.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
get_input()
Returns a new input stream interface.
Must be called before the component is elaborated.
Source code in katsuo/stream/packet/arbiter.py
25 26 27 28 29 30 31 32 33 34 35 36 | |