Elements of Logic

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.

via GIPHY

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

AND
OR
Buffer

NAND
NOR
NOT (Inverter)
XOR
XNOR

Logic Function Descriptions

FunctionDescription
ANDIf all inputs are TRUE (1), then the output is TRUE (1), else the output is FALSE (0)
ORIf any input is TRUE (1), then the output is TRUE (1), else the output is FALSE (0).
BufferThe 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.
NORIf any input is TRUE (1), then the output is FALSE (0), else the output is TRUE (1). Same logic as OR followed by NOT.
NOTThe output is the inverse of the input.
XORExclusive OR. If any input is TRUE (1), but not both, then the output is TRUE (1), else the output is FALSE (0).
XNORExclusive 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 AInput BOutput: A AND B
000
010
100
111

NAND
Input AInput BOutput: A AND B
001
011
101
110
OR
Input AInput BOutput: A OR B
000
011
101
111

NOR
Input AInput BOutput: A OR B
001
010
100
110
Buffer
Input AOutput = A
00
11

NOT
Input AOutput = NOT A
01
10
XOR
Input AInput BOutput: A OR B
000
011
101
110

XNOR
Input AInput BOutput: A OR B
001
010
100
111

Next: Binary & Hexidecimal Numbering Systems