# Org3 - Arithmetic Chapter 3 Computer Organization and...

This preview shows pages 1–15. Sign up to view the full content.

Arithmetic Chapter 3 Computer Organization and Design

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Addition Addition is similar to decimals   0000 0111 + 0000 0101 = 0000 1100 Subtraction (negate)   0000 0111 + 1111 1011 = 0000 0010
Over(under)flow For signed addition If signs are the same It has to agree with the arguments If signs different There can be no over(under)flow.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Over(under)flow For signed subtraction If signs are the same There can be no over(under)flow If signs are different It has to match the subtractant (zero?)
Over(under)flow For unsigned addition If result smaller than the argument, it is overflow For unsigned subtraction If the result is greater than the subtractant it is overflow

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
In practice... MIPS signed ops can cause overflow Causes exception and saves the offending instruction in  Exception PC (mfc0) Unsigned ops will not cause C ignores integer overflows.
Multimedia Operations Operations like MMX, SSE, etc Graphics and image processing often work with 8  or 16 bits Treat a 32-bit register as 4 8-bit registers or 2 16  bits registers. Break the carry chain

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Multiplication          1000        x 1001          1000         0000        0000       1000 =     1001000
Hardware Multiplicant Product Multiplier Control Adder

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Can we speed up? All operations could be done in parallel Have a cascade of adders and add them all Gate delays will be a problem Have a tree of additions Logarithmic time Use carry save adders

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Division unsigned long int rem, ldvsr; int i; rem   = divident; ldvsr = ((long)divisor)<<31; quot = 0; for (i=1; i<32; i++){   quot = quot<<1;   if (rem>=ldvsr){     rem-=ldvsr;     quot+=1;   } }

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Doing it faster Hard!
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern