sort() in HDL Coder

Hi, there is no sort() block in HDL Coder, right? I see there is a Simulink sort block in DSP toolbox under Simulink but it falls away in HDL coder library and is not HDL code generation compatible. Has anyone come across having to sort() for HDL coder as I don't want to write it all from scratch? Thanks

Respuestas (2)

Bharath Venkataraman
Bharath Venkataraman el 22 de Sept. de 2016

1 voto

If you have the Vision HDL Toolbox, it has a Histogram block that is optimized for HDL.

4 comentarios

DN
DN el 23 de Sept. de 2016
I read everything I could on this block and seen an example, and, I really doubt that this HDL histogram block can portray a histc() command in Matlab or represent a simple histogram from a statistics point of view. The 2-D Histogram block in the Statistics library is really what I would like, but this is not supported for HDL.
The vision HDL toolbox block here which you suggest takes a pixel input together with a pixel control bus port, which you can only feed with a frame-to-pixels block which in turn needs a video format of say 1080p spec etc. That's fine if you specifically want to do histograms for imaging, changing contrasts etc. etc. My point being you cannot change/configure the "Vision HDL toolbox histogram" to do a simple histogram mimicking either the 2-D histogram block or the histc() command. Its set-up specifically for imaging specialists rather than from a basic statistics point of view.
Walter Roberson
Walter Roberson el 23 de Sept. de 2016
Frame to Pixel Block can be fed with any 2D array, no actual video format required. The pixelcontrol bus signal will be created from the array.
DN
DN el 26 de Sept. de 2016
Hmm...I'm not that sure...I was under the impression that first you select your Video format from the drop down list in the Frame To Pixels block (even if you are not interested in video at all the block comes with these settings - you have to specify it in this block). Once the drop down option is selected below it will specify your "Active pixels per line by Active video lines" regardless whether you want it or not. So if I chose say 240p for example, it shows 320 x 240, which is not just any 2-D array as you suggest. I have a 480 x 64 array for example. In Matlab for example this would have just simply been putting a row vector M of size 480 in to histc() specifying it over a range t of size 64, i.e. y = histc(M,t).
I guess what you really mean is you don't need to think in terms of video format you can use any 2-D data set that you want to find a histogram of, but perhaps use a MxN ratio similar to the video format option lines specified by the drop down list of the block "Frame to Pixel Block", then it will work. Let me know if I'm missing your point.
DN
DN el 26 de Sept. de 2016
Actually I saw later on that there is a custom setting, so one would just have to figure out how to adjust the "front porch", and other inputs here for a normal 2D array associated with usual stats and not so image specific.

Iniciar sesión para comentar.

Bharath Venkataraman
Bharath Venkataraman el 31 de Jul. de 2016

0 votos

There is no support for sort, but it may be useful to know why you would like to implement sort. Is it for a median filter, which is supported?

3 comentarios

DN
DN el 31 de Jul. de 2016
Ok thanks Bharath. No I wanted to write a histogram block in Simulink (I don't have the image processing toolbox), basically a histc() function is what I wanted to replicate within Simulink but also in the future be HDL compatible (although histc is being replaced I see by hiscount I saw), but anyway the main point being that in the way I wanted to write a HDL histogram block in my user defined fu block I need to order it in ascending order before I can select the binning process - hence I need sort(). How does the median filter block look like and how can I use this for sorting in my case?
Walter Roberson
Walter Roberson el 31 de Jul. de 2016
You do not need sorted order to select the binning process. You need to know the range of values which you can get with max and min
DN
DN el 2 de Ag. de 2016
Thanks Walter, true I see what you mean.

Iniciar sesión para comentar.

Preguntada:

DN
el 28 de Jul. de 2016

Comentada:

DN
el 26 de Sept. de 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by