0% found this document useful (0 votes)
29 views

Chapter 1 & 2

The document discusses computer organization and architecture. It introduces basic digital logic components like logic gates, flip-flops, and sequential circuits. It then describes computer architecture as dealing with the high-level design of a computer system, while computer organization focuses on how the components are interconnected and how information flows between them. The basic components of a computer like CPU, memory, and I/O devices are also outlined. Combinational logic circuits like adders, decoders, and multiplexers are explained. Finally, common flip-flop circuits like SR, D, and JK are briefly described.

Uploaded by

miki
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Chapter 1 & 2

The document discusses computer organization and architecture. It introduces basic digital logic components like logic gates, flip-flops, and sequential circuits. It then describes computer architecture as dealing with the high-level design of a computer system, while computer organization focuses on how the components are interconnected and how information flows between them. The basic components of a computer like CPU, memory, and I/O devices are also outlined. Combinational logic circuits like adders, decoders, and multiplexers are explained. Finally, common flip-flop circuits like SR, D, and JK are briefly described.

Uploaded by

miki
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 78

Computer Organization and Architecture

Chapter One
Introduction to Digital Logic and
Digital Systems
• Computer organization and architecture
• Basic components of Digital computer
• Logic Gates
• Combinational Circuits
• Flip-Flops
• Sequential Circuits
• Common Digital Components

3/22/2023 1
1.1 Computer Architecture and Organization
What is Computer Architecture?
• It is concerned with the structure and behavior of various
functional modules (HW and SW) of a digital computer as well as
how these modules interact to meet the requirement of the user
• Deals with interface between hardware and software
• It helps us to understand the functionalities of a system. (deals
with high-level design issues)
• Is those attributes visible to the programmer
 Describes WHAT the computer does (logical view)
• Examples:

 the instruction set (what operations can be performed?)


 the number of bits used to represent various data types
 methods used for input-output (I/O mechanism), etc.
3/22/2023 2
Computer Architecture and Organization
Computer Organization
• It is concerned with ways in which the hardware
components operate and the way they are interconnected
together to form a computer system
• Concerned with information flow between components and
means by which such information flow is controlled
• It covers the hardware units and their connection details
• Is internal arrangements of a computer, how features are implemented
• Describes how it does it (how does a computer work)
• A computer's organization expresses the realization of the
architecture or how the physical aspects of a computer systems are
implemented.
• Eg. Circuit design, Control Signals, Memory types, peripherals, etc
3/22/2023 3
Computer Architecture and Organization
Computer Design:
• Is concerned with the hardware design of the computer.
• Once the computer specification is formulated, it is the task of
the designer to develop hardware for the system.
• While designing a computer architecture is considered
first. An organization is done on the basis of architecture.

3/22/2023 4
1.2 Basic Components of Computer
• The digital computer is a digital system that performs
various computational tasks.
• Computer is made up of the following HW components:
– A Central Processing Unit
• Arithmetic & Logic Unit
• Control Unit
• Registers
– Memory
• any physical device capable of storing information
temporarily or permanently
– Primary Memory (Usually called RAM)
– Secondary Memory or Mass Storage (Disk drives)
– Input and Output Devices
• allow the computer system to interact with the outside world by
moving data into and out of the system.
3/22/2023 5
Organization of the computer

Block Diagram of a digital Computer


3/22/2023 - How computer work
1.3 Logic Gates
• The building blocks used to create digital circuits are
logic gates
– Gates are used as the building blocks in the design of more
complex digital logic circuits
• There are three elementary logic gates and a range of
other simple gates
• Each gate has its own logic symbol which allows
complex functions to be represented by a logic diagram
• The function of each gate can be represented by a truth
table or using Boolean notation

3/22/2023
Logic Gates
• The 7 basic logic gates includes: AND, OR,
NOT, NAND, NOR, XOR, and XNOR.
1. The AND gate

3/22/2023
Logic Gates
2. The OR gate

