chap01 digital logic circuits - sangjidblab.sangji.ac.kr/downloads/csa/chap01.pdf3 instruction set...
TRANSCRIPT
Chap. 1 Digital Logic CircuitsComputer System Architectures
Database Lab.University of SANGJI University
2
What Is Computer Architecture?Computer Architecture =
Instruction Set Architecture + Machine Organization
3
Instruction Set Architecture• ISA = attributes of the computing system as seen by
the programmer– Organization of programmable storage– Data types & data structures– Instruction set– Instruction formats– Modes of addressing– Exception handling
4
Machine Organization• Capabilities & performance characteristics of
principal functional units (e.g., registers, ALU, shifters, logic units)
• Ways in which these components are interconnected
• Information flow between components
• Logic and means by which such information flow is controlled
What is “Computer”• A computer is a machine that performs computational
tasks using stored instructions.
A computer consist of … ?
1) Central processing unit (CPU);
2) Random access memory (RAM);
3) Input-output processors (IOP).
• These devices communicate to each other through a set of electric wires called bus.
CPU consists of
• > Arithmetic logic unit (ALU): Executes arithmetic (addition, multiplication,...) and logical (AND, OR,...) operations.
• > Control unit: Generates a sequence of control signals (cf. traffic signal) telling the ALU how to operate; reads and executes microprograms stored in a read only memory (ROM).
• > Registers: Fast, small memory for temporary storage during mathematical operations.
RAM stores
• > Program: A sequence of instructions to be executed by the computer
• Data
9
History of Computers
• The world’s first general-purpose electronic computer was ENIAC built by Eckert and Mauchly at the University of Pennsylvania
during World War II. However, rewiring this computer to perform a new task requires
days of work by a number of operators.
10
• The first practical stored-program computer was
• EDSAC built in 1949 by Wilkes of Cambridge University.
• Now the program in addition to data is stored in the memory so that different problems can be solved without hardware rewiring anymore.
The first practical stored-program computer
11
Eckert and Mauchly later went to business, and built the first commercial computer in the United States, UNIVAC I, in 1951.
UNIVAC I
12
IBM System/360 seriesA commercial breakthrough occurred in 1964 when IBM
introduced System/360 series.
The series include various models ranging from $225K to $1.9M with varied performance but with a singleinstruction set architecture.
13
Supercomputers
The era of vector supercomputers started in 1976 when Seymour Cray built Cray-1 Vector processing is a type of parallelism which speeds up computation. We will learn related concept of pipelining in this course.
In late 80’s, massively parallel computers such as the CM-2 became the central technology for supercomputing.
14
Another important development is the invention of the microprocessor--a computer on a single semiconductor chip.
Microprocessors
15
Microprocessors enabled personal computers such as the Apple II (below) built in 1977 by Steve Jobs and Steve Wozniak.
personal computers
16
Moore’s Law• In 1965, Gordon Moore predicted that the number of transistors
per integrated circuit would double every 18 months. This prediction, called "Moore's Law," continues to hold true today. The table below shows the number of transistors in several microprocessors introduced since 1971.
17
Moore’s Law Still Holds
’60 ’65 ’70 ’75 ’80 ’85 ’90 ’95 ’00 ’05 ’10
Tran
sist
ors P
er D
ie
1K4K 16K
64K256K
1M
16M4M
64M
4004
80808086
80286i386™
i486™Pentium®
MemoryMicroprocessor
Pentium® IIPentium® III
256M
Pentium® 4Itanium®
1G2G4G
128M
Source: Intel
108
107
106
105
104
103
102
101
100
109
1010
1011
512M
0000000000000000011111110000011110001000111110001011011010001011
(a) Analog form (b) Sampled analog form (c) Digital form
Magnetic tape contaning analog and digital forms of a signal.
18
Digital Systems - Analog vs. Digital
•Analog vs. Digital: Continuous vs. discrete.
•Results--- Digital computers replaced analog computers
Digital Advantages• More flexible (easy to program), faster, more precise.
• Storage devices are easier to implement.
• Built-in error detection and correction.
• Easier to minimize.
20
Binary System• Digital computers use the binary number system.
Binary number system: Has two digits: 0 and 1.
• Reasons to choose the binary system:1. Simplicity: A computer is an “idiot” which blindly
follows mechanical rules; we cannot assume any prior knowledge on his part.
2. Universality: In addition to arithmetic operations, a computer which speaks a binary language can perform any tasks that are expressed using the formal logic.
ExampleAdding two numbers
High-level language (C)
c = a + b;
Assembly language
LDA 004
ADD 005
STA 006
Machine language
0010 0000 0000 0100
0001 0000 0000 0101
0011 0000 0000 0110
22
Boolean algebraSince the need is great for manipulating the
relations between the functions that contain the binary or logic expression, Boolean algebra has been introduced.
The Boolean algebra is named in honor of a pioneering scientist named: George Boole.
A Boolean value is a 1 or a 0.A Boolean variable takes on Boolean values. A Boolean function takes in Boolean variables and produces Boolean values.
23
Boolean or logic operations1. OR. This is written + (e.g. X+Y where X and Y are
Boolean variables) and often called the logical sum. OR is called binary operator.
2. AND. Called logical product and written as a centered dot (like product in regular algebra). AND is called binary operator.
3. NOT. This is a unary operator (One argument), NOT(A) is written A with a bar over it or use ' instead of a bar as it is easier to type.
4. Exclusive OR (XOR).
Written as + with circle around it ⊕. It is also a binary operator.
True if exactly one input is true (i.e. true XOR true = false).
24
INPUT XOR A⊕B
A B
0 0 0
0 1 1
1 0 1
1 1 0
INPUT OR A+B
A B
0 0 0
0 1 1
1 0 1
1 1 1
INPUT AND A.B
A B
0 0 0 1
0 1 0 1
1 0 0 1
1 1 1 0
TRUTH TABLES
___A.B
25
Important identities of Boolean ALGEBRA.
Identity: A+0 = 0+A = A A.1 = 1.A = A
Inverse: A+A' = A'+A = 1 A.A' = A'.A = 0 (using ' for not)
+ for OR. for AND
Important identities of Boolean ALGEBRA• Associative:
– A+(B+C) = (A+B)+C – A.(B.C)=(A.B).C
• Due to associative law we can write A.B.C since either order of evaluation gives the same answer.
• Often elide the . so the product associative law is A(BC)=(AB)C
Important identities of Boolean ALGEBRA• Distributive:
– A(B+C)=AB+AC Similar to math.– A+(BC)=(A+B)(A+C) Contradictory to math.
• How does one prove these laws??– Simple (but long) write the Truth Tables for each and
see that the outputs are the same.
28
Important identities of Boolean ALGEBRA.
Logic GatesFormal logic: In formal logic, a statement (proposition) is
a declarative sentence that is either
true(1) or false (0).
It is easier to communicate with computers using formal logic.
• Boolean variable: Takes only two values – either
true (1) or false (0).
They are used as basic units of formal logic.
Boolean function and logic diagram
• Boolean function: Mapping from Boolean variables to a Boolean value.
• Truth table: – Represents relationship between a
Boolean function and its binary variables. – It enumerates all possible combinations of
arguments and the corresponding function values.
Boolean function and logic diagram• Boolean algebra: Deals with binary variables and logic
operations operating on those variables.
• Logic diagram: Composed of graphic symbols for logic gates. A simple circuit sketch that represents inputs and outputs of Boolean functions.
Gates• Refer to the hardware to implement Boolean
operators.
• The most basic gates are
Boolean function and truth table
BASIC IDENTITIES OF BOOLEAN ALGEBRA• Postulate 1 (Definition): A Boolean algebra is a closed
algebraic system containing a set K of two or more elements and the two operators · and + which refer to logical AND and logical OR
Basic Identities of Boolean Algebra(Existence of 1 and 0 element)(1) x + 0 = x
(2) x · 0 = 0
(3) x + 1 = 1
(4) x · 1 = 1
(Table 1-1)
Basic Identities of Boolean Algebra (Existence of complement)(5) x + x = x
(6) x · x = x
(7) x + x’ = x
(8) x · x’ = 0
Basic Identities of Boolean Algebra (Commutativity):(9) x + y = y + x
(10) xy = yx
Basic Identities of Boolean Algebra (Associativity):
(11) x + ( y + z ) = ( x + y ) + z
(12) x (yz) = (xy) z
Basic Identities of Boolean Algebra (Distributivity):(13) x ( y + z ) = xy + xz
(14) x + yz = ( x + y )( x + z)
Basic Identities of Boolean Algebra (DeMorgan’s Theorem)(15) ( x + y )’ = x’ y’
(16) ( xy )’ = x’ + y’
Basic Identities of Boolean Algebra (Involution)(17) (x’)’ = x
Function Minimization using Boolean Algebra
• Examples:
(a) a + ab = a(1+b)=a
(b) a(a + b) = a.a +ab=a+ab=a(1+b)=a.
(c) a + a'b = (a + a')(a + b)=1(a + b) =a+b
(d) a(a' + b) = a. a' +ab=0+ab=ab
Try• F = abc + abc’ + a’c
The other type of question
Show that;
1- ab + ab' = a
2- (a + b)(a + b') = a
1- ab + ab' = a(b+b') = a.1=a
2- (a + b)(a + b') = a.a +a.b' +a.b+b.b'
= a + a.b' +a.b + 0
= a + a.(b' +b) + 0
= a + a.1 + 0
= a + a = a
More Examples• Show that;
(a) ab + ab'c = ab + ac(b) (a + b)(a + b' + c) = a + bc
(a) ab + ab'c = a(b + b'c)= a((b+b').(b+c))=a(b+c)=ab+ac
(b) (a + b)(a + b' + c) = (a.a + a.b' + a.c + ab +b.b' +bc)
= …
DeMorgan's Theorem(a) (a + b)' = a'b'
(b) (ab)' = a' + b'
Generalized DeMorgan's Theorem
(a) (a + b + … z)' = a'b' … z'
(b) (a.b … z)' = a' + b' + … z‘
DeMorgan's Theorem• F = ab + c’d’
• F’ = ??
• F = ab + c’d’ + b’d
• F’ = ??
DeMorgan's TheoremShow that: (a + b.c)' = a'.b' + a'.c'
More DeMorgan's example
Show that: (a(b + z(x + a')))' =a' + b' (z' + x')
(a(b + z(x + a')))' = a' + (b + z(x + a'))'= a' + b' (z(x + a'))'= a' + b' (z' + (x + a')')= a' + b' (z' + x'(a')')= a' + b' (z' + x'a)=a‘+b' z' + b'x'a=(a‘+ b'x'a) + b' z' =(a‘+ b'x‘)(a +a‘) + b' z' = a‘+ b'x‘+ b' z‘= a' + b' (z' + x')
More Examples(a(b + c) + a'b)'=b'(a' + c')
ab + a'c + bc = ab + a'c= AB + A'C + ABC + A'BC .... By expanding BC= AB(1 + C) + A'C(1 + B) .....(1 + C) =1, also (1 + B) = 1= AB + A'C .....Proved
(a + b)(a' + c)(b + c) = (a + b)(a' + c)
..... Using Products of Sums, (A + C)(B + A') = AB + A'C + BC
= (aa’+ac+a’b+bc)(b+c)
= (ac+a’b+bc)(b+c) = abc+a’bb+bbc+acc+a’bc+bcc = abc+a’b+bc+ac+a’bc+bc
= abc+bc+ac+a’b(1+c) = bc(a+1)+ac+a’b = bc+ac+a’b =a’b+bc+ac =(a+b)(a’+c)
Minimization of Boolean expressions• The minimization will result in reduction of
the number of gates (resulting from less number of terms) and the number of inputs per gate (resulting from less number of variables per term)
• The minimization will reduce cost, efficiency and power consumption.
• y(x+x`)=y.1=y• y+xx`=y+0=y• (x`y+xy`)=x⊕y• (x`y`+xy)=(x⊕y)`
Minimum SOP and POS
• The minimum sum of products (MSOP) of a function, f, is a SOP representation of f that contains the fewest number of product terms and fewest number of literals of any SOP representation of f.
Minimum SOP and POS
• f= (xyz +x`yz+ xy`z+ …..)
Is called sum of products.
The + is sum operator which is an OR gate.
The product such as xy is an AND gate for the two inputs x and y.
Minterm and Maxterm
Example
• Minimize the following Boolean function using sum of products (SOP):
• f(a,b,c,d) = ∑m(3,7,11,12,13,14,15)
abcd 3 00117 011111 101112 110013 110114 111015 1111
a`b`cda`bcdab`cdabc`d`abc`dabcd`abcd
Examplef(a,b,c,d) = ∑m(3,7,11,12,13,14,15) =a`b`cd + a`bcd + ab`cd + abc`d`+ abc`d + abcd` +
abcd =cd(a`b` + a`b + ab`) + ab(c`d` + c`d + cd` + cd )=cd(a`[b` + b] + ab`) + ab(c`[d` + d] + c[d` + d])=cd(a`[1] + ab`) + ab(c`[1] + c[1])=ab+ab`cd + a`cd =ab+cd(ab` + a`)=ab+ cd(a + a`)(a`+b`)= ab + a`cd + b`cd = ab +cd(a` + b`)
Minimum product of sums (MPOS)
• The minimum product of sums (MPOS) of a function, f, is a POS representation of f that contains the fewest number of sum terms and the fewest number of literals of any POS representation of f.
• The zeros are considered exactly the same as ones in the case of sum of product (SOP)
Karnaugh Maps (K-maps)• Karnaugh maps -- A tool for representing Boolean
functions of up to six variables.
• K-maps are tables of rows and columns with entries represent 1`s or 0`s of SOP and POS representations.
Karnaugh Maps (K-maps)• An n-variable K-map has 2n cells with each
cell corresponding to an n-variable truth table value.
• K-map cells are labeled with the corresponding truth-table row.
• K-map cells are arranged such that adjacent cells correspond to truth rows that differ in only one bit position (logical adjacency).
Karnaugh Maps (K-maps)• If mi is a minterm of f, then place a 1 in cell i of the K-
map.
• If Mi is a maxterm of f, then place a 0 in cell i.
• If di is a don’t care of f, then place a d or x in cell i.
Karnaugh MapTruthTable
BooleanFunction
Unique Many different expressions existSimplification from Boolean function
- Finding an equivalent expression that is least expensive to implement- For a simple function, it is possible to obtain
a simple expression for low cost implementation- But, with complex functions, it is a very difficult task
Karnaugh Map (K-map) is a simple procedure forsimplifying Boolean expressions.
TruthTable
Booleanfunction
KarnaughMap
SimplifiedBooleanFunction
Examples• Two variable K-map f(A,B)=∑m(0,1,3)=A`B`+A`B+AB
1 10 1
B 0 1A 0 1
Three variable map
• f(A,B,C) = ∑m(0,3,5)= A`B`C`+A`BC+AB`C
1 1A`BC
1AB`C
A`B`C`
A
B
C
A BC
0
1
00 01 11 10
Karnaugh Map
• K-map cells that are physically adjacent are also logically adjacent. Also, cells on an edge of a K-map are logically adjacent to cells on the opposite edge of the map.
• If two logically adjacent cells both contain logical 1s, the two cells can be combined to eliminate the variable that has value 1 in one cell’s label and value 0 in the other.
Simplification of Boolean Functions ; Using K-maps
Simplification of Boolean Functions ; Using K-maps
• This is equivalent to the algebraic operation, aP + a′ P =P
where P is a product term not containing a or a′.
• A group of cells can be combined only if all cells in the group have the same value for some set of variables.
Simplification Guidelines for K-maps
• Always combine as many cells in a group as possible. This will result in the fewest number of literals in the term that represents the group.
• Make as few groupings as possible to cover all minterms. This will result in the fewest product terms.
• Always begin with the largest group, which means if you can find eight members group is better than two four groups and one four group is better than pair of two-group.
Simplification Guidelines for K-maps
Example
Example(Fig 1-10 ~ 1-13)
AND/OR, NAND/NOR logic diagram
Inverted-OR NAND
Different styles of drawing mapsf(A,B,C) = ∑m(1,2,3,6) = A′C + BC′
1
CAB
00 01 11 100 2 6 4
3 7 5
0
1
B
1 1
1 1
A
C
BCA 00 01 11 10
0
1
1 1 1
1
11 11
C
AB0 1
00
01
11
10
•Minterms that may produce either 0 or 1 for the function.
•They are marked with an ´ in the K-map.
•This happens, for example, when we don’t input certain minterms to the Boolean function.
•These don’t-care conditions can be used to provide further simplification of the algebraic expression.
(Example) F = A`B`C`+A`BC` + ABC`
d=A`B`C +A`BC + AB`C
F = A` + BC`
Don’t-care conditionB
1 1
1
Five variable K-mapsUse Two Four-variable K-Maps
a`=0 map a=1 map
11
11
11
11
1 1
f(a,b,c,d,e) = ∑m(0,5,7,13,15,16,21,23,29,31)a` f
0 1
1
2
3
4
5 1
6
7 1
8
9
10
11
12
13 1
14
15 1
a f
16 1
17
18
19
20
21 1
22
23 1
24
25
26
27
28
29 1
30
31 1
a`=0 map a=1 map
11
11
11
11
1 1
F1=a`b`c`d`e` + a`ce, F2=ace + ab`c`d`e`f(a,b,c,d,e) = f1+f2
F=(a+a`)ce + (a+a`)b`c`d`e`=ce + b`c`d`e`