Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

2 bit signed comparator

Status
Not open for further replies.

shomikc

Member level 4
Member level 4
Joined
Apr 19, 2013
Messages
71
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,953
Hello everyone,

First of all I wish everyone a very merry Christmas.
I came across a question in a book which has me very confused.
The question was to design a signed 2 bit comparator. ( I can understand signed 4 bit , signed 8 bit etc)

If my theory is correct then the only bits will be an MSB and an LSB which means the first bit from left will indicate sign.
So the inputs will be 00 for 0, 01 for 1 and 11 for -1 and I think the input 10 will be N/A.

Firstly is this correct?
Secondly the conditions to check for wx and ab which will be the two 2-bit numbers are

i) if w = 0 and a = 1 then wx is greater than ab
ii) if a = 0 and w = 1 then ab is greater than wx
iii) if a = 0 and w = 0 and x = 1 and b = 0 then wx is greater than ab
iv) if a = 0 and w = 0 and x = 0 and b = 1 then ab is greater than wx
v) if a = 1 and w = 1 and x = 1 and b = 0 then wx is greater than ab as ab is now a non-number
vi) if a = 1 and w = 1 and x = 0 and b = 1 then ab is greater than wx as wx is now a non-number
vii) if a = 0 and w = 0 and x = 1 and b = 1 then wx is equal to ab
viii) if a = 0 and w = 0 and x = 0 and b = 0 then wx is equal to ab
ix) if a = 1 and w = 1 and x = 1 and b = 1 then wx is equal to ab

Is this correct? And in the case both numbers are 10 then what should the output be?
 

Hi,

8 bit signed, is a sign bit plus 7 value bits.

So is 2 bist signed then
* 1 sign plus 1 value?

Klaus
 

There are different representations of signed numbers, sign manitude or 2s complement. In more popular 2s complement, binary 10 is decimal -2.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top