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's Complement, is it implemented in Compiler or Hardware

Status
Not open for further replies.

tia_design

Advanced Member level 4
Joined
Feb 22, 2005
Messages
113
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,298
Activity points
2,217
32's 2's complement is 00100000
25's 2's complement is 00011001
-25's 2's complement is 11100111

2's complement subtraction, like 32 - (-25), it will be finally converted into addition in computer as 2's complement like 00100000 + 00011001. Is this converstion made by compiler or in hardware?
I'm going to design a microcontroller, in my assembly language, for 32 - (-25), should I directly write 00100000 + 00011001? or should I write 00100000 - 11100111, and design some hardware in microcontroller to convert it into addtion? Thanks!
 

hi,
As per my knowledge subtration and additon are both done in hardware itslef.Hence, 2's compilment should also be done in hardware.
Its quite easy to impelent tht. If u find it difficult to do tht plz let me know, i will help u out.

SantoshL
 

Re: 2's Complement, is it implemented in Compiler or Hardwar

Hi,

2's complement will be implemented in hardware, hence write your assembly code accordingly.
 

Re: 2's Complement, is it implemented in Compiler or Hardwar

2's complement would be implemented in hardware itself because it is needed for subtraction....
 

Re: 2's Complement, is it implemented in Compiler or Hardwar

Hi.

When designing controllers we will be having Arithmetic and Logic circts. We will be implementing ADDER. Now ahardware designer will always try to reduce hardware. He will not go for seperate hw's for adders, subractors. He will try to do add/sub using the same logic, and sub using 2's compl method is simply doing that.

Hope it helps.

Thanks
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top