Simple Logic Gates
Computer Logic
- Data in a computer is stored in a series of bits which are often interpreted in blocks known as bytes (8 bits).
- The ALU (Arithmetic and Logic Unit) performs arithmetic operations on data and the control unit needs to decode instructions. Both of these functions are performed by logic circuits.
- Computer Logic is based on Boolean Algebra (and, or, etc.) and it is
possible to combine such operations into complex logical expressions.
- e.g. (A OR B) AND (C NOT D).
Binary and Boolean Variables
A Binary or Boolean variable has one of two values
- often referred to as TRUE or FALSE, 1 or 0.
- As we are dealing with an electronic system there is either a voltage
present (e.g. 5 or 3.3V) a value of 1 or no voltage a value of 0.
- Most computer languages (C++, FORTRAN, BASIC) represent TRUE as non zero and FALSE as 0.
Gates
The term Gate is used to describe the members of a set of basic electronic components which, when combined with each other, are able to perform complex logical and arithmetic operations. 'Gates' are the physical realization of the simple Boolean expressions.
An understanding of the electronics within logic gates is beyond the scope of
this course however it should be noted that logic gates can be designed with
only a few electronic components. For example the following circuit diagram
shows how an 'AND' logic gate can be constructed from two transistors and a
resistor.
Types of Logic Gates
The 'OR' Gate
Truth Table
X Y X OR Y
0 0 0
0 1 1
1 0 1
1 1 1
Note:
the output value is 1 when at least one input value is 1
The 'AND' Gate
Truth Table
X Y X OR Y
0 0 0
0 1 0
1 0 0
1 1 1
Notes:
The output is 1 only when both inputs are 1
The 'NOT' Gate
Truth Table
X X OR Y
0 1
1 0
Note: Only one input
Binary Arithmetic
Addition: You add binary numbers as you would decimal numbers except you must carry when you rach the value "2" in decimal.
Examples of Binary Addition: 1 + 0 = 1; 1 + 1 = 10; 10 + 10 = 100; 11 + 10 = 101