I am currently taking the Nand2Tetris course online, where I am in the process of building a virtual computer all from nand gates. I have learned what an ALU is, how it works, and build a simple virtual one myself.
Now I would like to make my own physical 8 bit ALU from simple 74(HC) series IC's. I have experience in building electronics and using the IC's, on a hobby level. My only real problem is that I don't know which functions to choose for my new ALU. In the virtual ALU I build there are input x and y, and 6 functions:
- zero x
- not x (bitwise),
- zero y,
- not y (bitwise),
- f (0: x AND y 1: x + y),
- not(bitwise, on everything).
I am going to build a whole whole computer, so i could of course just for example add multiplication with software later, but I would probably like to have more hardware functions. From my research i found out about in- and decrementers, left/right shifting, other "full" multiplying/dividing circuits and of course more logical implementations. But i have no idea what functions are needed/useful to have in an ALU, and what is a good balance between hardware and software implementations.


But i have no idea what functions are needed/useful to have in an ALU

Neither do we as you didn't specify the application that your ALU should be used in. What is a useful function of a device depends on its use.

The wikipedia article has a nice list of common functionality, i.e.

  1. add
  2. add with carry
  3. subtract
  4. and
  5. or
  6. shift

It also makes a statement on more complex functionality:

Although an ALU can be designed to perform complex functions, the resulting higher circuit complexity, cost, power consumption and larger size makes this impractical in many cases. Consequently, ALUs are often limited to simple functions

I think that makes sense and agree.

One example for more complex functionality could be a MAC-unit Which can be capable of doing a multiplication of two numbers in one cycle, which is useful for some real time applications.

As you can see this is basically a simple arithmetic operation, yet it is not included in the ALU but a dedicated unit.

  • \$\begingroup\$ That makes sense, I'll keep it simple and look at the article then. Thanks a lot :D \$\endgroup\$ Apr 22 '15 at 15:53
  • \$\begingroup\$ one's and two's complements are also useful functions. Though if you have XOR and Subtract, you can do both anyway. \$\endgroup\$ Apr 22 '15 at 16:05

One thing to look at is what functions were provided in various MSI (medium scale integration) ALU IC's that appeared some 40 years ago, when high end CPUs were still being built from discrete chips. Both of the chips below were bit-slice 4-bit ALU's, so four of them would be needed on a 16-bit computer, and eight for a 32-bit computer.

Here is a 48 function table from the 74F181 using four select lines (16) plus two extra control leads:

enter image description here

which perhaps goes a little overboard. However it was a very popular chip, and was used in many mini-computers like the PDP-11 and VAX 11/780.

Here is a simpler 8-function table from the 74F381, that uses just three select lines:

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.