When you start to design a computer, you usually start with rule 1. Use binary, 2s complement numbers (unless you're @SHAOS or @alice crush) but it's only the beginning. You have to choose a technology, which is a complex entangled web of compromises and constraints.
- cost
- speed
- size
- space
- availability
- power consumption
- interfacing with other stuff
- what's new/fun/enticing/trending
Of course,
- if you use vacuum tubes, integrated circuits or FPGA, the rest is mostly moot due to their inherent properties.
- I also assume you're not going anywhere near #Diode Resistor Logic either, though you might find inspiration here.
- Relays have a great range of "topological expressiveness" that are worth a whole article.
In fact, from here on, I guess you'll use discrete (MOS)FET or BJTs and things get downhill from there.
Many Hackaday projects, and in particular the #Hackaday TTLers, love to explore and play with various ways to interconnect discrete transistors. It's just a notch below the thrill of designing an integrated circuit but way above that in the BMOW wow-factor. You can touch it, probe it, fix and patch it, show it off and impress...
Creating a logic gate is an art in itself (ask Harvey about it), which draws from both boolean arithmetic and small-signal analog design, and we can dig in the literature, in the past or in the present, to find inspiration. Where each "logic family" differs is what they can express and how they perform each function. The range of possible functions is a sort of expressiveness, and this also deeply influences your higher-level design, as well as design methodology.
This page is important because it gives you a taste of how miserable you will feel, once you get a few working gates. For example, if too few inputs are possible, the final circuit will be slower because of logic fan-in restrictions: for logic reduction, a 2-tree uses more stages than a 3-tree, and a 4-tree is faster, but might each gate might be slower, so you must find a balance somewhere. One typical example is how you design a XOR gate: it might cripple your critical datapath and speed if your logic family is too limited.
The basic gates provide NOR and/or NAND, which I call "first order gates" because there is one level of inversion. Along with the MUX2, these are the "most basic gates" from which you can build all other circuits, but MUX2 is cheating because it contains both inversions, OR and AND. Building a computer with them is possible, but still a challenge ! You have to turn everything into a sequence of NOR or NANDs. This is why "expressiveness" is so important for architects and circuit designers : some families offer a wider range of gates that make life easier, critical datapaths shorter and circuits simpler.
Another choice or constraint is your ability or willingness to use complementary transistors. If all you have, or can get, is a single type, then you are more limited in the possible topologies and you are forced to perform more boolean trickery with the few possible gates. OTOH if you can source both P and N types, you can exploit both NOR and NAND, or combine them in creative ways that could reduce both complexity and power.
But mostly you end up with NANDs and/or NORs... you have to choose carefully !
- Chances are you'll want to try your hand with a proven and reputed family : TTL, the one and true Transistor-to-Transistor Logic. One transistor per input and one for the output sounds reasonable and the basic gate is the NAND, such as the 74x00.You notice the weird transistor, which briefly existed in discrete form half a century ago. You can substitute a pair of classical transistors (tripoles) for each of them, which is mostly irrelevant in a digital design (unless your parts are really badly binned) You can't go wrong with such a classic but soon you'll be trying to get more performance with Baker clamps or speedup capacitors. Oh and you can't find discrete transistors with multiple emitters. In the end, the speed will also be limited by R2 because the pull-up transistor has to fight the load's RC. Decrease R2 and your speed is enhanced at the cost of the dissipated power, or saturation problems. If you want to go even faster, you must use totem-pole or push-pull output stages and your parts count skyrockets. It looks so much easier inside an IC where you can add transistors and collectors at will.You now have 3 transistors for the output yet you can still only do NANDs...
- Since you're highly unlikely to find discrete parts with multiple collectors, you're not going to use Integrated Injection Logic either, despite its low power and interesting properties. In theory, you could go for 1V supply voltage or such but it is going to be pretty noise sensitive, so it isn't your first choice when building transistor computers which are going to be rather big and have long signal traces, and keeping trace impedances low by creatively adding termination resistors would be going to be ...difficult. Again, it's only for the IC guys and it was quickly obsoleted by CMOS. But it had to be mentioned, just in case somebody else wanted to have fun or needed to be pedantically exhaustive (who ? me ?).
- A little bit less exotic and more interesting is the #CBJT Logic logic family with a pretty good power/speed ratio and it can do NAND and NOR (AND and OR require an extra inverter). It is reminiscent of CMOS but with BJTs. However the very very tight PSU margin, around 1V, can make it difficult. Go above 1.2V and the current increases dangerously, you might even fry everything. That's some sort of extreme sports and those who get inverters working then have to deal with the actual challenge : get multiple inputs to work ! 2 inputs is not easy but you won't go far in real CPU design with less than 3 inputs. Then you have to deal with weird capacitive effects. This is where the promising topology crumbles and compared to other families, it might not be that fast. George tried to solve some of the problems but I'm still waiting for an actual implementation with real parts because circuitjs is far from perfect for simulations.
- Back to simplicity : you may want to trade input transistors for diodes and save room and costs with DTL: Diode-Transistor Logic. Look at many projects around here, such as Pavel's, Alan's or Mat's. It's simple, it's slow, it's not too fussy about the power supply, it's all NANDs.
You can even swap some parts for LEDs, such as Tim's #LCPU - A CPU in LED-Transistor-Logic (LTL) ! It's good to get started but your system won't easily exceed a few MHz of operating frequency.- Don't forget the speedup capacitor to short D3-D4.
- You could use Schottky diodes like LL101 (1ns). There are faster Schottky diodes, and even 2 diodes in a three pin SMD package (that's going to be quite compact).
- Add a Schottky clamp to the output transistor, it makes the gate faster, which also makes the gate output less sensitive to variations of the load.
- Put a 56k resistor or such in parallel to the Schottky diode, or else your gate inputs might be getting a hysteresis which increases with frequency
- Keep in mind that DTL piles up quite a bit of capacitance when wiring some gate inputs together.
- If DTL is still too modern or fast for you, just fall back to plain old RTL: Resistor-Transistor Logic, like they did back in the 50s and 60s. But this is pretty close to DCTL (Direct-Coupled Transistor Logic, a sort of DTL with less fuss, as used by Cray in the CDC6600 in the mid-60s) and with some care, DCTL can get pretty fast even with old parts: about 5ns per gate can be reached. The parts count is reasonable but this time, you're stuck to only NORs.You must also have one version of each gate for each fanout, or allow the output pull-up resistor to be changed. It's not too fussy but you still have to care about the saturation.
- While we're still on the Cray chapter, the next interesting family is ECL: at first intimidating, "non-saturating logic" has several qualities, among which speed is the most known. On top of that, the basic gate can do both NOR and OR, because the output is complementary, which helps a lot with complex boolean networks. The basic topology can be extended by "dotting" and cascading, easing the design of latches and arbitrary boolean gates. ECL can go faaast and our amateur tools are often the limits. Power is another major concern : each gate draws at least 2mA, regardless of the state (that's 10mW @5V). This simplifies filtering but heat management is a famous drawback. @Tim added a new twist to the story with #LED Coupled Logic (LCL), where gates that only need the inverting output can save several parts, with the substitution of a few diodes in series. It's alluring (fewer parts, still fast) but you end up back to "only NOR" domain, and with a probably similar speed as the above DCTL, you still consume more power (this must be tested and verified though).
Willmore said this :
As you seem to have discovered as well, RTL and DTL have a lot of drawbakcs and aren’t easier to use than ECL (and having the option of every signal being differential gives free inversion).
Anyway, ECL is worth a try, if only because it's one of the most "expressive" families. This flexibility provides more boolean functions per discrete part. The problem with ECL is line distribution and line termination, and getting this right would take some more years of experimentation, as well as some serious lab tools... - NMOS/PMOS was the first successful non-bipolar technology, it is easy to build with discrete parts, the Megaprocessor is a famous example. It's good for beginners but it suffers from the same "pull-up" issue as RTL/DTL/DCTL and even ECL: the speed is limited by the output resistor. Worse: the cheap discrete MOS parts have significant gate capacitance. Most implementations use NMOS because discrete PMOS is significantly more expensive, so no mix&match and funky topologies here. Conclusion: you're still stuck to NORs.
- CMOS is the king on silicon today, but is hard to build out of discrete parts. Several attempts have been documented but no significant circuit has been implemented. This is because commercially-available MOSFETs have their "bulk" tied to their "source" and pass-logic is much harder. Even the BS170/2N7002 are designed for medium power switching, and their gate capacitance is significant. However "pure CMOS" is highly expressive, many topologies easily provide AND/OR/NOT combinations and are a primary aspect of ASIC design.
Note that if you are not concerned with raw speed, and you're willing to deal with saturation and weird levels, you can play with less advertised aspects of transistors to create some shortcuts and extend your "expressiveness":
- Bipolar Junction Transistors can be seen as ANDN gates. This can be useful in certain cases and it is the basis for the classic 2-transistors XOR gate, but it requires "regeneration" (an output buffer, often inverting)
- Pass logic is also possible : it's common for MOS, but a BJT can also act as a logic pass gate. It's ugly, but it can sometimes work...
However these "analog tricks" break the principle of a "logic family" where every member can be connected to the others.
.
.
The conclusion of this exposé is simple:
Apart from ECL which offers some flexibility, most discrete logic families are restricted to NAND or NOR gates.
You have to adapt your logic design, architecture and physical parameters to the family you choose, and learn to break most boolean circuits into NORs or NANDs, it's a skill that is learned like a language.
This also means that if you can express your architecture as a collection of NOR gates, you are then free to implement it with several types of logic gates, which you can choose with more freedom. In fact, I found only recently that NOR is the more natural choice for many families than NAND:
- NAND is the natural gate of TTL and DTL
- NOR is natural for ECL, RTL, DCTL, NMOS...
You can twist and tweak the rules if you get access to complementary parts (as with IBM's "current steering logic" which was the precursor to ECL) but then the design would become too specialised and less portable.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Another comment :
It probably isn't a good idea to rebuild a TTL multi_emitter transistor from individual transistors, when I had tried this this gave me "crosstalk" between the inputs of the NAND.
Are you sure? yes | no
Comment from a friend :
Some years ago I had tinkered with output buffers where a NPN and a PNP transistor are wired together like in CBJT, BC547 and BC557, I gave up because the transistors had a habit of turning into a 100MHz..200MHz oscillator.
Are you sure? yes | no
Where does analog multiplexer logic fall?
https://hackaday.io/project/8449-hackaday-ttlers/log/175781-analog-multiplexer-logic
Are you sure? yes | no
I guess MUX2 like relays...
Are you sure? yes | no
So does the relay fall more in the nand or the nor camp?
Are you sure? yes | no
IMHO, neither :-)
This log covers the transistors, which are "tripoles" (at least for those you can easily buy in bulk for less than $0.01 each) and they have inherent limitations, in particular : the input and the output share the same reference node.
The simplest relays are tetrapoles : SPST types have 4 pins in 2 isolated sets, and are (usually) not polarised, so they are halfway in the MUX2 class. Already you can make a XOR gate with proper signaling and no effort.
But even SPST is not recommended for digital designs :-) Use at least SPDT, which are pentapoles that allow true MUX2, and DPDT for more practical implementations (they will save you from having to wire 2 relays in series or parallel, which happens a lot with SPDT).
Are you sure? yes | no
>you end up back to "only NOR" domain
You also get a very stable wired AND due to the strong output driver. This logic type is probably not that inefficient. I shall look into some basic gates and latches when i find the time.
>It's good to get started but your system won't easily exceed a few MHz of operating frequency. Be careful with your signal margins though.
Why? DTL has quite good signal margins. At least compared to RTL, ECL.
Are you sure? yes | no
OK I forgot about tying output collector/drain buffers together... It was late in the night, I hope you'll excuse me :-P
Now, what about mixing DTL and RTL to get both NORs and NANDs ?
Are you sure? yes | no
Late night engineering is the best :)
Will you could easily build a DTL NOR by connecting the outputs of two inverters.
Hm... I am realizing that a wired AND of a NOR gate is just another NOR gate. So this is not very useful.
Are you sure? yes | no
@Tim which again proves this log's point : the logic family influences the range of boolean primitives.
"Know your family and choose it well"
Are you sure? yes | no