flow/actor: add packetized parameter for Sink and Source

This commit is contained in:
Florent Kermarrec 2014-09-17 17:23:27 +02:00 committed by Sebastien Bourdeauducq
parent 967b73bef3
commit 66054af7bb
1 changed files with 9 additions and 4 deletions

View File

@ -13,13 +13,18 @@ def _make_m2s(layout):
return r
class _Endpoint(Record):
def __init__(self, layout):
full_layout = [
def __init__(self, layout, packetized=False):
endpoint_layout = [
("payload", _make_m2s(layout)),
("stb", 1, DIR_M_TO_S),
("ack", 1, DIR_S_TO_M)
]
Record.__init__(self, full_layout)
if packetized:
endpoint_layout += [
("sop", 1, DIR_M_TO_S),
("eop", 1, DIR_S_TO_M)
]
Record.__init__(self, endpoint_layout)
class Source(_Endpoint):
def connect(self, sink):