Skip to content

Instantly share code, notes, and snippets.

@cfelton
Created April 24, 2014 08:35
Show Gist options
  • Save cfelton/11246652 to your computer and use it in GitHub Desktop.
Save cfelton/11246652 to your computer and use it in GitHub Desktop.
This is a multi-dimension example (currently not support)
from copy import copy
from myhdl import *
def m_mdarray_top(clock, reset, x, y):
N = 16
M = 5
A = [[Signal(intbv(0)[8:]) for _ in range(N)]
for __ in range(M)]
B = copy(A)
g = m_mdarray(clock, reset, A, B, N, M)
return g
def m_mdarray(clock, reset, A, B, N, M):
@always_seq(clock.posedge, reset=reset)
def rtl():
for ii in range(M):
for jj in range(N):
A[ii][jj].next = B[ii][jj]
return rtl
clock = Signal(bool(0))
reset = ResetSignal(0, active=0, async=True)
x,y = [Signal(intbv(0)[8:]) for _ in range(2)]
toVHDL(m_mdarray_top, clock, reset, x, y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment