Skip to content

Instantly share code, notes, and snippets.

Created Dec 30, 2018
What would you like to do?
from nmigen import *
from nmigen.cli import main
class Test:
def __init__(self):
self.out = Signal(8)
def get_fragment(self, platform):
data = list(range(10))
arr = Array(data)
idx = Signal(max=len(data))
m = Module()
m.d.comb += self.out.eq(arr[idx])
m.d.sync += idx.eq(idx + 1)
return m.lower(platform)
test = Test()
main(test, ports=[test.out])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment