soc/interconnect/axi/AXIInterface: add optional tkeep.

This commit is contained in:
Florent Kermarrec 2021-02-09 15:52:11 +01:00
parent 018094abb2
commit 126dd267d6
1 changed files with 10 additions and 1 deletions

View File

@ -258,10 +258,13 @@ class AXILiteInterface:
# AXI Stream Definition ---------------------------------------------------------------------------- # AXI Stream Definition ----------------------------------------------------------------------------
class AXIStreamInterface(stream.Endpoint): class AXIStreamInterface(stream.Endpoint):
def __init__(self, data_width=32, user_width=0): def __init__(self, data_width=32, keep_width=0, user_width=0):
self.data_width = data_width self.data_width = data_width
self.keep_width = keep_width
self.user_width = user_width self.user_width = user_width
payload_layout = [("data", data_width)] payload_layout = [("data", data_width)]
if self.keep_width:
payload_layout += [("keep", keep_width)]
param_layout = [] param_layout = []
if self.user_width: if self.user_width:
param_layout += [("user", user_width)] param_layout += [("user", user_width)]
@ -274,6 +277,8 @@ class AXIStreamInterface(stream.Endpoint):
Subsignal("tready", Pins(1)), Subsignal("tready", Pins(1)),
Subsignal("tdata", Pins(self.data_width)), Subsignal("tdata", Pins(self.data_width)),
] ]
if self.keep_width:
subsignals += [Subsignal("tkeep", Pins(self.keep_width))]
if self.user_width: if self.user_width:
subsignals += [Subsignal("tuser", Pins(self.user_width))] subsignals += [Subsignal("tuser", Pins(self.user_width))]
ios = [(bus_name , 0) + tuple(subsignals)] ios = [(bus_name , 0) + tuple(subsignals)]
@ -287,6 +292,8 @@ class AXIStreamInterface(stream.Endpoint):
r.append(self.ready.eq(pads.tready)) r.append(self.ready.eq(pads.tready))
r.append(pads.tlast.eq(self.last)) r.append(pads.tlast.eq(self.last))
r.append(pads.tdata.eq(self.data)) r.append(pads.tdata.eq(self.data))
if self.keep_width:
r.append(pads.tkeep.eq(self.keep))
if self.user_width: if self.user_width:
r.append(pads.tuser.eq(self.user)) r.append(pads.tuser.eq(self.user))
if mode == "slave": if mode == "slave":
@ -294,6 +301,8 @@ class AXIStreamInterface(stream.Endpoint):
r.append(pads.tready.eq(self.ready)) r.append(pads.tready.eq(self.ready))
r.append(self.last.eq(pads.tlast)) r.append(self.last.eq(pads.tlast))
r.append(self.data.eq(pads.tdata)) r.append(self.data.eq(pads.tdata))
if self.keep_width:
r.append(self.keep.eq(pads.tkeep))
if self.user_width: if self.user_width:
r.append(self.user.eq(pads.tuser)) r.append(self.user.eq(pads.tuser))
return r return r