Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting Rank of Elements in an Array using VHDL

35 views
Skip to first unread message

Md Multan Biswas

unread,
Jun 21, 2022, 10:51:22 AM6/21/22
to
Dear VHDL Coders,

I am trying to get the rank of elements from an array of data. For example, I have an array, Voltage = [20 40 10 30] ;

The position of the elements in the voltage array is ranged from 0 to 3.

Using a bubble sorting algorithm, I obtained the position index of the elements in the array as follows:
Index (0)= 2 ; Index (1)= 0 ; Index (2)= 3 ; Index (3)= 1 ;

However, basically I just the rank of the elements in the voltage array. I expect to get:
Rank (0) = 1 ; Rank (1) = 3 ; Rank (2) = 0 ; Rank (3) = 2 ;

I would appreciate any of your help and suggestion to get the desired outcome using the VHDL code. Thanks, a bunch in advance :)

Kevin

unread,
Jun 21, 2022, 12:46:51 PM6/21/22
to
If you are asking how to sort from largest-to-smallest instead of smallest-to-largest, that is easy to do by a slight changed of the algorithm or by a wire-reversal at the end of the sort.

I recently built a sorter (in Verilog) and I found that the best sort algorithm for hardware, if you are doing a full-parallel sort, is the Batcher Odd-Even Mergesort. I did not find any good HDL examples, though, and had to start from scratch. The Bitonic Sort is OK, but not quite as efficient in hardware. If you have a lot of time, a parallelized bubble sort might work fine.
0 new messages