teaching machines

CS 352 Lecture 12 – ALU

October 3, 2016 by . Filed under cs352, fall 2016, lectures.

Dear students,

Now that we have hardware components that can perform boolean logic and arithmetic, let’s package them all together into a one-stop shop called the arithmetic-logic unit (ALU). This component will perform exactly one of many possible operations. Which operation it performs will be determined by 6 control pins, and it will also accept two multibit parameters named x and y. The six pins will have this influence:

if zx
  x = 0

if nx
  x = ~x

if zy
  y = 0

if ny
  y = ~y

if f
  result = x + y
else
  result = x & y

if no
  result = ~result

We’ll spend the first part of class today determining how exactly to set these pins so that they achieve 18 possible functions of x and y. Our function space looks something like this:

~? ({x, ~x, 0, 111...111} {&, |} {y, ~y, 0, 111...111})

To figure out how to set these pins, we’ll establish a few identities:

x & 111...111 = x
x + 111...111 = x - 1
~x = -x - 1
x + ~y = x - y - 1

Once we determine the pin configurations, we’ll sketch out a complete ALU using components we have defined earlier. Then we’ll have a memory-less computer!

Here’s your TODO list to complete before next time:

See you next class!

Sincerely,