# One ALU Slice tested with real hardware

A project log for AYTABTU - Discrete Computer

After the apocalypse we have to build computers from stuff we can make at home, I.E Transistors, diodes and resistors.

I did some soldering today.... Three boards each with six 4-input NAND gates giving 18 NANDs in total which is more than enough to wire up one ALU Slice and verify that it actually works in real life and not just in Logisim. The boards look a bit like the SIP (Single In Line Package) memory modules that was used for some years back in the 90's.

I realized that for the shift/rol instructions I need to be able to disable the Result and CarryOut ports of the ALU slices so there's now one additional control input to the slices and one more diode each for the two output gates.

So a slice looks like this now:

So I wired that up on a breadboard and hooked up an Arduino to automatically set the control signals and cycle through the combinations of A, B CarryIn and analyse the Result and CarryOut to see if the ALU behaves as expected. As far as I can see it does, so I'll route pcbs for this and send them off for manufacturing.

The ALU control pcb and the Shift/Rol pcbs I'll probably just solder up on breadboards since they're on-offs.

## Discussions

roelh wrote 01/11/2017 at 18:14 point

Hi Matseng,

you might want to consider the following schematic for an ALU that has dramatically less transistors:

The top part calculates the (inverted) carry. The lower part calculates the (inverted) sum, with the function   SUM =  (  ( A or B or Cin )  and /Cout  )  or  ( A and B and Cin )

With a few extra parts, the carry could be forced to always be active or inactive. In that case the circuit will perform a simple AND (for carry active, /Cout=low)  or an OR (for carry not active, /Cout=high).

To connect the /Cout to Cin of the following bit, you will need an extra transistor inverter, or you could use inverted logic for every alternate bit.

The make this into a working ALU, resistor values must be calculated and some parts must be added for optimal circuit response. It is supposed that the inputs can sink current but als source current (for the OR gate).

Are you sure? yes | no

matseng wrote 01/12/2017 at 01:47 point

Ah yea, I was playing around with this "analog style" ALU design for a bit before. Both in spice and with physical parts.

With some of tuning it actually works, but I never tested the temperature range. Will the tempco of the parts involved make the circuit go outside of its working conditions when the ambient temp goes from 20c up to 60?

One defenite drawback with this design is its slow speed and very undefined transitions compared to properly clamped and sped up digital design.

But it's a nice design for a low speed, minimal parts "educational" style build.

Are you sure? yes | no

roelh wrote 01/12/2017 at 18:11 point

Hi Matseng, the circuit is only analog in the sense that every digital gate is analog. It is equivalent to:

If the transistor gates get the usual speed-up addons, like diodes in series with base, speed-up capacitor at the right place, and perhaps replacing input diodes by transistors, the only point might be that there are too many passive gates in series. So I don't expect temperature issues. I think it's advantage is that there are no EXOR gates needed.

And, being concerned with speed, will you use ripple carry or something faster ?

I found your 11-bit instruction set, but do you also have a general design or architecture ? What is the structure in the instrutions ? Will you use microcode ?

Are you sure? yes | no

Tony Robinson wrote 01/10/2017 at 20:43 point

This is a great ALU design, I really love it.   I've borrowed a lot of it for my own ALU - thanks!   I replaced the first XNOR with a 2T version just to lower the transistor count a bit.   I also added in the bitshift as, even though it doesn't feature in your design, it integrates nicely.   Now I'm working the main problem of ALUs, that is the propagation of the carry signal.   Please see nanocpu.org and tell me what I can do better.

Are you sure? yes | no

matseng wrote 01/11/2017 at 04:56 point

Nice! I'm really glad that my half-baked ideas from back then turned out to be useful for someone. I hope I soon can continue writing on the machine, but I'm currently been on the road for a year....

I see that I never documented :-( the inputs of the ALU here, but it seems like you got it all covered anyways.

I'll have a serious look at your site later on today and see what you've done.

Are you sure? yes | no

Yann Guidon / YGDES wrote 01/11/2017 at 09:32 point

He's done some interesting work, such as study the carry chain made of diodes. I don't know who invented it first but for me it's a total discovery that ate a few precious hours of my sleep :-D

Are you sure? yes | no

Yann Guidon / YGDES wrote 10/01/2015 at 16:24 point

That is the kind of project to show to kids to get them interested in electronics !

Are you sure? yes | no

Andrew Starr wrote 10/01/2015 at 10:16 point

Very nice work! And when you have your PCBs, the vero modules will make really cool keyrings :)

Are you sure? yes | no