PYNQ: PYTHON PRODUCTIVITY

Why is one IP of my custom overlay is not working

Hello
I created a custom overlay with 2 different IPs and generated the bitstream with no problem. when I run the first IP, get the correct results. However, When I run my second IP the results are 0s (knowing that I testbench the HLS IP successfully). please check the block design below

And when I check the list of IPs in the overlay I get the following:

from pynq import allocate, Overlay
import numpy as np
ol = Overlay('ns_accel.bit')
for i in ol.ip_dict:
    print(I)
# dual_gap_0
# ns_kernel_0
# zynq_ultra_ps_e_0

ns_ip = ol.ns_kernel_0

M = 144
N = 32400

At_buffer = allocate(shape=(N,M), dtype=np.float64)
Z_buffer = allocate(shape=(M), dtype=np.float64)
X_buffer = allocate(shape=(N), dtype=np.float64)
diagxtx_buffer = allocate(shape=(N), dtype=np.float64)
Pin_b = allocate(shape=(6), dtype=np.float64)

G_buffer = allocate(shape=(N), dtype=np.float64)
PRB_buffer = allocate(shape=(N), dtype=np.float64)
D1_buffer = allocate(shape=(N), dtype=np.float64)
Pout_b = allocate(shape=(2), dtype=np.float64)

def run_ns():
    ns_ip.write(0x10, At_buffer.physical_address)
    ns_ip.write(0x18, Z_buffer.physical_address)
    ns_ip.write(0x20, X_buffer.physical_address)
    ns_ip.write(0x28, diagxtx_buffer.physical_address)
    ns_ip.write(0x30, Pin_b.physical_address)
    ns_ip.write(0x38, G_buffer.physical_address)
    ns_ip.write(0x40, D1_buffer.physical_address)
    ns_ip.write(0x48, PRB_buffer.physical_address)
    ns_ip.write(0x50, Pout_b.physical_address)
    ns_ip.write(0x00, 1)

A = np.arange(0.0,M*N,1, dtype=np.float64).reshape(N,M)
Z = np.ones(M,dtype=np.float64)*2
X = np.ones(N,dtype=np.float64)*3
dgxtx = np.ones(N,dtype=np.float64)*0.2

s = 1
t = 0.2
MU = 4
lmbda = 1.4
eta = 0.5
gap = 2.6
Pi = np.array([s, t, MU, lmbda, eta, gap],dtype=np.float64)

At_buffer[:] = A
Z_buffer[:] = Z
X_buffer[:] = X
diagxtx_buffer[:] = dgxtx
Pin_b[:] = Pi

run_ns()

for i in range(N):
    print(D1_buffer[I])

# 0.0
# 0.0
# 0.0
# 0.0 ....

What could be the problem?

1 Like

Are you only showing code for the IP that doesn’t work?

Do you leave enough time for the IP to complete before you check the results?

Is your IP using 64-bit floats?

Cathal

1 Like

Hello @cathalmccabe

I am showing the code only for the IP that does not work (ns_kernel_0 in the block design).
Yes, I am leaving enough time before I check the results.
My IP is using double (float 64-bit)

Further Info:
I used vivado 2018.2 to generate the HLS IP and create the design.
I use a specific AXI4 HP port for each IP to avoid addresses overlapping.

Could you please help? This is critical for my work I need to be able to put all the IPs in one design to be able to benchmark them later with overwriting the overlay.

Thank you

1 Like

Do you know if you output buffer gets written at all (i.e. with all zeros) or if the IP does not write anything back? You could try initialise your output buffer with some known non-zero value and check if it changes.
One possible problem I’ve seen people make with floating point -
Say you have an int value of 100. This is 0x00000064 represented as a 32-bit hex value. This should get converted to 0x42800000 (64.0) in float. If it does not get formatted properly and is sent as the value 0x00000064, this is 1.4013e-43 in float. This can mean your IP processes very small numbers and the results are zero.

Have you tried use register_map to readback the status register of the IP that isn’t working?
You should try check the IP starts (i.e. you write the correct start bit) and that the IP completes - is not stuck.

After that I think I would try add ILA probes (CHipScope) to the IP inputs/outputs to check what is happening.

Cathal

1 Like