cancel
Showing results for
Show  only  | Search instead for
Did you mean:
Visitor
1,149 Views
Registered: ‎01-21-2019

## Problem with big size of 2D matrix and input

I have a function which has a 2D matrix by the size of 32400*7, Input of (in_array[32400]) and in further I want to add o_array(o_array[32400]) as an output array. I got the compilation error by Vivado hls when I do (Run C simulation). Please help me with that and forgive me if it seems pretty simple to you. (I a newbe in Vivado Hls)

By looking through documents I think I need to use Block ram direction to store H_v matrix and the inut (in_array[32400]) and output(o_array[32400]) for synthesize and in the next step.

Sincerely,

Monaz.

LDPC_Encoder

#include "LDPC_Encoder.h"
#include <stdio.h>
#include <math.h>
#include "hls_math.h"
//If the hls_math.h library is used in the C source code,
//the C simulation and C/RTL co-simulation results are identical

void LDPC_Encoder( din_t in_array[K]){

int i,j;
#pragma HLS interface bram port=H_v
unsigned short H_v[64800][7];
//---------------------------------

//-----------------------------------------------------
unsigned int a;
short int i_array[K];

for (i = 0; i < K; i++)
{
i_array[i] = (short)((1 + in_array[i]) / 2);
}

// For the first line of H which has 6 nz elements
a = 0;
a = i_array[H_v[0][0]] ^ i_array[H_v[0][1]];
for (j = 2; j < 5; j++)
{
a = a ^ i_array[H_v[0][j]];
}
i_array[H_v[0][5]] = a;
// o_array[0] = a;

for (i = 1; i < K; i++)
{
a = 0;
a = i_array[H_v[i][0]] ^ i_array[H_v[i][1]];
for (j = 2; j < 6; j++)
{
a = a ^ i_array[H_v[i][j]];
}
i_array[H_v[i][6]] = a;
// o_array[i] = a;
//printf("\n%d = %d", i, a);
}
/*
for (i = 0; i < N; i++)
{
out_array[i] = 2 * i_array[i] - 1;
}*/

}

5 Replies
1,123 Views
Registered: ‎04-26-2015

What error?

1,088 Views
Registered: ‎05-30-2018

Until you post the error message you get, I suggest the following :

