shomikc
Member level 4
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?
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?