Hello,
I am trying to test an SVM IP on a ZCU104 board using PYNQ ( PYNQ2.7). I was able to reproduce this work for the hardware implementation of the SVM IP on ZCU104. My design is shown below
For the test of my SVM IP I tried the following
from pynq import Overlay
from pynq import MMIO
import numpy as np
import struct
from datetime import datetimeoverlay= Overlay(“SVM_orig.bit”)
overlay.is_loaded()overlay.download()
overlay.ip_dictol= overlay.svm_classifier_0
mmio = MMIO(0xA0000000,0xA000FFFF)
X=[-0.535835,0.291519,-1.055207,0.276026,-0.231975,-1.927177,-0.645042,0.133114,1.603685,-1.322951,-0.935624,2.438317,-1.307130,-0.219807,0.896202,0.740312]
mmio.write(0x100 ,X)
y= mmio.read(0x200)
print(y)
However, I got this error:
ValueError Traceback (most recent call last)
in
2
3 X=[-0.535835,0.291519,-1.055207,0.276026,-0.231975,-1.927177,-0.645042,0.133114,1.603685,-1.322951,-0.935624,2.438317,-1.307130,-0.219807,0.896202,0.740312]
----> 4 mmio.write(0x100 ,X)
5 y= mmio.read(0x200)
6 print(y)
/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/mmio.py in write_mm(self, offset, data)
189 self.array[idx + i] = buf[i]
190 else:
→ 191 raise ValueError(“Data type must be int or bytes.”)
192
193 def write_reg(self, offset, data):
ValueError: Data type must be int or bytes
So, I found this
mmio = MMIO(0xA0000000,0xA000FFFF)
X=[-0.535835,0.291519,-1.055207,0.276026,-0.231975,-1.927177,-0.645042,0.133114,1.603685,-1.322951,-0.935624,2.438317,-1.307130,-0.219807,0.896202,0.740312]
mmio.write(0x100,struct.unpack(‘I’, struct.pack(‘f’, X))[0])
c=struct.unpack(‘f’, struct.pack(‘I’, mmio.read(0x200)))[0]
print(c)
But I got this error : error: required argument is not a float
I think mmio.write should take one value of X. However, the HLS code indicates that each entry should be a vector of a dimension of 16, and the output should be 1 or 0.
Any ideas please how to deal with this?
Regards