Computer Science/Computer Architecture

[Computer Architecture] Arithmetic for computers

LeeJaeJun 2024. 2. 8. 16:54
728x90
반응형

Transistors: n-type

  • S: source
  • G: Gate
  • D: Drain
  • S, G, D는 모두 터미널로 각각 자신의 voltage 값을 가지고 있음
  • If G < S, then the switch is open
  • if G > S, then the switch is closed

n-type transistor

 

Transistor: p-type

  • S: source
  • G: Gate
  • D: Drain
  • S, G, D는 모두 터미널로 각각 자신의 voltage 값을 가지고 있음
  • If G > S, then the switch is open
  • if G < S, then the switch is closed

p-type transistor

 

 

Transistor: CMOS

  • Complementary metal-oxide-semiconductor
  • p-type과 n-type transistor를 혼합해서 구성
  • NAND gate

0: low, 1: high

 

Logic gates

  • 1개 이상의 1-bit input과 1개의 1-bit output으로 구성
  • 트랜지스터들로 제작 가능
  • 다음들을 통해서 나타낼 수 있음
    • A block in a circuit diagram
    • A truth table, listing the output for every possible input
    • A Boolean algebra expression
  • bitwise operations을 수행하기 위해서 사용됨
    • NOT, OR, AND, XOR, NAND, NOR, XNOR
  • logic gate들을 합쳐서 더 큰 circuit을 만들 수 있음
    • one or more inputs
    • one or more outputs
    • perform more complicated logic operations

 

 

 

Half adder (1-bit)

  • 자릿수가 넘어가면 carry를 발생시켜서 자리 올림이 가능

half adder

* A위의 -는 여집합을 의미

 

Full adder

  • 자리 올림 수까지 포함하여 덧셈 연산 수행
  • half adder 2개를 엮어서 구현

자세히 나타낸 경우
Half adder로 묶어서 표현

 

4-bit Ripple Adder using Full Adder

  • 각 bit를 각각 처리하여 계산 가능
    • ex) A0, B0은 0번 bit 처리, A1, B1은 1번 bit 처리

4-bit ripple adder using full adder

 

Substractor design

  • XOR을 추가해서 B의 값을 invert 시키고 cin에서 1을 더해서 2의 보수처리를 해서 뺄셈을 구현

Subtractor

 

Arithmetic for multimedia

  • Graphic과 media processing은 8bit나 16bit 벡터 데이터로 작동합니다.
    • 분리된 carry chain을 가진 64-bit adder(64-bit adder, with partitioned carry chain)를 사용해서 구현 가능
      • 8 x 8-bit, 4 x 16-bit, 2 x 32 bit vectors
    • SIMD(single-instruction, multiple-data)를 사용하여 구현 가능
      • 하나의 명령어로 여러 개의 데이터 처리
      • 우리가 가지고 있는 레지스터는 32bit이기에 8bit video라면 24bit가 남을 것이고, 16bit audio라면 16bit가 남을 것이기에 이런게 남는 애들을 그냥 냅두는 것이 아니라, 다른 데이터를 처리할 수 있도록 하는 것입니다.
  • Saturating operations
    • 만약 오버플로우가 발생시 최대값으로 유지하는 것이다.
      • c.f. 2s-complement modulo arithmetic
    • clipping in audio(영상이나 화면의 일부만 지정하여 표시하거나, 그 부분만 오려내어 남기고 다른 부분을 없애는 조작), saturation in video(예를들어, 색의 범위나 선명도의 최댓값을 넘어버리면 자동으로 최댓값으로 바꾸어 버리는 조작)
728x90
반응형