Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Comparator and minimum value address

 
Thread Tools Search this Thread
Old 02-22-2004, 01:10 PM   #1
Default Comparator and minimum value address


Hi all,
I have 16 values. I ahve to compare those values and i have to
get minimum value and it's address. I am comparing those all 16 avlues
with by 8 comaprators, next the 8 output values by 4 comparator and so
on......
at last i am getting minimum value but how i can get address of
that value. I tried by moving back which means if output deciison is 0
,then previous decision's 0 bit.... and so on..
but VHDL program is giving error.

whether any other choice is there, please help me.
-sunil


sunil
  Reply With Quote
Old 02-22-2004, 01:24 PM   #2
Ralf Hildebrandt
 
Posts: n/a
Default Re: Comparator and minimum value address
sunil wrote:

> I have 16 values. I ahve to compare those values and i have to
> get minimum value and it's address. I am comparing those all 16 avlues
> with by 8 comaprators, next the 8 output values by 4 comparator and so
> on......


-> This leads to combinational logic (remember: every comparator is a
subtractor).

> at last i am getting minimum value but how i can get address of
> that value.


Everytime you compare two values A and B, set a bit, that indicates, if
A or B is bigger. Do it for every comparator. This will result in a tree
of comparison results, that can be evaluated back to the adress with the
minimum value.



Last of all: Think about a serialized approach (compare only two values
and do it step by step). This will result in a much smaller circuit, but
will lead to slower computing.

Ralf



Ralf Hildebrandt
  Reply With Quote
Old 02-22-2004, 02:59 PM   #3
valentin tihomirov
 
Posts: n/a
Default Re: Comparator and minimum value address
Do you know how associative memory, i.e. get address/value by key, works?
You have a mux that chooses between val1 and val2 basing on their values
(btw, what do you select if they are equal, both is not possible), in other
words, value selection by comparator's output. You should have a second
(address) parallel channel controlled by the same comparator. In associative
memory you have two channels: value and operation status success bit. BTW,
this is not VHDL issue.




valentin tihomirov
  Reply With Quote
Old 02-22-2004, 05:35 PM   #4
valentin tihomirov
 
Posts: n/a
Default Re: Comparator and minimum value address

> -> This leads to combinational logic (remember: every comparator is a
> subtractor).

How do you perform calculations without using logic?


> Last of all: Think about a serialized approach (compare only two values
> and do it step by step). This will result in a much smaller circuit, but
> will lead to slower computing.

x:= a + b + c + d -> x := ((a + b) + c) + d
means N adders and N adder delays

The original idea
x := (a+b) + (c+d)
requires N adders and takes log2(N) adder delays; therefore, is considered
better. This is what optimizers should do.




valentin tihomirov
  Reply With Quote
Old 02-22-2004, 08:10 PM   #5
Ralf Hildebrandt
 
Posts: n/a
Default Re: Comparator and minimum value address
valentin tihomirov wrote:

>>-> This leads to combinational logic (remember: every comparator is a
>>subtractor).

>
> How do you perform calculations without using logic?


Maybe I am misunderstood.
Combinational logic is "just a buch of gates" without any memory element.
Sequential logic includes memory elements (latch, flipflops, RAM...)



>>Last of all: Think about a serialized approach (compare only two values
>>and do it step by step). This will result in a much smaller circuit, but
>>will lead to slower computing.

>
> x:= a + b + c + d -> x := ((a + b) + c) + d
> means N adders and N adder delays
>
> The original idea
> x := (a+b) + (c+d)
> requires N adders and takes log2(N) adder delays; therefore, is considered
> better. This is what optimizers should do.



But what about using just *one* adder to compare two values step by
step? It takes N steps to compute the result and some registers are
needed to store some information (which operand was bigger during the
last comparison plus a simple state machine), but it could be much
smaller than using N adders.

-> It depends on the constraints, which way is the best (parallel or
serial). Therefor I said "think about".


Ralf



Ralf Hildebrandt
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46