Logic is an important subject for electrical engineers, because semiconductor components can be used to implement any logic function, and logic functions can do useful things like system control, data storage, signal processing, and just about any type of math. So, in this section we are going to cover logic functions, logic components, logical numbering systems, logical math, and how to convert your logic into a circuit.

## Logic States

#### There are two logic states: TRUE and FALSE.

In the realm of pure logic, there is nothing in between true and false. Mathematically, these two states can be represented by numbers, and by convention we assign TRUE = 1, and FALSE = 0.

#### 1 = TRUE, 0 = FALSE

Logic states can also be represented by a digital signal. Digital signals have two valid states: high voltage, and low voltage. (Current can also be used as a digital signal, but using voltage is much more common.) You might jump to the conclusion that convention assigns high voltage = TRUE and low voltage = FALSE, but this is incorrect. Each state of the signal can mean either logic state, but which state that is must be defined for each signal. An ACTIVE-HIGH signal is defined to have high voltage = TRUE and low voltage = FALSE. An ACTIVE-LOW signal is defined to have low voltage = TRUE, and high voltage = FALSE.

#### Active-High: HIGH = TRUE

Active-Low: LOW = TRUE

Typically, we name signals in such a way to indicate whether it is active-high or active-low. For example, many folks add an _L to the end of a signal to indicate active low, or a lower-case n before the signal. For exmple, nRESET or RESET_L are common names for active-low reset. Active-high names typically do not have any special characters such as just RESET.

## Logic Functions

Logic functions take one or more logic inputs and performs a logical operation to produce an output. These functions can be represented by a table that lists each possible state of the inputs with the corresponding output state. This is called a Truth Table. For example, one basic logic function is AND. When input A is TRUE and input B is TRUE, then the output of A AND B is TRUE. For all other states of the inputs, the output is FALSE.

### Symbols

## Logic Function Descriptions

Function | Description |

AND | If all inputs are TRUE (1), then the output is TRUE (1), else the output is FALSE (0) |

OR | If any input is TRUE (1), then the output is TRUE (1), else the output is FALSE (0). |

Buffer | The output equals the input. |

NAND | If all inputs are TRUE (1), then the output is FALSE (0), else the output is TRUE (1). Same logic as AND followed by NOT. |

NOR | If any input is TRUE (1), then the output is FALSE (0), else the output is TRUE (1). Same logic as OR followed by NOT. |

NOT | The output is the inverse of the input. |

XOR | Exclusive OR. If any input is TRUE (1), but not both, then the output is TRUE (1), else the output is FALSE (0). |

XNOR | Exclusive NOR. If any input is TRUE (1), but not both, then the output is FALSE (0), else the output is TRUE (1). |

hdghf

## Truth Tables

AND | ||

Input A | Input B | Output: A AND B |

0 | 0 | 0 |

0 | 1 | 0 |

1 | 0 | 0 |

1 | 1 | 1 |

NAND | ||

Input A | Input B | Output: A AND B |

0 | 0 | 1 |

0 | 1 | 1 |

1 | 0 | 1 |

1 | 1 | 0 |

OR | ||

Input A | Input B | Output: A OR B |

0 | 0 | 0 |

0 | 1 | 1 |

1 | 0 | 1 |

1 | 1 | 1 |

NOR | ||

Input A | Input B | Output: A OR B |

0 | 0 | 1 |

0 | 1 | 0 |

1 | 0 | 0 |

1 | 1 | 0 |

Buffer | |

Input A | Output = A |

0 | 0 |

1 | 1 |

NOT | |

Input A | Output = NOT A |

0 | 1 |

1 | 0 |

XOR | ||

Input A | Input B | Output: A OR B |

0 | 0 | 0 |

0 | 1 | 1 |

1 | 0 | 1 |

1 | 1 | 0 |

XNOR | ||

Input A | Input B | Output: A OR B |

0 | 0 | 1 |

0 | 1 | 0 |

1 | 0 | 0 |

1 | 1 | 1 |