UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor aperloff
Visitor
297 Views
Registered: ‎04-04-2019

[HLS 2019.1] Using an hls::stream interface for a blackbox module

I have recently begun playing around with the new blackbox feature that was introduced in Vivado HLS 2019.1. I am trying to create a simple HLS program that make use of hls::streams as the input interface to the C++ version blackbox code. However, I keep recieving the error listed in [1] during csynth (csim finished without an issue). Can anyone see if I'm doing something wrong? Has anyone else managed to get the blackbox feature and streams to play nice together? I've attached the json, tcl, and Verilog files to this post if anyone would like to take a look. I've put the C++ code in [2].

Thanks, Alexx

[1]

INFO: [SCHED 204-61] Option 'relax_ii_for_timing' is enabled, will increase II to preserve clock frequency constraints.
WARNING: [HLS 200-40] Skipped source file 'simple_algo_blackbox_stream.json'. Source files must have extensions .c, .C, .cc, .cpp, .c++, .cp, or .cxx.
INFO: [HLS 200-10] Analyzing design file 'src/simple_algo_blackbox.cpp' ...
INFO: [HLS 200-111] Finished Linking Time (s): cpu = 00:00:12 ; elapsed = 00:00:18 . Memory (MB): peak = 926.070 ; gain = 128.000 ; free physical = 39721 ; free virtual = 53277
INFO: [HLS 200-111] Finished Checking Pragmas Time (s): cpu = 00:00:12 ; elapsed = 00:00:18 . Memory (MB): peak = 926.070 ; gain = 128.000 ; free physical = 39721 ; free virtual = 53277
INFO: [HLS 200-10] Starting code transformations ...
ERROR: [HLS 200-520] Stream argument 'a' of function 'rtl_simple_algo_blackbox_stream' has unsupported element type. It must be scalar type.
Fail to get information for parameter 'a' of function 'rtl_simple_algo_blackbox_stream'
Fail to get black box information from '/nfs/data41/aperloff/GlobalCorrelator/pulsar_devkit/simple_examples/HLSIPs/src/simple_algo_blackbox_stream.json'.
ERROR: [HLS 200-70] Synthesizability check failed.
command 'ap_source' returned error code
while executing
"source run_simple_algo_blackbox.tcl"
("uplevel" body line 1)
invoked from within
"uplevel \#0 [list source $arg] "

[2]

simple_algo_blackbox.h

#include "ap_int.h"
#include "hls_stream.h"
typedef ap_uint<11> data_t;
typedef ap_uint<44> data_v;

void rtl_simple_algo_blackbox_stream(hls::stream<data_v> & a, hls::stream<data_v> & b,
				     data_t &z1, data_t &z2, data_t &z3, data_t &z4);
void simple_algo_blackbox_stream(hls::stream<data_v> & a, hls::stream<data_v> & b, data_t &sigma);

simple_algo_blackbox.cpp

#include "simple_algo_blackbox.h"
//--------------------------------------------------------
void rtl_simple_algo_blackbox_stream(hls::stream<data_v> & a, hls::stream<data_v> & b,
									 data_t &z1, data_t &z2, data_t &z3, data_t &z4) {
	#pragma HLS inline=off
	data_v a_tmp, b_tmp;
	a_tmp = a.read();
	b_tmp = b.read();
	z1 = a_tmp(10,0) + b_tmp(10,0);
	z2 = a_tmp(21,11) + b_tmp(21,11);
	z3 = a_tmp(32,22) + b_tmp(32,22);
	z4 = a_tmp(43,33) + b_tmp(43,33);
}

//--------------------------------------------------------
void simple_algo_blackbox_stream(hls::stream<data_v> & a, hls::stream<data_v> & b, data_t &sigma) {
	data_t tmp1, tmp2,tmp3, tmp4;
	rtl_simple_algo_blackbox_stream(a, b, tmp1, tmp2, tmp3, tmp4);
	sigma = tmp1 + tmp2 + tmp3 + tmp4;
}

simple_algo_blackbox_test.cpp

#include <iostream>
#include "src/simple_algo_blackbox.h"

