soc/interconnect/stream/Shifter: add shift signal as optional parameter.

This commit is contained in:
Florent Kermarrec 2020-10-21 15:52:53 +02:00
parent 5a6b8f452d
commit c430587e91
1 changed files with 3 additions and 3 deletions

View File

@ -571,8 +571,8 @@ class Gearbox(Module):
# Shifter ------------------------------------------------------------------------------------------ # Shifter ------------------------------------------------------------------------------------------
class Shifter(PipelinedActor): class Shifter(PipelinedActor):
def __init__(self, dw): def __init__(self, dw, shift=None):
self.shift = Signal(max=dw) self.shift = Signal(max=dw) if shift is None else shift
self.sink = sink = Endpoint([("data", dw)]) self.sink = sink = Endpoint([("data", dw)])
self.source = source = Endpoint([("data", dw)]) self.source = source = Endpoint([("data", dw)])
PipelinedActor.__init__(self, latency=2) PipelinedActor.__init__(self, latency=2)
@ -582,7 +582,7 @@ class Shifter(PipelinedActor):
# Accumulate current/last sink.data. # Accumulate current/last sink.data.
r = Signal(2*dw) r = Signal(2*dw)
self.sync += If(self.pipe_ce, self.sync += If(self.pipe_ce,
r[0:dw].eq(r[dw:]), r[:dw].eq(r[dw:]),
r[dw:].eq(sink.data) r[dw:].eq(sink.data)
) )