DMA Application is not working in Jupyter

Hi every one,

I am writing here hoping you could help me. Well, first of all, I am using Pynq Z2 with the last versión. I am trying to execute the next code in Jupyter that, in a few words it send 13 elements of 64 bits to compare with a matrix of [20][13] and return the index of the element that is equal.

Code in Jupyter:

from pynq import Overlay
from pynq import allocate
import numpy as np

ol = Overlay("pruebar.bit")

dma = ol.axi_dma_0
dma_send = ol.axi_dma_0.sendchannel
dma_recv = ol.axi_dma_0.recvchannel

hls_ip = ol.my_fun_0 

envio = [0b0000000000000000000000000000000000000000000000000000000000000000,
             0b0000000000000000000000000000000000000000000000000000000000000000,
             0b0000000000000000000000000000000000000000000000000000000000000000,
             0b0000000000000000000000000000000000000000000011100000000000000000,
             0b0000001111110000000000000000000001111111100000000000000000001111,
             0b1111100000111100000000011111011110001111110000000001111001111111,
             0b1111110000000011110001111111111100000000001111001111111111000000,
             0b0000001111011111111100000000000000111111111111000000000000000011,
             0b1111111100000000000000000001111111000000000000000000000011110000,
             0b0000000000000000000000000000000000000000000000000000000000000000,
             0b0000000000000000000000000000000000000000000000000000000000000000,
             0b0000000000000000000000000000000000000000000000000000000000000000,
             0b0000000000000000000000000000000000000000000000000000000000000000,
]

CONTROL_REGISTER = 0x0
hls_ip.write(CONTROL_REGISTER, 0x81)

data_size1 = 13
input_buffer = allocate(shape=(data_size1,), dtype=np.uint64)
output_buffer = allocate(shape=(1,), dtype=np.uint64)
                         
for i in range(data_size1):
    input_buffer[i] = ejemplo_f[i]
    
dma_send.transfer(input_buffer)
dma_recv.transfer(output_buffer)

output_buffer

My code of HLS is: axis_t is <64,0,0,0>

#include <stdio.h>
#include <stdlib.h>
#include "DatosFunciones.h"
//#include "ap_int.h"

void my_fun(hls::stream<axis_t> &entrada, hls::stream<axis_t> &salida){

#pragma HLS INTERFACE s_axilite port = return bundle = CTRL
#pragma HLS INTERFACE axis port = entrada
#pragma HLS INTERFACE axis port = salida

		const long long unsigned int set[N][13]={
					#include "Data_TFM_64.dat"
					};


    short maximo = 500;
    short indice = 0;
    short auxiliar = 0;
    int contador = 0;
	long long unsigned int vec_entrada ;
	long long unsigned int vec_xnor[N][13] ;
	long long unsigned int aux[N] = {};
	axis_t tmp, sal;

	while(1){
		tmp = entrada.read();
		vec_entrada = tmp.data.to_long();
		for(int a = 0; a < N; a++){
			vec_xnor[a][contador] = ~(vec_entrada^set[a][contador]);
			for(int b = 0; b < 64; b++){
				aux[a] += ((vec_xnor[a][contador] >> b) & 1);
		}
	}
	contador = contador + 1;
	if (tmp.last == 1){
		for(int j = 0; j < N; j++){
			if (maximo < aux[j]){
				maximo = aux[j];
				indice = j;
			}
		}
		sal.data = indice;
		salida.write(sal);
		break;
	}

When i simulated in Vivado HLS it works but when i try in Jupyter it doesnt.

My proyect of Vivado is the next:

I hope you can help me, thank you very much.

Hi @Addint96,

It looks like you are not handling the output stream properly. You code does not set neither keep not last.

You may want to review this tutorial Tutorial: using a HLS stream IP with DMA (Part 1: HLS design)

Mario

1 Like

I tried with sal.keep = - 1 in the sending loop but it didnt work either.

I am going to do the same comment as I did earlier.

Mario