interconnect/stream: cleanup imports/idents

This commit is contained in:
Florent Kermarrec 2020-02-14 08:08:19 +01:00
parent 57fb3720e2
commit 18a9d4ff2f

View file

@ -4,11 +4,9 @@
# License: BSD
import math
from copy import copy
from migen import *
from migen.util.misc import xdir
from migen.genlib.record import *
from migen.genlib import fifo
from migen.genlib.cdc import MultiReg, PulseSynchronizer
@ -156,12 +154,12 @@ class PipelinedActor(BinaryActor):
class _FIFOWrapper(Module):
def __init__(self, fifo_class, layout, depth):
self.sink = Endpoint(layout)
self.source = Endpoint(layout)
self.sink = sink = Endpoint(layout)
self.source = source = Endpoint(layout)
# # #
description = self.sink.description
description = sink.description
fifo_layout = [
("payload", description.payload_layout),
("param", description.param_layout),
@ -169,28 +167,28 @@ class _FIFOWrapper(Module):
("last", 1)
]
self.submodules.fifo = fifo_class(layout_len(fifo_layout), depth)
self.submodules.fifo = fifo = fifo_class(layout_len(fifo_layout), depth)
fifo_in = Record(fifo_layout)
fifo_out = Record(fifo_layout)
self.comb += [
self.fifo.din.eq(fifo_in.raw_bits()),
fifo_out.raw_bits().eq(self.fifo.dout)
fifo.din.eq(fifo_in.raw_bits()),
fifo_out.raw_bits().eq(fifo.dout)
]
self.comb += [
self.sink.ready.eq(self.fifo.writable),
self.fifo.we.eq(self.sink.valid),
fifo_in.first.eq(self.sink.first),
fifo_in.last.eq(self.sink.last),
fifo_in.payload.eq(self.sink.payload),
fifo_in.param.eq(self.sink.param),
sink.ready.eq(fifo.writable),
fifo.we.eq(sink.valid),
fifo_in.first.eq(sink.first),
fifo_in.last.eq(sink.last),
fifo_in.payload.eq(sink.payload),
fifo_in.param.eq(sink.param),
self.source.valid.eq(self.fifo.readable),
self.source.first.eq(fifo_out.first),
self.source.last.eq(fifo_out.last),
self.source.payload.eq(fifo_out.payload),
self.source.param.eq(fifo_out.param),
self.fifo.re.eq(self.source.ready)
source.valid.eq(fifo.readable),
source.first.eq(fifo_out.first),
source.last.eq(fifo_out.last),
source.payload.eq(fifo_out.payload),
source.param.eq(fifo_out.param),
fifo.re.eq(source.ready)
]
@ -674,7 +672,7 @@ class Cast(CombinatorialActor):
class Unpack(Module):
def __init__(self, n, layout_to, reverse=False):
self.source = source = Endpoint(layout_to)
description_from = copy(source.description)
description_from = Endpoint(layout_to).description
description_from.payload_layout = pack_layout(description_from.payload_layout, n)
self.sink = sink = Endpoint(description_from)
@ -718,7 +716,7 @@ class Unpack(Module):
class Pack(Module):
def __init__(self, layout_from, n, reverse=False):
self.sink = sink = Endpoint(layout_from)
description_to = copy(sink.description)
description_to = Endpoint(layout_from).description
description_to.payload_layout = pack_layout(description_to.payload_layout, n)
self.source = source = Endpoint(description_to)