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!

Showing results for 
Search instead for 
Did you mean: 
Visitor erigusaab
Registered: ‎12-22-2011

Co-simulation with multidimensional array fails because of wrong input data?



I'm implementing a function (a 2D DCT) in HLS. The function takes pointers to two structs as parameters (input, output), and the structs contain a little metadata as well as the data to be processed. The data itself is in a 3-dimensional array ([3][8][8]) containing 8x8 pixel tiles from three color components.


My test case fills the input array with values and compares the output against known good results.


When I run C/RTL cosimulation it fails, and after checking the waveform I realized it is the testbench that is supplying the wrong data. The first, second and third set of 64 values are all copies of the first three intended values (i.e. rather than 3x8x8 = 192 distinct values, the test bench only supplies three)


I frequently find C multidimensional arrays confusing myself, but if this is a case of insufficient caffeination on my part I simply can not find it.


I have a created a minimal HLS project that replicates the problem (attached).


0 Kudos
1 Reply
Visitor erigusaab
Registered: ‎12-22-2011

Re: Co-simulation with multidimensional array fails because of wrong input data?



The problem only seems to occur with the array inside a struct, so a possible work-around for me may be to separate the metadata - although that creates less elegant code.

0 Kudos