Chapter 1 Computer Architecture and Orgnization
Chapter 1 Computer Architecture and Orgnization
Instructor:- Zerihun T.
E-mail:- [email protected]
1
Digital
Computers
A Digital computer can be considered as a digital system
that performs various computational tasks.
By convention, the digital computers use the binary number system, which
has two digits: 0 and 1. A binary digit is called a bit.
A computer system is subdivided into two functional entities: Hardware and
Software.
The hardware consists of all the electronic components and
electromechanical devices that comprise the physical entity of the device.
The software of the computer consists of the instructions and data that the
computer manipulates to perform various data-processing tasks.
2
The Central Processing Unit (CPU) contains an arithmetic and logic unit for
manipulating data, a number of registers for storing data, and a control circuit for
fetching and executing instructions.
The memory unit of a digital computer contains storage for instructions and data.
The Random Access Memory (RAM) for real-time processing of the data
The Input-Output
.
devces for generating inputs from the user and displaying the final
results to the user.
The Input-Output devices connected to the computer include the keyboard, mouse,
3
terminals, magnetic disk drives, and other communication devices
Introduction to Logic Gates
• We will introduce Boolean algebra and logic gates
• Logic gates are the building blocks of digital circuits
Logic Variables
In electronic circuits the two values can be represented by e.g.,
High voltage for a 1 >>on>>True>> 5volts
Low voltage for a 0>>off>>False>>0 volts
Note that since only 2 voltage levels are used, the circuits have greater
immunity to electrical noise 4
Logic Gates
• Basic logic circuits with one or more inputs and one output are
known as gates
• Gates are used as the building blocks in the design of more complex
digital logic circuits
Representing of Logic Function
There are several ways of representing logic functions:
Symbols to represent the gates
Truth tables
Boolean algebra
We will now describe commonly used gates
5
Boolean expressions
Uses Boolean algebra, a mathematical notation for expressing two-
valued logic
Logic diagrams
A graphical representation of a circuit; each gate has its own symbol
Truth tables
A table showing all possible input value and the associated output values
6
Gates
Seven types of gates
NOT
AND
OR
XOR
NAND
NOR
ENOR
A buffer, is a basic logic gate that passes its input, unchanged, to its output.
A buffer has one input and one output; its output always equals its input
7
NOT Gate
A NOT gate accepts one input signal (0 or 1) and returns the opposite signal as
output
=A
10
NAND (NOT AND ) Gate
The NAND gate accepts two input signals. If both are 1, the output is 0;
otherwise, the output is 1
X =+
11
NOR (NOT OR ) Gate
The NOR gate accepts two input signals . If both are 0, the output is 1;
otherwise, the output is 0
12
XOR Gate
An XOR gate accepts two input signals If both are the same, the output is 0;
otherwise, the output is 1
Note the difference between the XOR gate and the OR gate;
they differ only in one input situation
When both input signals are 1, the OR gate produces a 1 and the XOR produces a 0
XOR is called the exclusive OR
X=
X=(A+B).()
13
EXNOR gate
The 'Exclusive-NOR' gate circuit does the opposite to the EOR gate.
If both are the same, the output is 1; otherwise, the output is 1
It will give a low output if either, but not both, of its two inputs are high. The symbol is an
EXOR gate with a small circle on the output.
The small circle represents inversion.
14
Review of Gate Processing
A NOT gate inverts its single input
An AND gate produces 1 if both input values are 1
An OR gate produces 0 if both input values are 0
An XOR gate produces 0 if input values are the same
A NAND gate produces 0 if both inputs are 1
A NOR gate produces a 1 if both inputs are 0
An ENOR the output is 1 if input values are the same
15
Boolean algebra
Boolean algebra can be considered as an algebra that deals with binary
variables and logic operations. Boolean algebraic variables are designated by
letters such as A, B, x, and y.
The basic operations performed are AND, OR, and complement.
The Boolean algebraic functions are mostly expressed with binary variables,
logic operation symbols, parentheses, and equal sign.
For a given value of variables, the Boolean function can be either 1 or 0.
For instance, consider the Boolean function:
The relationship between Boolean function its binary variable can be
represented in a truth table.
To represent function in the truth table we need a list of combination of the
of the n binary ,where n is a number of variables. 16
Boolean algebra
For instance, consider the Boolean function:
F = x + y'z
1.List The truth Table
2.Draw he logic Diagram
The Boolean function F = x + y'z is transformed from an algebraic expression
into a logic AND, OR, and inverter gates.
Inverter at input 'y' generates its complement y'.
There is an AND gate for the term y'z, and an OR gate is used to combine the
two terms (x and y'z).
17
Example of Boolean Function
The truth table for the Boolean function F = x + y'z can be represented as:
18
Boolean Algebra
19
Simplified Form of Boolean Function(Logic Minimization)
• Any Boolean function can be implemented directly using
combinational logic (gates)
• However, simplifying the Boolean function will enable the number of
gates required to be reduced. Techniques available include:
– Algebraic manipulation (as seen in examples)
– Karnaugh (K) mapping (a visual approach)
• K mapping is the preferred technique for up to about 5 variables
Description of Kmaps and Terminology
A Kmap is a matrix consisting of rows and columns that represent the output values
of a Boolean function.
The output values placed in each cell are derived from the minterms of a Boolean
function.
A minterm is a product term that contains all of the function’s variables exactly once,
either complemented or not complemented. 20
Minterms
Consider variables A and B
Assume that they are somehow combined with AND operator
There are 4 possible combinations AB, A' B, AB ' , A' B '
Each of those terms is called a minterm (standard product)
In general, if there are n variables, there are 2n minterms
Dec. Rep Designatio
List the minterms for 3 variables A B C Minterm
n
0 0 0 0 A ' B ' C'
1 0 0 1 A'B'C
2 0 1 0 A ' B C'
3 0 1 1 A'B C
4 1 0 0 A B ' C'
5 1 0 1 A B'C
6 1 1 0 A B C'
21
Karnaugh maps(K-map)
A K-map is a collection of squares
• Each square represents a minterm
• The collection of squares is a graphical representation of a Boolean function
• Adjacent squares differ in the value of one variable
• Alternative algebraic expressions for the same function are derived by
recognizing patterns of squares (corresponding to cubes)
B BC
0 1 00 01 11 10 m0 m1 m3 m2
A m0 m1 A m0 m1 m3 m2
0 0
m4 m5 m7 m6
m2 m3 1 m4 m5 m7 m6
1
m12 m13 m15 m14
2 variables 3 variables Karnaugh map m8 m9 m11 m10
Cell = 23=8
4 variables Karnaugh map 22
K-maps Paring
• Having plotted the minterms, how do we use the map to give a
simplified expression?
• Group terms
• Having size equal to a power of 2, e.g., 2, 4, 8, etc.
• Large groups best since they contain fewer variables
• Groups can wrap around edges and corners BC
A 00 01 11 10
• Now we will look at a more complicated example.
0
F = m0 + m2 + m4 + m5 + m6
1
F = z’ + x y’
23
Example
• Express F in the sum of minterms
'
F A BC
' ' ' ' '
F A BC A( B B )(C C ) ( A A ) BC
' ' ' ' ' ' '
ABC ABC AB C AB C ABC A BC
ABC ABC ' AB 'C AB 'C ' A' BC '
m7 m6 m5 m4 m2
2,4,5,6,7
The highest has function has highest minterm 7 so can be mapped to three
BC
variable which is greater that 7 00 01 11 10
A m0 m1 m3 m2
0
F=Red+Blue 1 m4 M5 m7 m6
=A+BC’ 24
Example: Let YZ
00 01 11 10
X
F (x, y, z) = m (2, 3, 6,
7) 0
1
25
Example: Simplify and Draw the truth table
F (x, y, z) = m (1, 2, 3, 5, 7)
YZ
00 01 11 10
X
DEC X y Z
0 0 0 0 0
1 0 0 1
2 0 1 1 1
3 1 1 1
4 1 0 0
5 1 0 1
6 1 1 0
7 1 1 1
F(x, y, z) =z +x y’
26
Sample Problems
Try making a truth table and k-map to reduce the following expressions.
1. F= m3 + m4 + m6 + m7
2. F= x’z + x’y + x y’z + y z
3. F (x, y, z) = m (2, 3, 4, 5)
4. F (x, y, z) = m (3, 4, 6, 7)
Solutions
1. y z + x z’
2. z + x’y
3. F (x, y, z) = x’ y + x y’
4. F (x, y, z) = y z + x z’
Conclusion
• Kmaps provide an easy graphical method of simplifying Boolean
expressions.
• A Kmap is a matrix consisting of the outputs of the minterms of a
Boolean function.
• In this section, we have discussed 2- 3- and 4-input Kmaps. This
method can be extended to any number of inputs through the use of
multiple tables.
28
Combinational Circuits
A combinational circuit comprises of logic gates whose outputs at any time are
determined directly from the present combination of inputs without
any regard to previous inputs.
A combinational circuit performs a specific information-processing operation
fully specified logically by a set of Boolean functions.
The basic components of a combinational circuit are: input variables, logic
gates, and output variables.
29
Combinational Circuits
The basic components of a combinational circuit are: input variables, logic gates, and output
variables
The 'n' input variables come from an external source whereas the 'm' output variables go to an
external destination. In many applications, the source or destination are storage registers.
Binary Addition follows these same basic rules as for the denary addition above except in
binary there are only two digits with the largest digit being “1”. So when adding binary
numbers, a carry out is generated when the “SUM” equals or is greater than two (1+1) and
this becomes a “CARRY” bit for any subsequent addition being passed over to the next
column forrdaddition and so on. Consider the single bit addition below .
3 step Truth Table
31
Combinational Circuits
Solution
4th Step
Then the Boolean expression is as follows.
For the SUM bit: SUM = A XOR B = A ⊕ B
For the CARRY bit: CARRY = A AND B = A.B
Final Step
The Logic Diagram as follows
32
Block Diagram Sequential Circuit
• A Sequential logic circuits is a form of the binary circuit; its design employs one or
more in more outputs, whose states are related to some definite rules that
depend on previous s inputs and outputs can reach either of the two states:
logic 0 (low) or logic 1 (high).
Present
Present
Past output
Example Counter Decimal Current Output 1 then the it stores the pervious
output 1+1=2,2+1=3 3+1=4, 5,6….. Therefore, we need memory elements and
33
uses to store the output
Introduction to Sequential Circuits
• A Sequential circuit contains:
– Storage elements: Inputs Outputs
Combina-tional
Latches or Flip-Flops
Logic
– Combinational Logic: Storage
Performance As the input of current instant is only On other hand Sequential circuit are comparatively slower
required in case of Combinational circuit, and has low performance as compared to that of
it is faster and better in performance as Combinational circuit.
compared to that of Sequential circuit.
Complexity No implementation of feedback makes However on other hand implementation of feedback makes
the combinational circuit less complex as sequential circuit more complex as compared to
compared to sequential circuit. combinational circuit.
Elementary Elementary building blocks for On other hand building blocks for sequential circuit are flip
Blocks combinational circuit are logic gates. flops..
Operation Combinational circuit are mainly used for On other hand Sequential circuit is mainly used for storing
arithmetic as well as Boolean operations. data.
35
Latches
• Latches are basic storage elements that operate with signal levels .
• Latches controlled by a clock transition are flip-flops.
• Latches are level-sensitive devices.
• Latches are useful for the design of the asynchronous sequential
circuit ( clockless, or self-timed circuit).
LATCHES AND FLIP-FLOP
There are two types of memory elements based on the type of triggering that is
suitable to operate it.
1.Latches
2.Flip-flops
Latches operate with enable signal, which is level sensitive. Whereas,
flip-flops are edge sensitive.
Example Needing Bit Storage 3.2
button
• Does the circuit to the right, with cross-coupled NOR gates, do what we want?
NOR Gate
• SR latch can serve as bit storage in example of Q
A B Y R (reset)
– Reset(Call)=1: sets Q to 1
0 0 1 • Q stays 1 even after Reset(Call)= 0
0 1 0 – Set (Cancel)=1 : resets Q to 0
1 0 0
1 1 0 Store:-S=0 Q= 1 R=0 Q’= 0
Case-II:-S=1 R=0 Q= 1 Q’= 0
Case-I:-S=0 R=1 Q= 1 Q’= 0 Store:-S=0 Q’= 0 R=0 Q= 0
S=0 Q S=0 S=1 Q S=0 Q
t tQ Q
t Q
t
1 1 0 0
0 0 1 1
1 1 0 0
0 Q 0 Q 1 1
Q Q Recall…
R=1 R=0 R=0 R=0
0
1 1
S 0
0
R1 1
0 a
0
t 1
Q X
0
1
Q
0
Problem with SR Latch NOR Gate
A B Y
• Problem 0 0 1
– If S=1 and R=1 simultaneously, 0 1 0
– we don’t know what value Q will take 1 0 0
1 1 1 0
S=1 Qt S=0 Qt S=0 Qt S
0
1
SR Latch Truth Table NOR Gate
0 1 0
0 0 1 R
0 S R Q a Q’b
1
Q
t
0
0 Q
0
1 Q
1
0 Q 0
0 0 Memory (As before)
0 0 Not Used
path will be slightly longer than the 0 1 1 0
other, Q will eventually settle to 1 or 0 1 0 0 1
– but we don’t know which. 1 1 Memory (As before)
Flip-Flops
• They are memory elements
• They can store binary information
• Can keep a binary state until an input signal to switch the state is received
• There are different types of flip-flops depending on the number of inputs and
how the inputs affect the binary state
1 0 1
41
Edge-Triggered Flip-Flops
• Trigger the flip-flop only during a signal transition
43
S-R Flip-Flop Descriptors S
Q(t)=Present state Q(t+1)Next State Q
Clk
• Characteristic table -
Characteristic Table
defines the next Q
Graphical Symbol
44
Edge-Triggered D Flip-Flop
The D flip-flop is a modification of the clocked SR flip-flop.
The D input goes directly into the S input and the complement
of the D input goes to the R input. The D input is sampled
during the occurrence of a clock pulse. If it is 1, the flip-flop is
switched to the set state (unless it was already set). If it is 0, the
flip-flop switches to the clear state.
Circuit
Graphical Symbol
45
JK Flip-Flop
J
D Q Q
K Q Q
Clock
(a) Circuit
J K Q (t + 1)
0 0 Q (t) J Q
0 1 0
1 0 1
K Q
1 1 Q (t )
Characteristic Table
T Q(t+1) Operation
0 Q(t) No change
1 Q(t) Complement Circuit
J Q
T
K Q
Graphical Symbol
Questions