Binary information is represented in digital computers by physical quantities called **signals**. Electrical signals such as voltages exist throughout the computer in either one of the two recognizable states. The two states represent a binary variable that can be equal to 1 or 0.

For example, a particular digital computer may employ a signal of **3 volts** to represent binary `1`

and **0.5 volt** to represent binary `0`

. Now the input terminals of digital circuits will accept binary signals of only 3 and 0.5 volts to represent binary input and output corresponding to 1 and 0, respectively.

So now we know, that at core level, computer communicates in the form of `0`

and `1`

, which is nothing but **low** and **high** voltage signals.

But how are different operations performed on these signals? That is done using different logic **Gates**.

Binary logic deals with binary variables and with operations that assume a logical meaning. It is used to describe, in algebraic or tabular form, the manipulation done by logic circuits called **gates**.

Gates are blocks of hardware that produce graphic symbol and its operation can be described by means of an algebraic expression. The input-output relationship of the binary variables for each gate can be represented in tabular form by a truth-table.

The most basic logic gates are **AND** and **inclusive OR** with multiple inputs and **NOT** with a single input.

Each gate with more than one input is sensitive to either logic 0 or logic 1 input at any one of its inputs, generating the output according to its function. For example, a multi-input AND gate is sensitive to logic 0 on any one of its inputs, irrespective of any values at other inputs.

The various logical gates are:

- AND
- OR
- NOT
- NAND
- NOR
- XOR
- XNOR

The AND gate produces the AND logic function, that is, the output is 1 if input A and input B are both equal to 1; otherwise the output is 0.

The algebraic symbol of the AND function is the same as the **multiplication** symbol of ordinary arithmetic.

We can either use a **dot** between the variables or concatenate the variables without an operation symbol between them. AND gates may have more than two inputs, and by definition, the output is 1 if and only if all inputs are 1.

The OR gate produces the inclusive-OR function; that is, the output is 1 if input A or input B or both inputs are 1; otherwise, the output is 0.

The algebraic symbol of the OR function is `+`

, similar to arithmetic **addition**.

OR gates may have more than two inputs, and by definition, the output is 1 if any input is 1.

The inverter circuit inverts the logic sense of a binary signal. It produces the NOT, or complement, function.

The algebraic symbol used for the logic complement is either a prime or a bar over the variable symbol.

The NAND function is the complement of the AND function, as indicated by the graphic symbol, which consists of an AND graphic symbol followed by a small circle.

The designation NAND is derived from the abbreviation of NOT-AND.

The NOR gate is the complement of the OR gate and uses an OR graphic symbol followed by a small circle.

The exclusive-OR gate has a graphic symbol similar to the OR gate except for the additional curved line on the input side.

The output of the gate is 1 if any input is 1 but excludes the combination when both inputs are 1. It is similar to an odd function; that is, its output is 1 if an odd number of inputs are 1.

The exclusive-NOR is the complement of the exclusive-OR, as indicated by the small circle in the graphic symbol.

The output of this gate is 1 only if both the inputs are equal to 1 or both inputs are equal to 0.

/computer-architecture/logic-gates