Skip to content

Instantly share code, notes, and snippets.

@the6p4c
Created December 30, 2018 13:29
Show Gist options
  • Select an option

  • Save the6p4c/dc7d0c0243971ae026fbae479b9998b9 to your computer and use it in GitHub Desktop.

Select an option

Save the6p4c/dc7d0c0243971ae026fbae479b9998b9 to your computer and use it in GitHub Desktop.

Revisions

  1. the6p4c created this gist Dec 30, 2018.
    19 changes: 19 additions & 0 deletions test.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    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])