Skip to content

Instantly share code, notes, and snippets.

@The6P4C The6P4C/test.py
Created Dec 30, 2018

Embed
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
You can’t perform that action at this time.