In addition to nmigen.compat.
Replace:
s = Signal(max=1234)
with:
s = Signal(range(1234))
Use lower()
instead.
My personnal implementation of Migen's timeline as an Elaboratable:
from nmigen import *
__all__ = ["Timeline"]
class Timeline(Elaboratable):
def __init__(self, events):
self.trigger = Signal()
self._events = events
def elaborate(self, platform):
m = Module()
lastevent = max([e[0] for e in self._events])
counter = Signal(range(lastevent+1))
# Counter incrementation
# (with overflow handling)
if (lastevent & (lastevent + 1)) != 0:
with m.If(counter == lastevent):
m.d.sync += counter.eq(0)
with m.Else():
with m.If(counter != 0):
m.d.sync += counter.eq(counter+1)
with m.Elif(self.trigger):
m.d.sync += counter.eq(1)
else:
with m.If(counter != 0):
m.d.sync += counter.eq(counter+1)
with m.Elif(self.trigger):
m.d.sync += counter.eq(1)
for e in self._events:
if e[0] == 0:
with m.If(self.trigger & (counter == 0)):
m.d.sync += e[1]
else:
with m.If(counter == e[0]):
m.d.sync += e[1]
return m
Replace:
from migen import log2_int
with:
from nmigen.utils import log2_int
No stream implementation is provided in nMigen or nMigen-SoC. LambdaConcept offers their own implementation in lambdaUSB.
ack
->ready
stb
->valid
eop
->last