-1
$\begingroup$

I am not asking about if it is possible to build a computer using only NAND gates, since that question has been asked infinite times. I wonder if it is possible to replace the “ALU” in the cpu of a computer, with just a single NAND gate. And, then implement the rest of the ALU with software.

CPU seems to basically get an instruction, feed something into ALU, get something out. Then get another instructions, feed into ALU, get something out. It seems like it should work identically if the ALU is a single NAND gate. And, just like n-bit computation can be implemented on less than n-bit architecture, seems like a single NAND gate "ALU" might be able to scale up to compute on n-bit words.

An ADD instruction, would implement an adder with software that executes on the “ALU”. For a half adder, A and B are fed into a NAND, this result could be used both in the sum and the carry bit. For the carry, the result is inverted by passing the result into both inputs of the logical execution unit. For the sum, the result is passed through the rest of the XOR gate software implementation on this logic unit.

I am still learning the basics of computer architecture. This question probably has an easy answer, but I do not have enough oversight of how things can be pulled from registers and fed into “ALU” to be able to answer if the “ALU” can be reduced like this.

Also, if it is possible, has it been done? Any documentation of such a CPU architecture being used or experimented with historically?

$\endgroup$
11
  • $\begingroup$ Welcome to COMPUTER SCIENCE @SE. Please edit into your question: What is going to be the width of the ALU? (Regarding feasibility, have a look at bit serial ALUs/CPUs.) $\endgroup$
    – greybeard
    Oct 23 '21 at 6:27
  • $\begingroup$ No that's already understood. A single NAND gate has two 1-bit inputs. It is a good question. Easily answered too. $\endgroup$
    – Pancake
    Oct 23 '21 at 6:32
  • $\begingroup$ @Pancake, "good" is relative, you find it good, someone else may not. Also, you question is more suited to be asked on electronics.stackexchange.com $\endgroup$
    – user206904
    Oct 23 '21 at 15:29
  • $\begingroup$ Yes it's obviously relative from one perspective but not from another. Subjectivity and objectivity, consensus and whatever opposite is, are both true depending on context. You yourself would likely claim "it is not relative" or "it is scientific fact" for some things. Which just shows that arguments are often relative to how you feel at the moment and not to "truth" :) $\endgroup$
    – Pancake
    Oct 23 '21 at 22:18
  • $\begingroup$ It really isn't suited for electronics. First, that electronics is assumed to automatically cover computer architecture, that is built on electronics but vastly different from what "electronics" usually is, is an assumption I do not share. Second, I ask very theoretically about computation and computation architecture that is in no way about electronics. It can be answered mostly when fully abstracted from electronics, maybe not in full but, the answer should apply even if computer was made from... non electronic switches or gates. $\endgroup$
    – Pancake
    Oct 23 '21 at 22:21
1
$\begingroup$

I have to study the following computer architecture more, but it looks exactly what I asked about, and that proves the question was actually very good, so, I will share this here right away. The single NOR gate computer, https://hackaday.com/2020/11/23/a-cpu-less-computer-with-a-single-nor-gate-alu/. Also, this article seems to describe a similar thing, with a single NAND gate instead, http://www.inf.fu-berlin.de/inst/ag-ki/rojas_home/documents/tutorials/SmallestCPU.pdf. It also mentions a 1945 computer that was very similar.

Why is this relevant? It is "philosophically" relevant to anyone wanting to understand what a computer is. I also, without having the expertise to know if there is any truth in that, like the idea of moving more of the computer into software. I recall reading that IBM said in 1960s that "software was overrated, it is all in the hardware", and then that statement was proven wrong, and most computer architecture seems to me that it is based on what existed at that time. But, I lack expertise to know that, so will claim the "philosophy" angle for now.

$\endgroup$
0
$\begingroup$

CPU usually can have a lot of logical gates to perform operations, since any gate can be expressed as NAND-gate, so it's possible to build computers with NAND-gates only, although this will not be efficient.

Now if I understand your question, instead of building a CPU with NAND-gates you want to build it with 1 single NAND-gate. In other words, you are looking to reduce the number of gates (and therefore transistors) in your CPU, such CPU will probably be unusable, slow, no parallelism and it won't be able handle large operations. It may also require a huge amount of ram to compensate for the speed loss and to store intermediate results.

$\endgroup$
6
  • $\begingroup$ Thank you for your answer. Yes, replace the ALU (or equivalent) with the smallest number of logical gates needed to compute anything, and, this would be either a single NAND or a NOR gate (and I used NAND in question since it appears more often when I study basic computer science. ) That this forces some other part of CPU or RAM to increase in transistors, makes perfect sense, I assumed so too. $\endgroup$
    – Pancake
    Oct 23 '21 at 22:15
  • $\begingroup$ Why I was interested, the question "what is the smallest number of instructions needed to be Turing complete and be able to compute all other instructions" is pretty common, and I was thinking same thing for the logic computation itself. $\endgroup$
    – Pancake
    Oct 23 '21 at 22:15
  • $\begingroup$ It might be an extremely stupid way to build a CPU, I was/am just interested if it is possible. As a learning experience, good to reduce a computer to absolute minimum needed and then build from there (how I study other things like biology, I always go backwards evolutionarily, much easier. ) $\endgroup$
    – Pancake
    Oct 23 '21 at 22:16
  • 1
    $\begingroup$ @ user206904 this looks a lot like what I was thinking of, hackaday.com/2020/11/23/…. I have to study it a bit, just saw the article, but, looks exactly like my idea. $\endgroup$
    – Pancake
    Oct 24 '21 at 7:29
  • $\begingroup$ Great find! I quote " It may be slow" and "it still manages to ... and acts as a decent calculator". It's pretty much what I said in my answer, it can barely be useful for some basic arithmetic and it is very slow. They obviously did it for fun, not because there is something to gain out of it. $\endgroup$
    – user206904
    Oct 24 '21 at 9:23

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.