cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
307 Views
Registered: ‎03-14-2019

Synthesizable matrices inferred as ROMs while reading from a text file

Hello. I want to write a HLS code to do a remap() usign Vivado HLS 2019.1 (and the 2019.1 version of the xfOpenCV library).

The thing is, I don't want to compute the maps, so it doesn't use so many PL resources. I think it could be a good idea to compute the maps in another program and then read a text file containing these values and filling the matrices. my code would look like this:

 

#include "xf_remap_config.h"

void init_map_1(xf::Mat<XF_32FC1, HEIGHT, WIDTH, NPC1> & map){
	float f_val = 0.0;
	for(int i= 0; i < HEIGHT * WIDTH; i++){
		// f_val = READ FROM FILE A
		map.write_float(i, f_val);
	}
}
void init_map_2(xf::Mat<XF_32FC1, HEIGHT, WIDTH, NPC1> & map){
	float f_val = 0.0;
	for(int i= 0; i < HEIGHT * WIDTH; i++){
			// f_val = READ FROM FILE B
			map.write_float(i, f_val);
	}
}

void remap_accel(xf::Mat<TYPE, HEIGHT, WIDTH, NPC1> &_src,xf::Mat<TYPE, HEIGHT, WIDTH, NPC1> &_dst)
{
	static xf::Mat<XF_32FC1, HEIGHT, WIDTH, NPC1> map_1(HEIGHT, WIDTH);
	static xf::Mat<XF_32FC1, HEIGHT, WIDTH, NPC1> map_2(HEIGHT, WIDTH);
	init_map_1(map_1);
	init_map_2(map_2);

	xf::remap<REMAP_WIN_ROWS, XF_INTERPOLATION_BILINEAR , TYPE, XF_32FC1, TYPE, HEIGHT, WIDTH, NPC1, false>(_src, _dst, map_1, map_2);

}

Would it be synthesizable and the matrices inferred as ROMs if I read from a text file to fill them?

 

Thanks!

0 Kudos