int main() {
	data_t t_a1, t_a2, t_a3, t_a4;
	data_t t_b1, t_b2, t_b3, t_b4;
	data_t t_sigma, t_ref;
	data_v t_a, t_b;
	hls::stream<data_v> t_a_s, t_b_s;

	// Test #1 ----------------------------------------------
	t_a1=3; t_a2=4; t_a3=1; t_a4=20;
	t_b1=7; t_b2=9; t_b3=0; t_b4=1023;
	t_ref = t_a1+t_a2+t_a3+t_a4+t_b1+t_b2+t_b3+t_b4;
	t_a = (t_a4, t_a3, t_a2, t_a1);
	t_b = (t_b4, t_b3, t_b2, t_b1);
	t_a_s.write(t_a); t_b_s.write(t_b);
	simple_algo_blackbox_stream(t_a_s, t_b_s, t_sigma);
	std::cout << " t_sigma " << (int)t_sigma << " t_ref " << (int)t_ref <<  std::endl;
	if (t_sigma != t_ref) return -1;

	// Test #2 -----------------------------------------------
	t_a1=1; t_a2=0; t_a3=0; t_a4=0;
	t_b1=0; t_b2=0; t_b3=0; t_b4=0;
	t_ref = t_a1+t_a2+t_a3+t_a4+t_b1+t_b2+t_b3+t_b4;
	t_a = (t_a4, t_a3, t_a2, t_a1);
	t_b = (t_b4, t_b3, t_b2, t_b1);
	t_a_s.write(t_a); t_b_s.write(t_b);
	simple_algo_blackbox_stream(t_a_s, t_b_s, t_sigma);
	std::cout << " t_sigma " << (int)t_sigma << " t_ref " << (int)t_ref <<  std::endl;
	if (t_sigma != t_ref) return -2;

	return 0;
}
2 Replies
Moderator
Moderator
175 Views
Registered: ‎05-31-2017

Re: [HLS 2019.1] Using an hls::stream interface for a blackbox module

Hi @aperloff ,

Can you once give a try to design using int data type rather than using the ap_uint data type and let us know if you are able to synthesize the design ?

0 Kudos
Visitor aperloff
Visitor
167 Views
Registered: ‎04-04-2019

Re: [HLS 2019.1] Using an hls::stream interface for a blackbox module

Hi @shameera,

I tried that and indeed it gets around the 'unsupported element type' error. However, a new error appears during csynth (see [1]), but I have no idea what this means. I've included the function declarations in [2]. Furthermore, using ints rather than ap_ints would be unfortunate given that we would need to pack our bits into more than one int32_t/int64_t, with the possibility of having wasted space.

[1]

INFO: [SCHED 204-61] Option 'relax_ii_for_timing' is enabled, will increase II to preserve clock frequency constraints.
WARNING: [HLS 200-40] Skipped source file 'simple_algo_blackbox_stream.json'. Source files must have extensions .c, .C, .cc, .cpp, .c++, .cp, or .cxx.
INFO: [HLS 200-10] Analyzing design file 'src/simple_algo_blackbox.cpp' ...
INFO: [HLS 200-111] Finished Linking Time (s): cpu = 00:00:12 ; elapsed = 00:00:17 . Memory (MB): peak = 926.070 ; gain = 128.000 ; free physical = 41759 ; free virtual = 53557
INFO: [HLS 200-111] Finished Checking Pragmas Time (s): cpu = 00:00:12 ; elapsed = 00:00:17 . Memory (MB): peak = 926.070 ; gain = 128.000 ; free physical = 41759 ; free virtual = 53557
INFO: [HLS 200-10] Starting code transformations ...
ERROR: [HLS 200-539] Can not pass argument 'a' of top function 'simple_algo_blackbox_stream' to black box function 'rtl_simple_algo_blackbox_stream'.
ERROR: [HLS 200-534] Argument 'a' of function 'rtl_simple_algo_blackbox_stream' has invalid actual arguments.
ERROR: [HLS 200-70] Synthesizability check failed.
command 'ap_source' returned error code
    while executing
"source run_simple_algo_blackbox.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel \#0 [list source $arg] "

[2]

void rtl_simple_algo_blackbox_stream(hls::stream<int64_t> & a, hls::stream<int64_t> & b, data_t &z1, data_t &z2, data_t &z3, data_t &z4) {
 
void simple_algo_blackbox_stream(hls::stream<int64_t> & a, hls::stream<int64_t> & b, data_t &sigma) {
0 Kudos