# Getting Rank of Elements in an Array using VHDL...

M

#### Md Multan Biswas

##### Guest
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

G

#### gnuarm.del...@gmail.com

##### Guest
On Tuesday, June 21, 2022 at 10:52:44 AM UTC-4, Md Multan Biswas wrote:
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

I\'m curious, how did you end up solving this? I would think sorting would be a very hardware intensive task unless you created a state machine to process the data like a CPU would. I think a bubble sort could be implemented with very few resources if you have the time.

--

Rick C.

- Get 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209

A

#### Anssi Saari

##### Guest
\"gnuarm.del...@gmail.com\" <gnuarm.deletethisbit@gmail.com> writes:

On Tuesday, June 21, 2022 at 10:52:44 AM UTC-4, Md Multan Biswas wrote:
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

I\'m curious, how did you end up solving this? I would think sorting
would be a very hardware intensive task unless you created a state
machine to process the data like a CPU would. I think a bubble sort
could be implemented with very few resources if you have the time.

I\'m not sure what his problem was since the question was more than a
little vague to me. Using his notation without the semicolons he had

Voltage = [20 40 10 30]
Index = [2 0 3 1]
Rank = [1 3 0 2]

Since the Index array seems to be reversed (or right indexed), he can
get his desired Rank array simply by reversing it. Maybe he realized
that? Or maybe I misunderstood.

As for sorting data in hardware, it\'s the same as everything
else. Whatever works within the requirements, i.e. power, performance,
area.