All notes

Design of arithmetic and logic unit (ALU)

GATE CS50 min read

Free preview: 28% of the note

ALU role and datapath signals

Definition. An arithmetic and logic unit performs selected operations on input operands and produces a result plus status information. Control signals select operations such as add, subtract, AND, OR, XOR, compare, or shift. The ALU is part of a datapath; registers, buses, multiplexers, and control logic supply operands and use its result.

Example. An ALU may choose A+BA+B when opcode is 000 and A∧BA\land B when opcode is 010.

Exam point. Operation code determines function; operand width and signedness determine interpretation.

Bitwise logic operations

Definition. Bitwise AND, OR, XOR, and NOT apply Boolean operations independently at each bit position. They do not propagate carries. For an nn-bit word, each output has the same width, with any unused high bits governed by the operation's definition.

Example. 1010∧1100=10001010\land1100=1000.

Exam point. Distinguish bitwise logic from logical truth-value operations on an entire word.

Solved calculation. Compute AND, OR, and XOR of A=101101A=101101 and B=110011B=110011.

  1. AND each bit: 100001.
  2. OR each bit: 111111.
  3. XOR each bit: 011110.
  4. The results are six bits because both operands are six bits. Answer. AND=100001, OR=111111, XOR=011110.

Binary addition in an ALU

Definition. An nn-bit adder adds two bit vectors and a carry-in. Each bit uses propagate/generate behavior; sum is XOR of the operands and carry-in. The low nn result bits are retained, while carry-out and signed overflow are separate status conditions.

Example. Four-bit 1111+0001=1,00001111+0001=1,0000, yielding result 0000 and carry-out 1.

Exam point. Report the result width and flags independently.

Solved calculation. Add unsigned 8-bit values 01101101 and 00111011.

  1. From the least significant end: 1+1=0, carry 1.
  2. Next bit: 0+1+1=0, carry 1.
  3. Continue full addition: 01101101+00111011=1010100001101101+00111011=10101000.
  4. The operands sum to 168, which fits in 8 unsigned bits, so carry-out is 0. Answer. 10101000, carry-out 0.

Full-adder equations

Definition. A full adder computes Si=Ai⊕Bi⊕CiS_i=A_i\oplus B_i\oplus C_i and Ci+1=AiBi+(Ai⊕Bi)CiC_{i+1}=A_iB_i+(A_i\oplus B_i)C_i. Equivalently, carry-out is the majority of Ai,Bi,CiA_i,B_i,C_i. Cascading full adders forms a ripple-carry adder.

Example. For inputs 1,0,1, sum is 0 and carry is 1.

Exam point. Carry is generated by both operand bits or propagated from the prior position.

Solved calculation. Find sum and carry for bit inputs Ai=1,Bi=1,Ci=0A_i=1,B_i=1,C_i=0.

  1. S=1⊕1⊕0=0S=1\oplus1\oplus0=0.
  2. G=AiBi=1G=A_iB_i=1.
  3. P=Ai⊕Bi=0P=A_i\oplus B_i=0.
  4. Ci+1=G+PCi=1C_{i+1}=G+PC_i=1. Answer. Sum 0, carry-out 1.

Ripple-carry adder

Definition. A ripple-carry adder connects each stage's carry-out to the next stage's carry-in. Its area is approximately linear in bit width for a fixed gate implementation, but the worst-case carry delay also grows with width. It is simple and appropriate when timing requirements allow the propagation delay.

Example. A 4-bit ripple adder uses four carry stages to form a 4-bit sum and final carry.

Exam point. The longest carry chain determines the worst-case delay, not a typical input pattern.

Solved calculation. An 8-bit ripple adder has 2 ns carry delay per stage. Estimate worst-case carry-out delay when eight stages are serial.

  1. Carry must pass through eight stages in the simplified model.
  2. Delay is 8×2=168\times2=16 ns.
  3. This omits input arrival and sum-generation delay, which are not specified. Answer. 16 ns under the stated model.

Carry propagate and generate

Definition. Define Gi=AiBiG_i=A_iB_i and Pi=Ai⊕BiP_i=A_i\oplus B_i. Then Ci+1=Gi+PiCiC_{i+1}=G_i+P_iC_i. A group of bits can compute whether it generates a carry independently of the input carry and whether it propagates a carry through the group, enabling faster lookahead structures.

Example. Gi=1G_i=1 forces carry-out to 1 even when carry-in is 0.

Exam point. Some texts define propagate as Ai+BiA_i+B_i; state the convention and use it consistently.

Solved calculation. For two low bits, let (G0,P0)=(0,1)(G_0,P_0)=(0,1) and (G1,P1)=(1,0)(G_1,P_1)=(1,0) with C0=1C_0=1.

  1. C1=G0+P0C0=0+1=1C_1=G_0+P_0C_0=0+1=1.
  2. C2=G1+P1C1=1+0=1C_2=G_1+P_1C_1=1+0=1.
  3. The high bit generates carry regardless of C1. Answer. C2=1C_2=1.

You have read the free 28% of this note

Sign in with Google to keep reading. It is free, takes one tap, and you also get:

  • 6 practice questions from this note
  • Every note in full, plus the PDF library
  • Official past papers as timed tests, with explanations
  • An AI tutor for doubts, in Hindi or English
  • Your progress, mistakes and study plan saved on every device
Continue reading, free