3/22/2023
Logic Gates
3. The NOT gate (or inverter)

3/22/2023
Logic Gates
4. The NAND gate
– Is the complement of AND gate

3/22/2023
Logic Gates
5. The NOR gate
– Is the complement of OR gate

3/22/2023
Logic Gates
6. The Exclusive OR gate

C=A’B+AB’

3/22/2023
Logic Gates
7. The Exclusive NOR gate

3/22/2023
1.4 Combinational Circuits
• A combinational circuit is a connected arrangement of logic
gates with a set of inputs and outputs.
• The output is dependent upon combination of input
variable.
• The state of the output at any instant is entirely
determined by the states of the inputs at that time.
• Gates are basic combinational circuits themselves, and gates
used to construct more complex combinational functions.
• Combinational circuits are employed in digital computers:
– For generating binary control decisions and
– For providing digital components required for data
processing
3/22/2023
1.4 Combinational Circuits
Combinational logic
where the outputs are determined solely(only)
by the current states of the inputs

Examples
• Adders (Half adder and Full adder)
• Decoders /Encoders
• Multiplexers/ Demultiplexers
• Comparator
Used to implement comparison operators (= , > , < ,  , )
3/22/2023
Half-Adder
• The most basic digital arithmetic circuit.
• Performs the addition of two binary digits.
• The input variables of a half-adder are called the augends
• The output variables of a half-adder are called the sum (S) and
the carry (C).

half adder
S = x’y+xy’=x ⊕ y
C=xy

3/22/2023
Full-Adder
• A full-adder performs the addition of three binary digits.
• Two half-adders can be combined to form a full-adder.
• Full adder has three inputs and two outputs
• The full adder circuit contains two half adders and an OR gate.
• We have to use k-map to draw logic circuit.

3/22/2023
Decoder
A decoder is a combinational circuit that converts binary
information from the n coded inputs to a maximum of 2n unique
outputs.
Consists of: n Inputs and 2n Outputs (numbered from 0 - 2n - 1)
2 to 4 decoder

3/22/2023
Decoder
• The truth table of 3-to-8 Decoder is shown below:

3/22/2023
Decoder
Logic Diagram for 3-to-8 Decoder

Decoders typically include one or more enable inputs


to control (turn on/off) the operation of a circuit.

3/22/2023
Multiplexer (MUX)/selector
• It is a combinational circuit that receives input from
one of 2n input data lines and directs it to a single
output line.
• The selection of a particular input data line for a
particular output is determined by a set of selection
inputs.
• A 2n-to-1 multiplexer has 2n input data lines and n
input selection lines.

3/22/2023
3/22/2023
Multiplexers
• Multiplexer 4-data input MUX
– 2n data inputs
– n selection
inputs
– a single output

• Selection input
determines the
input that
should be
connected to
the output
3/22/2023
Multiplexers
• Like encoders, Multiplexers can have an enable
input to control the operation of the unit.

Function Table

4-to-1
multiplexer

3/22/2023
1.5 Flip-Flops
• Are the single bit storage devices
• Flip flops are the smallest temporary storage units
/memory/of a computer
• It is a binary cell capable of storing just one bit of
information (it contains 0 or 1)
• It is a bistable device (i.e. it has two stable states: its
output remains either high (1) or low (0))
• The high state ,i.e, 1 is called Set and the low state, i.e,
0 is called the Reset or clear state

3/22/2023
1.5 Flip-Flops
 All flip flops have 2 outputs,
 one for the normal value (Q) and other giving a value
opposite to the value stored in the flip flop (Q’)
 Flip flops are of many types depending on the
number of inputs they have and how these inputs
affect the outputs.
 The most common types of flip flops are:
• SR Flip- Flop
• D Flip- Flop
• JK Flip- Flop
• T Flip- Flop
3/22/2023
1.5 Flip-Flops
• SR (set-reset) Flip- Flop
– Can be constructed using two NOR gates
– There are two inputs (S & R) and two outputs (Q &
Q’)

