( ESNUG 330 Item 5 ) --------------------------------------------- [9/30/99]

Subject: ( ESNUG 326 #7 329 #7 )  Getting *Signed* Comparitors w/ DC 99.05

> An old collegue in the Netherlands, Rob van der Valk, gave me a hint on
> how to do the signed comparisons after he saw my letter in ESNUG.  The
> trick is to invert the MSB's of the operands and do an unsigned
> comparison on that.  So instead of:
>
>                       op_a[n:0] > op_b[n:0]
> do:
>          {~op_a[n],op_a[n-1:0]} > {~op_b[n],op_b[n-1:0]}
>
> That's easier and smaller in logic than the functions I wrote.
>
>     - Menno Spijker
>       Mitel Semiconductor                           Kanata, Canada


From: Charutosh Dixit <charu@lsil.com>

John,

The solution given for above for signed comparators looks flawed to me.  The
correct solution is: If we have two signed numbers to be compared, we swap
the MSBs of the two numbers and then perform the regular magnitude
comparison.  The scheme works as follows:

  a. When the two numbers have the same sign, MSB swapping does not have any
     effect and the regular magnitude comparison is done

  b. When the two numbers have opposite sign, like for example A=0011 and
     B=1001, then the positive number (A) is the bigger number.  By swapping
     the  MSB we get A=1011 and B=0001, and thus the positive number is made
     bigger in magnitude (1011 > 0001), for the magnitude comparison that
     follows this process.

Hope this helps your ESNUG readers.

    - Charu Dixit
      LSI Logic                                    Milpitas, CA



 Sign up for the DeepChip newsletter.
Email
 Read what EDA tool users really think.


Feedback About Wiretaps ESNUGs SIGN UP! Downloads Trip Reports Advertise

"Relax. This is a discussion. Anything said here is just one engineer's opinion. Email in your dissenting letter and it'll be published, too."
This Web Site Is Modified Every 2-3 Days
Copyright 1991-2024 John Cooley.  All Rights Reserved.
| Contact John Cooley | Webmaster | Legal | Feedback Form |

   !!!     "It's not a BUG,
  /o o\  /  it's a FEATURE!"
 (  >  )
  \ - / 
  _] [_     (jcooley 1991)