Output is zero after changing from ints to floats

Hi there,

I’m trying to get an (extremely basic) function to run on the PYNQ-Z2 board and I’m running into issues when moving from integers to floats. I am writing C++/HLS in Vivado HLS and using Vivado Design Suite to generate bitstreams.

The code is as follows

#define DATA_TYPE int

DATA_TYPE test(DATA_TYPE S, DATA_TYPE K, DATA_TYPE T, DATA_TYPE r, DATA_TYPE v) {
	return (S * K) + T + r + v;
}

void mult(DATA_TYPE *pCall, DATA_TYPE S, DATA_TYPE K, DATA_TYPE T, DATA_TYPE r, DATA_TYPE v) {

	*pCall = test(S, K, T, r, v);

}

And the HLS directives are
Untitled

I am using the MMIO module inside Jupyter to read/write to memory, when using the code above this works fine. However, when changing “DATA_TYPE” from int to float, I receive an output of zero. Any ideas on why this would happen/steps to remedy would be much appreciated.

Cheers.

EDIT I’ve added bitstreams, tcl and hwh files along with the notebook to Google Drive, bitstreams etc. are zipped and labelled “integer” (correct output) and “float” (incorrect output).
https://drive.google.com/drive/folders/1-iyCcFJ8aFfSsacLm0aFKwG84c7laUuc?usp=sharing

Block design - couldn’t attach to main post.

@mjcarter95

Do you know float type employs the IEEE 754 format ? It implies you should do some transform for the data you read back from HW in the PYNQ to the world of python to treat the data you read as float. Thanks

@NS_Huang

Thanks for your reply - it was indeed the mixing of integers/floats that was causing the issue. Everything works okay assuming I am only transferring floats to and from the PL.

Cheers

I am trying to do the same thing but I can’t figure how to do conversion in Python. Could you ellaborate on the solution you implemented?