S R Q
R Q 0 0 hold
0 1 0
1 0 1
S Q' 1 1 disallow

3/22/2023
1.5 Flip-Flops
• SR Flip Flops S R Q0 Q Q’
0 0 0 0 1
Q = Q0
0 0 1 1 0
0 1 0 0 1
R 1
Q=0
10 0 1 1 0 1
Q 1 0 0 1 0
Q=1
1 0 1 1 0
1 1 0 0 0 Q = Q’
1 1 1 0 0 Q = Q’
S Q
1 0

3/22/2023
1.5 Flip-Flops

• SR Flip- Flop

3/22/2023
1.5 Flip-Flops
• Disadvantages of SR flip flop
1. It needs two data inputs a high S to store a 1 bit
and a high R to store 0 bit
• Generation of two signals to drive a flip flop is difficult in
many applications
2. The SR flip flop puts a forbidden(invalid)
condition that both S and R can not be high at the
same time

3/22/2023
1.5 Flip-Flops
D Flip Flop
• The D (Data) flip flop is a slight modification of SR flip flop
• SR flip flop is converted to D flip flop by inserting an
inverter b/n S and R and assigning the symbol D to the
signal input

3/22/2023
1.5 Flip-Flops
JK Flip Flop
• Is a refinement of the SR flip flop in that the
indeterminate condition of the SR type is define
in the JK type
• Inputs J and K behave like inputs S and R to set
and clear the flip flop, respectively
• When inputs J and K are both equal to 1, a clock
transition switches the outputs of the flip flop to
their complement state.

3/22/2023
1.5 Flip-Flops
JK Flip Flop
• Instead of the indeterminate condition, the JK
flip flop has a complement condition

3/22/2023
1.5 Flip-Flops
T Flip Flop
• T(Toggle) flip flop is obtained from a JK flip flop when
inputs J and K are connected to provide a signal input
designated by T. (both J and K inputs are always equal)
• When T=0 (J=K=0) a clock transition does not change the
state of the flip flop
• When T=1 (J=K=1) a clock transition complements the
state of the flip flop

3/22/2023
1.6 Sequential Circuits
• Is an interconnection of flip flops and gates
/combinational circuits/
• the current output of a sequential circuit depends on the
current input and the current state of that circuit.
• Remembering the past is the key feature of
sequential circuits.

3/22/2023
1.6 Sequential Circuits
The two major uses of Sequential circuits in digital
systems are:
 As memories to store information while processing
 As control circuits to generate control signals which
are essential to select and enable a sequence of data
transfer or data processing steps in the execution of
multistep tasks
Examples
 Registers
 Counter

3/22/2023
Registers
• An n-bit register has a group of n flip-flops and is capable
of storing any binary information of n bits.
• In addition to flip-flops, registers can have combinational
gates that perform certain data-processing tasks.
– The gates control how and when new information is
transferred into the registers.
• The transfer of new information into a register is referred
to as a loading the register.
• If the loading occurs simultaneously at a common clock
pulse transition, we say that the load is done in parallel.

3/22/2023
Registers
• The load input in a register determines the action to be
taken with each clock pulse.
• When the load input is 1, the data from the input lines is
transferred into the register's flip-flops.
• When the load input is 0, the data inputs are inhibited and
the flip-flop maintains its present state.

• 4 bit register

3/22/2023
1.7. Integrated Circuits (IC)
• Digital circuits are constructed with integrated circuits
• The various gates are interconnected inside the chip to form
the required IC
• An IC is a piece (also called a chip) of silicon on which
multiple gates or transistors have been embedded
• These silicon pieces are mounted on a plastic or ceramic
package with pins along the edges that can be soldered onto
circuit boards or inserted into appropriate sockets

• SSI chip contains independent NAND gates


• The inputs and outputs of the gates are connected directly to the pins in the package
3/22/2023
1.7. Integrated Circuits (IC)
• As the technology of ICs has improved , the number of gates
that can be put in a single chip has increased considerably.

