Skip to content

Combinational Logic Blocks

Data Multiplexors

1.3 Logic Gates

Multiple MUX can be combined together to get more way selection.

a --
   +--MUX----
b --   |    |
       ---  +--MUX--e
c --     |  |   |
   +--MUX----   |
d --   | |      |
       +--      |
       S0       S1

Arithmetic Logic Unit (ALU)

Most processors contain a special logic block called "Arithmetic Logic Unit" (ALU).

A simple version that does ADD, SUB, bitwise AND (&), bitwise OR (|)

  A     B
  |     |
  /32   /32
  |     |               when S=00, R=A+B
__v__ __v__             when S=01, R=A-B
\    V    /             when S=10, R=A&B
 \  ALU  /<---/---S     when S=11, R=A|B
  \_____/     2
     |
     /32
     |
     v
     R

Implementation

                   A     B
                   |     |
                   / 32  / 32
                   |     |
     --------------+--------------
     |       ------|-----+-------|------
     |       |     |     |       |     |
   +-----------+  +-------+     +-------+
S0>|  ADD/SUB  |  |  AND  |     |  O R  |
   +-|---|-----+  +---|---+     +---|---+
     |   |            / 32          / 32
     |   -----        |             |
     |       |        -----     -----
     v       |            |     |
  overflow   |          __v_____v__
             |          \ 0 MUX 1 /<----S0
             / 32        \_______/
             |               |
             |     -----------
		     |     |
		   __v_____v__
		   \ 0 MUX 1 /<-----------------S1
		    \_______/
		        |
		        / 32
		        |
		        v
		        R
  • All operations done altogether
  • Let MUX choose which one to output

Adder

2.2 Binary Addition

Full Adder (Alternative Implementation)

si=XOR(ai,bi,ci)ci+1=MAJ(ai,bi,ci)=aibi+aici+bici
  • MAJ is the majority operator, whereMAJ(x1,x2,,xn)={1,xi=1i>xj=0j,0xi=1ixj=0j.

Multibit Adder

Cascading n instances of 1-bit Full Adder

  • Unsigned: Last carry cn is overflow bit
  • Signed: XOR(cn,cn1) is overflow bit
    • No overflow: Last bit cincout or cincout
    • Overflow: Either cin or cout is 1

Subtractor

AB=A+(B)=A+(B+1)
  • XOR serve as conditional inverter
    • x = 0, XOR(x, y) = y
    • x = 1, XOR(x, y) = -y
  • One bit carry input into the LSB as +1

Final design: