Digital Logic Design and Computer Organization
Digital Logic Design and Computer Organization
asia
LECTURE NOTES
ON
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
UNIT-1 PART-1
A computer can be defined as a fast electronic calculating machine that accepts the
(data) digitized input information process it as per the list of internally stored instructions
and produces the resulting information.
List of instructions are called programs & internal storage is called computer memory.
1. Personal computers: - This is the most common type found in homes, schools, Business
offices etc., It is the most common type of desk top computers with processing and storage
units along with various input and output devices.
2. Note book computers: - These are compact and portable versions of PC
3. Work stations: - These have high resolution input/output (I/O) graphics capability, but with
same dimensions as that of desktop computer. These are used in engineering applications of
interactive design work.
4. Enterprise systems: - These are used for business data processing in medium to large
corporations that
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
require much more computing power and storage capacity than work stations. Internet
associated with
servers have become a dominant worldwide source of all types of information.
5. Super computers: - These are used for large scale numerical calculations required in the
applications like weather forecasting etc.,
I
n
p A
u L
t U
P
r
o
c
e
s
I s
/ o
O r
M
e
m
o
r
y
O C
u o
t n
p t
u r
t o
l
U
n
i
t
Input device accepts the coded information as source program i.e. high level
language. This is either stored in the memory or immediately used by the processor to
perform the desired operations. The program stored in the memory determines the processing
steps. Basically the computer converts one source program to an object program. i.e. into
machine language.
Finally the results are sent to the outside world through output device. All of these
actions are coordinated by the control unit.
Input unit: -
The source program/high level language program/coded information/simply data is
fed to a computer through input devices keyboard is a most common type. Whenever a key is
pressed, one corresponding word or number is translated into its equivalent binary code over
a cable & fed either to memory or processor.
Memory unit: -
Its function into store programs and data. It is basically to two types
6. Primary memory
7. Secondary memory
Primary memory: - Is the one exclusively associated with the processor and operates at the
electronics speeds
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
programs must be stored in this memory while they are being executed. The memory
contains a large number of semiconductors storage cells. Each capable of storing one bit of
information. These are processed in a group of fixed site called word.
Number of bits in each word is called word length of the computer. Programs must
reside in the memory during execution. Instructions and data can be written into the memory
or read out under the control of processor.
Memory in which any location can be reached in a short and fixed amount of time
after specifying its address is called random-access memory (RAM).
The time required to access one word in called memory access time. Memory which
is only readable by the user and contents of which can’t be altered is called read only
memory (ROM) it contains operating system.
Caches are the small fast RAM units, which are coupled with the processor and are
aften contained on the same IC chip to achieve high performance. Although primary storage
is essential it tends to be expensive.
2 Secondary memory: - Is used where large amounts of data & programs have to be stored,
particularly information that is accessed infrequently.
Examples: - Magnetic disks & tapes, optical disks (ie CD-ROM’s), floppies etc.,
The control and the ALU are may times faster than other devices connected to a
computer system. This enables a single processor to control a number of external devices
such as key boards, displays, magnetic and optical disks, sensors and other mechanical
controllers.
Output unit:-
These actually are the counterparts of input unit. Its basic function is to send the
processed results to the outside world.
Examples:- Printer, speakers, monitor etc.
Control unit:-
It effectively is the nerve center that sends signals to other units and senses their
states. The actual timing signals that govern the transfer of data between input unit,
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
processor, memory and output unit are generated by the control unit.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Individual instructions are brought from the memory into the processor, which executes the
specified operations. Data to be stored are also stored in the memory.
This instruction adds the operand at memory location LOCA, to operand in register
R0 & places the sum into register. This instruction requires the performance of several steps,
1.First the instruction is fetched from the memory into the processor. 2.The operand at LOCA is
fetched and added to the contents of R0
3.Finally the resulting sum is stored in the register R0
The preceding add instruction combines a memory access operation with an ALU
Operations. In some other type of computers, these two types of operations are performed by
separate instructions for performance reasons.
Transfers between the memory and the processor are started by sending the address
of the memory location to be accessed to the memory unit and issuing the appropriate control
signals. The data are then transferred to or from the memory.
The fig shows how memory & the processor can be connected. In addition to the
ALU & the control circuitry, the processor contains a number of registers used for several
different purposes.
The instruction register (IR):- Holds the instructions that is currently being executed. Its
output is available for the control circuits which generates the timing signals that control the
various processing elements in one execution of instruction.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
1.MAR – (Memory Address Register):- It holds the address of the location to be accessed.
2.MDR – (Memory Data Register):- It contains the data to be written into or read out of the
address location.
1.Programs reside in the memory & usually get these through the I/P unit.
2. Execution of the program starts when the PC is set to point at the first instruction of the
program. 3.Contents of PC are transferred to MAR and a Read Control Signal is sent to the
memory.
4. After the time required to access the memory elapses, the address word is read out of the
memory and loaded into the MDR.
2. Now contents of MDR are transferred to the IR & now the instruction is ready to be decoded
and executed.
3. If the instruction involves an operation by the ALU, it is necessary to obtain the required
operands.
4. An operand in the memory is fetched by sending its address to MAR & Initiating a read
cycle.
5. When the operand has been read from the memory to the MDR, it is transferred from MDR
to the ALU.
6. After one or two such repeated cycles, the ALU can perform the desired operation.
7. If the result of this operation is to be stored in the memory, the result is sent to MDR.
8. Address of location where the result is stored is sent to MAR & a write cycle is initiated.
9. The contents of PC are incremented so that PC points to the next instruction that is to be
executed.
An interrupt is a request signal from an I/O device for service by the processor. The
processor provides the requested service by executing an appropriate interrupt service
routine.
The Diversion may change the internal stage of the processor its state must be saved in
the memory location before interruption. When the interrupt-routine service is
completed the state of the processor is restored so that the interrupted program may continue.
The simplest and most common way of interconnecting various parts of the
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
In addition to the lines that carry the data, the bus must have lines for address and
control purpose. Simplest way to interconnect is to use the single bus as shown
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Since the bus can be used for only actively use the bus at any given time. Bus requests for
use of one bus, one transfer at a time, only two units can control lines are used to arbitrate
multiple
Single bus structure is Low cost
Very flexible for attaching peripheral devices
Multiple bus structure certainly increases, the performance but also increases the cost
significantly.
All the interconnected devices are not of same speed & time, leads to a bit of a
problem. This is solved by using cache registers (ie buffer registers). These buffers are
electronic registers of small capacity when compared to the main memory but of comparable
speed.
The instructions from the processor at once are loaded into these buffers and then the
complete transfer of data at a fast rate will take place.
1.1.5 Performance
The most important measure of the performance of a computer is how quickly it can
execute programs. The speed with which a computer executes program is affected by the
design of its hardware. For best performance, it is necessary to design the compiles, the
machine instruction set, and the hardware in a coordinated way.
The total time required to execute the program is elapsed time is a measure of the
performance of the entire computer system. It is affected by the speed of the processor, the
disk and the printer. The time needed to execute a instruction is called the processor time.
Just as the elapsed time for the execution of a program depends on all units in a
computer system, the processor time depends on the hardware involved in the execution of
individual machine instructions. This hardware comprises the processor and the memory
which are usually connected by the bus as shown in the fig c.
P
r
o
c
C e
M a s
a c s
i h o
n e r
M M
e e
m m
o o
r r
y y
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Fig d: The processor cache
Let us examine the flow of program instructions and data between the memory and
the processor. At the start of execution, all program instructions and the required data are
stored in the main memory. As the execution proceeds, instructions are fetched one by one
over the bus into the processor, and a copy is placed in the cache later if the same instruction
or data item is needed a second time, it is read directly from the cache.
The processor and relatively small cache memory can be fabricated on a single IC
chip. The internal speed of performing the basic steps of instruction processing on chip is
very high and is considerably faster than the speed at which the instruction and data can be
fetched from the main memory. A program will be executed faster if the
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
movement of instructions and data between the main memory and the processor is
minimized, which is achieved by using the cache.
For example:- Suppose a number of instructions are executed repeatedly over a short period
of time as happens in a program loop. If these instructions are available in the cache, they
can be fetched quickly during the period of repeated use. The same applies to the data that
are used repeatedly.
Processor clock: -
Processor circuits are controlled by a timing signal called clock. The clock designer
the regular time intervals called clock cycles. To execute a machine instruction the processor
divides the action to be performed into a sequence of basic steps that each step can be
completed in one clock cycle. The length P of one clock cycle is an important parameter that
affects the processor performance.
Processor used in today’s personal computer and work station have a clock rates
that range from a few hundred million to over a billion cycles per second.
1.1.6 Basic performance equation
We now focus our attention on the processor time component of the total elapsed
time. Let ‘T’ be the processor time required to execute a program that has been prepared in
some high-level language. The compiler generates a machine language object program that
corresponds to the source program. Assume that complete execution of the program requires
the execution of N machine cycle language instructions. The number N is the actual number
of instruction execution and is not necessarily equal to the number of machine cycle
instructions in the object program. Some instruction may be executed more than once, which
in the case for instructions inside a program loop others may not be executed all, depending
on the input data used
Suppose that the average number of basic steps needed to execute one machine
cycle instruction is S, where each basic step is completed in one clock cycle. If clock rate is
‘R’ cycles per second, the program execution time is given by
T= N
×
S
R
this is often referred to as the basic performance equation.
We must emphasize that N, S & R are not independent parameters changing one
may affect another. Introducing a new feature in the design of a processor will lead to
improved performance only if the overall result is to reduce the value of T.
Pipelining and super scalar operation: -
We assume that instructions are executed one after the other. Hence the value of S is
the total number of basic steps, or clock cycles, required to execute one instruction. A
substantial improvement in performance can be achieved by overlapping the execution of
successive instructions using a technique called pipelining.
Consider Add R1 R2 R3
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
This adds the contents of R1 & R2 and places the sum into R3.
The contents of R1 & R2 are first transferred to the inputs of ALU. After the addition
operation is
performed, the sum is transferred to R3. The processor can read the next instruction from the
memory, while the addition operation is being performed. Then of that instruction also uses,
the ALU, its operand can be transferred to the ALU inputs at the same time that the add
instructions is being transferred to R3.
In the ideal case if all instructions are overlapped to the maximum degree possible the
execution proceeds at
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
the rate of one instruction completed in each clock cycle. Individual instructions still require
several clock cycles to complete. But for the purpose of computing T, effective value of S is
1.
A higher degree of concurrency can be achieved if multiple instructions pipelines
are implemented in the processor. This means that multiple functional units are used creating
parallel paths through which different instructions can be executed in parallel with such an
arrangement, it becomes possible to start the execution of several instructions in every clock
cycle. This mode of operation is called superscalar execution. If it can be sustained for a
long time during program execution the effective value of S can be reduced to less than one.
But the parallel execution must preserve logical
correctness of programs, that is the results produced must be same as those produced by the
serial execution of program instructions. Now a days may processor are designed in this
manner.
1. Improving the IC technology makes logical circuit faster, which reduces the time of
execution of basic steps. This allows the clock period P, to be reduced and the clock rate R
to be increased.
2. Reducing the amount of processing done in one basic step also makes it possible to
reduce the clock period P. however if the actions that have to be performed by an
instructions remain the same, the number of basic steps needed may increase.
Increase in the value ‘R’ that are entirely caused by improvements in IC technology affects
all aspects of the processor’s operation equally with the exception of the time it takes to
access the main memory. In the presence of cache the percentage of accesses to the main
memory is small. Hence much of the performance gain excepted from the use of faster
technology can be realized.
Simple instructions require a small number of basic steps to execute. Complex instructions
involve a large number of steps. For a processor that has only simple instruction a large
number of instructions may be needed to perform a given programming task. This could lead
to a large value of ‘N’ and a small value of ‘S’ on the other hand if individual instructions
perform more complex operations, a fewer instructions will be needed, leading to a lower
value of N and a larger value of S. It is not obvious if one choice is better than the other.
But complex instructions combined with pipelining (effective value of S ¿ 1) would achieve
one best performance. However, it is much easier to implement efficient pipelining in
processors with simple instruction sets.
It is very important to be able to access the performance of a computer, comp designers use
performance estimates to evaluate the effectiveness of new features.
The previous argument suggests that the performance of a computer is given by the
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Inspite of the performance equation being so simple, the evaluation of ‘T’ is highly complex.
Moreover the parameters like the clock speed and various architectural features are
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Hence measurement of
computer performance using
bench mark programs is done to
make comparisons possible,
standardized programs must be
used.
SPEC rating =
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
50
n 1
SPEC rating = π SP
n
ECi
(i=1 )
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
increased complexity and cost.
In contrast to multiprocessor
systems, it is also possible to
use an interconnected group of
complete computers to achieve
high total computational power.
These computers normally have
access to their own memory
units when the tasks they are
executing need to communicate
data they do so by exchanging
messages over a communication
network. This properly
distinguishes them from shared
memory multiprocessors,
leading to name message-
passing multi computer.
BIG-ENDIAN AND LITTLE-
ENDIAN ASIGNMENTS:-
A B B
d y y
d t t
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
r e e
e
s a a
s d d
d d
r r
e e
s s
s s
3 2 1 0
0 0 1 2 3 0
4 5 6 7 7 6 5 4
4 4
… …
. .
…
…
.
.
…
…
.
.
2 2
k k
- -
1 3
2 2
2k -4 k k
2k -3
2k -2 - -
2k -1 2 4
2 2
k k
- -
4 4
(a) Big-endian
assignment (b) Little-endian assignment
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Page 23
1.1.10. BUSES:
• e.g.
Control/Address/Data bus (PC)
WHAT IS A BUS
• A communication
pathway connecting two or
more devices
• Often grouped
• A number of channels
in one bus
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
SCHEME
DATA BUS:
• Carries data
• Width is a key
determinant of performance
ADDRESS BUS:
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
CONTROL BUS:
— Ribbon cables
— Propagation delays
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
HIGH PERFORMANCE
BUS:
BUS TYPES:
• Dedicated
• Multiplexed
— Shared lines
— Disadvantages
– Ultimate performance
BUS ARBITRATION:
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
• Arbitration may be
centralised or distributed
CENTRALIZED
ARBITRTAION:
— Bus Controller
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
— Arbiter
• 32 or 64 bit
• 50 lines
• Systems lines
• Interface Control
• Arbitration
— Not shared
• Error lines
• Interrupt lines
— Not shared
• Cache support
— Additional 32 lines
— Time multiplexed
• JTAG/Boundary Scan
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
PCI COMMANDS:
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
• Address phase
Two categories of parallel computers are discussed below namely shared common memory or
unshared distributed
memory.
Shared memory parallel computers vary widely, but generally have in common the ability for all
processors to access all
• Multiple processors can operate independently but share the same memory resources.
• Changes in a memory location effected by one processor are visible to all other processors.
• Shared memory machines can be divided into two main classes based upon memory
access times: UMA , NUMA and COMA. Uniform Memory Access (UMA):
• Identical processors
• Sometimes called CC-UMA - Cache Coherent UMA. Cache coherent means if one
processor updates a location in shared memory, all the other processors know about the
update. Cache coherency is accomplished at the hardware level.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
If cache coherency is maintained, then may also be called CC-NUMA - Cache Coherent
NUMA
The COMA model : The COMA model is a special case of NUMA machine in which the
distributed main memories are converted to caches. All caches form a global address
space and there is no memory hierarchy at each processor node.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Advantages:
• Global address space provides a user-friendly programming perspective to memory
• Data sharing between tasks is both fast and uniform due to the proximity of memory to
CPUs
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Disadvantages:
• Processors have their own local memory. Memory addresses in one processor do
not map to another processor, so there is no concept of global address space across all
processors.
• Because each processor has its own local memory, it operates independently.
Changes it makes to its local memory have no effect on the memory of other
processors. Hence, the concept of cache coherency does not apply.
• When a processor needs access to data in another processor, it is usually the
task of the programmer to explicitly define how and when data is communicated.
Synchronization between tasks is likewise the programmer's responsibility.
• Modern multicomputer use hardware routers to pass message. Based on the
interconnection and routers and channel used the multicomputers are divided into
generation
o 1st generation : based on board technology using hypercube architecture and software
controlled message switching.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
• The network "fabric" used for data transfer varies widely, though it can be as simple as
Ethernet.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Advantages:
Disadvantages:
• The programmer is responsible for many of the details associated with data
communication between processors.
• It may be difficult to map existing data structures, based on global memory, to this
memory organization.
• Non-uniform memory access (NUMA) times
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
some exceptions, most of the advances introduced in one generation are carried
through to later generations. We are currently in the fifth generation.
Ist generation of computers ( 1945-54)
The first generation computers where based on vacuum tube technology. The first large
electronic computer was ENIAC (Electronic Numerical Integrator and Calculator), which
used high speed vacuum tube technology and were designed primarily to calculate the
trajectories of missiles. They used separate memory block for program and data. Later in
1946 John Von Neumann introduced the concept of stored program, in which data and
program where stored in same memory block. Based on this concept EDVAC (Electronic
Discrete Variable
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Automatic Computer) was built in 1951. On this concept IAS (Institute of advance
studies, Princeton) computer was built whose main characteristic was CPU consist of
two units (Program flow control and execution unit).
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
The transistors were invented by Bardeen, Brattain and Shockely in 1947 at Bell Labs
and by the 1950s these transistors made an electronic revolution as the transistor is
smaller, cheaper and dissipate less heat as compared to vacuum tube. Now the
transistors were used instead of a vacuum tube to construct computers. Another major
invention was invention of magnetic cores for storage. These cores where used to large
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
random access memories. These generation computers has better processing speed,
larger memory capacity, smaller size as compared to pervious generation computer.
In 1950 and 1960 the discrete components ( transistors, registers capacitors) were
manufactured packaged in a separate containers. To design a computer these discrete
unit were soldered or wired together on a circuit boards. Another revolution in
computer designing came when in the 1960s, the Apollo guidance computer and
Minuteman missile were able to develop an integrated circuit (commonly called ICs).
These ICs made the circuit designing more economical and practical. The IC based
computers are called third generation computers. As integrated circuits, consists of
transistors, resistors, capacitors on single chip eliminating wired interconnection, the
space required for the computer was greatly reduced. By the mid-1970s, the use of ICs
in computers became very common. Price of transistors reduced very greatly. Now it
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
was possible to put all components required for designing a CPU on a single printed
circuit board. This advancement of technology resulted in development of
minicomputers, usually with 16-bit words size these system have a memory of
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
PART-2
Data Representation:
1.2.1Binary Numbers,
1.2.2Fixed Point Representation .
1.2.3Floating Point Representation.
1.2.4 Number base conversions
1.2.5 Octal and Hexadecimal Numbers,
1.2.6Signed binary numbers,
1.2.7Binary codes.
DATA REPRESENTATION
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
The ancient Indian writer Pingala developed advanced mathematical concepts for describing
prosody, and in doing so presented the first known description of a binary numeral system.A full
set of 8 trigrams and 64 hexagrams, analogous to the 3-bit and 6-bit binary numerals, were
known to the ancient Chinese in the classic text I Ching. An arrangement of the hexagrams of
the I Ching, ordered according to the values of the corresponding binary numbers (from 0 to 63),
and a method for generating thesame, was developed by the Chinese scholar and philosopher
Shao Yong in the 11th century.
In 1854, British mathematician George Boole published a landmark paper detailing an algebraic
system of logic that would become known as Boolean algebra. His logical calculus was to
become instrumental in the design of digital electronic circuitry. In 1937, Claude Shannon
produced his master's thesis at MIT that implemented Boolean algebra and binary arithmetic
using electronic relays and switches for the first time in history. Entitled A Symbolic Analysis of
Relay and Switching Circuits, Shannon's thesis essentially founded practical digital circuit design.
The radix (no of symbols in a number system is called radix) is 2. The positive binary
numbers are stored in binary notation of sign magnitude representation and negative
numbers are stored in sign magnitude or I’s complement form or 2’s complement form.
In 2’s complement representation we have only one zero. Hence 2’s complement
representation is used in computers to store the data.
It is used to represent integers either positive or negative. They are Sign Magnitude
representation, I’s complement representation and 2’s complement representation
It is used to represent real numbers. It consists of mantissa which is fraction i.e. the first
digit is a non zero digit for normalization condition and an exponent which is an integer.
If the number of bits allocated for mantissa increases the accuracy of the number is
increased, if the number of bits allocated for exponent increases the range of the number
is increased.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Any number in one base system can be converted into another base system Types
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
2) A
n
y
b
a
s
e
t
o
d
e
c
i
m
a
l
3) A
n
y
b
a
s
e
t
o
A
n
y
b
a
s
e
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
D
e
c
i
m
a
l
t
o
B
i
n
a
r
y
O
c
t
a
l
T
o
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
B
i
n
a
r
y
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Weighted binary codes are those which obey the positional weighting principles, each
position of the number represents a specific weight. The binary counting sequence is an
example.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Reflective Code
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
A code is said to be reflective when code for 9 is complement for the code for 0, and so is
for 8 and 1 codes, 7 and 2, 6 and 3, 5 and 4. Codes 2421, 5211, and excess-3 are
reflective, whereas the 8421 code is not.
Sequential Codes
Non weighted codes are codes that are not positionally weighted. That is, each
position within the binary number is not assigned a fixed value. Ex: Excess-3 code
Excess-3 Code
Excess-3 is a non weighted code used to express decimal numbers. The code derives
its name from the fact that each binary code is the corresponding 8421 code plus
0011(3).
Gray Code
The gray code belongs to a class of codes called minimum change codes, in which only one
bit in the code changes when moving from one code to the next. The Gray code is non-
weighted code, as the position of bit does not contain any weight. The gray code is a
reflective digital code which has the special property that any two subsequent numbers
codes differ by only one bit. This is also called a unit- distance code. In digital Gray code has
got a special place.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
UNIT-2
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
PART-1
Digital Logic Circuits-I:
2.1.1 Basic Logic Functions,
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Boolean algebra, like any other deductive mathematical system, may be defined with
aset of elements, a set of operators, and a number of unproved axioms or postulates. A
set of elements is anycollection of objects having a common property. If S is a set and
x and y are certain objects, then x Î Sdenotes that x is a member of the set S, and y ÏS
denotes that y is not an element of S. A set with adenumerable number of elements is
specified by braces: A = {1,2,3,4}, i.e. the elements of set A are thenumbers 1, 2, 3,
and 4. A binary operator defined on a set S of elements is a rule that assigns to each
pair ofelements from S a unique element from S._ Example: In a*b=c, we say that * is
a binary operator if it specifies a rule for finding c from the pair (a,b)and also if a, b, c
Î S.
CLOSURE: The Boolean system is closed with respect to a binary operator if for
every pair of Boolean values,it produces a Boolean result. For example, logical AND
is closed in the Boolean system because it accepts only Boolean operands and
produces only Boolean results.
_ A set S is closed with respect to a binary operator if, for every pair of elements of S,
the binary operator specifies a rule for obtaining a unique element of S.
_ For example, the set of natural numbers N = {1, 2, 3, 4, … 9} is closed with respect
to the binary operator plus (+) by the rule of arithmetic addition, since for any a, b Î N
we obtain a unique c Î N by the operation a + b = c.
ASSOCIATIVE LAW:
COMMUTATIVE LAW:
IDENTITY ELEMENT:
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
• x+0=x
• x·0=0
• x+1=1
• x·1=1
• x+x=x
• x·x=x
• x + x’ = x
• x · x’ = 0
• x+y=y+x
• xy = yx
• x+(y+z)=(x+y)+z
• x (yz) = (xy) z
• x ( y + z ) = xy + xz
• x + yz = ( x + y )( x + z)
• ( x + y )’ = x’ y’
• ( xy )’ = x’ + y’
• (x’)’ = x
DeMorgan's Theorem
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
L
O
G
I
C
G
A
T
E
S
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
• Boolean variable: Takes only two values – either true (1) or false (0). They are
used as basic units of formal logic.
• 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.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
example, If we are building a logic circuit that uses discrete logic made of small scale
Integration ICs(SSIs) like 7400 series, in which basic building block are constructed
and are available for use. The goal of minimization would be to reduce the number of
ICs and not the logic gates. For example, If we require two 6 and gates and 5 Or
gates,we would require 2 AND ICs(each has 4 AND gates) and one OR IC. (4 gates).
On the other hand if the same logic could be implemented with only 10 nand gates, we
require only 3 ICs. Similarly when we design logic on Programmable device, we may
implement the design with certain number of gates and remaining gates may not be
used. Whatever may be the criteria of minimization we would be guided by the
following:
Goal of the simplification: There are a minimal number of product/sum terms and
Each term has a minimal number of literals
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Karnaugh map
m
i
n
t
e
r
x y m
x
’
y
0 0 ’
x
’
0 1 y
Y
x
y
1 0 ’
x
0
1 1 y 1
x
’ x
y ’
’ y
0
x
y x
X ’ y
1
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
0 1 Y
’ Y
x
’ x x
y ’ ’ x
’ y X y ’
0 ’ ’ y
x
y x x
y x
’ y
X ’ y
1 X
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
k-map Simplification
x’y’ + x’y
• Both of these minterms appear in the top row of a Karnaugh map, which
Y
x
’ x
y ’
’ y
x
y x
X ’ y
x
’
y
’
+
[
x
’ D
y i
= s
t
x r
’ i
( b
y u
’ t
i
+ v
e
y
• ) ]
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
= y
’
x
’ =
1
• 1 ]
[
=
=
x
x
• ’ ]
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
K-maps
From
Truth
Tables
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Reading the
MSP from the
K-map
Grouping the
Minterms
Together
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
K-map Simplification
of SoP Expressions
Unsimplifying
Expressions
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Four-variable
K-maps –
f(W,X,Y,Z)
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Simplify
m0+m2+m5+m8+
m10+m13
Five-variable K-
maps –
f(V,W,X,Y,Z)
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Simplify
f(V,W,X,Y,Z)=Σm(0,1,4,5,6,11,12,14,16,20,22,
28,30,31)
PoS Optimization
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
PoS
Optimiz
ation
from
SoP
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
SoP
Optimiz
ation
from
PoS
Don’t
care
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
K-map Summary
– K-maps are really only good for manual simplification of small expressions...
– When grouping, you can wrap around all sides of the K-map, and your groups
can overlap
– Make as few rectangles as possible, but make each of them as large as possible. This
leads to fewer, but simpler, product terms
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
• A combinational circuit consists of input variables, logic gates, and output variables.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Analysis procedure
To obtain the output Boolean functions from a logic diagram, proceed as follows:
1. Label all gate outputs that are a function of input variables with arbitrary
symbols. Determine the Boolean functions for each gate output.
2. Label the gates that are a function of input variables and previously labeled gates
with other arbitrary symbols. Find the Boolean functions for these gates.
3. Repeat the process outlined in step 2 until the outputs of the circuit are obtained.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
1. The flip-flop is a bistable device either 0 or 1. It exists in one of two states and, in the
absence of input, remains in that state. Thus, the flip-flop can function as a 1-bit memory.
2. The flip-flop has two outputs, which are always the complements of each other. These are
generally labeled
Q and Q.
Table 1 shows symbolic graphic and feature table for three types of flip-flop that are S-R,
J-K and D flip-flops. Flip-flop is a form of memory element used to construct sequential
circuits that are more complex, such as registers etc. Sequential circuits can be divided
into
1. Synchronous
2. Asynchronous
In synchronous sequential circuit, all flip-flops are moved by the same clock pulse so that
all flip-flops involved change simultaneously.
In asynchronous circuit, the change of flip-flop condition depends on the change that
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
occurs on the input and the late time that is in the circuit.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Q
n
C +
l S R 1
S o Q
c
k
Q
S 0 0 n
- –
R R Q
0 1 0
1 0 1
1 1 -
JQ Q
n
+
J K 1
C
l
o
J c
- k
K –
Q
KQ 0 0 n
0 1 0
1 0 1
C
h
a
n
g
1 1 e
D c
o
n
d
i
t
i
o
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
c n
k
0 0
–
Q
1 1
Q
C n
+
l D 1
Do Q Table 1: A few basic Flip-flops
S
-
R
F
l
i
p
-
f
l
o
p
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
S-R flip-flop has 2 inputs, S (set) and R (reset) like Diagram 3 below. In the diagram
below, (also for JK and D flip-flops), there use another input called clock. It is to control
the movement of input that is input will only occur when given a clock pulse
(synchronous circuit)
The features of S-R flip-flop can be depicted in Table 2 below. It can be summarized
that:
1. If the value of both S and R are 0, the flip-flop will remain in its present condition (either
0 or 1).
2. If S = 0 and R = 1 (reset), then the flip-flop condition will change to 0 (its output, Q = 0).
3. If S = 1 (set) and R = 0, then the flip-flop condition will change to 1 (output, Q = 1).
4. This circuit does not allow combinational input of input S = 1 and R = 1.
clock
Q
R
Q
Q n
+
S R n 1
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 -
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
1 1 1 -
J-K Flip-flop
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
J-K flip-flop also has 2 inputs, J and K. The function of clock is same as S-R flip-flop.
Unlike S-R flip-flop, J-K flip-flop allows all combination of inputs. The logic circuit for
J-K flip-flop is shown in Diagram 2 below. Table 3 shows the features of J-K flip-flop.
From the table, it can be summarized that:
1. If J = 0 and K = 0, it will maintain the flip-flop condition like before
2. If J = 0 and K = 1, it will cause flip-flop to change to condition 0 (reset).
3. If J = 1 and K = 0, it will cause flip-flop to change to condition 1 (set).
4. If J = 1 and K = 1, it will change the flip-flop condition, that is it will become
complementary to the
initial or prior condition
It can be observed that J-K flip-flop is built to address the input problem of S = R = 1 in
S-R flip-flop. Features 1 till 3 are same as S-R flip-flop.
J
Q
Clock
Q
K
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Q
n
Q +
J K n 1
0 0 0 0
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 0
D Flip-flop
Logic circuit for D flip-flop is shown in Diagram 5 below. This flip-flop only has one
input that is D. The clock function is same as S-R and J-K flip-flops. The features of D
flip-flop can be illustrated by Table 2. From the table, it can be seen that this flip-flop
produces the same output as its input regardless of the condition of the stated flip-flop.
This feature is very suitable to be used as memory element and this flip-flop is mostly
used to make registers and computer memory (RAM)
clock
Q
D
Diagram 5 : D Flip-flop
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Q
Q n
+
D n 1
0 0 0
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
0 1 0
1 0 1
1 1 1
UNIT-2
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
PART-2
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Registers,
Shift Registers,
Binary counters
Decoders,
Multiplexers,
Programmable Logic Devices.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Logic
Circuits can
be divided
into :
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
m
n
o
i u
n t
p p
u combin u
t ational t
. circuit
Diagram 1
Examples of Combinational circuits in the computer system are decoder, parallel adder, and
multiplexer
Examples of sequential circuits in the computer system are like registers, counters and
serial adders
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
2. Determine the number of input and output variables that are needed
4. Construct a truth table that defines the relationship between the input and output
5. Obtain the Boolean function or the logical expression from the truth table in (2) using Karnaugh
Map or other known methods.
6. Draw a logic circuit based on the expression obtained from (5) above.
Below are examples of designing combinational circuits that are in the computer system that is
the adder. Because computers use binary system for its data, its adder is based on the addition
of the binary system. There are 2 kinds of addition, which are identified to be half addition and
full addition.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Half addition is the addition of 2 bits data (doesn’t involve carry) that produces 2 bits output,
that is the result and the carrier. Full addition is the addition of 3 bits data (2 bits data and 1 bit
carry) that produces 2 bits output (sum and carry). Logic circuit for half addition is known as Half
Adder while the logic circuit for full addition is known as Full Adder
I
N
P
U
T
1. OUTPUT
x y S c
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
s y
x 0 1
s
=
x
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
y
+
x
y
=
For c
x y
x
y
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
s = xy + xy
c = xy
OR
x+y=s
xy = c
A Block
Diagram for
HA is as
below:
i o
n u
p t
u p
t S u
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
t
x
H
y A c
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
O
I U
N T
P P
U U
T T
c c
X y i S o
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
5. Obtain the expression for r and co using Karnaugh Map (Students are required to try
this out themselves):
w
i s=
l xy y
l pi + i
o xy c
b ci + c+ x i
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
t xy
a
i
n
= x + y + ci
a
n co = x y + y
d ci + x c i
6. Draw the circuit for FA (Students are required to try this out themselves):
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
y r
c F c
i A o
To construct a 2-bit parallel adder, 3 FA and 1 HA are required like the diagram below with the
input as X = x3x2x1x0 and Y = y3y2y1y0 (X and Y are binary numbers 2-bit) and the output
(addition result) is r3r2r1r0.
x x x x
I
N 3 2 1 0
P
U y y y y
T 3 2 1 0
F F F H
A A A A
c c c
2 1 0
O
U
T
P
U
T
c
3
s s s s
3 2 1 0
O
R
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
x x x
I
N 3 2 1
P
U y y y x y
T 3 2 1 0 0
0
F F F F
A A A A
c c c
2 1 0
O
U
T
P
U
T
c
3
s
s s s
3 2 1 0
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Sequential circuits are a kind of logic circuit where the current output not only depends on the
current input but also on the past history of inputs. Another and generally more useful way to
view it is that the current output of a sequential circuit depends on the current input and the
current state of that circuit. The simplest form of sequential circuit is the flip-flop. Flip-flop is a
kind of logic circuit that is capable of exhibiting 2 stable conditions. It is also known as 1-bit
memory element and is mostly used to make important computer components such as
registers, counters, memory etc.
As priory stated, flip-flop is an example of the simplest form of sequential circuit. It is also a form of
memory element where a flip-flop can store 1 bit of data. In this section, examples of sequential
circuits that use flip-flop will be given:
Register
Register is an important component in the computer. Generally, it can be categorized
into:
1. Storage Register (or Parallel Register)
I1 I2 I3 I2
D Q D Q D Q D Q
C C C C
l l l l
o – o – o – o –
c c c c
k k k k
Q Q Q Q
C
l
o
c
k
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
In the above diagram, 2 bits of input is admitted simultaneously, that is I1, I2, I3 and I2,
whereas its output is also is simultaneous or parallel, that is Q1, Q2, Q3 and Q2.
In shift register, only one output is produced at a time. There are 2 types of shift register
that is shift to right and shift to left. Shift to right register means the rightmost bit of the
stated will be taken out first followed by the
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
following bits after a given clock beat. It’s vice versa for move to shift to left register.
Diagram 7 below is an example of 2-bit shift to right register that utilizes J-K flip-flop.
I O
n u
p t
u p
t u
Q J Q J Q J Q t
C C C
l l l
o o o
J c c c
k k k
C
l – – – –
o Q K Q K Q K Q
c
k
K
C
l
o
c
k
Parallel Adder
In the computer environment, there are 2 types of adders:
1. Parallel Adder
2. Serial Adder
Parallel adder is an adder that performs addition concurrently for each bit involved. Adder in
section 2.2 is called a serial adder. Serial Adder performs addition bit by bit starting with the
rightmost bit, followed by the following bits. Diagram 8 below is an example of a serial 2-bit
adder. This adder uses two Shift to Right Registers, X and Y to hold operand 1 (A =
A3A2AIA0) and operand 2 (B = B3B2B1B0), a full adder (see section 2.2) and a flip-flop
(usually D flip-flop) to hold the carrier value.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
X=X+Y
that is the X and Y registers will hold operand 1 and operand 2 and the addition result will be
kept in the X register. Hence, in the addition, the value in the Y (Operand 2) register cannot
change while the X register holds the addition result (the value of operand 1 will be lost)
Note: observe and understand the data movement in the stated circuit after every clock pulse is
given.
R
e
g
i
s
t
e
r A S
i i
A A A
A 2 1 0
F
u
B l
i l
C
i
B B B B +
1
3 2 1 0
C
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
UNIT-3 PART-1
3.1.1. Algorithms for fixed point and floating point addition
3.1.1.1. Algorithms for fixed point addition
3.1.1.2. Algorithms for floating point addition
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
UNIT-3 PART-2
Instruction set & Addressing
Data is transferred to and from memory in groups of bits called words. A word can be a
group of 8bits, 16bits, 32bits or 64bits (and growing).
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
•If the word is 8bits, it is referred to as a byte. The term “byte” is so common in computer
science that sometimes a 16-bit word is referred to as a 2-byte word, or a 32-bitword is
referred to as a 4 byteword.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Address space
•To access a word in memory requires an identifier. Although programmers use a name
to identify a word (or a collection of words), at the hardware level each word is
identified by an address.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Big Endian
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
MEMORY OPERATIONS
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
LOC,PLACE,MEM are the address of memory location R1 , R2,… are processor registers
DATA_IN, DATA_OUT are I/O registers
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Eg:
1. MOVE LOCN, R2
2. ADD R3, R2, R4
The MCU typically determines the address of the first microinstruction which
implements a machine instruction based on that instruction's opcode. Upon machine
power-up, the CAR should contain the address of the first microinstruction to be
executed.
The MCU must be able to execute microinstructions sequentially (e.g., within routines),
but must also be able to ``branch'' to other microinstructions as required; hence, the
need for a sequencer.
Addressing Sequencing
CAR
control ROM
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
opcode
mapping logic
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
branch logic
determines how the next CAR value will be determined from all the various possibilities
multiplexors
incrementer
SBR
Subroutine branches are helpful to have at the microprogram level. Many routines contain
identical sequences of microinstructions; putting them into subroutines allows those
routines to be shorter, thus saving memory.
Mapping of opcodes to microinstruction addresses can be done very simply. When the
CM is designed, a ``required'' length is determine for the machine instruction routines
(i.e., the length of the longest one). This is rounded up to the next power of 2, yielding a
value k such that 2 k microinstructions will be sufficient to implement any routine.
The first instruction of each routine will be located in the CM at multiples of this
``required'' length. Say this is N. The first routine is at 0; the next, at N; the next, at 2*N;
etc. This can be accomplished very easily. For instance, with a four-bit opcode and
routine length of four microinstructions, k is two; generate the microinstruction address
by appending two zero bits to the opcode:
addressing
Alternately, the n-bit opcode value can be used as the ``address'' input of a 2n x M ROM;
the contents of the selected ``word'' in the ROM will be the desired M-bit CAR address
for the beginning of the routine implementing that instruction. (This technique allows
for variable-length routines in the CM.) >pp We choose between all the possible ways of
generating CAR values by feeding them all into a multiplexor bank, and implementing
special branch logic which will determine how the muxes will pass on the next address
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
to the CAR. As there are four possible ways of determining the next address, the
multiplexor bank is made up of N 4x1 muxes, where N is the number of bits in the
address of a CW. The branch logic is used to determine which of the four possible ``next
address'' values is to be passed on to the CAR; its two output lines are the select inputs
for the muxes
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
The term addressing modes refers to the way in which the operand of an instruction is
specified. Information contained in the instruction code is the value of the operand or the
address of the result/operand. Following are the main addressing modes that are used on
various platforms and architectures.
1) Immediate Mode
2) Index Mode
The address of the operand is obtained by adding to the contents of the general register
(called index register) a constant value. The number of the index register and the
constant value are included in the instruction code. Index Mode is used to access an
array whose elements are in successive memory locations. The content of the
instruction code, represents the starting address of the array and the value of the index
register, and the index value of the current element. By incrementing or decrementing
index register different element of the array can be accessed.
.data
array1: .byte 1,2,3,4,5,6
.text
__start:
move $3, $0 # $3 initialize index register with 0
add $3, $3,4 # compute the index value of the fifth element
sb $0, array1($3) # array1[4]=0
# store byte 0 in the fifth element of the array
# index addressing mode
done
3) Indirect Mode
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
The effective address of the operand is the contents of a register or main memory
location, location whose address appears in the instruction. Indirection is noted by
placing the name of the register or the memory address given in the instruction in
parentheses. The register or memory location that contains the address of the operand
is a pointer. When an execution takes place in such mode, instruction may be told to go
to a
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
specific address. Once it's there, instead of finding an operand, it finds an address
where the operand is located.
NOTE:
Two memory accesses are required in order to obtain the value of the operand
(fetch operand address and fetch operand value).
(address A is embedded in the instruction code and (A) is the operand address =
pointer variable)
.data
array1: .byte 1,2,3,4,5,6
.text
__start:
la $3, array1 # array1 is direct addressing mode
add $3, $3,4 # compute the address of the fifth element
sb $0, ($3) # array1[4]=0 , byte accessing
# indirect addressing mode
done
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Example: (SPIM)
lw $11, beta # load word (32 -bit quantity) at address beta into register $11
# address of the word is embedded in the instruction code
# (register $11 will receive value 2000)
5) Register Mode
The name (the number) of the CPU register is embedded in the instruction. The
register contains the value of the operand. The number of bits used to specify the
register depends on the total number of registers from the processor set.
Example (SPIM)
6) Displacement Mode
Similar to index mode, except instead of a index register a base register will be used.
Base register contains a pointer to a memory location. An integer (constant) is also
referred to as a displacement. The address of the operand is obtained by adding the
contents of the base register plus the constant. The difference between index mode
and displacement mode is in the number of bits used to represent the constant. When
the constant is represented a number of bits to access the memory, then we have
index mode. Index mode is more appropriate for array accessing; displacement mode
is more appropriate for structure (records) accessing.
.data
student: .word 10000 #field code
.ascii "Smith" #field name
.byte # field test
.byte 80,80,90,100 # fields hw1,hw2,hw3,hw4
.text __start:
la $3, student # load address of the structure in $3
# $3 base register
add $17,$0,90 # value 90 in register $17
# displacement of field "test" is 9 bytes
#
sb $17, 9($3) # store contents of register $17 in field "test"
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
A special case of indirect register mode. The register whose number is included in
the instruction code, contains the address of the operand. Autoincrement Mode =
after operand addressing , the contents of the register is incremented. Decrement
Mode = before operand addressing, the contents of the register is decrement.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Computer with three addresses instruction format can use each address field to
specify either processor register are memory operand.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
The advantage of the three address formats is that it results in short program when
evaluating arithmetic expression. The disadvantage is that the binary-coded
instructions require too many bits to specify three addresses.
Most common in commercial computers. Each address field can specify either a
processes register on a memory word.
R
1
R M
1
M , [
O A
V A ]
R
1
R
1
R M
1
A , [
D B
D B ]
R R X
2 2
M , =
O ®
V C (
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
M A
[ +
C
] B
)
D
)
R
2
R
2
R M
2
A , [
D D
D D ]
R
1
R
R 1
1
, *
M
U R R
L 2 2
M X M
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
O 1
V [
R X
1 ]
R
1
It used an implied accumulator (AC) register for all data manipulation. For
multiplication/division, there is a need for a second register.
A
C
M
L
O [
A A
D A ]
A
C
A
C
A [
D B
D B ]
S M X
T
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
O [ =
R T
E ] (
A
T ®
+
A B
C )
(
C
A
)
All operations are done between the AC register and a memory operand. It’s the
address of a temporary memory location required for storing the intermediate
result.
A
C
M
L
O (
A C
D C )
A
C
A
C
A +
D
D D M
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
(
D
)
A
C
A
C
(
M T
L T )
M
S [
T ×
O ]
R ®
E
A
X C
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
A stack organized computer does not use an address field for the instruction ADD and
MUL. The PUSH & POP instruction, however, need an address field to specify the
operand that communicates with the stack (TOS ® top of the stack)
T
P O
U S
S ®
H A A
T
P O
U S
S ®
H B B
T
O
S
®
A (A
D +
D B)
T
P O
U S
S ®
H C C
T
P O
U S
S ®
H D D
T
O
S
®
A (C
D +
D D)
T
O
S
M ®
U (C
L +
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
D)
*
(A
+
B)
M
[X
]
P T
O O
P X S
CISC Characteristics
2.Some instructions that perform specialized tasks and are used infrequently.
RISC Characteristics
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
—Immediate
—Register operand
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
—Relative
– used in transfer-of-control instructions
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Pentium Instruction
Formats
• Instruction consists of
Optional displacement
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Pentium Instruction
Formats
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
operation on strings
Address size
Instruction
1. Opcode
2. ModR/m
3. SIB
4.Displacement
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Pentiu
m
Instruc
tion
Forma
ts
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
UNIT-4
Memory organization
4.1Concept Of Memory,
4.2RAM,ROM Memories
4.3Memory Hierarchy 4.4Cache
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Making programs and data available at a rapid rate, it is possible to increase the
performance rate of the computer.
Auxiliary and cache memories are used for different purposes. The
cache holds those parts of the program and data that are most heavily used, while
the auxiliary memory holds those parts that are not presently used by the CPU.
Moreover, the CPU has direct access to both cache and main memory but not to
auxiliary memory. The transfer from auxiliary to main memory is usually done
by means of direct memory access of large blocks of data. The typical access
time ratio between cache and main memory is about 1 to 7. For example, a
typical cache memory may have an access time of 100ns, while main memory
access time may be 700ns. Auxiliary memory average access time is usually
1000 times that of main memory. Block size in auxiliary memory typically
ranges from256 to 2048 words, while cache block size is typically from 1 to 16
words.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
MAIN MEMORY
Among other things, the ROM portion of main memory is needed for
storing an initial program called a bootstrap loader. The bootstrap loader is a
program whose function is to start the computer software operating when power is
turned on. Since RAM is volatile, its contents are destroyed when power is turned
off. The contents of ROM remain unchanged after power is turned off and on
again. The startup of a computer consists of turning the power on and starting the
execution of an initial program. Thus when power is turned on, the hardware of the
computer sets the program counter to the first address of the bootstrap loader. The
bootstrap program loads a portion of the operating system from disk to main
memory and control is then transferred to the operating system, which prepares the
computer from general use.
RAM and ROM chips are available in a variety of sizes. If the memory
needed for the computer is larger than the capacity of one chip, it is necessary to
combine a number of chips to form the required memory size. To demonstrate the
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
A RAM chip is better suited for communication with the CPU if it has
one or more control inputs that select the chip only when needed. Another
common feature is a bidirectional data bus that allows the transfer of data either
from memory to CPU during a read operation or from CPU to memory during a
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Address and an 8-bit bidirectional data bus. The read and write inputs specify the
memory operation and the two chips select (CS) control inputs are for enabling the
chip only when it is selected by the microprocessor. The availability of more than
one control input to select the chip facilitates the decoding of the address lines
when multiple chips are used in the microcomputer. The read and write inputs are
sometimes combined into one line labeled R/W. When the chip is selected, the two
binary states in this line specify the two operations or read or write.
The function table listed in Fig. (b) Specifies the operation of the RAM
chip. The unitis in operation only when CSI = 1 and CS2 = 0. The bar on top of the
second select variable indicates that this input in enabled when it is equal to 0. If
the chip select inputs are not enabled, or if they are enabled but the read but the
read or write inputs are not enabled, the memory is inhibited and its data bus is in a
high-impedance state. When SC1 = 1 and CS2 = 0, the memory can be placed in a
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
write or read mode. When the WR input is enabled, the memory stores a byte from
the data bus into a location specified by the address input lines. When the RD input
is enabled, the content of the selected byte is placed into the data bus. The RD and
WR signals control the memory operation as well as the bus buffers associated
with the bidirectional data bus.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
The nine address lines in the ROM chip specify any one of the 512
bytes stored in it. Thetwo chip select inputs must be CS1 = 1 and CS2 = 0 for the
unit to operate. Otherwise, the data bus is in a high-impedance state. There is no
need for a read or write control because the unit can only read. Thus when the
chip is enabled by the two select inputs, the byte selected by the address lines
appears on the data bus.
To be used are specified in Fig Typical RAM chip and Typical ROM chip. The
memory address map for this configuration is shown in Table 7-1. The
component column specifies whether a RAM or a ROM chip is used. The
hexadecimal address column assigns a range of hexadecimal equivalent
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
addresses for each chip. The address bus lines are listed in the third column.
Although there are 16 lines in the address bus, the table shows only 10 lines
because the other 6 are not used in this example and are assumed to be zero.
The small x’s under the address bus lines designate those lines that must be
connected to the address inputs in each chip. The RAM chips have 128 bytes and
need seven address lines. The ROM chip has 512 bytes and needs 9 address
lines. The x’s are always assigned to the low-order bus lines: lines 1 through 7
for the RAM and lines 1 through 9 for the ROM. It is now necessary to
distinguish between four RAM chips by assigning to each a different address.
For this particular example we choose bus lines 8 and 9 to represent four distinct
binary combinations. Note that any other pair of unused bus lines can be chosen
for
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
this purpose. The table clearly shows that the nine low-order bus lines constitute
9
a memory space from RAM equal to 2 = 512 bytes. The distinction between a
RAM and ROM address is done with another bus line. Here we choose line 10
for this purpose. When line 10 is 0, the CPU selects a RAM, and when this line
is equal to 1, it selects the ROM.
RAM and ROM chips are connected to a CPU through the data and
address buses. The low-order lines in the address bus select the byte within the
chips and other lines in the address bus select a particular chip through its chip
select inputs. The connection of memory chips to the CPU is shown in belowFig.
This configuration gives a memory capacity of 512 bytes of RAM and 512 bytes
of ROM. It implements the memory map of Table 7-1. Each RAM receives the
seven low-order bits of the address bus to select one of 128 possible bytes. The
particular RAM chip selected is determined from lines 8 and 9 in the address
bus. This is done through a 2 × 4 decoder whose outputs go to the SCI input in
each RAM chip. Thus, when address lines 8 and 9 are equal to 00, the first RAM
chip is selected. When 01, the second RAM chip is selected, and so on. The RD
and WR outputs from the microprocessor are applied to the inputs of each RAM
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
chip.
The selection between RAM and ROM is achieved through bus line
10. The RAMs are selected when the bit in this line is 0, and the ROM when the
bit is 1. The other chip select input in the ROM is connected to the RD control
line for the ROM chip to be enabled only during a read operation. Address bus
lines 1 to 9 are applied to the input address of ROM without going through the
decoder. This assigns addresses 0 to 511 to RAM and 512 to 1023 to ROM. The
data bus of the ROM has only an output capability, whereas the data bus
connected to the RAMs can transfer information in both directions.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
ASSOCIATIVE MEMORY
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
HARDWARE ORGANIZATION
The key register provides a mask for choosing a particular field or key in the
argument word.
The entire argument is compared with each memory word if the key register
contains all 1’s. Otherwise, only those bits in the argument that have 1’s in their
corresponding position of the key register are compared. Thus the key provides a
mask or identifying piece of information which specifies how the reference to
memory is made.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
1
1
1
1 1
0 0
A 1 0
0
0
0
1 0
1 0
K 1 0
n
o
W 1
o 1 m
r 1 a
d 1 1 t
0 0 c
1 0 0 h
W 0
o 0 m
r 0 a
d 1 0 t
0 0 c
2 1 1 h
Word 2 matches the unmasked argument field because the three leftmost bits of
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
in word i. A bit A j in the argument register is compared with all the bits in
column j of the array provided that K j = 1. This is done for all columns j = 1,
2,…,n. If a matchoccurs between all the unmasked bits of the argument and the
bits in word i, the corresponding bit Mi in the match register is set to 1. If one or
more unmasked bits of the argument and the word do not match, Mi is cleared to
0.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Flop storage element Fij and the circuits for reading, writing, and matching the
cell. The input bit is transferred into the storage cell during a write operation.
The bit stored is read out during a read operation. The match logic compares
the content of the storage cell with the corresponding unmasked bit of the
argument and provides an output for the decision logic that sets the bit in Mi.
MATCH LOGIC
The match logic for each word can be derived from the comparison
algorithm for two binary numbers. First, we neglect the key bits and compare
the argument in A with the bits stored in the cells of the words. Word i is equal
to the argument in A if Aj = Fij for j = 1, 2,…, n. Two bits are equal if they
are both 1 or both 0. The equality of two bits can be expressed logically by the
' '
Boolean function xj = AjFij + A jFij
equal to 1. This is the condition for setting the corresponding match bit Mi to
1. The Boolean function for this condition is
Mi = x1 x2 x3 … xn
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
We now include the key bit Kj in the comparison logic. The requirement is
i
f
=
x K 1
j j
x
K
’
=
i
f =
1 K 0
Kj’ = 1 xj + 1 = 1. A term (xj + Kj’) will be in the 1 state if its pair of bitsis
not compared. This is necessary because each term isANDed with all other
terms so that an output of 1 will have no effect. The comparison of the bits has
an effect only when Kj = 1.
The match logic for word i in an associative memory can now be expressed by
the following Boolean function:
' ' ' '
Mi = (x1 + K j ) (x2 + K j ) (x3 + K j ) …. (xn + K j )
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
'
Each term in the expression will be equal to 1 if its corresponding K j = 0.
ifKj = 1, the term willbe either 0 or 1 depending on the value of xj. A match
If we substitute the original definition of xj. The Boolean function above can
be expressed as follows:
The circuit for catching one word is shown in below Fig. Each cell
requires two AND gates and one OR gate. The inverters for Aj and Kj are
needed once for each column and are used for all bits in the column. The
output of all OR gates in the cells of the same word go to the input of a
common AND gate to generate the match signal for Mi.Mi will be logic 1 if a
catch occurs and 0 if no match occurs.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Note that if the key register contains all 0’s, output Mi will be a 1 irrespective
of the value of A or the word. This occurrence must be avoided during normal
operation.
READ OPERATION
the same word position (instead of the M register), the content of the matched
word will be presented automatically at the output lines and no special read
command signal is needed. Furthermore, if we exclude words having zero
content, an all-zero output will indicate that no match occurred and that the
searched item is not available in memory.
WRITE OPERATION
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
If unwanted words have to be deleted and new words inserted one at a time,
there is a need for a special
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
(together with the Kj bits) with the argument word so that only active words
are compared.
If the active portions of the program and data are placed in a fast
small memory, the average memory access time can be reduced, thus reducing
the total execution time of the program. Such a fast small memory is referred
to as a cache memory. It is placed between theCPU and main memory as
illustrated in below Fig. The cache memory access time is less than the access
time of main memory by a factor of 5 to 10. The cache is the fastest
component in the memory hierarchy and approaches the speed of CPU
components.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
The basic operation of the cache is as follows. When the CPU needs
to access memory, the cache is examined. If the word is found in the cache, it
is read from the fast memory. If the word addressed by the CPU is not found
in the cache, the main memory is accessed to read the word. A block
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
of words containing the one just accessed is then transferred from main
memory to cache memory. The block size may vary from one word (the one
just accessed) to about 16 words adjacent to the one just accessed. In this
manner, some data are transferred to cache so that future references to
memory find the required words in the fast cache memory.
1. Associative mapping
2. Direct mapping
3. Set-associative mapping
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
ASSOCIATIVE MAPPING
Arg
ume
nt
regis
ter
A
d
d
r D
e a
s t
s a
0 1 0 0 0 3 4 5 0
0 2 7 7 7 6 7 1 0
2 2 3 4 5 1 2 3 4
And sent to the CPU. If no match occurs, the main memory is accessed for the
word. The address-data pair is then transferred to the associative cache
memory. If the cache is full, an address−data pair must be displaced to make
room for a pair that is needed and not presently in the cache. The decision as
to what pair is replaced is determined from the replacement algorithm that the
designer chooses for the cache. A simple procedure is to replace cells of the
cache in round-robin order whenever a new word is requested from main
memory. This constitutes a first-in first-out (FIFO) replacement policy.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
DIRECT MAPPING
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
index to access the cache. The internal organization of the words in the cache
memory is as shown in Fig. (b). Each word in cache consists of the data word
and its associated tag. When a new word is first brought into the cache, the tag
bits are stored alongside the data bits. When the CPU generates a memory
request, the index field is used for the address to access the cache.
The tag field of the CPU address is compared with the tag in the word
read from the cache. If the two tags match, there is a hit and the desired data
word is in cache. If the two tags match, there is a hit and the desired data word
is in cache. If there is no match, there is a miss and the required word is read
from main memory. It is then stored in the cache together with the new tag,
replacing the previous value. The disadvantage of direct mapping is that the
hit ratio can droop considerably if two or more words whose addresses have
the same index but different tags are accessed repeatedly. However, this
possibility is minimized by the fact that such words are relatively far apart in
the address range (multiples of 512 locations in this example).
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
I
n D
d T a
e a t
x g a 6 6 3
3
4 B
l W
0 0 5
0 T o o
0 1 0 a c r
B g k d
l
o
c
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
0
6
0 0 7
0
7 1 8
0 I
1 n
0 d
B e
l x
o
c
k
1
0
1
7
7 0
7
0 2
B
l
o
c
k
6
3
6
7 0 1
7
7 2 0
Fig
Field is now divided into two parts: the block field and the word field.
In a 512-word cache there are 64 block of 8 words each, since 64 × 8 = 512.
The block number is specified with a 6-bit field
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
and the word within the block is specified with a 3-bit field. The tag field stored
within the cache is common to all eight words of the same block. Every time a
miss occurs, an entire block of eight words must be transferred from main memory
to cache memory. Although this takes extra time, the hit ratio will most likely
improve with a larger block size because of the sequential nature of computer
programs.
SET-ASSOCIATIVE MAPPING
I
n D D
d T a T a
e a t a t
x g a g a
3 5
4 6
0 0 5 0 7
0
0 1 0 2 0
7 6 0 2
7
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
7 7 0 3
1 4
0 0
The octal numbers listed in above Fig.are with reference to the main
memory content illustrated in Fig.(a). The words stored at addresses 01000
and 02000 of main memory are stored in cache memory at index address 000.
Similarly, the words at addresses 02777 and 00777 are stored in cache at index
address 777. When the CPU generates a memory request, the index value of
the address is used to access the cache. The tag field of the CPU address is
then compared with both tags in the cache to determine if a catch occurs. The
comparison logic is done by an associative search of the tags in the set similar
to an associative memory search: thus the name “set-associative”. The hit ratio
will improve as the set size increases because more words with the same index
but different tag can reside in cache. However, an increase in the set size
increases the number of bit s in words of cache and requires more complex
comparison logic.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
CACHE INITIALIZATION
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
The cache is initialized by clearing all the valid bits to 0. The valid bit
of a particular cache word is set to 1 the first time this word is loaded from
main memory and stays set unless the cache has to be initialized again. The
introduction of the valid bit means that a word in cache is not replaced by
another word unless the valid bit is set to 1 and a mismatch of tags occurs. If
the valid bit happens to be 0, the new word automatically replaces the invalid
data. Thus the initialization condition has the effect of forcing misses from the
cache until it fills with valid data.
VIRTUAL MEMORY
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
In a virtual memory system, programmers are told that they have the
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
total address space at their disposal. Moreover, the address field of the
instruction code has a sufficient number of bits to specify all virtual addresses.
In our example, the address field of an instruction code will consist of 20 bits
but physical memory addresses must be specified with only 15 bits. Thus CPU
will reference instructions and data with a 20-bit address, but the information
at this address must be taken from physical memory because access to
auxiliary storage for individual words will be prohibitively long. (Remember
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
V
i
r
t
u
a
l
a
d
d
r
e
s
s
M
a
i
n
V M m
i e e
r m
t m M
o o a
u r
a r i
l y y n
a
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
a d
d d
d r
e
r
s
e s
s
r
s
e
g
m i
r
e a s m
g p t e
i p e m
s i r o
t
e n e r
r g d y
( (
2 1
0 5
b t b
i a i
b t
t
l s
s e )
)
M
M a
e i
m n
o
r
y m
e
t m
a o
b r
l y
e
b
b u
u f
f f
f e
e r
r
r
r e
e g
g i
i s
s t
t e
e r
r
Takes space from main memory and two accesses to memory are required
with the program running at half speed. A third alternative is to use an
associative memory as explained below.
ADDRESS MAPPING USING PAGES
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
information in the address space and the memory space are each divided into
groups of fixed size. The physical memory is broken down into groups of
equal size called blocks, which may range from 64 to 4096 words each. The
term page refers to groups of address space of the same size. For example, if a
page or block consists of 1K words, then, using the previous example, address
space is divided into 1024 pages and main memory is divided into 32 blocks.
Although both a page and a block are split into groups of 1K words, a page
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
The word to the main memory buffer register ready to be used by the
CPU. If the presence bit in the word read from the page table is 0, it signifies
that the content of the word referenced by the virtual address does not reside in
main memory. A call to the operating system is then generated to fetch the
required page from auxiliary memory and place it into main memory before
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
resuming computation.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
four blocks. In general, system with n pages and m blocks would require a
memory-page table of n locations of which up to m blocks will be marked
with block numbers and all others will be empty. As a second numerical
example, consider an address space of 1024K words and memory space of
32K words. If each page or block contains 1K words, the number of pages is
1024 and the number of blocks 32. The capacity of the memory-page table
must be 1024 words and only 32 locations may have a presence bit equal to 1.
At any given time, at least 992 locations will be empty and not in use.
Virtual
address
P
a
g
e
n
o
.
A
r
g
u
m
e
L n
i t
n
e r
e
n g
1 u i
m s
0 b t
e e
1 r r
K
e
y
1 1 1 0 0 r
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
e
g
i
s
t
e
r
0 0 1 1 1
0 1 0 0 0 Associative
memory
1 0 1 0 1
1 1 0 1 0
P
a
g
e
n
o Block
. no .
Consider again the case of eight pages and four blocks as in the
example of Fig. We replace the random access memory-page table with an
associative memory of four words as shown in Fig. Each entry in the
associative memory array consists of two fields. The first three bits specify a
field from storing the page number. The last two bits constitute a field for
storing the block number. The virtual address is placed in the argument
register. The page number bits in the argument are compared with all page
numbers in the page field of the associative memory. If the page number is
found, the 5-bit word is read out from memory. The corresponding block
number, being in the same word, is transferred to the main memory address
register. If no match occurs, a call to the operating system is generated to bring
the required page from auxiliary memory.
management software system handles all the software operations for the
efficient utilization of memory space. It must decide (1) which page in main
memory ought to be removed to make room for a new page, (2) when a new
page is to be transferred from auxiliary memory to main memory, and (3)
where
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Two of the most common replacement algorithms used are the first-in first-out
(FIFO) and the least recently used (LRU). The FIFO algorithm selects for
replacement the page the has been in memory the longest time. Each time a
page is loaded into memory, its identification number is pushed into a FIFO
stack. FIFO will be full whenever memory has no more empty blocks. When a
new page must be loaded, the page least recently brought in is removed. The
page to be removed is easily determined because its identification number is at
the top of the FIFO stack. The FIFO replacement policy has the advantage of
being easy to implement. It has the disadvantages that under certain circum-
stances pages are removed and loaded form memory too frequently.
The LRU policy is more difficult to implement but has been more
attractive on the assumption that the least recently used page is a better
candidate for removal than the least recently loaded pages in FIFO. The LRU
algorithm can be implemented by associating a counter with every page that is
in main memory. When a page is referenced, its associated counter is set to
zero. At fixed intervals of time, the counters associated with all pages
presently in memory are incremented by 1. The least recently used page is the
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
page with the highest count. The counters are often called aging registers, as
their count indicates their age, that is, how long ago their associated pages
have been reference.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
UNIT-5
Input / Output Organization:
5.1 Introduction To I/O
5.6 Buses
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Move DATAIN, R0
from DATAIN and stores them into processor register R0. Similarly, the instruction Move R0,
DATAOUT
The hardware required to connect an I/O device to the bus. The address
decoder enables the device to recognize its address when this address appears on
the address lines. The data register holds the data being transferred to or from the
processor. The status register contains information relevant to the operation of
the I/O device. Both the data and status registers are connected to the data bus
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
and assigned unique addresses. The address decoder, the data and status registers,
and the control circuitry required to coordinate I/O transfers constitute the
device’s interface circuit.
I/O devices operate at speeds that are vastly different from that of the
processor. When a human operator is entering characters at a keyboard, the
processor is capable of executing millions of instructions between successive
character entries. An instruction that reads a character from the keyboard should
be executed only when a character is available in the input buffer of the keyboard
interface. Also, we must make sure that an input character is read only once.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
i +1. Therefore, when an interrupt occurs, the current contents of the PC, which
point to instruction i+1, must be put in temporary storage in a known location. A
Return-from-interrupt instruction at the end of the interrupt-service routine
reloads the PC from the temporary storage location, causing execution to resume
at instruction i +1. In many processors, the return address is saved on the
processor stack.
We should note that as part of handling interrupts, the processor must inform the
device
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
that its request has been recognized so that it may remove its interrupt-request
signal. This may be accomplished by means of a special control signal on the bus.
An interrupt-acknowledge signal. The execution of an instruction in the interrupt-
service routine that accesses a status or data register in the device interface
implicitly informs that device that its interrupt request has been recognized.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
common with the program being executed at the time the interrupt request is
received. In fact, the two programs often belong to different users. Therefore,
before starting execution of the interrupt-service routine, any information that
may be altered during the execution of that routine must be saved. This
information must be restored before execution of the interrupt program is
resumed. In this way, the original program can continue execution without being
affected in any way by the interruption, except for the time delay. The
information that needs to be saved and restored typically includes the condition
code flags and the contents of any registers used by both the interrupted program
and the interrupt-service routine.
interrupt-request signals INTR1 to INTRn are inactive, that is, if all switches are
open, the voltage on the interrupt-request line will be equal to Vdd. This is the
inactive state of the line. Since the closing of one or more switches will cause the
line voltage to drop to 0, the value of INTR is the logical OR of the requests from
individual devices, that is,
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
INTR
It is customary to use the complemented form, , to name the interrupt-
request signal on the common line, because this signal is active when in the low-
voltage state.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
The second option, which is suitable for a simple processor with only one
interrupt-request line, is to have the processor automatically disable interrupts
before starting the execution of the interrupt-service routine. After saving the
contents of the PC
and the processor status register (PS) on the stack, the processor performs the
equivalent of executing an Interrupt-disable instruction. It is often the case that
one bit in the PS register, called Interrupt-enable, indicates whether interrupts are
enabled.
In the third option, the processor has a special interrupt-request line for
which the interrupt-handling circuit responds only to the leading edge of the
signal. Such a line is said to be edge-triggered.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
a single device. Assuming that interrupts are enabled, the following is a typical
scenario.
1. The device raises an interrupt request.
2. The processor interrupts the program currently being executed.
3. Interrupts are disabled by changing the control bits in the PS (except in the case
of edge-triggered interrupts).
4. The device is informed that its request has been recognized, and in response, it
deactivates the
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
interrupt-request signal.
5. The action requested by the interrupt is performed by the interrupt-service
routine.
6. Interrupts are enabled and execution of the interrupted program is resumed.
The means by which these problems are resolved vary from one computer to
another, And the approach taken is an important consideration in determining the
computer’s suitability for a given application.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
requested service.
Vectored Interrupts:-
To reduce the time involved in the polling process, a device requesting an
interrupt may identify
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
itself directly to the processor. Then, the processor can immediately start
executing the corresponding interrupt-service routine. The term vectored
interrupts refers to all interrupt-handling schemes based on this approach.
Interrupt Nesting: -
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
the clock during the execution of an interrupt-service routine for another device.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
routine, interrupt requests will be accepted from some devices but not from
others, depending upon the device’s priority. To implement this scheme, we can
assign a priority level to the processor that can be changed under program
control. The priority level of the processor is the priority of the program that is
currently being executed. The processor accepts interrupts only from devices that
have priorities higher than its own.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Simultaneous Requests:-
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Polling the status registers of the I/O devices is the simplest such
mechanism. In this case, priority is determined by the order in which the devices
are polled. When vectored interrupts are used, we must ensure that only one
device is selected to send its interrupt vector code. A widely used scheme
is to connect the devices to form a daisy chain, as shown in figure 3a. The interrupt-
INTR
request line is
Move DATAIN, R0
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
special control unit may be provided to allow transfer of a block of data directly
between an external device and the main memory, without continuous
intervention by the processor. This approach is called direct memory access, or
DMA.
DMA transfers are performed by a control circuit that is part of the I/O
device interface. We refer to this circuit as a DMA controller. The DMA
controller performs the functions that would
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
normally be carried out by the processor when accessing the main memory. For
each word transferred, it provides the memory address and all the bus signals that
control data transfer. Since it has to transfer blocks of data, the DMA controller
must increment the memory address for successive words and keep track of the
number of transfers.
While a DMA transfer is taking place, the program that requested the
transfer cannot continue, and the processor can be used to execute another
program. After the DMA transfer is completed, the processor can return to the
program that requested the transfer.
I/O operations are always performed by the operating system of the computer in
response to a request from an application program. The OS is also responsible for
suspending the execution of one program and starting another. Thus, for an I/O
operation involving DMA, the OS puts the program that requested the transfer in
the Blocked state, initiates the DMA operation, and starts the execution of
another program. When the transfer is completed, the DMA controller informs
the processor by sending an interrupt request. In response, the OS puts the
suspended program in the Runnable state so that it can be selected by the
scheduler to continue execution.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
accessed by the processor to initiate transfer operations. Two registers are used
for storing the
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
S
t
a
t
u
s
a
n
d
C
o
n
t
r
o 3 3
l 1 0 1 0
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
D
I o
R n
Q e
R
I /
E W
Starting address
Word count
Main memory
Processor
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
System bus
D
i
s
k
/
D D
M M
A A
c c
o o
n n K
t t P e
r r r y
o o i b
l l n o
l l t a
e e e r
r r r d
N
e
t
D D w
i i o
s s r
k k k
I
n
t
e
r
f
a
c
e
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Starting address and the word count. The third register contains status and control flags. The
R/W bit determines the direction of the transfer. When this bit is set to 1 by a program
instruction, the controller performs a read operation, that is, it transfers data from the
memory to the I/O device. Otherwise, it performs a write operation. When the controller has
completed transferring a block of data and is ready to receive another command, it sets the
Done flag to 1. Bit 30 is the Interrupt-enable flag, IE. When this flag is set to 1, it causes the
controller to raise an interrupt after it has completed transferring a block of data. Finally, the
controller sets the IRQ bit to 1 when it has requested an interrupt.
To start a DMA transfer of a block of data from the main memory to one of the disks, a
program writes the address and word count information into the registers of the
corresponding channel of the disk controller. It also provides the disk controller with
information to identify the data for future retrieval. The DMA controller proceeds
independently to implement the specified operation when the DMA transfer is completed.
This fact is recorded in the status and control register of the DMA channel by setting the
Done bit. At the same time, if the IE bit is set, the controller sends an interrupt request to the
processor and sets the IRQ bit. The status register can also be used to record other
information, such as whether the transfer took place correctly or errors occurred.
Memory accesses by the processor and the DMA controller are interwoven.
Requests by DMA devices for using the bus are always given higher priority than processor
requests. Among different DMA devices, top priority is given to high-speed peripherals such
as a disk, a high-speed network interface, or a graphics display device. Since the processor
originates most memory access cycles, the DMA controller can be said to “steal” memory
cycles from the processor. Hence, the interweaving technique is usually called cycle stealing.
Alternatively, the DMA controller may be given exclusive access to the main memory to
transfer a block of data without interruption. This is known as block or burst mode.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Most DMA controllers incorporate a data storage buffer. In the case of the network
interface in figure 5 for example, the DMA controller reads a block of data from the main
memory and stores it into its input buffer. This transfer takes place using burst mode at a
speed appropriate to the memory and the computer bus. Then, the data in the buffer are
transmitted over the network at the speed of the network.
A conflict may arise if both the processor and a DMA controller or two DMA controllers try
to use the bus
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
at the same time to access the main memory. To resolve these conflicts, an arbitration
procedure is implemented on the bus to coordinate the activities of all devices requesting
memory transfers.
Bus Arbitration:-
The device that is allowed to initiate data transfers on the bus at any given time is called the
bus master. When the current master relinquishes control of the bus, another device can
acquire this status. Bus arbitration is the process by which the next device to become the bus
master is selected and bus mastership is transferred to it. The selection of the bus master must
take into account the needs of various devices by establishing a priority system for gaining
access to the bus.
Centralized Arbitration:-
The bus arbiter may be the processor or a separate unit connected to the bus. A basic
arrangement in which the processor contains the bus arbitration circuitry. In this case, the
processor is normally the bus master unless it grants bus mastership to one of the DMA
controllers. A DMA controller indicates that it needs to become the bus
BR
master by activating the Bus-Request line, . The signal on the Bus-Request line is the
logical OR of the bus
requests from all the devices connected to it. When Bus-Request is activated, the processor
activates the Bus-Grant signal, BG1, indicating to the DMA controllers that they may use the
bus when it becomes free. This signal is connected to all DMA controllers using a daisy-
chain arrangement. Thus, if DMA controller 1 is requesting the bus, it blocks the propagation
of the grant signal to other devices. Otherwise, it passes the grant downstream by asserting
BG2. The current bus master indicates to all device that it is using the bus by activating
another open-controller line
BBSY
called Bus-Busy, . Hence, after receiving the Bus-Grant signal, a DMA controller
waits for Bus-Busy to
become inactive, then assumes mastership of the bus. At this time, it activates Bus-Busy to
prevent other devices from using the bus at the same time.
5.6.BUSES
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
The PCI bus is a good example of a system bus that grew out of the need for
standardization. It supports the functions found on a processor bus bit in a standardized
format that is independent of any particular processor. Devices connected to the PCI bus
appear to the processor as if they were connected directly to the processor bus. They are
assigned addresses in the memory address space of the processor.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
The PCI follows a sequence of bus standards that were used primarily in IBM PCs. Early
PCs used the 8-bit XT bus, whose signals closely mimicked those of Intel’s 80x86
processors. Later, the 16-bit bus used on the PC At computers became known as the ISA bus.
Its extended 32-bit version is known as the EISA bus. Other buses developed in the eighties
with similar capabilities are the Microchannel used in IBM PCs and the NuBus used in
Macintosh computers.
The PCI was developed as a low-cost bus that is truly processor independent. Its
design anticipated a rapidly growing demand for bus bandwidth to support high-speed disks
and graphic and video devices, as well as the specialized needs of multiprocessor systems.
As a result, the PCI is still popular as an industry standard almost a decade after it was first
introduced in 1992.
Data Transfer:-
In today’s computers, most memory transfers involve a burst of data rather than just
one word. The reason is that modern processors include a cache memory. Data are
transferred between the cache and the main memory in burst of several words each. The
words involved in such a transfer are stored at successive memory locations. When the
processor (actually the cache controller) specifies an address and requests a read operation
from the main memory, the memory responds by sending a sequence of data words starting
at that address. Similarly, during a write operation, the processor sends a memory address
followed by a sequence of data words, to be written in successive memory locations starting
at the address. The PCI is designed primarily to support this mode of operation. A read or
write operation involving a single word is simply treated as a burst of length one.
The bus supports three independent address spaces: memory, I/O, and configuration.
The first two are self explanatory. The I/O address space is intended for use with processors,
such as Pentium, that have a separate I/O address space. However, as noted , the system
designer may choose to use memory-mapped I/O even when a separate I/O address space is
available. In fact, this is the approach recommended by the PCI its plug-and-play capability.
A 4-bit command that accompanies the address identifies which of the three spaces is being
used in a given data transfer operation.
The signaling convention on the PCI bus is similar to the one used, we assumed that
the master maintains the address information on the bus until data transfer is completed. But,
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
this is not necessary. The address is needed only long enough for the slave to be selected.
The slave can store the address in its internal buffer. Thus, the address is needed on the bus
for one clock cycle only, freeing the address lines to be used for sending data in subsequent
clock cycles. The result is a significant cost reduction because the number of wires on a bus
is an important cost factor. This approach in used in the PCI bus.
At any given time, one device is the bus master. It has the right to initiate data transfers by
issuing read and
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
write commands. A master is called an initiator in PCI terminology. This is either a processor
or a DMA controller. The addressed device that responds to read and write commands is
called a target.
Device Configuration:-
The PCI simplifies this process by incorporating in each I/O device interface a small
configuration ROM memory that stores information about that device. The configuration
ROMs of all devices is accessible in the configuration address space. The PCI initialization
software reads these ROMs whenever the system is powered up or reset. In each case, it
determines whether the device is a printer, a keyboard, an Ethernet interface, or a disk
controller. It can further learn bout various device options and characteristics.
Devices are assigned addresses during the initialization process. This means that
during the bus configuration operation, devices cannot be accessed based on their address, as
they have not yet been assigned one. Hence, the configuration address space uses a different
mechanism. Each device has an input signal called Initialization Device Select, IDSEL#.
The PCI bus has gained great popularity in the PC word. It is also used in many
other computers, such as SUNs, to benefit from the wide range of I/O devices for which a
PCI interface is available. In the case of some processors, such as the Compaq Alpha, the
PCI-processor bridge circuit is built on the processor chip itself, further simplifying system
design and packaging.
SCSI Bus:-
The acronym SCSI stands for Small Computer System Interface. It refers to a
standard bus defined by the American National Standards Institute (ANSI) under the
designation X3.131 . In the original specifications of the standard, devices such as disks are
connected to a computer via a 50-wire cable, which can be up to 25 meters in length and can
transfer data at rates up to 5 megabytes/s.
The SCSI bus standard has undergone many revisions, and its data transfer
capability has increased very rapidly, almost doubling every two years. SCSI-2 and SCSI-3
have been defined, and each has several options. A SCSI bus may have eight data lines, in
which case it is called a narrow bus and transfers data one byte at a time. Alternatively, a
wide SCSI bus has 16 data lines and transfers data 16 bits at a time. There are also several
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Devices connected to the SCSI bus are not part of the address space of the processor in the
same way as devices connected to the processor bus. The SCSI bus is connected to the
processor bus through a SCSI controller. This controller uses DMA to transfer data packets
from the main memory to the device, or vice versa. A packet may contain a block of data,
commands from the processor to the device, or status information about the device.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
To illustrate the operation of the SCSI bus, let us consider how it may be used with a
disk drive. Communication with a disk drive differs substantially from communication with
the main memory.
Data transfers on the SCSI bus are always controlled by the target controller. To
send a command to a target, an initiator requests control of the bus and, after winning
arbitration, selects the controller it wants to communicate with and hands control of the bus
over to it. Then the controller starts a data transfer operation to receive a command from the
initiator.
The processor sends a command to the SCSI controller, which causes the following
sequence of event to take place:
1.The SCSI controller, acting as an initiator, contends for control of the bus.
2. When the initiator wins the arbitration process, it selects the target controller and hands
over control of the bus to it.
1. The target starts an output operation (from initiator to target); in response to this, the initiator
sends a command specifying the required read operation.
2. The target, realizing that it first needs to perform a disk seek operation, sends a message to
the initiator indicating that it will temporarily suspend the connection between them. Then it
releases the bus.
3. The target controller sends a command to the disk drive to move the read head to the first
sector involved in the requested read operation. Then, it reads the data stored in that sector
and stores them in a data buffer. When it is ready to begin transferring data to the initiator,
the target requests control of the bus. After it wins arbitration, it reselects the initiator
controller, thus restoring the suspended connection.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
4. The target transfers the contents of the data buffer to the initiator and then suspends the
connection again. Data are transferred either 8 or 16 bits in parallel, depending on the width
of the bus.
5. The target controller sends a command to the disk drive to perform another seek operation.
Then, it transfers the contents of the second disk sector to the initiator as before. At the end of
this transfers, the logical connection between the two controllers is terminated.
6. As the initiator controller receives the data, it stores them into the main memory using the
DMA approach.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
7. The SCSI controller sends as interrupt to the processor to inform it that the requested
operation has been completed
This scenario show that the messages exchanged over the SCSI bus are at a higher
level than those exchanged over the processor bus. In this context, a “higher level” means
that the messages refer to operations that may require several steps to complete, depending
on the device. Neither the processor nor the SCSI controller need be aware of the details of
operation of the particular device involved in a data transfer. In the preceding example, the
processor need not be involved in the disk seek operation.
The USB supports two speeds of operation, called low-speed (1.5 megabits/s) and
full-speed (12 megabits/s). The most recent revision of the bus specification (USB 2.0)
introduced a third speed of operation, called high-speed (480 megabits/s). The USB is
quickly gaining acceptance in the market place, and with the addition of the high-speed
capability it may well become the interconnection method of choice for most computer
devices.
The USB has been designed to meet several key objectives:
1.Provides a simple, low-cost and easy to use interconnection system that overcomes the
difficulties due to the limited number of I/O ports available on a computer.
2.Accommodate a wide range of data transfer characteristics for I/O devices, including
telephone and Internet connections.
5.7.INTERFACE CIRCUITS
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Parallel port
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
D D
a a
t t
a a
D
A
T
A
I
N
E
n
c
o
d
e
r
K
A e
d y
d b
r o
e a a
s n r
s d d
D
P e
r b s
o o w
c u i
e n t
s c c
s i h
o n e
r g s
c
i
r
c
S u
I i
N t
R
/
I
W n
p
u
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
t
M i
a n
s t
t e
e r
r f
- a
r c V
e e a
a l
d i
y d
Slave-ready
The output of the encoder consists of the bits that represent the encoded character and
one control signal called Valid, which indicates that a key is being pressed. This information
is sent to the interface circuit, which contains a data register, DATAIN, and a status flag,
SIN. When a key is pressed, the Valid signal changes from 0 to 1, causing the ASCII code to
be loaded into DATAIN and SIN to be set to 1. The status flag SIN is cleared to 0 when the
processor reads the contents of the DATAIN register. The interface circuit is connected to an
asynchronous bus on which transfers are controlled using the handshake signals Master-ready
and Slave-ready, as indicated in
W
figure 11. The third control line, R/ distinguishes read and write transfers.
Figure 12 shows a suitable circuit for an input interface. The output lines of the
DATAIN register are connected to the data lines of the bus by means of three-state drivers,
which are turned on when the processor issues a read instruction with the address that selects
this register. The SIN signal is generated by a status flag circuit. This signal is also sent to the
bus through a three-state driver. It is connected to bit D0, which means it will appear as bit 0
of the status register. Other bits of this register do not contain valid information. An address
decoder is used to select the input interface when the high-order 31 bits of an address
correspond to any of the addresses assigned to this interface. Address bit A0 determines
whether the status or the data registers is to be read when the Master-ready signal is active.
The control handshake is accomplished by activating the Slave-ready signal when either
Read-status or Read-data is equal to 1.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Let us now consider an output interface that can be used to connect an output device,
such as a printer, to a processor, as shown in figure 13. The printer operates under control of
the handshake signals Valid and Idle in a manner similar to the handshake used on the bus
with the Master-ready and Slave-ready signals. When it is ready to accept a character, the
printer asserts its Idle signal. The interface circuit can then place a new character on the data
lines and activate the Valid signal. In response, the printer starts printing the new character
and negates the Idle signal, which in turn causes the interface to deactivate the Valid signal.
The circuit in figure 16 has separate input and output data lines for connection to an
I/O device. A more flexible parallel port is created if the data lines to I/O devices are
bidirectional. Figure 17 shows a general-purpose parallel interface circuit that can be
configured in a variety of ways. Data lines P7 through P0 can be used for either input or
output purposes. For increased flexibility, the circuit makes it possible for some lines to serve
as inputs and some lines to serve as outputs, under program control. The DATAOUT register
is connected to these lines via three-state drivers that are controlled by a data direction
register, DDR. The processor can write any 8-bit pattern into DDR. For a given bit, if the
DDR value is 1, the corresponding data line acts as an output line; otherwise, it acts as an
input line.
The processor bus is the bus defied by the signals on the processor chip
itself. Devices that require a very high-speed connection to the processor, such as the main
memory, may be connected directly to this bus. For electrical reasons, only a few devices can
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
be connected in this manner. The motherboard usually provides another bus that can support
more devices. The two buses are interconnected by a circuit, which we will call a bridge, that
translates the signals and protocols of one bus into those of the other. Devices connected to
the expansion bus appear to the processor as if they were connected directly to the
processor’s own bus. The only difference is that the bridge circuit introduces a small delay in
data transfers between the processor and those devices.
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
It is not possible to define a uniform standard for the processor bus. The structure of
this bus is closely tied to the architecture of the processor. It is also dependent on the
electrical characteristics of the processor chip, such as its clock speed. The expansion bus is
not subject to these limitations, and therefore it can use a standardized signaling scheme. A
number of standards have been developed. Some have evolved by default, when a particular
design became commercially successful. For example, IBM developed a bus they called ISA
(Industry Standard Architecture) for their personal computer known at the time as PC AT.
Some standards have been developed through industrial cooperative efforts, even
among competing companies driven by their common self-interest in having compatible
products. In some cases, organizations such as the IEEE (Institute of Electrical and
Electronics Engineers), ANSI (American National Standards Institute), or international
bodies such as ISO (International Standards Organization) have blessed these standards and
given them an official status.
A given computer may use more than one bus standards. A typical Pentium
computer has both a PCI bus and an ISA bus, thus providing the user with a wide range of
devices to choose from.
Main
Memory
Processor bus
P B
r r
o i
c d
e g
s e
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
s
o
r
PCI bus
A
d
d E
i t
t h
i e
o S r
n C n U I
a S e S S
l I t B A
c c
o i o i
n n n n
t t t t
m r e r e
e o r o r
m l f l f
o l a l a
r e c e c
y r e r e
jntuworldupdates.org Specworld.in
Smartzworld.com Smartworld.asia
Port Limitation:-
The parallel and serial ports described in previous section provide a general-purpose
point of connection through which a variety of low-to medium-speed devices can be
connected to a computer. For practical reasons, only a few such ports are provided in a
typical computer.
Device Characteristics:-
The kinds of devices that may be connected to a computer cover a wide range of
functionality. The speed, volume, and timing constraints associated with data transfers to and
from such devices vary significantly.
Plug-and-Play:-
The plug-and-play feature means that a new device, such as an additional speaker,
can be connected at any time while the system is operating. The system should detect the
existence of this new device automatically, identify the appropriate device-driver software
and any other facilities needed to service that device, and establish the appropriate addresses
and logical connections to enable them to communicate. The plug-and-play requirement has
many implications at all levels in the system, from the hardware to the operating system and
the applications software. One of the primary objectives of the design of the USB has been
to provide a plug-and-play capability.
jntuworldupdates.org Specworld.in