Hello Umair,
To support floating calculation, you don't need to modify stream_read() and stream_write(). Instead, you need to modify MEM_READ() and MEM_WRITE() in reconos_calls.h. The key point to support float type is to transferring float data to reconos api, but let reconos "think" this is uint32 data. After you obtain the data via stream_read() or before you write back data via stream_write(), you need to change the type of the pointer WITHOUT changing your data in the memory pointed by this pointer.
For example, in MEM_READ, original code section is
------
...
for (; __len > 0; __len -= 4) {\
(dst)[__i++] = stream_read(memif_mem2hwt);\
__addr += 4;\
__rem -= 4;\
}\
...
------
You need to change it to:
----
uint32 __data;\
...\
for (; __len > 0; __len -= 4) {\
__data = stream_read(memif_mem2hwt);\
(dst)[__i++] = *((float*) (&__data));\ (The content of __data is not modified, we ONLY need to change the type of pointer that points to this location)
__addr += 4;\
__rem -= 4;\
}
...
----
You can do the similar thing in MEM_WRITE.
To support this in rdk, you need to modify /lib/calls/reconos_calls_hls.h.
If you want to support transferring both uint32 and float data in the same hw ip core, you need to add one more argument indicating the type of data in MEM_WRITE and MEM_READ. To make rdk support this, you need to modify /lib/calls/reconos_calls_hls.h; build.cfg in your hw project, /tools/_pypack/reconos/runtime/project.py and /tools/_pypack/reconos/scripts/hw/export.py.
Thanks,
Guanwen