컴퓨터구조론-3(Arithmetic for computers)

dragonappear·2021년 3월 30일
0

Computer architecture

목록 보기
3/4

Arithmetic for Computers

  1. Operations on integers

    • addition and substraction
    • Multiplication and division
    • Dealing with overflow
  2. Floating-point real numbers

    • Representation and operations

Operations on integers

addition and substraction

- adding +ve and -ve operands, no overflow
- adding two +ve operands can cause overflow
- adding two -ve operands can cause overflow
- 뺄셈은 2의 보수를 취한다음 덧셈연산으로 해주면된다.

Multiplication and division

Multiplication:

  • Multiplicand의 비트수는 64비트(왼쪽으로 shift할 자리수가 필요하다)
  • Multiplier의 오른쪽 비트 값에 덧셈이 진행된다.
  • 64비트인 Product와 Muliplicand의 덧셈은 64bit ALU에서 이루어진다.
  • 덧셈의 결과값은 product의 값으로 저장된다.

Improved Multiplication

  • 위 Multiplication에서 Multiplicand의비트수와 ALU의 비트수를 반으로 줄였다.
  • Multiplicand의 값은 고정된다. 그리고 32비트를 사용한다.
  • 덧셈이 이루어지는 ALU의 비트는 32비트이다.

Optimized Multiplication

  • Improved Multiplication에서 연산을 할때마다 Multiplier의 shift 연산을 하는 것을 product의 LO로 이동시켜서 shfit연산횟수를 줄였다.
  • 어차피 product의 초기값은 0이고 연산마다 오른쪽으로 shift연산을 하기때문에 이게 가능한것이다.

Division

예제

Optimized Division

Dealing with overflow

0개의 댓글