A simple ALU
Objectives
We would like to :
- Build a simple ALU
Notes
- This is the end of chapter 4 in Carpinelli
- Hennessee and Patterson have a great treatment of this topic.
- Generally in the development of a simple ALU you build an adder
- We have discussed this in the past when we discussed binary addition.
- We will build a ripple-carry adder.
- Usually the first step is to build a 1-bit half-adder
- This takes two inputs (a,b) and produces a sum and a carry
- Carpinelli does this.
- You then combine two half adders to build a full adder
- This takes a,b, cin and produces s, cout
- Carpinelli provides the following:
- S = a⊕b⊕Cin
- Cout = ab + aCin + bCin
- Which produces the following
-
- FullAdder.dig.
From this we can build a ripple carry adder.
- Do this in class for a 4 bit RC-Adder.
What else might we want from an ALU?
- How about subtraction?
- Do we need to build a subtractor?
- No, just flip the bits and add 1.
- But how do we add 1? (Carry in set to 1)
- Do this.
What else might we want from our alu?
- Most assembly languages support
- jump on 0, not 0
- jump on overflow, or at least overflow detection.
- jump on carry
- Can we add these?
My finished product