26 lines
395 B
Python
26 lines
395 B
Python
from migen.fhdl.structure import *
|
|
from migen.fhdl import verilog
|
|
|
|
dx = 5
|
|
dy = 5
|
|
|
|
x = Signal(BV(bits_for(dx)))
|
|
y = Signal(BV(bits_for(dy)))
|
|
out = Signal()
|
|
|
|
my_2d_array = Array(Array(Signal() for a in range(dx)) for b in range(dy))
|
|
comb = [
|
|
out.eq(my_2d_array[x][y])
|
|
]
|
|
|
|
we = Signal()
|
|
inp = Signal()
|
|
sync = [
|
|
If(we,
|
|
my_2d_array[x][y].eq(inp)
|
|
)
|
|
]
|
|
|
|
f = Fragment(comb)
|
|
print(verilog.convert(f))
|