Skip to content

Commit ff511b2

Browse files
committed
A bug in axi.set_memory is fixed.
1 parent c55a628 commit ff511b2

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

veriloggen/types/axi.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,7 @@ def make_memory_image(filename, length, pattern='inc', dtype=None,
16641664
import numpy as np
16651665

16661666
if dtype is None:
1667-
dtype = np.int32
1667+
dtype = np.int64
16681668

16691669
if pattern == 'inc':
16701670
l = list(range(length))
@@ -1746,12 +1746,9 @@ def aligned_shape(shape, wordsize, mem_wordsize):
17461746
return aligned_shape
17471747

17481748
chunk = mem_wordsize // wordsize
1749-
res = mem_wordsize - aligned_shape[-1] % chunk
1749+
new_size = int(math.ceil(aligned_shape[-1] / chunk)) * chunk
1750+
aligned_shape[-1] = new_size
17501751

1751-
if res == mem_wordsize:
1752-
return aligned_shape
1753-
1754-
aligned_shape[-1] += res
17551752
return aligned_shape
17561753

17571754

@@ -1854,7 +1851,7 @@ def align(src, num_align_words):
18541851
import numpy as np
18551852

18561853
src_aligned_shape = aligned_shape(src.shape, 1, num_align_words)
1857-
ret = np.zeros(src_aligned_shape).reshape([-1])
1854+
ret = np.zeros(src_aligned_shape, dtype=np.int64).reshape([-1])
18581855
offset = 0
18591856
index = 0
18601857
res = num_align_words - src.shape[-1] % num_align_words

0 commit comments

Comments
 (0)