An additional constraint from the architecture and LEDs and wiring page is that both inputs have to have LEDs and the output of the ALU is to a memory register which also shows state. This means that it doesn't matter too much if the input or output is inverted. It's easy to see how diodes work, they pass current in one direction and not the other. It's also easy to implement ASR, OR and AND with diodes in a easy to understand way (with fairly low component count). So the idea is to build a standard 2T memory cell where instead of having one write and one feedback/sustain, there is one write per ALU function and the normal feedback/sustain. All inputs from the bus got through a transistor which both inverts and shows the input on an LED. So, in reality, the ALU has not A and not B available to it. AND, OR and ASR will work with the negated values as input, so the input to the 2T memory cell is also negated. That's fine, the other half will have the needed value, so it will be possible to use and show the correct value. This only leaves the ADD/SUB/XOR chain, and the output of that can be easily inverted with the INV ALU input. The only question is, can I get the right LED lights on the two XORs needed to compute ADD/SUB? By far the slowest part of this ALU is the carry propagation mechanism for ADD/SUB as we use a ripple-carry adder (there are more efficient adders but these are way out of scope). This is because a one bit change a low order bit can change all the high order bits (consider adding 1 to 0xFFFF) which is a very long data path. So that's what I've spent time on. Just from the input, A _{i} and B_{i}, we can construct two signals at every bit position:- G
_{i}= A_{i }B_{i}is the Generate signal, if A_{i}and B_{i}are set then we generate a carry at this position - P
_{i}= A_{i}+ B_{i}is the Propagate signal, if either A_{i}or B_{i}are set then we will propagate the carry from C_{i}to C_{i+1}. In practice we use the inverse of this, the Kill signal, K_{i}.
Now we can express the carry out as C _{i} = G_{i} + P_{i} C_{i-1} and so a circuit is needed which implements this without the long times needed to switch off a transistor Diodes work much faster, especially Schottky diodes which both switch fast and have a low voltage drop. Here is a (probably minimal) design where the ripple carry only goes through diodes: The carry in signal can be killed by the transistor that takes it to ground. The carry out signal is the OR of the generate and the (potentially killed) carry in. This is good but I worry about signal loss. I see 0.83V drop across 5 diodes, so 2.49V drop for the full 16 bit ALU. That's very marginal with a 3.3V power supply. I have no problem adding an oscillator and an voltage doubler to up the voltage of Cin if needs be. Oh - it's not quite so simple. The kill signal reduces the amplitude of the previous carry signals. A analog hack would be to increase the voltage labelled above as ground so that if a kill signal is high it's still below 0.6V and so regarded as "low", but the signal one diode before is above the 0.8V needed to be regarded as "high". So that's at least 0.2V per diode and that will limit the number of carries I can propagate before boosting the signal (but it might only be one boost, and I was kind of resigned to that anyway unless I used more than 3.3V). Regard this whole idea as untested until I can finish the work above. OPEN QUESTION: I've been using 1N5817 Schottky diodes, which I find have a reverse resistance of about 1 MOhm. At 3.3V or 5V this is low enough to cause some current to flow into the base, causing partial switching. I can either drag all carry points low using 100 kOhm resistors, or move to 1N5819 Schottky diodes which have a higher reverse resistance. https://www.electronics-tutorials.ws/amplifier/transistor-biasing.html |