mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
examples/basic/arrays: demonstrate lowering of Array in Instance expression
This commit is contained in:
parent
7a06e9457c
commit
af4eb02551
1 changed files with 7 additions and 2 deletions
|
@ -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()))
|
||||
|
|
Loading…
Reference in a new issue