# SECTION II-1: DIGITAL SYSTEM - Binary Logic and Logic Gates

__Binary Logic__:

Computers use the binary number system because the two voltage levels can be represented as the two digits 0 and 1. Signals in digital electronics have two distinct voltage levels. A system may define 0V as logic '0' and +5V as logic '1'. Picture below demonstrated this system with built-in tolerances for variations in the voltage.

**Binary Signals:**

__Logic Gates__:

Binary logic gates are simple circuits that take one or more input signals and send out one output signal. Several of these are demonstrated below.

**AND Gate:- **

The AND gate takes two or more inputs and performs a logic AND on them. If both inputs to the AND gate are 1, the output will be 1. Any other combination of inputs will give a 0 output. The example shows two inputs, x and y. Multiple outputs are also possible for logic gates. In the case of AND, if all inputs are 1, the output is 1. If any input is 0, the output is 0.

Logical AND Function | |
---|---|

Inputs |
Output |

X Y | X AND Y |

00 | 0 |

01 | 0 |

10 | 0 |

11 | 1 |

**OR Gate:****-**

The OR logic function will output a 1 if one or more inputs is 1. If all inputs are 0, then and only then will the output be 0.

Logical OR Function | |
---|---|

Inputs |
Output |

X Y | X OR Y |

00 | 0 |

01 | 1 |

10 | 1 |

11 | 1 |

**Tri-State Buffer:-**

A buffer gate does not change the logic level of the input. It is used to isolate or amplify the signal.

**Inverter:-**

The inverter, also called NOT gate, outputs the value opposite to that input to the gate. A 1 input will give a 0 output, while a 0 input will give a 1 output.

Logical Inverter | |
---|---|

Input |
Output |

X | NOT X |

0 | 1 |

1 | 0 |

**XOR Gate:-**

The XOR gate performs an exclusive-OR operation on the inputs. Exclusive-OR produces a 1 output if one, but only one, input is 1. If both operands are 0, the output is 0. If both operands are 1, the output is also 0. In below truth table whenever are two inputs are the same, the output is 0. This function can be used to compare two bits to see if they are the same.

Logical XOR Function | |
---|---|

Inputs |
Output |

X Y | X XOR Y |

00 | 0 |

01 | 1 |

10 | 1 |

11 | 0 |

**NAND Gate:-**

The NAND gate functions like an AND gate with an inverter on the output. It produces a 0 output when all the inputs are 1. Otherwise it produces a 1 output when all the inputs are 0. NAND gate are used extensively in digital design because they are easy and inexpensive to fabricate. Any circuit that can be designed with AND, OR, XOR and INVERTER gates can be implemented using only NAND and NOR gates

Logical NAND Function | |
---|---|

Inputs | Output |

X Y | X NAND Y |

00 | 1 |

01 | 1 |

10 | 1 |

11 | 0 |

**NOR Gate:-**

The NOR gate functions like an OR gate with an inverter on the output. It produces a 1 output when all the inputs are 0. Otherwise it produces a 0 output when all the inputs are 1. NOR gate are used extensively in digital design because they are easy and inexpensive to fabricate. Any circuit that can be designed with AND, OR, XOR and INVERTER gates can be implemented using only NAND and NOR gates

Logical NOR Function | |
---|---|

Inputs |
Output |

X Y | X NOR Y |

00 | 1 |

01 | 0 |

10 | 0 |

11 | 0 |