Abbreviation Name Number of Gates Examples


SSI Small Scale Less than 10
Integration
MSI Medium Scale 10 to 200 decoders, adders,
Integration registers
LIS Large Scale between 200 and a Processors, Memory
Integration few thousand chips
VLSI Very large Scale Thousands large memory arrays,
Integration complex microcomputer
chips

3/22/2023
Chapter Two:
Data Representation
• Data representation refers to the form in which data is
stored, processed, and transmitted
• In computers instructions and data are stored in binary
number system consists of 0 and 1.
• The computer is required to store the following types of
data:
1. Numbers used in arithmetic computations
2. Alphabets used in symbolic instructions
3. Special Characters and symbols
 Computers internally store all data in binary form, i.e,
as strings of 0’s and 1’s.

3/22/2023
Data Representation
• Since binary numbers are awful to see and work
with, octal and hexadecimal numbers are most
widely used to compress long string of binary data.
i.e,
– It is difficult for a human to work with long strings
of 0’s and 1’s
– Octal and Hexadecimal are ways to group bits
together

3/22/2023
Data Representation
• BIT for Binary Digit -- each 0 or 1 in the binary system
– Single bit is not overly useful
• Bits commonly stored and manipulated in groups
• BYTE – a group of bits (8 bits = 1 byte)
– Each byte represents one character of data
• Numbers, letters, special characters (%, $, # etc.)
• Letter, numbers and symbols are the form we use to
represent information.
• WORD – the number of bits that can be processed at one time by
the central processing unit of the computer. (4 bytes = 1 word (in
many systems)
– Early computers – Apple II – 8 bit Words,
– Modern machines – can process up to 64 bits/word

3/22/2023
Common Number Systems:
The base of number system represents the number of
digits that are used in the system.
The digits always begin with 0 and continue through one
less than the base
System Base Symbols

Decimal 10 0, 1, … 9
Binary 2 0, 1
Octal 8 0, 1, … 7
Hexa- 16 0, 1, … 9,
decimal A, B, … F

3/22/2023
Decimal Binary Octal Hexa
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
16 10000 20 10
3/22/2023
Conversion Among Bases

• The possibilities:

Decimal Octal

Binary Hexadecimal

3/22/2023
Base Conversion
Converting a decimal number into binary
(decimal  binary)
 Divide the decimal number by 2 and take its remainder
 The process is repeated until it produces the result of 0
 The binary number is obtained by taking the remainder
from the bottom to the top

3/22/2023
Example: Decimal  Binary

5310 => 53 / 2 = 26 remainder 1


26 / 2 = 13 remainder 0
13 / 2 = 6 remainder 1 Read from
the bottom
6 / 2 = 3 remainder 0 to the top
3 / 2 = 1 remainder 1
1 / 2 = 0 remainder 1

= 1101012 (6 bits)
= 001101012 (8 bits)
(note: bit = binary digit)

3/22/2023
0.8110  binary???
0.1100112
0.8110 => 0.81 x 2 = 1.62
0.62 x 2 = 1.24
0.24 x 2 = 0.48
0.48 x 2 = 0.96
0.96 x 2 = 1.92
0.92 x 2 = 1.84
= 0.1100112 (approximately)

3/22/2023
Converting a binary number into decimal
• Multiply each bit in the binary number with the weight (or
position)
• Add up all the results of the multiplication performed
• The desired decimal number is the total of the multiplication
results performed
Example: Binary Decimal
a)1110012 (6 bits)
(1x25) + (1x24) + (1x23) + (0x22) + (0x21) + (1x20)
= 32 + 16 + 8 + 0 + 0 + 1=5710
b)000110102 (8 bits)
= 24 + 23 +21
= 16 + 8 + 2=2610

3/22/2023
Binary to octal
– 3 digits in binary is equivalent to 1
digit in octal
Binary Octal
000 0 In a computer
001 1 system, the
conversion from
010 2
binary to octal or
011 3 otherwise is based
100 4 on the conversion
table above.
101 5
110 6
111 7

