[CrashCourse CS] #5 How Computers Calculate - the ALU

Steve·2021년 4월 10일
0

Arithmetic and Logic Unit - the ALU

  • Mathmatical brain of a computer.
  • Intel 74181 - the most famous ALU, 1970.
    • The first complete ALU that fit entirely inside of a single chip.

An ALU has two units in one - arithmetic unit and a logic unit.

Arithmetic unit

  • Responsible for handling all numerical operations in a computer (add, subtract...).
  • It can be built by using logic gates (and, or, not, xor)

Half Adder

  • Takes two inputs (A, B) to add them together (A, B, and the output is single bit).
  • 4 cases
    • 0 + 0 = 0
    • 1 + 0 = 1
    • 0 + 1 = 1
    • 1 + 1 = 1 0
  • This matches the boolean logic of an XOR gate, so we can use it as a one bit adder.
  • For the 4th case, we need an extra output wire for the carry bit.
  • Carry bit is only true when the inputs are 1 and 1 (only time when the result is bigger than 1 bit can store) -> use AND gate.

Full Adder

  • Takes three bits as inputs (A, B, C).
  • Total of 4 output cases (00, 01, 10, 11)

  • Building an 8-bit adder (8-bit Ripple Carry Adder)

  • If there is a carry into the 9th bit, it means the sum of the two numbers is too large to fir into 8-bit: "overflow"
  • Overflow occurs when the result of an addition is too large to be represented by the number of bits you are using. this can usually cause errors and unexpected behavior.
  • In order to avoid overflow, you need to add more gates, but operation would take more time.
  • Thus, modern computers use the faster carry-look-ahead adder.

Multiplication/Division

  • Simple ALU's dont have circuits for multiply/divide.
    • Perfrom series of additions instead.
    • Thermostat, tv remote, microwave.
  • Laptop, smartphones - have dedicated circuits for multiplication.

Logic Unit

  • Performs logical operations(AND, OR, NOT...)
  • Performs simple numerical tests, like chcking if the number is 0.

Arithmetic & Logic Unit

  • Symbol for ALU - V (another level of abstraction).

  • Operation codes : tells what operation to perform.
  • Flags(wires)
    • overflow : true if the number has overflowed.
    • zero : true if the number is zero.
    • negative : true if the number is negative.

영어 표현

  • pièce de résistance - the most impressive thing in a series or collection. (가장 중요한 것)
  • crème de la crème - best of person or thing of kind. (일류 중의 일류)
  • rite of passage - 통과의례
  • admittedly - 인정하건데
  • feat - impressive and difficult achievement
  • mint - make coins or medals

느낀점

  • 작은 스위치들을 조합하여 기계 부품을 만들어간다는게 신비롭다. 다음편이 기대된다.
profile
게임과 프론트엔드에 관심이 많습니다.

0개의 댓글