# Boolean Algebra question

#### bibble235

Joined May 29, 2018
40
Started on the road to FPGAs and looking at boolean algrebra. I was doing the full adder example and wanted to confirm my assumption. There answer was used the expression (A ^ B) and mine used (!A ^ !B).

Are these equivalent and therefore negation does not matter for XOR if the same?

Here is my full solution

Code:
module full_adder (

// Inputs
input   [2:0]   pmod,

// Output
output  [1:0]   led
);
wire A;
wire B;
wire C;

// Set A, B, and C  to buttons and off
assign A = ~pmod[0];
assign B = ~pmod[1];
assign C = ~pmod[2];

// Taken from above working
// led[0] C (A̅ ⊕ B̅) + AB
// led[1] C ⊕ A ⊕ B

// Cout
assign led[0] = (C & (!A ^ !B) ) | (A & B);

// S
assign led[1] = C ^ A ^ B;

endmodule
Thanks,

#### MrChips

Joined Oct 2, 2009
27,695
It would be easier to tell the differences if you drew the truth-table for each function and compare them.

#### Papabravo

Joined Feb 24, 2006
19,610
You also know that A ^ B = A!B + !AB
And therefore !A ^ !B = !A!!B + !!A!B = !AB + A!B
So yes, they are the same because '+' (the inclusive OR operator) is commutative.

#### WBahn

Joined Mar 31, 2012
27,903
Started on the road to FPGAs and looking at boolean algrebra. I was doing the full adder example and wanted to confirm my assumption. There answer was used the expression (A ^ B) and mine used (!A ^ !B).

Are these equivalent and therefore negation does not matter for XOR if the same?
Does not matter if WHAT is the same?

You should be able to quickly convince yourself whether or not the two expressions are the same by preparing a truth table for both.

But since you specifically mention Boolean algebra in the thread title, it might be more educational for you to see if you can prove they are the same using Boolean algebra. It only takes about three lines of algebra.

A sometimes useful takeaway is that each inversion at either the input or the output of an XOR toggles it between an XOR and an XNOR. This extents to multi-input XOR gates. This is useful because if you need an XNOR and all you have is XOR, you don't have to put the additional inverter in the output path. Instead, you have the option of trying to remove an inversion in the longest input path, or add an inversion in a shorter input path and thereby not slow down the logic at all. Also, removing an inversion in one of the input paths reduces the gate count and the power consumption.

#### bibble235

Joined May 29, 2018
40
You also know that A ^ B = A!B + !AB
And therefore !A ^ !B = !A!!B + !!A!B = !AB + A!B
So yes, they are the same because '+' (the inclusive OR operator) is commutative.
This is what I arrived at, but confidence drains when you are working different realm for the first time. The language is also new too (e.g. commutative - probably a poor education). Top that with operators all re-symbolized (loving + means OR) and shot of dyslexia

We are getting there though. Onto chapter 5. And this is immensely helpful with my actual electronics. Love there is a real purpose to binary algebra which is tangible.

Still cannot get u+0305 to work on Chrome Android so keeping notes on my wiki is hard too. e.g. A̅ ⊕ B̅ shows up incorrectly.

#### Papabravo

Joined Feb 24, 2006
19,610
This is what I arrived at, but confidence drains when you are working different realm for the first time. The language is also new too (e.g. commutative - probably a poor education). Top that with operators all re-symbolized (loving + means OR) and shot of dyslexia

We are getting there though. Onto chapter 5. And this is immensely helpful with my actual electronics. Love there is a real purpose to binary algebra which is tangible.

Still cannot get u+0305 to work on Chrome Android so keeping notes on my wiki is hard too. e.g. A̅ ⊕ B̅ shows up incorrectly.
Interesting because basic abstract algebra was part of the "New Math" that I was "subjected" to in 1959 when I started the 7th grade. I keep forgetting that other people have different pathways to get where they are. I applaud your industry – keep it up.

#### bibble235

Joined May 29, 2018
40
Interesting because basic abstract algebra was part of the "New Math" that I was "subjected" to in 1959 when I started the 7th grade. I keep forgetting that other people have different pathways to get where they are. I applaud your industry – keep it up.
I did not finish school, but I did do algebra but not with booleans only quadratic, a small amount of calculus. I had to relearn how to eat and walk last year so I do not see any shame learning or re-learning something.

It is FSM next, Did not understood a single word about regarding Q, q0, δ, λ, X, Y. Like boolean algebra recognise some elements, heard of tuples and state machines implemented them in assembly, c++, C#, blah blah blah, but most of the text on https://www.javatpoint.com/finite-state-machine means nothing so it is off to youtube tonight.

Good news is I can ask questions on forums like this. I do not mind being of lesser intelligence, instead grateful for what I can learn. Each according to their gifts as they say.

#### panic mode

Joined Oct 10, 2011
2,363
There answer was used the expression (A ^ B) and mine used (!A ^ !B).

Are these equivalent and therefore negation does not matter for XOR if the same?
they are equivalent...

XOR returns TRUE when inputs are different (one is TRUE and other is FALSE).
if you invert both inputs, you get still the same thing, just inputs a and b have swapped places but that makes no difference to outcome.

#### panic mode

Joined Oct 10, 2011
2,363
state machines are simple and can be implemented in any logic or programming language.
the bottom line is that there could be several states (a finite number) and transitions or change of state. change of states only occurs when specific conditions are met. one can associate different conditions to each transition and this can be as simple or complex as needed. then FSM will blindly follow the path of different stated based on configuration, current state and conditions encountered.

#### bibble235

Joined May 29, 2018
40
state machines are simple and can be implemented in any logic or programming language.
the bottom line is that there could be several states (a finite number) and transitions or change of state. change of states only occurs when specific conditions are met. one can associate different conditions to each transition and this can be as simple or complex as needed. then FSM will blindly follow the path of different stated based on configuration, current state and conditions encountered.
Thanks for this, A day on and a day further down the road. Did the Digi-key tutorial for my FPGA and some of it made sense but the eye opener for me was the youtube
by Intermation which made the Digi-key one make more sense. Key for me was the phrase directed graph which helped me understand the diagrams.

None of it is too much of a challenge but tieing it back to things you already know is the key for me. He did bring up karnaugh maps which will be for tonight but I think they look like an alternative to rationalisation of boolean algebra. - love learning.

#### Janis59

Joined Aug 21, 2017
1,537
General Excel is able to make a Boolean Algebra calculus.

#### Ian0

Joined Aug 7, 2020
6,713
Boolean algebra was invented in order to prove the existence of evil.