optimal way to generate two complement of a number

Status
Not open for further replies.

bh_letters

Junior Member level 3
Joined
Feb 14, 2005
Messages
25
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,464
Hi,

Which is an optimal way to generate two complement of a number using logic gates?

thanks
 

I meant integer when I said number. I am looking for optimal circuit for representing an integer in its two's complement form.
 

Well one option can be take a 4 bit subtractor and subtract the no. you want to convert from '0'.The output will be two's complement of the input.
And second can obviously can be to flip all bits (one's complement) using xor gates followed by adding one.
 

Invert and add one
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…