- Try using a constant value instead of K as size for in_array (or #define it for example).

- Make sure that all the values of H_v [i][j] are between 0 and the (size of i_array - 1) , since you're using the values of H_v as indices for i_array.

- Try using CLANG compiler instead of GCC.

- Try to define your big array H_v as static unsigned short.

Best !

Rashed

_________________________

Visitor
1,076 Views
Registered: ‎01-21-2019

oh, thanks. I will apply your suggestion , and will let you know as soon as possible.

Sincerely,

Monaz

Visitor
1,008 Views
Registered: ‎01-21-2019

I was able to do the "Run c simulation" by applying what you suggest.

so I really appreciate your help. Now I am trying to do the "Run C synthezis" which takes a long time.

I used

#pragma HLS INTERFACE m_axi port=in_array offset=slave bundle=gmem
#pragma HLS INTERFACE s_axilite port=in_array bundle=control
#pragma HLS INTERFACE s_axilite port=return bundle=control

for the input array .

Actually I am waiting for the result around 28 hours and still there is no result. Do You have any suggestion for me or it is normal to take a long time to synthesize code.

The Consol page is as follws:

Starting C synthesis ...
INFO: [HLS 200-10] For user 'umroot' on host 'secrecy' (Windows NT_amd64 version 6.1) on Tue Mar 12 16:46:43 -0400 2019
INFO: [HLS 200-10] In directory 'C:/LDPC_big_correct'
INFO: [HLS 200-10] Opening project 'C:/LDPC_big_correct/LDPC_Big'.
INFO: [HLS 200-10] Adding design file 'LDPC_Encoder.cpp' to the project
INFO: [HLS 200-10] Adding test bench file 'LDPC_Encoder.h' to the project
INFO: [HLS 200-10] Adding test bench file 'LDPC_Encoder_tb.cpp' to the project
INFO: [HLS 200-10] Opening solution 'C:/LDPC_big_correct/LDPC_Big/solution1'.
INFO: [SYN 201-201] Setting up clock 'default' with a period of 10ns.
INFO: [HLS 200-10] Setting target device to 'xa7a12tcsg325-1q'
INFO: [SCHED 204-61] Option 'relax_ii_for_timing' is enabled, will increase II to preserve clock frequency constraints.
INFO: [HLS 200-10] Analyzing design file 'LDPC_Encoder.cpp' ...
INFO: [HLS 200-111] Finished Linking Time (s): cpu = 00:00:02 ; elapsed = 00:01:10 . Memory (MB): peak = 106.832 ; gain = 18.301
INFO: [HLS 200-111] Finished Checking Pragmas Time (s): cpu = 00:00:02 ; elapsed = 00:01:10 . Memory (MB): peak = 106.832 ; gain = 18.301
INFO: [HLS 200-10] Starting code transformations ...
INFO: [HLS 200-111] Finished Standard Transforms Time (s): cpu = 00:46:55 ; elapsed = 00:53:45 . Memory (MB): peak = 744.168 ; gain = 655.637
INFO: [HLS 200-10] Checking synthesizability ...
WARNING: [SYNCHK 200-77] The top function 'LDPC_Encoder' (LDPC_Encoder.cpp:8) has no outputs. Possible cause(s) are: (1) Output parameters are passed by value; (2) intended outputs (parameters or global variables) are never written; (3) there are infinite loops.
INFO: [SYNCHK 200-10] 0 error(s), 1 warning(s).
INFO: [HLS 200-111] Finished Checking Synthesizability Time (s): cpu = 01:30:17 ; elapsed = 01:37:09 . Memory (MB): peak = 843.863 ; gain = 755.332

---------------------------------------------------------------------------------------------

One more questions:

1-I was wondering to ask would you please explain more about these suggestion because I am kind of beginner:

"Try using CLANG compiler instead of GCC"

2- I want an output array as the output of topfunction.

can I use array as an output?!!! so if not what is the solution to define the top function output as an array with size of K=32400 or 64800.

Best Regards.

998 Views
Registered: ‎05-30-2018

Glad to hear that C-SIM is working ! which suggestion exactly helped ?

TOP-LEVEL FUNCTION OUTPUT:

I can see from the log and the code that LDPC_Encoder is your top-level function which takes the input in_array.

But how would you get the results of it? This is up to what you really want to do, but I suggest returning out_array as a parameter, as follows:

```void LDPC_Encoder( din_t in_array[K], dout_t out_array[SOME_SIZE]){
...
}```

where out_array is an array that stores the result of your encoder.

---------------------------------------------------------------------------------------------------

SYNTHESIS TAKES FOREVER:

I am not sure why it's taking this much time to Synthesize. However, this is strongly related to how powerful your PC/Server is.

Keep in mind that Synthesizing an array of size 64800x7 needs effort by the Synthesizer.

I still recommend that you make sure that C Simulation is working well before you carry on.

---------------------------------------------------------------------------------------------------

USING CLANG :

using CLANG is explained in UG902. Just open UG902 and search for CLANG. However, it's only available under Ubuntu so if you're using Windows I guess you won't be able to run it.

Normally when you run C Simulation, a dialog pops up allowing you to choose simulation options. There you can choose clang.

If you use Ubuntu but couldn't find the CLANG option for compiler, you can manually modify the script.tcl by changing the line of csim_design to:

`csim_design -compiler clang`

And then run from command line:

`vivado_hls -f <PATH_TO_CUSTOM_SCRIPT> `

Here I recommend having your own copy of the script in top project folder, otherwise it will be overwritten every time you run the solution.

Best !

Rashed

_________________________