Skip to content

Arithmetic and Logic Unit, Shifter, and Control Unit

Arithmetic and Logic Unit

arithmetic and logical operation (연산) 이 실제 수행되는 장치.

뭔가 신비해 보이지만, selector와 combinatorial logic circuit (gate)로 구성된다

  • shift operation은 shift register로, data flow control은 control unit에서 이루어짐.

operation을 구성하는 micro-operation은 크게 register-transfer, arithmetic op, logical op, shift 등의 4가지로 나누어지는데, ALU는 이중 arithmetic operation과 logical operation을 담당한다고 볼 수 있다. (register에 저장된 data들에 대해 이루어지는 기본적인 operation들을 micro-operation이라고 함)

  • Control unit에서 오는 control signal (opcode)에 따라, data를 가져와서 연산을 수행.
  • Accumulator 와 condition code register등에 연산결과와 status가 저장됨.

  • 위 그림에서 status register 가 바로 condition code register임.
  • ALU 제어 신호는 달리 말하면, opcode (operation code)로 연산의 종류를 의미함.
  • 상단의 register 에서 들어오는 data를 operand (피연산자) 라고 부름.

ALU's opcodes (Simple Version)

ALU가 수행하는 opcode들을 나타낸 표임. (example)

opcode mnemonic description
0000 clr operand에 상관없이 result를 0으로
0001 set result를 1로
0010 not operand A의 각 bit에 not연산
0011 neg operand A의 two's complement -A를 result로
0100 shl Shift A left by the low 4 bits of B
0101 shr Shift A right by the low 4 bits of B
0110 Unused
0111 Unused
1000 load pass operand B to the result
1001 and bitwise A AND B
1010 or bitwise A OR B
1011 xor bitwise A XOR B
1100 add A + B
1101 sub A - B
1110 cmp Set condition codes based on B-A (compare)
1111 Unused

Shift Registers

shift연산을 담당.

Sequential Shift Register

flip-flop들로 구성한 shift register임.

  • 1bit를 shift하는데 1 clk가 필요 : 매우 느림.

Barrel Shifter

selector(or MUX) 기반의 shift register.

shifter를 만드는데 들어가는 기본 구성요소 selector 등은 EDA에서 component로 제공된다. 즉, selector에 해당하는 chip들을 배선으로 연결하여 만드는 것이 아닌 "EDA에서 컴포넌트로 제공되는 블럭들을 조합하여 하나의 chip으로 설계" 하여 만드는게 일반적이다.
이는 마치 programming이 여러 function과 class들을 조합하는 것과 비슷하다.


Control Unit (or Execution Unit)

명령을 fetch하고 decode하며, 해당 명령을 수행하기 위한 여러 제어 신호를 보내는 소자. 실제적으로 ALU에게 필요한 연산과 데이터를 제공하고 결과값을 올바른 메모리 장소로 보내는 일들을 담당한다.