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.

design CMOS digital comparator using Manchester carry chain

Status
Not open for further replies.

salatech

Newbie level 6
Newbie level 6
Joined
Sep 2, 2009
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
kl
Activity points
1,352
HI guys. i am working on this project..design digital comparator using Manchester carry chain approach. i really need your help. i just want to know what is the relation between Manchester carry chain adder to digital comparator
 

Hi,

looking at
Carry look-ahead adder - Wikipedia, the free encyclopedia

assuming two 4bit input A and B

for the final carry (C4) the Manchester carry look ahead calculates the equation
C4 = G3 + G2&P3 + G1&P2&3 + G0&P1&P2&P3 + C0&P0&P1&P2&P3

with
Gi = Ai & Bi
Pi = Ai + Bi

for implementing an adder C0 = 0
this gives the final carry C4


for implementing an comparator C0 = 1 and one input (either A or B) needs to be inverted (e.g. Ai = ~Ai)
C4 is the result of the comparison

regards
 
thanks for replying my post..i really appreciate it. pls explain me more the part where we need to invert either one of the input.. i am bit blur on that part? Pls..
 

Hi,

If you want to compare A and B you need to do A-B and check if the result is < 0 or > 0
(you can do this if you the final carry flag)
A and B have to be in twos complement notation. If this is not the case you just need to
concatinate a 0 at the begining (e.g. 9 = 0b1001 have to be extended to 5 bit = 0b01001)

You can do the substraction of B by adding -B.
-B can be calculated by doing the twos complement
tows complement means inverting and adding 1
(e.g. 9 = 0b01001 twos complement (-9) = 0b10110 + b1 = 0b10111 = 0x17)

now you could add this to A and look for the final carry (with the manchester carry chain look ahead)

the adding of the 0b1 from the twos complement can be done if you set the carry input of the manchester chain to 1.
Now you only need to use the inverted B and you will have a comparator.

Hope this is your question and it helps

regards
 
thanks again for helping me. basically we need to set either A or B as two complement. for example if i take B, i need to invert B and add 1 , the value 1 is coming from the carry input from the Manchester carry chain..after i add with the carry in ..i add -B to A..is my concept correct? how if i want to determine A=B?
 

is my concept correct?

yes

how if i want to determine A=B?

normally you do a bitwise XOR of A with B
after this you OR all bits of the result
the result is 0 if all bits are equal

regards
 

hello qieda..thanks for helping me again. just wanna ask u for a favour..do u have any idea how to design cmos digital comparator using Manchester carry chain approach using dcsh and microwind software ,if can all in transistor level..do u know any website or refrence that can help me ?
 

hello qieda..thanks for helping me again. just wanna ask u for a favour..do u have any idea how to design cmos digital comparator using Manchester carry chain approach using dcsh and microwind software ,if can all in transistor level..do u know any website or refrence that can help me ?

I'm sorry I never did such a design

regards
 

hey qieda need to reconfirm with -B thing..sorry i am abit slow. first i need to invert B and add 1 after that i need to add the carry from Manchester adder or izzit i invert B and add 1 (this 1 is comin from the carry input)..which concept is correct? pls help me..
 

Hi

try this examples

A=5 = 0b0101
B=7 = 0b0111
=>
~B = 0b1000
G = A & (~B) = 0b0000
P = A + (~B) = 0b1101

now use a carry look ahead with C0 = 1 (e.g. manchester carry chain)
C4 = G3 + G2&P3 + G1&P2&3 + G0&P1&P2&P3 + C0&P0&P1&P2&P3
C4 = 0 => B greater A

second example
A=7 = 0b0111
B=5 = 0b0101
=>
~B = 0b1010
G = A & (~B) = 0b0010
P = A + (~B) = 0b1111

again carry look ahead with C0 = 1 (e.g. manchester carry chain)
C4 = G3 + G2&P3 + G1&P2&3 + G0&P1&P2&P3 + C0&P0&P1&P2&P3
C4 = 1 => A greater(or equal) B

now with inverting A

A=5 = 0b0101
B=7 = 0b0111
=>
~A = 0b1010
G = (~A) & B = 0b0010
P = (~A) + B = 0b1111

now use a carry look ahead with C0 = 1 (e.g. manchester carry chain)
C4 = G3 + G2&P3 + G1&P2&3 + G0&P1&P2&P3 + C0&P0&P1&P2&P3
C4 = 1 => B greater (or equal) A

regards
 

thanks for the example qieda..one more question qieda we determine A>B or B<A by comparing C0 and C4. for example if i invert B and i get C4=0 and C0=1, my answer is B>A and vice versa..i dun understand the part u said B>=A..it should be either B>A or B<A..in is the any possibility i get A=B?
 

Hi,

you always look at C4

if you invert B
C4 = 0 => B greater A
C4 = 1 => A greater(or equal) B

if you invert A
C4 = 0 => A greater B
C4 = 1 => B greater (or equal) A

If A equal B you can invert A or B you will always get C4 = 1
(this could be used to detect if A=B)

regards
 
hey qieda really need your help..for example one of my input is negative..A=5 and B= -7..what should i do so that my comparator can show that A> B using the Manchester carry chain approach? pls help me...pls.
 

Hi,

If your numbers are twos complement,
you need to do an XOR of the MSB of A and B and the C flag to get the final C flag.

see

example 1
A=5 = 0b0101
B=-7 = 0b1001
=>
~B = 0b0110
G = A & (~B) = 0b0100
P = A + (~B) = 0b0111

now use a carry look ahead with C0 = 1 (e.g. manchester carry chain)
C4 = G3 + G2&P3 + G1&P2&3 + G0&P1&P2&P3 + C0&P0&P1&P2&P3
C4 = 0
(A4 ^ B4) ^ C4 = 1
=> A greater B



example 2
A=-5 = 0b1011
B=-7 = 0b1001
=>
~B = 0b0110
G = A & (~B) = 0b0010
P = A + (~B) = 0b1111

now use a carry look ahead with C0 = 1 (e.g. manchester carry chain)
C4 = G3 + G2&P3 + G1&P2&3 + G0&P1&P2&P3 + C0&P0&P1&P2&P3
C4 = 1
(A4 ^ B4) ^ C4 = 1
=> A greater B

regards
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top