examples/basic/arrays: demonstrate lowering of Array in Instance expression
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Mon, 18 Mar 2013 17:37:23 +0000 (18:37 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Mon, 18 Mar 2013 17:37:23 +0000 (18:37 +0100)
examples/basic/arrays.py

index a041658f71dd300e2856ea91822688be03eb805a..7792dc9115de3f161c9e3e70807dff8dd7713e6e 100644 (file)
@@ -1,11 +1,12 @@
 from migen.fhdl.structure import *
+from migen.fhdl.specials import Instance
 from migen.fhdl.module import Module
 from migen.fhdl import verilog
 
 class Example(Module):
        def __init__(self):
-               dx = 5
-               dy = 5
+               dx = 2
+               dy = 2
 
                x = Signal(max=dx)
                y = Signal(max=dy)
@@ -20,4 +21,8 @@ class Example(Module):
                                my_2d_array[x][y].eq(inp)
                        )
 
+               ina = Array(Signal() for a in range(dx))
+               outa = Array(Signal() for a in range(dy))
+               self.specials += Instance("test", Instance.Output("O", outa[y]), Instance.Input("I", ina[x]))
+
 print(verilog.convert(Example()))