Hi, I am using Pynq- Z2 with image v2.7.
I want to rebuild some projects from pynq community. But, most of them were deployed on older versions where Xlnk was there. But, now I cannot use their codes.
I got to know that now we have allocate() in place of Xlnk.
But, not sure exact syntax. Can anyone help how can I change the older code to get it working now.
e.g.
-
def cleanup(self):
xlnk = Xlnk()
xlnk.xlnk_reset() -
self.library = library
self.xlnk = Xlnk()
self.xlnk.set_allocator_library(self.library) -
def copy_array(self, x, dtype=np.int32):
“”“Copy numpy array to contiguous memory.
Parameters
----------
x: np.array
Input numpy array, not necessarily in contiguous memory.
dtype : type
Data type for the give numpy array.
Returns
-------
xlnk.cma_array
Physically contiguous memory.
“””
size = x.shape
data_buffer = self.xlnk.cma_array(shape=size, dtype=dtype, cacheable=self.cacheable)
np.copyto(data_buffer, x.astype(dtype), casting=“unsafe”)
return data_buffer