I am testing a simple design, which is the following:
I am testing it in PYNQ with the following simple code:
from pynq import Overlay
from pynq import allocate
import matplotlib.pyplot as plt
import numpy as np
import pynq.lib.dma
from pynq import allocate
overlay = Overlay('/home/xilinx/pynq/overlays/multiplier/axis_multiplier.bit')
dma = overlay.axi_dma_0
in_buffer = allocate(shape=(20,), dtype=np.uint32)
out_buffer = allocate(shape=(20,), dtype=np.uint32)
for i in range(20):
in_buffer[i] = i
dma.sendchannel.transfer(in_buffer)
dma.recvchannel.transfer(out_buffer)
dma.sendchannel.wait()
dma.recvchannel.wait()
out_buffer
The code works fine, depending on the “type” of my IP.
To make this point clearer, this is the working version of my IP:
#include "ap_axi_sdata.h"
#include "hls_stream.h"
typedef struct {
ap_int<24> first_value;
ap_int<24> second_value;
} my_data_struct;
typedef hls::axis<my_data_struct,0,0,0> pkt_t;
void mult_stream(
hls::stream< pkt_t > &din,
hls::stream< pkt_t > &dout ) {
#pragma HLS INTERFACE ap_ctrl_none port=return
#pragma HLS INTERFACE axis port=din
#pragma HLS INTERFACE axis port=dout
pkt_t pkt;
//pkt_t pkt_out;
din.read(pkt);
pkt.data.first_value *= 2;
pkt.data.second_value *=3;
//pkt_out.data.first_value = pkt.data.first_value*2;
//pkt_out.data.second_value = pkt.data.first_value*2;
dout.write(pkt_out);
}
Where I am just multiplying the two values of the struct and then sending them to the output stream. This code works perfectly fine.
However, if I just change slightly the code and I assign the result of the multiplication to a new (yet identical) variable, my code in PYNQ just idles and waits infinitely:
#include "ap_axi_sdata.h"
#include "hls_stream.h"
typedef struct {
ap_int<24> first_value;
ap_int<24> second_value;
} my_data_struct;
typedef hls::axis<my_data_struct,0,0,0> pkt_t;
void mult_stream(
hls::stream< pkt_t > &din,
hls::stream< pkt_t > &dout ) {
#pragma HLS INTERFACE ap_ctrl_none port=return
#pragma HLS INTERFACE axis port=din
#pragma HLS INTERFACE axis port=dout
pkt_t pkt;
pkt_t pkt_out;
din.read(pkt);
//pkt.data.first_value *= 2;
//pkt.data.second_value *=3;
//Same identical code, i am just assigning the result to a new variable
pkt_out.data.first_value = pkt.data.first_value*2;
pkt_out.data.second_value = pkt.data.first_value*2;
dout.write(pkt_out);
}
Does anybody know why? Both versions of the IP work fine inside vitis 2020.2, correct C smulation, correct synthesis and correct Co-simulation