Getting Rank of Elements in an Array using VHDL

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 :)

Reply to
Md Multan Biswas
Loading thread data ...

Md Multan Biswas schrieb am Dienstag, 21. Juni 2022 um 08:51:22 UTC-6:

e, I have an array, Voltage = [20 40 10 30] ;

ements in the array as follows:

I expect to get:

come using the VHDL code. Thanks, a bunch in advance :)

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 algor ithm for hardware, if you are doing a full-parallel sort, is the Batcher Od d-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 wor k fine.

Reply to
Kevin

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.