Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Comparator and minimum value address

Reply
Thread Tools

Comparator and minimum value address

 
 
sunil
Guest
Posts: n/a
 
      02-22-2004
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
 
Reply With Quote
 
 
 
 
Ralf Hildebrandt
Guest
Posts: n/a
 
      02-22-2004
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

 
Reply With Quote
 
 
 
 
valentin tihomirov
Guest
Posts: n/a
 
      02-22-2004
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.


 
Reply With Quote
 
valentin tihomirov
Guest
Posts: n/a
 
      02-22-2004

> -> 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.


 
Reply With Quote
 
Ralf Hildebrandt
Guest
Posts: n/a
 
      02-22-2004
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
stl map: get the <key,value> pair which has the minimum value Rui Maciel C++ 2 12-01-2009 11:21 PM
difference between comparator and comparable interface gaurav Java 4 04-14-2009 12:18 PM
strange outcome when comparing int value against a give minimum and maximum value Pugi! Javascript 2 02-12-2007 09:10 PM
TreeMap and Comparator question Darko Aleksic Java 4 06-20-2006 02:56 PM
Re: generic pipelined comparator and package MB VHDL 1 11-20-2005 04:14 AM



Advertisments