# Lecture 5.1

```Lecture 5.1:
Digital Logic:
Gates and Boolean Algebra
Gates
Digital circuits are constructed from a small number
of primitive elements by combining them in
innumerable ways
A digital circuit is one where only two logical values
are present (example high voltage and low voltage,
or binary 0 and binary 1)
Gates compute a function based on input values
Five basic gates include NOT (inverter), OR
(disjunction function), AND (conjunction function),
NOR (OR+NOT), NAND (AND+NOT)
CS211
Reference: Structured Computer Organization, Chapter 3
Gates
Lecture Exercise 1:
What is XOR and how do we draw a gate for XOR?
Gates
Boolean Algebra
Digital circuits, formed from gates, can be
represented by boolean algebra – where variables
and functions can take only values 0 and 1
A boolean function has one or more input variables
and yields a result depending on values of these
variables
Truth tables can be used to represent boolean
functions
5 Basic Gates:
Boolean Algebra
Example: “Majority” function
(a) Truth table; (b) Circuit for the function
Boolean Algebra
Another notation to represent boolean functions:
Determine which combination of input values give an output
of 1 (look up the truth table for rows that have output 1)
Assuming x is an input variable, represent an inverted input
value (0) as x (a bar above x) and a not an inverted value
(1) as x
Combine all appropriate variables with AND (.) and OR (+)
to form the function
Example: For the previous “Majority” function,
M = A.B.C + A.B.C + A.B.C + A.B.C
OR f(x,y,z) = xyz + xyz + xyz + xyz
Such an expression is called the disjunctive normal
form (DNF) of the function
Implementing Functions
The circuit for the boolean function can be drawn
from the truth table or from the DNF expression we
saw before
Refer to Slide #6 for an example!
Lecture Exercise 2:
Draw a circuit for the XOR function (Hint: Draw truth
table and determine DNF expression first)
```
Arab people

15 Cards