Close
0%
0%

1-Bit ALU useing Open Loop Op-Amps

using the lm324n quad 1mhz op amp to build simple logic; which are then used to create a simple ALU

Similar projects worth following
Expanding on the flowing Quora post: https://www.quora.com/Can-we-design-logic-gates-using-an-op-amp-If-so-how, I managed to build a prototype ALU. Building one section at a time I will expand on this to see how many pieces of a functioning computer can be built in this way.

This was going to eventually be a 1 bit CPU with a 4 bit control register.  I've sense shifted my sights on building a MC14500 Like state machine, which i'll post the link to the project once it's up on hackaday. I have not decided on an architecture though this project is going to be very much inspired by the UE14500 being built by David from Usagi Electric, which is a vacuum tube computer based on the MC14500 Industrial Control Unit. 

Schematic z80 1-Bit ALU cell but it's op amps._2021-11-03.pdf

here's a bunch of actual schematics that I drew up to explain the components of my final build.

Adobe Portable Document Format - 237.37 kB - 11/09/2021 at 15:46

Preview

Z80 1-Bit ALU cell (based on ken shirrif's blog - unmodified).circ

Here's the reverse engineered 1-bit ALU calcuation Cell design taken from Kens blog.

circ - 9.93 kB - 11/09/2021 at 18:24

Download

Z80 1-Bit ALU cell (based on ken shirrif's blog - modified).circ

here is a logic diagram of the final project ALU

circ - 9.96 kB - 11/09/2021 at 15:44

Download

1 BIT ALU WITH DECODE LOGIC.circ

Here's a logism mock up of the ALU and its decode -- I ended up not going with this as it became clear I was going a different direction with the project. Instead i switched to the same configuration used by the Z80.

circ - 18.88 kB - 10/19/2021 at 18:24

Download

  • Final Prototype and Reflections

    Dave Collins11/09/2021 at 16:34 0 comments

    Introduction

    It's interesting how these projects can take a completely different direction than when you started out.  About 2 weeks ago I decided that this project had kind of a turn off the road, and the reason that happened is, in my mission to make the project as absurd as I possibly could I'd really set some design goals that should not have existed.  I set out to see if I could make a CPU from op amps. If you know me,  then you know when I set goals like that unless something else pops my interest  I'll probably build a CPU from op amps... the only trouble was I'd greatly underestimated the size of that rabbit hole. 

    Building a digital CPU from what is essentially an analog competitor has consistently more variables and pit falls than traditional logic.   Don't get me wrong, I work in telecom, I spend 8-13 hours a day looking at spectrum readings on a scope I am well aware of the analog component to digital signaling, I knew this would be difficult on the outset.  What I did not understand going into this would be the time sink that this type of project would create... and for a while that was great I was definitely not bored, after all I like solving problems from data and signal readings I am a annalist.

    Also, as I continued to prototype and build this thing up on the bread board it became clear that, though it would absolutely be possible to build a 1-bit CPU from op amps on a bread board; it was basically just a large state machine.  Additionally,  the more and more I built, the more I started to realize that at the end of this I was really excited for the state machine build.  And with that excitement came the realization that I was simply delaying the project that I wanted to do in order to optimize the project that I was really just interested in for it's absurdity.


    OPEN LOOP?
    I get this question a lot.  the answer is yes, when the op amp is in open loop its basically a really inefficient comparator.  essentially when the voltage on the input side of the gate's input pin is less than the voltage at the divider on the opposed input pin the gate is in cut off, and when it is greater than the voltage at the divider it "rails out and registers a high signal (close to but not exactly the same as the VCC of the circuit.  Also important to note the source voltage pins are tied to +12v and GND at the positive and negative input pins respectively. The High state on an open loop op amp is generally "good enough" to trigger another gate in a combinational logic setup.

    The ALU Design

    The turning point for me was running into Ken Shirriff's blog on the Z-80 ALU.  Its an interesting read if you have the time (and its short so I highly recommend it!).  He goes in to great detail the design of the Z-80 4-bit ALU.  You heard that right, 4 bits ALU for a 8 bit CPU.  He also lays out a very good explanation of the inner workings for the 1-bit calculation cell used on the chip for the 4-bit alu.   It was so fun to read I thought i'd build it up in Logism:

    Z-80 1-Bit ALU Calculation Cell


    As you can see as simple as it gets; it has an 8 bit multiplexer built in ... and is so simple it relies on further logic to drive the inputs for 2 component comparison (it only has 3 way gates, and certain states must be asserted by the rest of the CPU to produce proper calculations).  In fact, as I read, I became hooked on this design and thought it would be no problem to build it up on a bread board with op amps.

    moddified ALU design, eliminates the NOR / Inverter output

    It probably took about another week to build this in afternoons after work, and then another two days to troubleshoot values to really get it working.   But in the end I did end up with a fully functioning ALU:


    It's an interesting little thing to play with; I'll be honest some times i just plug it in and push the buttons just to appreciate the absurdity of what is really going on here.  But honestly...

    Read more »

  • Logism Diagram

    Dave Collins10/19/2021 at 18:45 0 comments

    The ALU is mostly completed; I have built the proof of concept so now is on to building the ALU and it's 4 bit decode (actually 3). I was able to omit an additional XOR GATE (a savings of 1 whole package!). This was done by taking the results of the first XOR gate from the full adder.  I'll be the first to admit Its not the best design but I was shooting for as few gates as possible to try to keep the package count under 4.  I made a major decision that I'll be using diodes to make some of the OR gates; as it's going to be VERY complex otherwise.    The 3 bit command word selects between ADD WITH CARRY, SUBTRACT WITH BORROW, AND, OR, XOR, NAND, NOR, AND XNOR.  I opted for leaving in NOR and OR, as they can be used in place of LOAD 1 or LOAD 0 as the result is predictable based on the data bus.   This allows me to omit this instruction in the command register for memory operations.  The remaining 4th bit puts the whole ALU circuit into cut off, this is convenient because the memory and bus control register will also have a 3 bit command word; though the forth bit will be used to cut off the control register in a low state (as opposed to a high state cutting off the ALU).  I will more than likely microcode this using an eeprom but for now next will be the D flip flops for the Results register, and the CB Flag.

  • Proof of concept completed

    Dave Collins09/22/2021 at 03:15 0 comments

    I completed an initial proof of concept; which is a simple ALU.  The current proof of concept has 1 bug which is the carry / borrow big resolves; even if the MU (math unit) is not selected. This is due to the proof of concept resolving all of the functions and only outputting the selected function.   The next logical step is to create a control register which will allow only 1 function to output.   The ALU currently supports the following functions add with carry, subtract with borrow, AND, OR, and XOR (and their inverse values).

View all 3 project logs

Enjoy this project?

Share

Discussions

Tim wrote 11/09/2021 at 19:48 point

Nice project! Certainly one of the most complex ways to build logic gates I have seen :)

  Are you sure? yes | no

Dave Collins wrote 11/09/2021 at 20:04 point

Thanks! Yes it's definitely convoluted 😁. But it was fun to do. I was trying to think of practical use and about the only thing I could think of was it'd be a really good fast gate for detecting if a rail was about to drop given you can make the cut off nearly as tight as you need. it can trigger a low state very quickly.. but honestly there's probably much better modern ways of doing that now. 

  Are you sure? yes | no

Tim wrote 11/09/2021 at 20:07 point

There is never only one gate ;)

I thought of using analog multiplexers as gate one time, but never tried it beyond some simulation. Kudos for getting so far.

https://hackaday.io/project/8449-hackaday-ttlers/log/175781-analog-multiplexer-logic

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates