From: Sebastien Bourdeauducq Date: Mon, 18 Mar 2013 17:37:23 +0000 (+0100) Subject: examples/basic/arrays: demonstrate lowering of Array in Instance expression X-Git-Tag: 24jan2021_ls180~2099^2~633 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=af4eb02551300434d676980d9877da428ad63adf;p=litex.git examples/basic/arrays: demonstrate lowering of Array in Instance expression --- diff --git a/examples/basic/arrays.py b/examples/basic/arrays.py index a041658f..7792dc91 100644 --- a/examples/basic/arrays.py +++ b/examples/basic/arrays.py @@ -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()))