09-11-2009 09:48 AM
A public service announcement for today, "Compound Arithmetic". I try to remember to use this function when I sit down and just start wiring up a formula. It can really improve the readability and editability (is that a word?) of many formulas. For instance compare the following simple example
Not only does it look better already, inevitably I will need to add an operation in the middle which will either require manual shifting or making space on the BD which often moves a lot more things than I would like. My only gripe with this function is that the inversion dots can be a little hard to see sometimes and there is plenty of space in the terminal area to provide a better indication.
As usual VIOTD groundrules are here.
09-11-2009 10:22 AM
Also, not only can the inputs be inverted, but so can the output.
It works for the multiply mode as well by doing a division instead of multiplication. Or on the output, it is a reciprocal.
Of course for AND, OR, XOR, inversion means applying the NOT function to it.
What is interesting is that you can do an XOR on more than 2 inputs. I never thought about that possibility before. What is the result of XOR'ing multiple booleans? It looks like if an odd number of booleans are true, then the result is true. If an even number of booleans are true, than the output is false. I wonder what a practical use of that function would be.
09-11-2009 10:28 AM
Ravens Fan wrote:
What is interesting is that you can do an XOR on more than 2 inputs. I never thought about that possibility before. What is the result of XOR'ing multiple booleans? It looks like if an odd number of booleans are true, then the result is true. If an even number of booleans are true, than the output is false. I wonder what a practical use of that function would be.
I believe that the inverse Gray code is found from a cascade of XORs, is that practical?
09-11-2009 10:29 AM - edited 09-11-2009 10:30 AM
it can be made to be practical lol:)
09-11-2009 10:43 AM - edited 09-11-2009 10:45 AM
Ravens Fan wrote:...
What is the result of XOR'ing multiple booleans? It looks like if an odd number of booleans are true, then the result is true. If an even number of booleans are true, than the output is false. I wonder what a practical use of that function would be.
I believe that is called a "half-adder". A "half-adder" does the math for adding two boolean bits. The third bit is the "Carry-in" from next least significant bit.
So if you are adding 1 plus 1 and have a carry-in of 1 then the result for that digit is 1 with a carry-out to the next more significant bit. If you chain enough of these together along with other stuff, and you have an ALU.
Ben