1 / 23

Computer Arithmetic:

Computer Arithmetic:. Unsigned Notation By Sherwin Chiu. Unsigned Notation. Introduction Definition of Unsigned Notation Addition Subtraction Multiplication Division. Introduction. Most frequently preformed operation is copying data from one place to another:

carla-wong
Télécharger la présentation

Computer Arithmetic:

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Arithmetic: Unsigned Notation By Sherwin Chiu

  2. Unsigned Notation • Introduction • Definition of Unsigned Notation • Addition • Subtraction • Multiplication • Division

  3. Introduction Most frequently preformed operation is copying data from one place to another: • From one register to another • Between a register and a memory location * Value is not modified as it is copied

  4. Definition of Unsigned Notation Unsigned Notation: The notation does not have a separate bit to represent the sign of the number.

  5. Unsigned Notation There are two types of unsigned notation: • Non-negative notation • 2’s complement notation

  6. Non-negative versus 2’s complement n-1 n-1

  7. Addition • Can be easily done when values fit the limitations for non-negative or 2’s complement • A little more complicated when it does not.

  8. Straightforward Addition • Adding numbers that fit the limitations can perform a straightforward addition of binary numbers. • When adding two numbers of different signs (+/-), a valid result will always occur.

  9. Implementation of ADD: XX+Y

  10. Overflow • When two numbers being added exceed the number of bits available in the register, an overflow occurs. • In non-negative, an overflow flag is notified by the carry out bit. • In 2’s complement, an overflow flag is notified by both the carry in and carry out bit.

  11. Subtraction • Essentially treated the same as addition, but negating one of the values. “X + (-Y)” • Overflow is still caused by exceeding the number of bits available in the register.

  12. Implementation ofSUB: X X – Y

  13. Multiplication • We could multiply by adding n copies of the number together, but it would be inefficient. • It is also not how people would do multiplication.

  14. People to Shift-Add Multiplication

  15. Binary Multiplication • Using binary notation makes multiplication even easier by having only two possible values, 0 (X · 0 = 0) or 1 (1 X · 1 = 1)

  16. Shift-Add Multiplication in RTL Form X,U,V – n bit register U – high order half C – 1 bit register for carry V – low order half Start – initiates Finish – terminates 1: U0, i n Vo 2: CU U + X 2: i i – 1 3: shr(CUV) Z’3: GOTO 2 Z 3: FINISH1

  17. 1: U0, i n Vo 2: CUU + X 2: i i – 13: shr(CUV) Z’3: GOTO 2 Z 3: FINISH1

  18. Implementation of Shift-Add Multiplication Algorithm

  19. Division • Can be done with the same idea of repeated additions like multiplication, but instead for division, it is repeated subtractions. • Shifting is also applicable in the same way as multiplication, just shifting left and subtracting instead.

  20. Shift-Sub Division in RTL Form X,Y,U,V – n bit register U – high order half C – 1 bit register for carry V – low order half Start – initiates Finish – terminates 1 : CUU+X’+1 1 : U U+X C1 : FINISH 1,OVERFLOW 1 2 : Y 0,OVERLOW 0,i n 3 : shl(CUV),shl(Y),i i-1 C4 : U U+X’+1 C’4 : CU U+X’+1 C4 : Y 1 C’4 : U U+X Z 4 :FINISH 1 Z’4 :GOTO 3 1 2 2 1 1 0 2 2 2 2

  21. X,Y,U,V – n bit register U – high order halfC – 1 bit register for carry V – low order halfStart – initiates Finish – terminates i

  22. Implementation of shift-sub division algorithm

  23. Conclusion • Basic arithmetic functions are a lot more complicated than what it seems. • These implementations are only for unsigned notation. • There still exist signed notation and binary-coded decimal. • Any Questions?

More Related