3 digits in base-2 (binary) is equivalent to 1 digit in base-8 (octal)

3/22/2023
Example: Binary  Octal

Convert these binary numbers into octal


numbers:
(a) 001011112 (8 bits) (b) 111101002 (8 bits)

Refer to the binary- Refer to the binary-


octal conversion table octal conversion table
000 101 111 011 110 100

0 5 7 3 6 4

= 578 = 3648
3/22/2023
Binary − Hexadecimal Conversion
Hex Binary
• Each group of 4 bits represents 0
1
0000
0001
a hexadecimal digit 2 0010
3 0011
4 0100
5 0101
Assume Zeros 6 0110
Example: 7 0111
8 1000
( 1 0 1 1 0 . 0 1 )2 9 1001
A 1010
B 1011
C 1100
D 1101
(1 6 . 4 )16 E 1110
F 1111

Works both ways (Binary to Hex & Hex to Binary)


3/22/2023
Example: Octal  Hexadecimal
Convert the following octal numbers
into hexadecimal numbers (16 bits)
(a) 658 (b) 1238
Refer to the binary-octal conversion table Refer to the binary-octal conversion table

68 58 18 28 38
110 101 001 010 011
0000 0000 0011 01012 0000 0000 0101 00112
0 0 3 5 0 0 5 3
= 3516 = 5316
octal  binary  hexadecimal
3/22/2023
Example: Hexadecimal  Binary

Convert the following hexadecimal


numbers into binary numbers
(a) 12B16 (b) ABDE16

Refer to the binary-hexadecimal Refer to the binary-hexadecimal


conversion table conversion table

1 2 B16 A B D E16
0001 0010 10112 (12 bits) 1010 1011 1101 11102
= 0001001010112 = 10101011110111102
3/22/2023
Signed Integer Representation

• Signed integers are usually used by programmers


• Unsigned integers are used for addressing purposes
in the computer (especially for assembly language
programmers)
• Three representations of signed integers:
1. Sign-Magnitude
2. Ones Complement
3. Twos Complement

3/22/2023
1. Sign-Magnitude

• The easiest representation


• The leftmost bit in the binary number represents the
sign of the number. 0 if positive and 1 if negative
• The balance bits represent the magnitude of the
number.

3/22/2023
Examples:

i) 8 bits binary number

Sign bit 7 bits for magnitude (value)


0 => +ve 1 => –ve

a) +7 = 0 0 0 0 0 1 1 1
(–7 = 100001112)
b) –10 = 1 0 0 0 1 0 1 0
(+10 = 000010102)
3/22/2023
ii) 6 bits binary number

5 bits for magnitude (value)


Sign bit
0 => +ve 1 => –ve
a) +7 = 0 0 0 1 1 1
(–7 = 1 0 0 1 1 12)
b) –10 = 1 0 1 0 1 0
(+10 = 0 0 1 0 1 02)

3/22/2023
2. Ones Complement
• In the ones complement representation, positive
numbers are same as that of sign-and-magnitude
Example: +5 = 00000101 (8 bit)
as in sign-magnitude representation
• Sign-magnitude and ones complement use the same
representation above for +5 with 8 bits and all positive
numbers.
• For negative numbers, their representation are obtained
by changing bit 0 → 1 and 1 → 0 from their positive
numbers

3/22/2023
Example:

Convert –5 into ones complement


representation (8 bit)
Solution:
• First, obtain +5 representation
in 8 bits  00000101
• Change every bit in the number
from 0 to 1 and vice-versa.
• –510 in ones complement is
111110102

3/22/2023
Exercise:

Get the representation of ones


complement (6 bit) for the following
numbers:

i) +710 ii) –1010

Solution: Solution:

(+7) = 0001112 (+10)10 = 0010102

So,
(-10)10 = 1101012

