X nand y nand x nand y
![x nand y nand x nand y x nand y nand x nand y](https://slidetodoc.com/presentation_image/c6916af88e3eab2b151f28936f0eb507/image-63.jpg)
My question is why not just let the dev specify "Here is a NAND operation just do that"? I assume and pray that some compiler or something is smart enough to optimize this (after all, I see NAND in some IBM instruction sets), but I haven't heard of higher-level languages having an operator that explicitly invokes it. I know each of these gates is a single processor instruction, but wouldn't that instruction be so much more efficient if it only passed through one gate rather than several? This seems silly and inefficient to me! Just look at the first line of the implementation of C = NOT ( A AND B ): it gives us the result right away! But we toss it back and forth a few times after that anyway to return to the result we started with. The problem I see is that, since each of these operators is implemented in the processor as a combination of NANDs, then expressing NAND as these compositions might have them be executed as this: C = NOT ( A AND B )Ĭ = ( ( A NAND B ) NAND ( A NAND B ) ) NAND ( ( A NAND B ) NAND ( A NAND B ) )Ĭ = ( ( A NAND A ) NAND ( A NAND A ) ) NAND ( ( B NAND B ) NAND ( B NAND B ) ) I've seen arguments saying that these languages don't contain a dedicated NAND operator since C = A NAND B can be expressed as these: C = NOT ( A AND B ) So, it just makes sense to me that it would be really efficient for a program to say "Hey, I have a NAND operation for you please pass it through only one gate and store the result in a register." However, as far as I'm aware, no such operator exists in actual compiled languages. For example, processors compose NAND gates like this to create these operators: A AND B = ( A NAND B ) NAND ( A NAND B ) since these are the languages which actually implement golfing languages.Īs far as I know, modern processors are made up of NAND gates, since any logic gate can be implemented as a combination of NAND gates. All rights reserved.I know that some golfing languages like APL have a dedicated NAND operator, but I'm thinking about languages like C, C++, Java, Rust, Go, Swift, Kotlin, even instruction sets, etc. New Math Functions i.Ĭopyright (c) 2000-2014 Gepsoft Ltd.
![x nand y nand x nand y x nand y nand x nand y](https://image1.slideserve.com/3011405/minimal-set-l.jpg)
![x nand y nand x nand y x nand y nand x nand y](https://d10lpgp6xz60nq.cloudfront.net/question-thumbnail/en_304980274.png)
You must preview your comment first before finally posting. There are currently no comments on this article. In the next post I'll talk about the similar NOR System and the NOR Grammar of GeneXproTools. So depending on our goals, we must articulate the different tools at our disposal (especially circuit architecture, function set and linking functions) to create the kind of circuit that we need. This kind of inflation happens a lot every time we use more exoteric logical functions in the design of our logic circuits. Y = gepNand(y,gepNand(gepNand(gepNand(d,gepNand(d,d)),Īs you can see, we went from a minimal circuit with just 11 literals to a NAND circuit with 20 literals, almost doubling in complexity. Y = gepNand(y,gepNand(gepNand(gepNand(gepNand(d,d), So, here's the first minimal logic circuit created for the 6-Multiplexer using just NAND gates as building blocks:
X NAND Y NAND X NAND Y CODE
Like in the previous post " Go Language: NOT-AND-OR Grammar", I'll be using again the 6-Multiplexer function in all the code examples, but you'll notice I'll be using a simpler architecture as I want to keep the circuits small even after converting them to the NAND system. But let's illustrate this with a few code examples to show off our new Go Grammar. Note, however, that GeneXproTools also allows you to design/evolve your logic circuits using NAND gates alone as building blocks, and this is the recommended course of action if you want your circuits to include only NAND gates, since you'll be able to create much more compact circuits if you do. And like we just saw for the XOR function, any logical function or logic circuit can be defined in terms of NAND's alone (the same is true for the NOR function, but I'll talk about the NOR Universal System in the next post).Īnd that's what the NAND Grammar of GeneXproTools is all about! It defines all the 258 built-in logical functions of GeneXproTools in terms of NAND gates alone, allowing us to design our logic circuits using all kinds of logical functions and then convert them automatically to NAND gates. And this is because the NAND gate is a Universal Logical System that can be used to define all kinds of logical expressions.įor example, we can define the XOR function using NAND operators alone but there's no way to express the NAND function using only XOR. NAND gates play an important role in electronics as we can build all kinds of electronic circuits with just NAND gates.