cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
oxygen.chu
Visitor
Visitor
2,435 Views
Registered: ‎07-07-2015

Cannot map array into URAM

Hi~

 

I have seen a problem when synthesizing array into URAM primitive.

The URAM is instantiated in HLS synthesis report, but BRAM is used after RTL synthesis & implementation.

The C/C++ code 

 

#define N 32

void uram_inst (
  float i_x[N][N],
  float i_y[N][N],
  float o_z[N][N]
) {

float x[N][N], y[N][N], z[N][N];
float t1;

#pragma HLS RESOURCE variable=x core=XPM_MEMORY uram
#pragma HLS RESOURCE variable=y core=XPM_MEMORY uram
#pragma HLS RESOURCE variable=z core=XPM_MEMORY uram

for (int k1=0; k1<N; k1++) {
	for (int k2=0; k2<N; k2++) {
		#pragma HLS PIPELINE II=1
		x[k1][k2] = i_x[k1][k2];
		y[k1][k2] = i_y[k1][k2];
	}
}

for (int k1=0; k1<N; k1++) {
	for (int k2=0; k2<N; k2++) {
		t1 = 0.0f;
		for (int k3=0; k3<N; k3++) {
			t1 += x[k1][k3] * y[k3][k2];
		}
		z[k1][k2] = t1;
	}
}

for (int k1=0; k1<N; k1++) {
	for (int k2=0; k2<N; k2++) {
		#pragma HLS PIPELINE II=1
		o_z[k1][k2] = z[k1][k2];
	}
}

}

HLS Synthesis (left) vs. RTL Implementation (right)

0 Kudos
5 Replies
chrisz
Xilinx Employee
Xilinx Employee
2,378 Views
Registered: ‎05-06-2008

Hello @oxygen.chu,

 

The device you selected does not contain any URAM components.  The details can been seen in XMP104:

URAM_ZU9EG_silicon.PNG

I changed the device to a ZU15EG, and here are the results:

Device target:       xczu15eg-ffvb1156-2-i
Report date:         Tue Aug 07 10:37:10 -0600 2018

#=== Post-Implementation Resource usage ===
CLB:             95
LUT:            453
FF:             647
DSP:              5
BRAM:             0
SRL:              0
URAM:             3


Thanks,
Chris

0 Kudos
oxygen.chu
Visitor
Visitor
2,347 Views
Registered: ‎07-07-2015

The problem cannot be solved, even with XCVU9P with URAM

You might see the snapshot.

XCVU9P.PNG
URAM2.PNG
0 Kudos
chrisz
Xilinx Employee
Xilinx Employee
2,335 Views
Registered: ‎05-06-2008

Hello @oxygen.chu,

 

I ran the testcase for the VU9P:

Implementation tool: Xilinx Vivado v.2018.2
Project:             more_more_fun4
Solution:            solution3
Device target:       xcvu9p-flgb2104-2-i
Report date:         Fri Aug 10 10:20:30 -0600 2018

#=== Post-Implementation Resource usage ===
CLB:            123
LUT:            455
FF:             647
DSP:              5
BRAM:             0
SRL:              0
URAM:             3
#=== Final timing ===
CP required:    10.000
CP achieved post-synthesis:    3.792

I am not sure why you are not seeing the URAMs being used for this code.  I ran it on both Windows10 and Ubuntu 16.04.

 

Thanks,
Chris

0 Kudos
oxygen.chu
Visitor
Visitor
2,320 Views
Registered: ‎07-07-2015

Ok, here's the code for your reference to re-produce this issue.

And please copy some CODE here from the enclosed "const.txt" file into the C/C++ code (see "CONSTANT DECLARATION BEGIN" & "CONSTANT DECLARATION END"), since the code is too large to be viewed by web.

 

#include <complex>
typedef std::complex<float> T;

#define L 1024
#define S 10

void uram_inst2 (
  T i_x[L],
  T o_y[L]
) {

// CONSTANT DECLARATION BEGIN // please copy the CODE here from the enclosed "const.txt" file // CONSTANT DECLARATION END
T x_1[L]; T temp_1, temp_2, temp_3; int idx_1, idx_2; #pragma HLS RESOURCE variable=x_1 core=XPM_MEMORY block #pragma HLS RESOURCE variable=IDX core=XPM_MEMORY uram #pragma HLS RESOURCE variable=COE core=XPM_MEMORY uram for (int k1=0; k1<L; k1++) { #pragma HLS PIPELINE II=1 x_1[k1] = i_x[k1]; } for (int k1=0; k1<S; k1++) { for (int k2=0; k2<L/2; k2++) { idx_1 = IDX[k1][k2]; idx_2 = idx_1 + (1<<(S-k1-1)); temp_1 = x_1[idx_1] + x_1[idx_2]; temp_2 = x_1[idx_1] - x_1[idx_2];
temp_3 = temp_2 * COE[k1][k2]; x_1[idx_1] = temp_1; x_1[idx_2] = temp_3; } } for (int k1=0; k1<L; k1++) { #pragma HLS PIPELINE II=1 o_y[k1] = x_1[k1]; } }

 

URAM3.PNG
0 Kudos
oxygen.chu
Visitor
Visitor
2,205 Views
Registered: ‎07-07-2015

Is anyone to answer this?

It's a bug in HLS 2018.2 or something wrong with my code?

 

Thanks in advance :- )

Oxygen

0 Kudos