3/22/2023
3. Twos complement
• Similar to ones complement, its positive number is same as
sign-magnitude
• Representation of its negative number is obtained by adding 1
to the ones complement of the number.
Example: Convert –5 into twos complement representation
and give the answer in 8 bits.
Solution:
 First, obtain +5 representation in 8 bits
000001012
 Obtain ones complement for –5 111110102
 Add 1 to the ones complement number:
111110102 + 12 = 111110112
 –5 in twos complement is 111110112

3/22/2023
Exercise:

• Obtain representation of twos


complement (6 bit) for the
following numbers
i) +710 ii)–1010
Solution: Solution:

(+7) = 0001112 (+10) 10 = 0010102


(same as sign-magnitude)

(-10) 10 = 1101012 + 12
= 1101102
So, twos compliment
for –10 is 1101102
3/22/2023
10/26/2019 63
Exercise:
Obtain representation for the following
numbers

Decimal Sign-magnitude Twos complement


+7
+6 4 bits
-4
-6
-7
+18
-18 8 bits

-13

3/22/2023
Solution:
Obtain representation for the following
numbers

Decimal Sign-magnitude Twos complement


+7 0111 0111
+6 0110 0110
-4 1100 1100
-6 1110 1010
-7 1111 1001
+18 00010010 00010010
-18 10010010 11101110
-13 11110010 11110011

3/22/2023
Floating point representation

• Floating-Point Numbers are useful for applications


where very large and very small numbers are needed
simultaneously
• The signed magnitude, 1’s complement, and 2’s
complement representations as such are not useful
in scientific or business applications that deal with
real number values over a wide range.
• Floating-point representation solves this problem.

3/22/2023
Floating point representation
• Computers use a form of scientific notation for floating-
point representation
• Numbers written in scientific notation have three
components:

• Computer representation of a floating-point number


consists of three fixed-size fields:

• This is the standard arrangement of these fields.

3/22/2023
Floating point representation
• Floating numbers “normalized” to utilize
maximum precision possible
– number arranged so that first bit of mantissa
always a non-zero digit.
– For binary, this means the first digit must be a 1
• A fixed place is chosen for the binary point of
the mantissa, say immediately after the first
digit.

3/22/2023
Floating point representation
example

3/22/2023
Floating point representation
Biased Exponent Notation
• The value actually stored for the exponent made always
positive which simplifies implementation of floating
point operations.
• the bias is a fixed positive constant big enough to make
all “biased exponents” positive.
• Two reasons quoted for using baised notation:
– easier to design hardwrae for floating point arthmetic
– Easier to sort numbers as can sort simply on bit patterns.

3/22/2023
Floating point representation
• The IEEE has established a standard for floating-point numbers
• IEEE (Institute of Electrical and Electronics Engineers) Standard
Floating-Point Format (IEEE 754)
Short (32-bit) format
Short exponent range is –127 to 128
but the two extreme values
8 bits, 23 bits for fractional part are reserved for special operands
bias = 127, (plus hidden 1 in integer part)
–126 to 127
(similarly for the long format)

Sign Exponent Significand


11 bits,
bias = 1023, 52 bits for fractional part
–1022 to 1023 (plus hidden 1 in integer part)

Long (64-bit) format


Fig. The two IEEE standard floating-point formats.

3/22/2023
Floating point representation

• A bias is a number that is approximately midway in the range of


values expressible by the exponent.

3/22/2023
Floating point representation

• To increase the precision of the significand, the IEEE 754


Standard uses a normalized significand which implies that
its most significant bit is always 1.
• As this is implied, it is assumed to be on the left of the
(virtual) binary point of the significand.
3/22/2023
Floating point representation

3/22/2023
Floating point representation
Exercises:
1. Express the decimal number -3.75 as a floating point
number using IEEE single precision (32 bit format).
2. Represent 10101010.010101 in the floating point
representation,
Assume we use the following figure to represent floating
point number in a 32 bit system: (Exponent Bias=2n-1-1 for
an n bit exponent)

3/22/2023
Floating point representation

3/22/2023

You might also like