Computer Organization PDF
Computer Organization PDF
Functional units – Basic operational concepts – Bus structures – Performance and metrics
– Instructions and instruction sequencing – Hardware – Software interface – Instruction
set architecture – Addressing modes – RISC – CISC – ALU design – Fixed point and
floating point operations.
Basic concepts – Data hazards – Instruction hazards – Influence on instruction sets – Data
path and control considerations – Performance considerations – Exception handling.
Basic concepts – Semiconductor RAM – ROM – Speed – Size and cost – Cache
memories – Improving cache performance – Virtual memory – Memory management
requirements – Associative memories – Secondary storage devices.
Accessing I/O devices – Programmed I/O – Interrupts – Direct memory access – Buses –
Interface Circuits – Standard I/O interfaces (PCI, SCSI, and USB) – I/O Devices and
processors.
L: 45 T: 15 Total: 60
TEXT BOOKS
1. Carl Hamacher, Zvonko Vranesic and Safwat Zaky, “Computer Organization”, 5th
Edition, Tata Mc-Graw Hill, 2002.
2. Heuring, V.P. and Jordan, H.F., “Computer Systems Design and Architecture”, 2nd
Edition, Pearson Education, 2004.
REFERENCES
1. Patterson, D. A., and Hennessy, J.L., “Computer Organization and Design:The
Hardware/Software Interface”, 3rd Edition, Elsevier, 2005.
2. William Stallings, “Computer Organization and Architecture – Designing for
Performance”, 6th Edition, Pearson Education, 2003.
3. Hayes, J.P., “Computer Architecture and Organization”, 3rd Edition, Tata Mc-Graw
Hill, 1998.
1 GupShupStudy
GupShupStudy 2
UNIT I
Functional units
Bus structures
Hardware
Software interface
Addressing modes
RISC
CISC
ALU design
2 GupShupStudy
GupShupStudy 3
It refers to the operational units and their interconnections that realize the
architectural specifications.
It describes the function of and design of the various units of digital computer that
store and process information.
Computer hardware:
Computer Architecture:
Functional Units
3 GupShupStudy
GupShupStudy 4
4 GupShupStudy
GupShupStudy 5
RAM:
Memory in which any location can be reached in short and fixed amount of time
after specifying its address is called RAM.
Time required to access 1 word is called Memory Access Time.
Cache Memory:
The small,fast,RAM units are called Cache. They are tightly coupled with
processor to achieve high performance.
Main Memory:
The largest and the slowest unit is called the main memory.
1.3. ALU:
Most computer operations are executed in ALU.
Consider a example,
Suppose 2 numbers located in memory are to be added. They are brought
into the processor and the actual addition is carried out by the ALU. The sum may then
be stored in the memory or retained in the processor for immediate use.
Access time to registers is faster than access time to the fastest cache unit in
memory.
1.4. Output Unit:
Its function is to send the processed results to the outside world. eg.Printer
Printers are capable of printing 10000 lines per minute but its speed is
comparatively slower than the processor.
5 GupShupStudy
GupShupStudy 6
Instructions are fetched from memory and the operand at LOC A is fetched. It is then
added to the contents of R0, the resulting sum is stored in Register R0.
Eg:2
Load LOC A, R1
Eg:3
Add R1 ,R0
Add the contents of Register R1 & R0 and places the sum into R0.
Fig:Connection between Processor and Main Memory
Instruction Register(IR)
Program Counter(PC)
6 GupShupStudy
GupShupStudy 7
It contains the memory address of the next instruction to be fetched for execution.
It contains the data to written into or read out of the address location.
MAR and MDR facilitates the communication with memory.
Operation Steps:
The program resides in memory. The execution starts when PC is point to the first
instruction of the program.
MAR read the control signal.
The Memory loads the address word into MDR.The contents are transferred to
Instruction register. The instruction is ready to be decoded & executed.
Interrupt:
ISR save the internal state of the processor in memory before servicing the
interrupt because interrupt may alter the state of the processor.
When ISR is completed, the state of the processor is restored and the interrupted
program may continue its execution.
7 GupShupStudy
GupShupStudy 8
BUS STRUCTURES:
A group of lines that serves as the connection path to several devices is called a Bus.
A Bus may be lines or wires or one bit per line.
The lines carry data or address or control signal.
The Buffer Register when connected with the bus, carries the information during transfer.
The Buffer Register prevents the high speed processor from being locked to a slow I/O
device during a sequence of data transfer.
8 GupShupStudy
GupShupStudy 9
SOFTWARE:
Application program
System program
Application Program:
It translates the high level language program into the machine language program.
Text Editor:
Functions of OS:
9 GupShupStudy
GupShupStudy 10
Steps:
10 GupShupStudy
GupShupStudy 11
PERFORMANCE:
Elapsed Timethe total time required to execute the program is called the elapsed time.
It depends on all the units in computer system.
Processor TimeThe period in which the processor is active is called the processor time.
It depends on hardware involved in the execution of the instruction.
Processor clock:
T = (N*S)/R
11 GupShupStudy
GupShupStudy 12
N,S<R
Clock Rate:
The Complex instruction combined with pipelining would achieve the best
performance.
It is much easier to implement the efficient pipelining in processor with simple
instruction set.
Simple
Simple Instruction
Instruction set
Set
RISC
RISC CISC
CISC
COM Compiler
High level Machine
Translated into
Language instruction
Program
12 GupShupStudy
GupShupStudy 13
Functions of Compiler:
Performance Measurement:
n 1/n
SPEC rating=
Where, ( Π SPECi
n Number )
of programs in the suite
(SPEC)irating i=1
for program I in the suite.
A computer must have instruction capable of performing the following operations. They
are,
13 GupShupStudy
GupShupStudy 14
Memory Location
Processor register
Registers in I/O sub-system.
Add R1,R2,R3 Add the contents of register R1 & R2 and places their sum
into register R3.
14 GupShupStudy
GupShupStudy 15
Instruction Fetch
Instruction Execution
Instruction Fetch:
The instruction is fetched from the memory location whose address is in PC.This is
placed in IR.
Instruction Execution:
Instruction in IR is examined to determine whose operation is to be performed.
Program execution Steps:
Branching:
The Address of the memory locations containing the n numbers are symbolically
given as NUM1,NUM2…..NUMn.
15 GupShupStudy
GupShupStudy 16
Separate Add instruction is used to add each number to the contents of register
R0.
After all the numbers have been added,the result is placed in memory location
SUM.
Decrement R1
16 GupShupStudy
GupShupStudy 17
Conditional Codes:
17 GupShupStudy
GupShupStudy 18
ADDRESSING MODES
Immediate mode
Register mode
Absolute mode
Indirect mode
Index mode
Base with index
Base with index and offset
Relative mode
Auto-increment mode
Auto-decrement mode
Variables:
Register Mode
Absolute Mode
Register Mode:
18 GupShupStudy
GupShupStudy 19
Constants:
Address and data constants can be represented in assembly language using Immediate
Mode.
Immediate Mode.
It places the value 200 in the register R0.The immediate mode used to specify the value
of source operand.
Move #200,R0
Instruction does not give the operand or its address explicitly.Instead it provides
information from which the new address of the operand can be determined.This address
is called effective Address(EA) of the operand.
19 GupShupStudy
GupShupStudy 20
Indirect Mode:
Add (R1),R0
B
…
Operand
Operand
Address of an operand(B) is stored into R1 register.If we want this operand,we can get it
through register R1(indirection).
The register or new location that contains the address of an operand is called the pointer.
Index Mode:
X(Ri)
EA=X + [Ri]
20 GupShupStudy
GupShupStudy 21
The index register R1 contains the address of a new location and the value of X defines
an offset(also called a displacement).
To find operand,
Here the constant X refers to the new address and the contents of index register
define the offset to the operand.
The sum of two values is given explicitly in the instruction and the other is stored
in register.
Relative Addressing:
It is same as index mode. The difference is, instead of general purpose register, here we
can use program counter(PC).
Relative Mode:
The Effective Address is determined by the Index mode using the PC in place of
the general purpose register (gpr).
This mode can be used to access the data operand. But its most common use is to
specify the target address in branch instruction.Eg. Branch>0 Loop
It causes the program execution to goto the branch target location. It is identified
by the name loop if the branch condition is satisfied.
Additional Modes:
21 GupShupStudy
GupShupStudy 22
Auto-increment mode
Auto-decrement mode
Auto-increment mode:
CISC
Pronounced sisk, and stands for Complex Instruction Set Computer. Most PC's use CPU
based on this architecture. For instance Intel and AMD CPU's are based on CISC
architectures.
Typically CISC chips have a large amount of different and complex instructions. The
philosophy behind it is that hardware is always faster than software, therefore one should
make a powerful instruction set, which provides programmers with assembly instructions
to do a lot with short programs.
In common CISC chips are relatively slow (compared to RISC chips) per instruction, but
use little (less than RISC) instructions.
RISC
Pronounced risk, and stands for Reduced Instruction Set Computer. RISC chips evolved
around the mid-1980 as a reaction at CISC chips. The philosophy behind it is that almost
no one uses complex assembly language instructions as used by CISC, and people mostly
use compilers which never use complex instructions. Apple for instance uses RISC chips.
Therefore fewer, simpler and faster instructions would be better, than the large, complex
and slower CISC instructions. However, more instructions are needed to accomplish a
task.
An other advantage of RISC is that - in theory - because of the more simple instructions,
22 GupShupStudy
GupShupStudy 23
RISC chips require fewer transistors, which makes them easier to design and cheaper to
produce.
Finally, it's easier to write powerful optimised compilers, since fewer instructions exist.
RISC vs CISC
There is still considerable controversy among experts about which architecture is better.
Some say that RISC is cheaper and faster and therefor the architecture of the future.
Others note that by making the hardware simpler, RISC puts a greater burden on the
software. Software needs to become more complex. Software developers need to write
more lines for the same tasks.
Therefore they argue that RISC is not the architecture of the future, since conventional
CISC chips are becoming faster and cheaper anyway.
RISC has now existed more than 10 years and hasn't been able to kick CISC out of the
market. If we forget about the embedded market and mainly look at the market for PC's,
workstations and servers I guess a least 75% of the processors are based on the CISC
architecture. Most of them the x86 standard (Intel, AMD, etc.), but even in the mainframe
territory CISC is dominant via the IBM/390 chip. Looks like CISC is here to stay …
Is RISC than really not better? The answer isn't quite that simple. RISC and CISC
architectures are becoming more and more alike. Many of today's RISC chips support
just as many instructions as yesterday's CISC chips. The PowerPC 601, for example,
supports more instructions than the Pentium. Yet the 601 is considered a RISC chip,
while the Pentium is definitely CISC. Further more today's CISC chips use many
techniques formerly associated with RISC chips.
ALU Design
In computing an arithmetic logic unit (ALU) is a digital circuit that performs arithmetic
and logical operations. The ALU is a fundamental building block of the central
processing unit (CPU) of a computer, and even the simplest microprocessors contain one
for purposes such as maintaining timers. The processors found inside modern CPUs and
graphics processing units (GPUs) accommodate very powerful and very complex ALUs;
a single component may contain a number of ALUs.
Mathematician John von Neumann proposed the ALU concept in 1945, when he wrote a
report on the foundations for a new computer called the EDVAC. Research into ALUs
remains an important part of computer science, falling under Arithmetic and logic
structures in the ACM Computing Classification System
Numerical systems
An ALU must process numbers using the same format as the rest of the digital circuit.
The format of modern processors is almost always the two's complement binary number
representation. Early computers used a wide variety of number systems, including ones'
complement, Two's complement sign-magnitude format, and even true decimal systems,
with ten tubes per digit.
23 GupShupStudy
GupShupStudy 24
ALUs for each one of these numeric systems had different designs, and that influenced
the current preference for two's complement, as this is the representation that makes it
easier for the ALUs to calculate additions and subtractions.
The ones' complement and Two's complement number systems allow for subtraction to
be accomplished by adding the negative of a number in a very simple way which negates
the need for specialized circuits to do subtraction; however, calculating the negative in
Two's complement requires adding a one to the low order bit and propagating the carry.
An alternative way to do Two's complement subtraction of A-B is present a 1 to the carry
input of the adder and use ~B rather than B as the second input.
Practical overview
Most of a processor's operations are performed by one or more ALUs. An ALU loads
data from input registers, an external Control Unit then tells the ALU what operation to
perform on that data, and then the ALU stores its result into an output register. Other
mechanisms move data between these registers and memory.
Simple operations
A simple example arithmetic logic unit (2-bit ALU) that does AND, OR, XOR, and
addition
Complex operations
Engineers can design an Arithmetic Logic Unit to calculate any operation. The more
complex the operation, the more expensive the ALU is, the more space it uses in the
processor, the more power it dissipates. Therefore, engineers compromise. They make the
ALU powerful enough to make the processor fast, but yet not so complex as to become
prohibitive. For example, computing the square root of a number might use:
24 GupShupStudy
GupShupStudy 25
produce numbers as fast as a single-clock ALU, although the results start to flow
out of the ALU only after an initial delay.
3. interactive calculation Design a complex ALU that calculates the square root
through several steps. This usually relies on control from a complex control unit
with built-in microcode
4. Co-processor Design a simple ALU in the processor, and sell a separate
specialized and costly processor that the customer can install just beside this one,
and implements one of the options above.
5. Software libraries Tell the programmers that there is no co-processor and there is
no emulation, so they will have to write their own algorithms to calculate square
roots by software.
6. Software emulation Emulate the existence of the co-processor, that is, whenever
a program attempts to perform the square root calculation, make the processor
check if there is a co-processor present and use it if there is one; if there isn't one,
interrupt the processing of the program and invoke the operating system to
perform the square root calculation through some software algorithm.
The options above go from the fastest and most expensive one to the slowest and least
expensive one. Therefore, while even the simplest computer can calculate the most
complicated formula, the simplest computers will usually take a long time doing that
because of the several steps for calculating the formula.
Powerful processors like the Intel Core and AMD64 implement option #1 for several
simple operations, #2 for the most common complex operations and #3 for the extremely
complex operations.
The inputs to the ALU are the data to be operated on (called operands) and a code from
the control unit indicating which operation to perform. Its output is the result of the
computation.
In many designs the ALU also takes or generates as inputs or outputs a set of condition
codes from or to a status register. These codes are used to indicate cases such as carry-in
or carry-out, overflow, divide-by-zero, etc.
A Floating Point Unit also performs arithmetic operations between two values, but they
do so for numbers in floating point representation, which is much more complicated than
the two's complement representation used in a typical ALU. In order to do these
calculations, a FPU has several complex circuits built-in, including some internal ALUs.
In modern practice, engineers typically refer to the ALU as the circuit that performs
integer arithmetic operations (like two's complement and BCD). Circuits that calculate
25 GupShupStudy
GupShupStudy 26
more complex formats like floating point, complex numbers, etc. usually receive a more
specific name such as FPU.
In computing, a fixed-point number representation is a real data type for a number that
has a fixed number of digits after (and sometimes also before) the radix point (e.g., after
the decimal point '.' in English decimal notation). Fixed-point number representation can
be compared to the more complicated (and more computationally demanding) floating
point number representation.
Fixed-point numbers are useful for representing fractional values, usually in base 2 or
base 10, when the executing processor has no floating point unit (FPU) or if fixed-point
provides improved performance or accuracy for the application at hand. Most low-cost
embedded microprocessors and microcontrollers do not have an FPU.
Representation
The scaling factor is usually a power of 10 (for human convenience) or a power of 2 (for
computational efficiency). However, other scaling factors may be used occasionally, e.g.
a time value in hours may be represented as a fixed-point type with a scale factor of
1/3600 to obtain values with one-second accuracy.
The maximum value of a fixed-point type is simply the largest value that can be
represented in the underlying integer type, multiplied by the scaling factor; and similarly
for the minimum value. For example, consider a fixed-point type represented as a binary
integer with b bits in two's complement format, with a scaling factor of 1/2f (that is, the
last f bits are fraction bits): the minimum representable value is −2b-1/2f and the maximum
value is (2b-1-1)/2f.
Operations
To convert a number from a fixed point type with scaling factor R to another type with
scaling factor S, the underlying integer must be multiplied by R and divided by S; that is,
multiplied by the ratio R/S. Thus, for example, to convert the value 1.23 = 123/100 from a
type with scaling factor R=1/100 to one with scaling factor S=1/1000, the underlying
integer 123 must be multiplied by (1/100)/(1/1000) = 10, yielding the representation
1230/1000. If S does not divide R (in particular, if the new scaling factor R is less than the
26 GupShupStudy
GupShupStudy 27
original S), the new integer will have to be rounded. The rounding rules and methods are
usually part of the language's specification.
To add or subtract two values the same fixed-point type, it is sufficient to add or subtract
the underlying integers, and keep their common scaling factor. The result can be exactly
represented in the same type, as long as no overflow occurs (i.e. provided that the sum of
the two integers fits in the underlying integer type.) If the numbers have different fixed-
point types, with different scaling factors, then one of them must be converted to the
other before the sum.
To multiply two fixed-point numbers, it suffices to multiply the two underlying integers,
and assume that the scaling factor of the result is the product of their scaling factors. This
operation involves no rounding. For example, multiplying the numbers 123 scaled by
1/1000 (0.123) and 25 scaled by 1/10 (2.5) yields the integer 123×25 = 3075 scaled by
(1/1000)×(1/10) = 1/10000, that is 3075/10000 = 0.3075. If the two operands belong to
the same fixed-point type, and the result is also to be represented in that type, then the
product of the two integers must be explicitly multiplied by the common scaling factor; in
this case the result may have to be rounded, and overflow may occur. For example, if the
common scaling factor is 1/100, multiplying 1.23 by 0.25 entails multiplying 123 by 25
to yield 3075 with an intermediate scaling factor if 1/10000. This then must be multiplied
by 1/100 to yield either 31 (0.31) or 30 (0.30), depending on the rounding method used,
to result in a final scale factor of 1/100.
To divide two fixed-point numbers, one takes the integer quotient of their underlying
integers, and assumes that the scaling factor is the quotient of their scaling factors. The
first division involves rounding in general. For example, division of 3456 scaled by 1/100
(34.56) by 1234 scaled by 1/1000 (1.234) yields the integer 3456÷1234 = 3 (rounded)
with scale factor (1/100)/(1/1000) = 10, that is, 30. One can obtain a more accurate result
by first converting the dividend to a more precise type: in the same example, converting
3456 scaled by 1/100 (34.56) to 3456000 scaled by 1/100000, before dividing by 1234
scaled by 1/1000 (1.234), would yield 3456000÷1234 = 2801 (rounded) with scaling
factor (1/100000)/(1/1000) = 1/100, that is 28.01 (instead of 290). If both operands and
the desired result are represented in the same fixed-point type, then the quotient of the
two integers must be explicitly divided by the common scaling factor.
27 GupShupStudy
GupShupStudy 28
For simplicity, fixed-point multiply procedures use the same result format as the
operands. This has the effect of keeping the middle bits; the I-number of least significant
integer bits, and the Q-number of most significant fractional bits. Fractional bits lost
below this value represent a precision loss which is common in fractional multiplication.
If any integer bits are lost, however, the value will be radically inaccurate.
Some operations, like divide, often have built-in result limiting so that any positive
overflow results in the largest possible number that can be represented by the current
format. Likewise, negative overflow results in the largest negative number represented by
the current format. This built in limiting is often referred to as saturation.
Some processors support a hardware overflow flag that can generate an exception on the
occurrence of an overflow, but it is usually too late to salvage the proper result at this
point.
With this fractional number system,we can represent the fractional numbers in the
following range,
The binary point is said to be float and the numbers are called floating point
numbers.
The position of binary point in floating point numbers is variable and hence
numbers must be represented in the specific manner is referred to as floating point
representation.
28 GupShupStudy
GupShupStudy 29
Where ,
29 GupShupStudy
GupShupStudy 30
UNIT I
PART A
PART B
6. Explain in detail the different types of instructions that are supported in a typical
processor.
30 GupShupStudy
GupShupStudy 31
UNIT II
Fundamental concepts
Hardwired control
Nano programming.
31 GupShupStudy
GupShupStudy 32
1. Fetch cycle
2. Decode cycle
3. Execute cycle
Basic instruction cycle
To perform fetch, decode and execute cycles the processor unit has to perform set
of operations called micro-operations.
Single bus organization of processor unit shows how the building blocks of
processor unit are organised and how they are interconnected.
32 GupShupStudy
GupShupStudy 33
They can be organised in a variety of ways, in which the arithmetic and logic unit
and all processor registers are connected through a single common bus.
It also shows the external memory bus connected to memory address(MAR) and
data register(MDR).
Single Bus Organisation of processor
The registers Y,Z and Temp are used only by the processor unit for temporary
storage during the execution of some instructions.
These registers are never used for storing data generated by one instruction for
later use by another instruction.
The programmer cannot access these registers.
The IR and the instruction decoder are integral parts of the control circuitry in the
processing unit.
All other registers and the ALU are used for storing and manipulating data.
The data registers, ALU and the interconnecting bus is referred to as data path.
Register R0 through R(n-1) are the processor registers.
The number and use of these register vary considerably from processor to
processor.
33 GupShupStudy
GupShupStudy 34
These registers include general purpose registers and special purpose registers
such as stack pointer, index registers and pointers.
These are 2 options provided for A input of the ALU.
The multiplexer(MUX) is used to select one of the two inputs.
It selects either output of Y register or a constant number as an A input for the
ALU according to the status of the select input.
It selects output of Y when select input is 1 (select Y) and it selects a constant
number when select input is 0(select C) as an input A for the multiplier.
The constant number is used to increment the contents of program counter.
For the execution of various instructions processor has to perform one or more of
the following basic operations:
1. Register Transfers
Each register has input and output gating and these gates are controlled by
corresponding control signals.
Fig: Input and Output Gating for the Registers
34 GupShupStudy
GupShupStudy 35
The input and output gates are nothing but the electronic switches which can be
controlled by the control signals.
When signal is 1, the switch is ON and when the signal is 0, the switch is OFF.
35 GupShupStudy
GupShupStudy 36
The edge triggered D flip-flop which stores the one-bit data is connected to the
common bus through tri-state switches.
Input D is connected through input tri-state switch and output Q is connected
through output tri-state switch.
The control signal Rin enables the input tri-state switch and the data from common
bus is loaded into the D flip-flop in synchronisation with clock input when Rin is
active.
It is implemented using AND gate .
The control signal Rout is activated to load data from Q output of the D flip-flop
on to the common bus by enabling the output tri-state switch.
36 GupShupStudy
GupShupStudy 37
37 GupShupStudy
GupShupStudy 38
38 GupShupStudy
GupShupStudy 39
The address of the memory word to be read word from that location to the
register R3,.
It can be indicated by instruction MOVE R3,(R2).
a) MAR [R2]
b) Activate the control signal to perform the Read operation
c) Load MDR from the memory bus
d) R3 [MDR]
Various control signals which are necessary to activate to perform given actions in each
step:
a) R2out, MARin
b) MARout, MDRinM, Read
c) MDRoutP,R3in
39 GupShupStudy
GupShupStudy 40
40 GupShupStudy
GupShupStudy 41
(v) Step 5, the contents of register R1 are transferred to register Y by activating R1out and
Yin signals. In the same step, MARout, MDRinM and Read signals are activated.
Due to MARout signal, memory gets the address and after receiving read signal
and activation of MDRinM signal it loads the contents of specified location into
MDR register.
(vi) Step 6 MDRoutP, select Y, Add and Zin signals are activated to perform addition of
contents of register Y and the contents of MDR. The result is stored in the register Z.
(vii) Step 7, the contents of register Z are transferred to register R1 by activating Zout and
R1in signals.
Branch Instruction
The branch instruction loads the branch target address in PC so that PC will fetch
the next instruction from the branch target address.
The branch target address is usually obtained by adding the offset in the contents
of PC. The offset is specified within the instruction.
The control sequence for unconditional branch instruction is as follows:
1. PCout, MARin, Yin, SelectC, Add, Zin
2. Zout, PCin, MARout, MDRinM, Read
3. MDRoutP,IRin
4. PCout,Yin
5. Offset_field_Of_IRout,SelectY,Add,Zin
6. Zout,PCin
41 GupShupStudy
GupShupStudy 42
42 GupShupStudy
GupShupStudy 43
Single bus only one data word can be transferred over the bus in a clock cycle.
This increases the steps required to complete the execution of the instruction.
To reduce the number of steps needed to execute instructions, most commercial
process provide multiple internal paths that enable several transfer to take place in
parallel.
3 buses are used to connect registers and the ALU of the processor.
All general purpose registers are shown by a single block called register file.
There are 3 ports, one input port and two output ports.
So it is possible to access data of three register in one clock cycle, the value can
be loaded in one register from bus C and data from two register can be accessed to
bus A and bus B.
Buses A and B are used to transfer the source operands to the A and B inputs of
the ALU.
After performing arithmetic or logic operation result is transferred to the
destination operand over bus C.
To increment the contents of PC after execution of each instruction to fetch the
next instruction, separate unit is provided. This unit is known as incrementer.
Incrementer increments the contents of PC accordingly to the length of the
instruction so that it can point to next instruction in the sequence.
The incrementer eliminates the need of multiplexer connected at the A input of
ALU.
Let us consider the execution of instruction, Add,R1,R2,R3.
This instruction adds the contents of registers R2 and the contents of register R3
and stores the result in R1.
With 3 bus organization control steps required for execution of instruction Add
R1,R2,R3 are as follows:
1. PCout, MARin
2. MARout, MDRinM, Read
3. MDRoutP,IRin
4. R2out,R3out,Add,R1in
Step 1: The contents of PC are transferred to MAR through bus B.
Step 2: The instruction code from the addressed memory location is read into
MDR.
Step 3: The instruction code is transferred from MDR to IR register. At the
beginning of step 4, the instruction decoder interprets the contents of the IR.
This enables the control circuitry to activate the control signals for step 4,
which constitute the execution phase.
Step 4: two operands from register R2 and register R3 are made available at A and
B inputs of ALU through bus A and bus B.
These two inputs are added by activation of Add signal and result is stored
in R1 through bus C.
43 GupShupStudy
GupShupStudy 44
Hardwird Control
The control units use fixed logic circuits to interpret instructions and
generate control signals from them.
The fixed logic circuit block includes combinational circuit that generates the
required control outputs for decoding and encoding functions.
44 GupShupStudy
GupShupStudy 45
45 GupShupStudy
GupShupStudy 46
Instruction decoder
It decodes the instruction loaded in the IR.
If IR is an 8 bit register then instruction decoder generates 28(256 lines); one for
each instruction.
According to code in the IR, only one line amongst all output lines of decoder goes
high (set to 1 and all other lines are set to 0).
Step decoder
It provides a separate signal line for each step, or time slot, in a control sequence.
Encoder
It gets in the input from instruction decoder, step decoder, external inputs and
condition codes.
It uses all these inputs to generate the individual control signals.
After execution of each instruction end signal is generated this resets control step
counter and make it ready for generation of control step for next instruction.
The encoder circuit implements the following logic function to generate Yin
Yin = T1 + T5 . Add + T . BRANCH+…
The Yin signal is asserted during time interval T1 for all instructions, during T5 for
an ADD instruction, during T4 for an unconditional branch instruction, and so on.
As another example, the logic function to generate Zout signal can given by
Zout = T2 + T7 . ADD + T6 . BRANCH +….
The Zout signal is asserted during time interval T2 of all instructions, during T7 for an
ADD instruction, during T6 for an unconditional branch instruction, and so on.
A Complete processor
It consists of
Instruction unit
Integer unit
Floating-point unit
Instruction cache
Data cache
Bus interface unit
Main memory module
Input/Output module.
Instruction unit- It fetches instructions from an instruction cache or from the main
memory when the desired instructions are not available in the cache.
Integer unit – To process integer data
Floating unit – To process floating –point data
Data cache – The integer and floating unit gets data from data cache
The 80486 processor has 8-kbytes single cache for both instruction and data whereas
the Pentium processor has two separate 8 kbytes caches for instruction and data.
46 GupShupStudy
GupShupStudy 47
The processor provides bus interface unit to control the interface of processor to
system bus, main memory module and input/output module.
Microprogrammed Control
Every instruction in a processor is implemented by a sequence of one or more
sets of concurrent micro operations.
Each micro operation is associated with a specific set of control lines which,
when activated, causes that micro operation to take place.
Since the number of instructions and control lines is often in the hundreds, the
complexity of hardwired control unit is very high.
Thus, it is costly and difficult to design. The hardwired control unit is relatively
inflexible because it is difficult to change the design, if one wishes to correct design error
or modify the instruction set.
Microprogramming is a method of control unit design in which the control signal
memory CM.
The control signals to be activated at any time are specified by a microinstruction,
which is fetched from CM.
A sequence of one or more micro operations designed to control specific
operation, such as addition, multiplication is called a micro program.
47 GupShupStudy
GupShupStudy 48
The micro programs for all instructions are stored in the control memory.
48 GupShupStudy
GupShupStudy 49
Microinstruction
There are 46 signals and hence each microinstruction will have 46 bits.
It is not at all necessary to use all 46 bits for every microinstruction because by using
grouping of control signals we minimize number of bits for microinstruction.
49 GupShupStudy
GupShupStudy 50
50 GupShupStudy
GupShupStudy 51
The total number of grouping bits are 17. Therefore, we minimized 46 bits
microinstruction to 17 bit microinstruction.
Techniques of grouping of control signals
The grouping of control signal can be done either by using technique called
vertical organisation or by using technique called vertical organisation or by using
technique called horizontal organisation.
51 GupShupStudy
GupShupStudy 52
Vertical organisation
Highly encoded scheme that can be compact codes to specify only a small number
of control functions in each microinstruction are referred to as a vertical organisation.
Horizontal organisation
The minimally encoded scheme, in which resources can be controlled with a
single instruction is called a horizontal organisation.
1. Vertical approach is the significant factor,it is used to reduce the requirement for the
parallel hardware required to handle the execution of microinstructions.
2. Less bits are required in the microinstruction.
3. The horizontal organisation approach is suitable when operating speed of computer is a
critical factor and where the machine structure allows parallel usage of a number of
resources.
Disadvantages
Vertical approach results in slower operations speed.
Microprogram sequencing
The task of microprogram sequencing is done by microprogram sequencer.
2 important factors must be considered while designing the microprogram
sequencer:
a) The size of the microinstruction
b) The address generation time.
The size of the microinstruction should be minimum so that the size of control memory
required to store microinstructions is also less.
This reduces the cost of control memory.
With less address generation time, microinstruction can be executed in less time resulting
better throughout.
During execution of a microprogram the address of the next microinstruction to be
executed has 3 sources:
i. Determined by instruction register
ii. Next sequential address
iii. Branch
52 GupShupStudy
GupShupStudy 53
Each box in the flowchart corresponds to a microinstruction that controls the transfers
and operations indicated within the box.
The microinstruction is located at the address indicated by the number above the upper
right-hand corner of the box.
During the execution of the microinstruction, the branching takes place at point A.
The branching address is determined by the addressing mode used in the instruction.
Techniques for modification or generation of branch addresses
i. Bit-ORing
The branch address is determined by ORing particular bit or bits
with the current address of microinstruction.
53 GupShupStudy
GupShupStudy 54
Eg: If the current address is 170 and branch address is 172 then the
branch address can be generated by ORing 02(bit 1), with the
current address.
i. Using condition variables
It is used to modify the contents CM address register directly, thus
eliminating whole or in part the need for branch addresses in
µµµµµµmicroinstructions.
Eg: Let the condition variable CY indicate occurance of CY = 1,
and no carry when CY = 0.
Suppose that we want to execute a SKIP_ON_CARRY
microinstruction.
It can be done by logically connecting CY to the count enable
input of µpc at on appropriate point in the microinstruction cycle.
It allows the overflow condition increment µpc an extra time, thus
performing the desired skip operation.
iii. Wide-Brance Addressing
Generating branch addresses becomes more difficult as the number of
branches increases.In such situations programmable logic array can be used to generate
the required branch addresses.The simple and inexpensive way of generating branch
addresses is known as wide-branch addressing.The opcode of a machine instruction is
translated into the starting address of the corresponding micro-routine.This is achieved by
connecting the opcode bits of the instruction register as inputs to the PLA , which acts as
a decoder.The output of the PLA is the address of the desired microroutine.
54 GupShupStudy
GupShupStudy 55
55 GupShupStudy
GupShupStudy 56
56 GupShupStudy
GupShupStudy 57
UNIT III
PIPELINING
Basic concepts
Data hazards
Instruction hazards
Performance considerations
Exception handling
57 GupShupStudy
GupShupStudy 58
Basic Concepts
It is a particularly effective way of organizing concurrent activity in a computer
system.
Sequencial execution
Hardware organization
An inter-stage storage buffer, B1, is needed to hold the information being passed from
one stage to the next.
New information is loaded into this buffer at the end of each clock cycle.
F Fetch: read the instruction from the memory
D Decode: decode the instruction and fetch the source operand(s)
E Execute: perform the operation specified by the instruction
W Write: store the result in the destination location
Pipelined execution
In the first clock cycle, the fetch unit fetches an instruction I1 (step F1) and stores
it in buffer B1 at the end of the clock cycle.
In the second clock cycle the instruction fetch unit proceeds with the fetch
operation for instruction I2 (step F2).
Meanwhile, the execution unit performs the operation specified by instruction
I1,which is available to it in buffer B1 (step E1).
By the end of the second clock cycle, the execution of instruction I1 is completed
and instruction I2 is available.
Instruction I2 is stored in B1, replacing I1, which is no longer needed.
Step E2 is performed by the execution unit during the third clock cycle, while
instruction I3 is being fetched by the fetch unit.
58 GupShupStudy
GupShupStudy 59
These units must be capable of performing their tasks simultaneously and without
interfering with one another.
Information is passed from one unit to the next through a storage buffer.
During clock cycle 4, the information in the buffers is as follows:
Buffer B1 holds instruction I3, which was fetched in cycle 3 and is being decoded
by the instruction-decoding unit.
Buffer B2 holds both the source operands for instruction I2 and the specifications
of the operation to be performed. This is the information produced by the
decoding hardware in cycle 3.
- The buffer also holds the information needed for the write step of
instruction I2(step W2).
- Even though it is not needed by stage E, this information must be
passed on to stage W in the following clock cycle to enable that stage
to perform the required write operation.
Buffer B3 holds the results produced by the execution unit and the destination
information for instruction I1.
Pipeline performance
Pipelining is proportional to the number of pipeline stages.
For variety of reasons, one of the pipeline stages may not be able to complete
its processing task for a given instruction in the time allotted.
For eg, stage E in the four-stage pipeline is responsible for arithmetic and
logic operations and one clock cycle is assigned for this task.
Although this may be sufficient for most operations some operations such as
divide may require more time to complete.
Instruction I2 requires 3 cycles to complete from cycle 4 through cycle 6.
Thus in cycles 5 and 6 the write stage must be told to do nothing, because it
has no data to work with.
Meanwhile, the information in buffer B2 must remain intact until the execute
stage has completed its operation.
59 GupShupStudy
GupShupStudy 60
This means that stage 2 and in turn stage1 are blocked from accepting new
instructions because the information in B1 cannot be overwritten.
Thus steps D4 and F5 must be postponded.
I2 F2 D2 E2 W2
I3 F3 D3 E3 W3
Clock Cycle 1 2 3 4 5 6 7 8 9
Stage
F: Fetch F1 F2 F2 F2 F2
D: Decode D1 idle idle idle D2 D3
E: Execute E1 idle idle idle E2 E3
W : Write W1 idle idle idle W2 W3
Hazard:
Any location that causes the pipeline to stall is called hazard.
60 GupShupStudy
GupShupStudy 61
Data Hazard
A data hazard is any conditions in which either the source or the destination
operands of an instruction are not available at the time expected in the pipeline. As a
result some operation has to be delayed ,and the pipeline stalls.
b)Pipeline performance
For a variety of reasons, one of the pipeline stages may not be able to complete its
processing task for a given instruction I the time allotted.
For Ex. Stage E in the 4 stage pipeline is responsible for arithmetic and logic
operations and one clock cycle is assigned for this task.
Although this may be sufficient for most operations, same operations such as
divide may require more time to complete.
Effect of an execution operation talking more than one clock cycle:
The operation specified in instruction I2 requires three cycles to complete
,from cycle 4 through cycle 6.
Pipe Lining:
1. Basic Concepts:
Pipelining is a particularly effective way of organization concurrent activity in a
computer system.
Instruction pipeline:
The fetch, decode and execute cycles for several instructions are performed
simultaneously to reduce overall processing time. This process is referred to as
instruction pipelining.
Consider 4 stage process
F Fetch : read the instruction from the memory
D Decode: Decode the instruction and fetch the some operands
E Execute: perform the operation specified by the instruction.
W Write: Store the results in the destination location.
During
61 GupShupStudy
GupShupStudy 62
62 GupShupStudy
GupShupStudy 63
When single bus is used in a processor only one data word can be transferred
over the bus in a clock cycle.
This increases the steps required to complete the execution of the instruction.
To reduce the number of steps needed to execute instructions most commercial
processors provide multiple internal paths that enable several transfer to take place in
parallel.
63 GupShupStudy
GupShupStudy 64
3 buses are used to connect registers and the ALU of the processor.
All general purpose registers are connected by a single block called register file.
It has 3 ports:
- One input port
- Two output ports
It is possible to access data of 3 register in one clock cycle, the value can be loaded in
one register from bus C and data from two register can be accessed to bus A and bus B
respectively.
Buses A and B are used to transfer the source operands to the A and B inputs of
the ALU.
64 GupShupStudy
GupShupStudy 65
Superscalar Operation
65 GupShupStudy
GupShupStudy 66
The instruction fetch unit can read two instructions simultaneously and stores
them temporarily in the instruction queue.
The queue operates on the principle first in first out (FIFO).
In each clock cycle, the dispatch unit can take two instructions from the
instruction queue and decodes them.
If these instructions are such that one is integer and another is floating-point with
no hazards, then both instructions are dispatched in the same clock cycle.
The compiler is designed to avoid hazards by proper selection and ordering of the
instructions.
66 GupShupStudy
GupShupStudy 67
It is assumed that the floating point unit takes three clock cycles and integer unit
takes one clock cycle to complete execution.
1. The instruction fetch unit fetches instructions I1 and I2 in clock cycle.
2. I1 and I2 enter the dispatch unit in cycle 2. The fetch unit fetches next two
instructions, I3 and I4 during the same cycle.
3. The floating point unit takes three clock cycles to complete the floating point
operation(Execution: EA,EB,EC) specified in I1. The integer unit completes
execution of I2 in one clock cycle(clock cycle 3). Also, instructions I3 and I4
enter the dispatch unit in cycle 3.
4. We have assumed the floating point unit as a three-stage pipeline. So it can
accept a new instruction for execution in each clock cycle. So during clock cycle
4, though the execution of I1 is in progress, it accepts I3 for the execution. The
integer unit can accept a new instruction for execution because instruction I2 has
entered to the write stage. Thus, instructions I3 and I4 are dispatched in cycle 4.
Instruction I1 is still in the execution phase, but in the second stage of the internal
pipeline in floating-point unit.
5. The instructions complete execution with no hazards as shown in further clock
cycles.
67 GupShupStudy
GupShupStudy 68
Out-of-order Execution
The dispatch unit dispatches the instructions in the order in which they appear in
the program. But their execution may be completed in the different order.
For example, execution of I2 is completed before the complete execution of I1.
Thus the execution of the instructions is completed out of order.
If there is a data dependency among the instructions, the execution of the
instructions is delayed.
For example, if the execution of I2 needs the results of execution of I1, I2 will be
delayed.
If such dependencies are handled correctly, the execution of the instructions will
not be delayed.
There are two causes of exceptions,
- a bus error (during an operand fetch)
- illegal operation(eg. Divide by zero)
-
2 types of exceptions,
- Imprecise exceptions
- Precise exceptions
Imprecise exception
Consider the pipeline timing, the result of operation of I2 is written into the
register file in cycle 4.
If instruction I1 causes an exception and succeeding instructions are permitted to
complete execution, then the processor is said to have imprecise exceptions. Because of
the exception by I1, program execution is in an inconsistent state.
Precise exception
68 GupShupStudy
GupShupStudy 69
69 GupShupStudy
GupShupStudy 70
Register renaming
When temporary register holds the contents of the permanent register, the name of
permanent register is given to that temporary register is called as register
renaming.
For example, if I2 uses R4 as a destination register, then the temporary register
used in step TW2 is also reffered as R4 during cycles 6 and 7, that temporary
register used only for instructions that follow I2 in program order.
For example, if I1 needs to read R4 in cycle 6 or 7, it has to access R4 though it
contains unmodified data be I2.
Commitment Unit
It is a special control unit needed to guarantee in-order commitment when out-of-
order execution is allowed.
It uses a special queue called the reorder buffer which stores the instruction
committed next.
Retired instructions
The instructions entered in the reorder buffer(queue)of the commitment unit
strictly in program order.
When the instruction from this queue is executed completely, the results obtained
from it are copied from temporary registers to the permanent registers and
instruction is removed from the queue.
The resources which were assigned to the instruction are released.
At this stage, the instruction is said to have been retired.
The instructions are retired in program order though they may complete execution
out of order.
That is, all instructions that were dispatched before it must also have been retired.
Dispatch operation
Deadlock
Consider 2 units U1 and U2 are using shared resources.
U2 needs completion of the task assign to unit U1 to complete its task.
If unit U2 is using a resource which is also required to unit U1, both units cannot
complete the tasks assigned to them.
Both the units remain waiting for the need resource.
Also, unit U2 is waiting for the completion of task by unit U1 before it can release that
resource. Such a situation is called a deadlock.
70 GupShupStudy
GupShupStudy 71
71 GupShupStudy
GupShupStudy 72
UNIT IV
MEMORY SYSTEM
Basic concepts
Semiconductor RAM
ROM
Cache memories
Virtual memory
Associative memories
72 GupShupStudy
GupShupStudy 73
BASIC CONCEPTS
The maximum size of the memory that can be used in any computer is determined
by the addressing scheme.
If MAR is k bits long and MDR is n bits long, then the memory may contain upto
2K addressable locations and the n-bits of data are transferred between the
memory and processor.
This transfer takes place over the processor bus.
The processor bus has,
Address Line
Data Line
Control Line (R/W, MFC – Memory Function Completed)
Memory Access Time → It is the time that elapses between the intiation of an
73 GupShupStudy
GupShupStudy 74
Cache Memory:
It is a small, fast memory that is inserted between the larger slower main memory
and the processor.
It holds the currently active segments of a pgm and their data.
Virtual memory:
The address generated by the processor does not directly specify the physical
locations in the memory.
The address generated by the processor is referred to as a virtual / logical address.
The virtual address space is mapped onto the physical memory where data are
actually stored.
The mapping function is implemented by a special memory control circuit is often
called the memory management unit.
Only the active portion of the address space is mapped into locations in the
physical memory.
The remaining virtual addresses are mapped onto the bulk storage devices used,
which are usually magnetic disk.
As the active portion of the virtual address space changes during program
execution, the memory management unit changes the mapping function and
transfers the data between disk and memory.
Thus, during every memory cycle, an address processing mechanism determines
whether the addressed in function is in the physical memory unit.
If it is, then the proper word is accessed and execution proceeds.
If it is not, a page of words containing the desired word is transferred from disk to
memory.
This page displaces some page in the memory that is currently inactive.
74 GupShupStudy
GupShupStudy 75
Memory cells are usually organized in the form of array, in which each cell is
capable of storing one bit of in formation.
Each row of cells constitute a memory word and all cells of a row are connected
to a common line called as word line.
The cells in each column are connected to Sense / Write circuit by two bit lines.
The Sense / Write circuits are connected to data input or output lines of the chip.
During a write operation, the sense / write circuit receive input information and
store it in the cells of the selected word.
The data input and data output of each senses / write ckt are connected to a single
bidirectional data line that can be connected to a data bus of the cptr.
CS Chip Select input selects a given chip in the multi-chip memory system
Requirement of external
Bit Organization connection for address, data and
control lines
128 (16x8) 14
(1024) 128x8(1k) 19
75 GupShupStudy
GupShupStudy 76
Static Memories:
Memories that consists of circuits capable of retaining their state as long as power is
applied are known as static memory.
Read Operation:
In order to read the state of the SRAM cell, the word line is activated to close
switches T1 and T2.
If the cell is in state 1, the signal on bit line b is high and the signal on the bit line
b is low.Thus b and b are complement of each other.
Sense / write circuit at the end of the bit line monitors the state of b and b‟ and set
the output accordingly.
Write Operation:
The state of the cell is set by placing the appropriate value on bit line b and its
complement on b and then activating the word line. This forces the cell into the
corresponding state.
The required signal on the bit lines are generated by Sense / Write circuit.
Fig:CMOS cell (Complementary Metal oxide Semi Conductor):
76 GupShupStudy
GupShupStudy 77
Transistor pairs (T3, T5) and (T4, T6) form the inverters in the latch.
In state 1, the voltage at point X is high by having T5, T6 on and T4, T5 are OFF.
Thus T1, and T2 returned ON (Closed), bit line b and b will have high and low
signals respectively.
The CMOS requires 5V (in older version) or 3.3.V (in new version) of power
supply voltage.
The continuous power is needed for the cell to retain its state
Merit :
It has low power consumption because the current flows in the cell only when the
cell is being activated accessed.
Static RAM‟s can be accessed quickly. It access time is few nanoseconds.
Demerit:
SRAM‟s are said to be volatile memories because their contents are lost when the
power is interrupted.
Asynchronous DRAMS:-
Less expensive RAM‟s can be implemented if simplex calls are used such cells
cannot retain their state indefinitely. Hence they are called Dynamic RAM’s
(DRAM).
The information stored in a dynamic memory cell in the form of a charge on a
capacitor and this charge can be maintained only for tens of Milliseconds.
The contents must be periodically refreshed by restoring by restoring this
capacitor charge to its full value.
In order to store information in the cell, the transistor T is turned „on‟ & the
appropriate voltage is applied to the bit line, which charges the capacitor.
After the transistor is turned off, the capacitor begins to discharge which is caused
by the capacitor‟s own leakage resistance.
Hence the information stored in the cell can be retrieved correctly before the
threshold value of the capacitor drops down.
77 GupShupStudy
GupShupStudy 78
During a read operation, the transistor is turned „on‟ & a sense amplifier
connected to the bit line detects whether the charge on the capacitor is above the
threshold value.
If charge on capacitor > threshold value -> Bit line will have logic value „1‟.
If charge on capacitor < threshold value -> Bit line will set to logic value „0‟.
DESCRIPTION:
The 4 bit cells in each row are divided into 512 groups of 8.
21 bit address is needed to access a byte in the memory(12 bitTo select a row,9
bitSpecify the group of 8 bits in the selected row).
During Read/ Write operation ,the row address is applied first. It is loaded into the
row address latch in response to a signal pulse on Row Address Strobe(RAS)
input of the chip.
When a Read operation is initiated, all cells on the selected row are read and
refreshed.
Shortly after the row address is loaded,the column address is applied to the
address pins & loaded into Column Address Strobe(CAS).
The information in this latch is decoded and the appropriate group of 8
Sense/Write circuits are selected.
R/W =1(read operation)The output values of the selected circuits are
transferred to the data lines D0 - D7.
R/W =0(write operation)The information on D0 - D7 are transferred to the
selected circuits.
78 GupShupStudy
GupShupStudy 79
RAS and CAS are active low so that they cause the latching of address when they
change from high to low. This is because they are indicated by RAS & CAS.
To ensure that the contents of a DRAM „s are maintained, each row of cells must
be accessed periodically.
Refresh operation usually perform this function automatically.
A specialized memory controller circuit provides the necessary control signals
RAS & CAS, that govern the timing.
The processor must take into account the delay in the response of the memory.
Such memories are referred to as Asynchronous DRAM’s.
79 GupShupStudy
GupShupStudy 80
Data held in the latches that correspond to the selected columns are transferred
into the data output register, thus becoming available on the data output pins.
It refers to the amount of time it takes to transfer a word of data to or from the
memory.
For a transfer of single word,the latency provides the complete indication of
memory performance.
For a block transfer,the latency denote the time it takes to transfer the first word
of data.
Bandwidth:
It is defined as the number of bits or bytes that can be transferred in one second.
80 GupShupStudy
GupShupStudy 81
Bandwidth mainly depends upon the speed of access to the stored data & on the
number of bits that can be accessed in parallel.
The standard SDRAM performs all actions on the rising edge of the clock signal.
The double data rate SDRAM transfer data on both the edges(loading edge,
trailing edge).
The Bandwidth of DDR-SDRAM is doubled for long burst transfer.
To make it possible to access the data at high rate , the cell array is organized into
two banks.
Each bank can be accessed separately.
Consecutive words of a given block are stored in different banks.
Such interleaving of words allows simultaneous access to two words that are
transferred on successive edge of the clock.
Larger Memories:
SIMM & DIMM consists of several memory chips on a separate small board that
plugs vertically into single socket on the motherboard.
To reduce the number of pins, the dynamic memory chips use multiplexed
address inputs.
The address is divided into two parts.They are,
High Order Address Bit(Select a row in cell array & it is provided first
and latched into memory chips under the control of RAS signal).
Low Order Address Bit(Selects a column and they are provided on same
address pins and latched using CAS signals).
81 GupShupStudy
GupShupStudy 82
The Controller accepts a complete address & R/W signal from the processor,
under the control of a Request signal which indicates that a memory access
operation is needed.
The Controller then forwards the row & column portions of the address to the
memory and generates RAS &CAS signals.
It also sends R/W &CS signals to the memory.
The CS signal is usually active low, hence it is shown as CS.
Refresh Overhead:
Clock cycle=4
Clock Rate=133MHZ
No of cycles to refresh all rows =8192*4
=32,768
Time needed to refresh all rows=32768/133*106
=246*10-6 sec
=0.246sec
Refresh Overhead =0.246/64
Refresh Overhead =0.0038
Rambus Memory:
82 GupShupStudy
GupShupStudy 83
Instead of using signals that have voltage levels of either 0 or Vsupply to represent
the logical values, the signals consists of much smaller voltage swings around a
reference voltage Vref.
.The reference Voltage is about 2V and the two logical values are represented by
0.3V swings above and below Vref..
This type of signaling is generally is known as Differential Signalling.
Rambus provides a complete specification for the design of communication
links(Special Interface circuits) called as Rambus Channel.
Rambus memory has a clock frequency of 400MHZ.
The data are transmitted on both the edges of the clock so that the effective data
transfer rate is 800MHZ.
The circuitry needed to interface to the Rambus channel is included on the
chip.Such chips are known as Rambus DRAM‟s(RDRAM).
Rambus channel has,
A two channel rambus has 18 data lines which has no separate address lines.It is
also called as Direct RDRAM’s.
Communication between processor or some other device that can serves as a
master and RDRAM modules are serves as slaves ,is carried out by means of
packets transmitted on the data lines.
There are 3 types of packets.They are,
Request
Acknowledge
Data
83 GupShupStudy
GupShupStudy 84
Fig:ROM cell
Types of ROM:
PROM
EPROM
EEPROM
Flash Memory
PROM:-Programmable ROM:
Merit:
It provides flexibility.
It is faster.
It is less expensive because they can be programmed directly by the user.
EPROM allows the stored data to be erased and new data to be loaded.
84 GupShupStudy
GupShupStudy 85
Demerits:
The chip must be physically removed from the circuit for reprogramming and its
entire contents are erased by UV light.
Merits:
It can be both programmed and erased electrically.
It allows the erasing of all cell contents selectively.
Demerits:
It requires different voltage for erasing ,writing and reading the stored data.
Flash Memory:
Flash Cards:
One way of constructing larger module is to mount flash chips on a small card.
Such flash card have standard interface.
85 GupShupStudy
GupShupStudy 86
Flash Drives:
Larger flash memory module can be developed by replacing the hard disk drive.
The flash drives are designed to fully emulate the hard disk.
The flash drives are solid state electronic devices that have no movable parts.
Merits:
They have shorter seek and access time which results in faster response.
They have low power consumption which makes them attractive for battery
driven application.
They are insensitive to vibration.
Demerit:
The capacity of flash drive (<1GB) is less than hard disk(>1GB).
It leads to higher cost perbit.
Flash memory will deteriorate after it has been written a number of
times(typically atleast 1 million times.)
SPEED,SIZE COST:
Characteristics SRAM DRAM Magnetis Disk
Speed Very Fast Slower Much slower than
DRAM
Size Large Small Small
Cost Expensive Less Expensive Low price
Magnetic Disk:
A huge amount of cost effective storage can be provided by magnetic disk;The
main memory can be built with DRAM which leaves SRAM‟s to be used in
smaller units where speed is of essence.
86 GupShupStudy
GupShupStudy 87
Fig:Memory Hierarchy
CACHE MEMORIES
The effectiveness of cache mechanism is based on the property of „Locality of
reference’.
Locality of Reference:
Many instructions in the localized areas of the program are executed repeatedly
during some time period and remainder of the program is accessed relatively
infrequently.
It manifests itself in 2 ways.They are,
Temporal(The recently executed instruction are likely to be executed again
very soon.)
Spatial(The instructions in close proximity to recently executed instruction
are also likely to be executed soon.)
If the active segment of the program is placed in cache memory, then the total
execution time can be reduced significantly.
87 GupShupStudy
GupShupStudy 88
The term Block refers to the set of contiguous address locations of some size.
The cache line is used to refer to the cache block.
Fig:Use of Cache Memory
The Cache memory stores a reasonable number of blocks at a given time but this
number is small compared to the total number of blocks available in Main
Memory.
The correspondence between main memory block and the block in cache memory
is specified by a mapping function.
The Cache control hardware decide that which block should be removed to create
space for the new block that contains the referenced word.
The collection of rule for making this decision is called the replacement
algorithm.
The cache control circuit determines whether the requested word currently exists
in the cache.
If it exists, then Read/Write operation will take place on appropriate cache
location. In this case Read/Write hit will occur.
In a Read operation, the memory will not involve.
The write operation is proceed in 2 ways.They are,
Write-through protocol
Write-back protocol
Write-through protocol:
Here the cache location and the main memory locations are updated
simultaneously.
Write-back protocol:
This technique is to update only the cache location and to mark it as with
associated flag bit called dirty/modified bit.
The word in the main memory will be updated later,when the block containing
this marked word is to be removed from the cache to make room for a new block.
If the requested word currently not exists in the cache during read operation,then
read miss will occur.
To overcome the read miss Load –through / Early restart protocol is used.
88 GupShupStudy
GupShupStudy 89
Read Miss:
The block of words that contains the requested word is copied from the main memory
into cache.
Load –through:
After the entire block is loaded into cache,the particular word requested is
forwarded to the processor.
If the requested word not exists in the cache during write operation,then Write
Miss will occur.
If Write through protocol is used,the information is written directly into main
memory.
If Write back protocol is used then block containing the addressed word is first
brought intothe cache and then the desired word in the cache is over-written with
the new information.
Mapping Function:
Direct Mapping:
It is the simplest technique in which block j of the main memory maps onto block
„j‟ modulo 128 of the cache.
Thus whenever one of the main memory blocks 0,128,256 is loaded in the cache,it
is stored in block 0.
Block 1,129,257 are stored in cache block 1 and so on.
The contention may arise when,
When the cache is full
When more than one memory block is mapped onto a given cache block
position.
The contention is resolved by allowing the new blocks to overwrite the currently
resident block.
Placement of block in the cache is determined from memory address.
Fig: Direct Mapped Cache
89 GupShupStudy
GupShupStudy 90
Associative Mapping:
In this method, the main memory block can be placed into any cache block position.
12 tag bits will identify a memory block when it is resolved in the cache.
The tag bits of an address received from the processor are compared to the tag bits
of each block of the cache to see if the desired block is persent.This is called
associative mapping.
It gives complete freedom in choosing the cache location.
A new block that has to be brought into the cache has to replace(eject)an existing
block if the cache is full.
90 GupShupStudy
GupShupStudy 91
In this method,the memory has to determine whether a given block is in the cache.
A search of this kind is called an associative Search.
Merit:
It is more flexible than direct mapping technique.
Demerit:
Its cost is high.
Set-Associative Mapping:
It is the combination of direct and associative mapping.
The blocks of the cache are grouped into sets and the mapping allows a block of
the main memory to reside in any block of the specified set.
In this case,the cache has two blocks per set,so the memory blocks
0,64,128……..4032 maps into cache set „0‟ and they can occupy either of the two
block position within the set.
6 bit set fieldDetermines which set of cache contains the desired block .
6 bit tag fieldThe tag field of the address is compared to the tags of the two blocks of
the set to clock if the desired block is present.
2 6
3 5
8 4
128 no set field
91 GupShupStudy
GupShupStudy 92
The cache which contains 1 block per set is called direct Mapping.
A cache that has „k‟ blocks per set is called as „k-way set associative cache‟.
Each block contains a control bit called a valid bit.
The Valid bit indicates that whether the block contains valid data.
The dirty bit indicates that whether the block has been modified during its cache
residency.
Valid bit=0When power is initially applied to system
Valid bit =1When the block is loaded from main memory at first time.
If the main memory block is updated by a source & if the block in the source is
already exists in the cache,then the valid bit will be cleared to „0‟.
If Processor & DMA uses the same copies of data then it is called as the Cache
Coherence Problem.
Merit:
The Contention problem of direct mapping is solved by having few choices for
block placement.
The hardware cost is decreased by reducing the size of associative search.
Replacement Algorithm:
In direct mapping, the position of each block is pre-determined and there is no
need of replacement strategy.
In associative & set associative method,the block position is not pre-
determined;ie..when the cache is full and if new blocks are brought into the cache,
then the cache controller must decide which of the old blocks has to be replaced.
Therefore,when a block is to be over-written,it is sensible to over-write the one
that has gone the longest time without being referenced.This block is called Least
recently Used(LRU) block & the technique is called LRU algorithm.
The cache controller track the references to all blocks with the help of block
counter.
Eg:
92 GupShupStudy
GupShupStudy 93
PERFORMANCE CONSIDERATION:
Two Key factors in the commercial success are the performance & cost ie the best
possible performance at low cost.
A common measure of success is called the Pricel Performance ratio.
Performance depends on how fast the machine instruction are brought to the
processor and how fast they are executed.
To achieve parallelism(ie. Both the slow and fast units are accessed in the same
manner),interleaving is used.
Interleaving:
Fig:Consecutive words in a Module
VIRTUAL MEMORY:
Techniques that automatically move program and data blocks into the physical
main memory when they are required for execution is called the Virtual
Memory.
The binary address that the processor issues either for instruction or data are
called the virtual / Logical address.
The virtual address is translated into physical address by a combination of
hardware and software components.This kind of address translation is done by
MMU(Memory Management Unit).
When the desired data are in the main memory ,these data are fetched /accessed
immediately.
If the data are not in the main memory,the MMU causes the Operating system to
bring the data into memory from the disk.
93 GupShupStudy
GupShupStudy 94
Transfer of data between disk and main memory is performed using DMA
scheme.
Address Translation:
In address translation,all programs and data are composed of fixed length units
called Pages.
The Page consists of a block of words that occupy contiguous locations in the
main memory.
The pages are commonly range from 2K to 16K bytes in length.
The cache bridge speed up the gap between main memory and secondary storage
and it is implemented in software techniques.
Each virtual address generated by the processor contains virtual Page
number(Low order bit) and offset(High order bit)
Virtual Page number+ OffsetSpecifies the location of a particular byte (or word) within
a page.
Page Table:
It contains the information about the main memory address where the page is
stored & the current status of the page.
Page Frame:
An area in the main memory that holds one page is called the page frame.
Page Table Base Register:
94 GupShupStudy
GupShupStudy 95
The Control bits specifies the status of the page while it is in main memory.
Function:
The control bit indicates the validity of the page ie)it checks whether the page is
actually loaded in the main memory.
It also indicates that whether the page has been modified during its residency in
the memory;this information is needed to determine whether the page should be
written back to the disk before it is removed from the main memory to make room
for another page.
The Page table information is used by MMU for every read & write access.
The Page table is placed in the main memory but a copy of the small portion of
the page table is located within MMU.
This small portion or small cache is called Translation LookAside Buffer(TLB).
This portion consists of the page table enteries that corresponds to the most
recently accessed pages and also contains the virtual address of the entry.
95 GupShupStudy
GupShupStudy 96
When the operating system changes the contents of page table ,the control bit in
TLB will invalidate the corresponding entry in the TLB.
Given a virtual address,the MMU looks in TLB for the referenced page.
If the page table entry for this page is found in TLB,the physical address is
obtained immediately.
If there is a miss in TLB,then the required entry is obtained from the page table in
the main memory & TLB is updated.
When a program generates an access request to a page that is not in the main
memory ,then Page Fault will occur.
The whole page must be broght from disk into memry before an access can
proceed.
When it detects a page fault,the MMU asks the operating system to generate an
interrupt.
The operating System suspend the execution of the task that caused the page fault
and begin execution of another task whose pages are in main memory because the
long delay occurs while page transfer takes place.
When the task resumes,either the interrupted instruction must continue from the
point of interruption or the instruction must be restarted.
If a new page is brought from the disk when the main memory is full,it must
replace one of the resident pages.In that case,it uses LRU algorithm which
removes the least referenced Page.
96 GupShupStudy
GupShupStudy 97
A modified page has to be written back to the disk before it is removed from the
main memory. In that case,write –through protocol is used.
SECONDARY STORAGE:
The Semi-conductor memories donot provide all the storage capability.
The Secondary storage devices provide larger storage requirements.
Some of the Secondary Storage devices are,
Magnetic Disk
Optical Disk
Magnetic Tapes.
Magnetic Disk:
Magnetic Disk system consists o one or more disk mounted on a common spindle.
A thin magnetic film is deposited on each disk, usually on both sides.
97 GupShupStudy
GupShupStudy 98
The disk are placed in a rotary drive so that the magnetized surfaces move in
close proximity to read /write heads.
Each head consists of magnetic yoke & magnetizing coil.
Digital information can be stored on the magnetic film by applying the current
pulse of suitable polarity to the magnetizing coil.
Only changes in the magnetic field under the head can be sensed during the Read
operation.
Therefore if the binary states 0 & 1 are represented by two opposite states of
magnetization, a voltage is induced in the head only at 0-1 and at 1-0 transition in
the bit stream.
A consecutive (long string) of 0‟s & 1‟s are determined by using the clock which
is mainly used for synchronization.
Phase Encoding or Manchester Encoding is the technique to combine the clocking
information with data.
The Manchester Encoding describes that how the self-clocking scheme is
implemented.
Fig:Mechanical Structure
The Read/Write heads must be maintained at a very small distance from the
moving disk surfaces in order to achieve high bit densities.
When the disk are moving at their steady state, the air pressure develops between
the disk surfaces & the head & it forces the head away from the surface.
The flexible spring connection between head and its arm mounting permits the
head to fly at the desired distance away from the surface.
Wanchester Technology:
Read/Write heads are placed in a sealed, air –filtered enclosure called the
Wanchester Technology.
98 GupShupStudy
GupShupStudy 99
In such units, the read/write heads can operate closure to magnetic track surfaces
because the dust particles which are a problem in unsealed assemblies are absent.
Merits:
99 GupShupStudy
GupShupStudy 100
One inch disk- weight=1 ounce, size -> comparable to match book
Capacity -> 1GB
Inch disk has the following parameter
Recording surface=20
Tracks=15000 tracks/surface
Sectors=400.
Each sector stores 512 bytes of data
Capacity of formatted disk=20x15000x400x512=60x109 =60GB
Seek time=3ms
Platter rotation=10000 rev/min
Latency=3ms
Internet transfer rate=34MB/s
Data Buffer / cache
A disk drive that incorporates the required SCSI circuit is referred as SCSI drive.
The SCSI can transfer data at higher rate than the disk tracks.
An efficient method to deal with the possible difference in transfer rate between
disk and SCSI bus is accomplished by including a data buffer.
This buffer is a semiconductor memory.
The data buffer can also provide cache mechanism for the disk (ie) when a read
request arrives at the disk, then controller first check if the data is available in the
cache(buffer).
If the data is available in the cache, it can be accessed and placed on SCSI bus . If
it is not available then the data will be retrieved from the disk.
Disk Controller
The disk controller acts as interface between disk drive and system bus.
The disk controller uses DMA scheme to transfer data between disk and main
memory.
100 GupShupStudy
GupShupStudy 101
When the OS initiates the transfer by issuing Read/Write request, the controllers
register will load the following information. They are,
Main memory address(address of first main memory location of the block of
words involved in the transfer)
Disk address(The location of the sector containing the beginning of the desired
block of words)
(number of words in the block to be transferred).
101 GupShupStudy
GupShupStudy 102
The SCSI can transfer data at higher rate than the disk tracks.
An efficient method to deal with the possible difference in transfer rate between disk and
SCSI bus is accomplished by including a data buffer.
This buffer is a semiconductor memory.
The data buffer can also provide cache mechanism for the disk (ie) when a read request
arrives at the disk, then controller first check if the data is available in the cache(buffer).
If the data is available in the cache, it can be accessed and placed on SCSI bus . If it is not
available then the data will be retrieved from the disk.
Disk Controller
The disk controller acts as interface between disk drive and system bus.
The disk controller uses DMA scheme to transfer data between disk and main memory.
When the OS initiates the transfer by issuing Read/Write request, the controllers register
will load the following information. They are,
Main memory address(address of first main memory location of the block of words
involved in the transfer)
Disk address(The location of the sector containing the beginning of the desired block of
words)
(number of words in the block to be transferred).
UNIT V
MEMORY SYSTEM
PART-A
102 GupShupStudy
GupShupStudy 103
PART – B
103 GupShupStudy
GupShupStudy 104
UNIT V
I/O ORGANIZATION
Programmed I/O
Interrupts
Buses
Interface Circuits
104 GupShupStudy
GupShupStudy 105
Processor Memory
Bus
Eg:-
Move DATAIN, Ro Reads the data from DATAIN then into processor register Ro.
Move Ro, DATAOUT Send the contents of register Ro to location DATAOUT.
DATAIN Input buffer associated with keyboard.
DATAOUT Output data buffer of a display unit / printer.
Address line
Data line
Control line
Input device.
105 GupShupStudy
GupShupStudy 106
Address Decoder:
It enables the device to recognize its address when the address appears on address
lines.
Data register It holds the data being transferred to or from the processor.
Status register It contains infn/. Relevant to the operation of the I/O devices.
The address decoder, data & status registers and the control circuitry required to
co-ordinate I/O transfers constitute the device‟s I/F circuit.
For an input device, SIN status flag in used SIN = 1, when a character is entered
at the keyboard.
For an output device, SOUT status flag is used SIN = 0, once the char is read by
processor.
Eg
The data from the keyboard are made available in the DATAIN register & the data sent to
the display are stored in DATAOUT register.
Program:
106 GupShupStudy
GupShupStudy 107
DMA:
Synchronization is achieved by having I/O device send special over the bus where
is ready for data transfer operation)
It is a technique used for high speed I/O device.
Here, the input device transfer data directly to or from the memory without
continuous involvement by the processor.
107 GupShupStudy
GupShupStudy 108
INTERRUPTS
When a program enters a wait loop, it will repeatedly check the device status.
During this period, the processor will not perform any function.
The Interrupt request line will send a hardware signal called the interrupt signal to
the processor.
On receiving this signal, the processor will perform the useful function during the
waiting period.
The routine executed in response to an interrupt request is called Interrupt
Service Routine.
The interrupt resembles the subroutine calls.
The processor first completes the execution of instruction i Then it loads the
PC(Program Counter) with the address of the first instruction of the ISR.
After the execution of ISR, the processor has to come back to instruction i + 1.
Therefore, when an interrupt occurs, the current contents of PC which point to i
+1 is put in temporary storage in a known location.
A return from interrupt instruction at the end of ISR reloads the PC from that
temporary storage location, causing the execution to resume at instruction i+1.
When the processor is handling the interrupts, it must inform the device that its
request has been recognized so that it remove its interrupt requests signal.
This may be accomplished by a special control signal called the interrupt
acknowledge signal.
The task of saving and restoring the information can be done automatically by the
processor.
The processor saves only the contents of program counter & status register (ie)
it saves only the minimal amount of information to maintain the integrity of the
program execution.
108 GupShupStudy
GupShupStudy 109
Saving registers also increases the delay between the time an interrupt request is
received and the start of the execution of the ISR. This delay is called the
Interrupt Latency.
Generally, the long interrupt latency in unacceptable.
The concept of interrupts is used in Operating System and in Control
Applications, where processing of certain routines must be accurately timed
relative to external events. This application is also called as real-time processing.
Interrupt Hardware:
Fig:An equivalent circuit for an open drain bus used to implement a common
interrupt request line
A single interrupt request line may be used to serve „n‟ devices. All devices are
connected to the line via switches to ground.
To request an interrupt, a device closes its associated switch, the voltage on INTR
line drops to 0(zero).
If all the interrupt request signals (INTR1 to INTRn) are inactive, all switches are
open and the voltage on INTR line is equal to Vdd.
When a device requests an interrupts, the value of INTR is the logical OR of the
requests from individual devices.
INTR It is used to name the INTR signal on common line it is active in the low
voltage state.
Open collector (bipolar ckt) or Open drain (MOS circuits) is used to drive INTR
line.
The Output of the Open collector (or) Open drain control is equal to a switch to
the ground that is open when gates input is in „0‟ state and closed when the gates
input is in „1‟ state.
Resistor „R‟ is called a pull-up resistor because it pulls the line voltage upto the
high voltage state when the switches are open.
109 GupShupStudy
GupShupStudy 110
The arrival of an interrupt request from an external device causes the processor to
suspend the execution of one program & start the execution of another because
the interrupt may alter the sequence of events to be executed.
INTR is active during the execution of Interrupt Service Routine.
There are 3 mechanisms to solve the problem of infinite loop which occurs due to
successive interruptions of active INTR signals.
The following are the typical scenario.
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 said to be edge-
triggered.
When several devices requests interrupt at the same time, it raises some questions.
They are.
Polling Scheme:
If two devices have activated the interrupt request line, the ISR for the selected
device (first device) will be completed & then the second request can be serviced.
The simplest way to identify the interrupting device is to have the ISR polls all
the encountered with the IRQ bit set is the device to be serviced
IRQ (Interrupt Request) -> when a device raises an interrupt requests, the status
register IRQ is set to 1.
Merit:
110 GupShupStudy
GupShupStudy 111
It is easy to implement.
Demerit:
The time spent for interrogating the IRQ bits of all the devices that may not be
requesting any service.
Vectored Interrupt:
Here the device requesting an interrupt may identify itself to the processor by
sending a special code over the bus & then the processor start executing the ISR.
The code supplied by the processor indicates the starting address of the ISR for
the device.
The code length ranges from 4 to 8 bits.
The location pointed to by the interrupting device is used to store the staring
address to ISR.
The processor reads this address, called the interrupt vector & loads into PC.
The interrupt vector also includes a new value for the Processor Status Register.
When the processor is ready to receive the interrupt vector code, it activate the
interrupt acknowledge (INTA) line.
Interrupt Nesting:
Multiple Priority Scheme:
In multiple level priority scheme, we 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.
At the time the execution of an ISR for some device is started, the priority of the
processor is raised to that of the device.
The action disables interrupts from devices at the same level of priority or lower.
Privileged Instruction:
The processor priority is usually encoded in a few bits of the Processor Status
word. It can also be changed by program instruction & then it is write into PS.
These instructions are called privileged instruction. This can be executed only
when the processor is in supervisor mode.
The processor is in supervisor mode only when executing OS routines.
It switches to the user mode before beginning to execute application program.
Privileged Exception:
111 GupShupStudy
GupShupStudy 112
Simultaneous Requests:
Daisy Chain:
The interrupt request line INTR is common to all devices. The interrupt
acknowledge line INTA is connected in a daisy chain fashion such that INTA
signal propagates serially through the devices.
When several devices raise an interrupt request, the INTR is activated & the
processor responds by setting INTA line to 1. this signal is received by device.
112 GupShupStudy
GupShupStudy 113
Device1 passes the signal on to device2 only if it does not require any service.
If devices1 has a pending request for interrupt blocks that INTA signal &
proceeds to put its identification code on the data lines.
Therefore, the device that is electrically closest to the processor has the highest
priority.
Merits:
It requires fewer wires than the individual connections.
Here the devices are organized in groups & each group is connected at a different
priority level.
Within a group, devices are connected in a daisy chain.
Exception of ISR:
Read the input characters from the keyboard input data register. This will cause
the interface circuits to remove its interrupt requests.
Store the characters in a memory location pointed to by PNTR & increment
PNTR.
When the end of line is reached, disable keyboard interrupt & inform program
main.
Return from interrupt.
113 GupShupStudy
GupShupStudy 114
Exceptions:
Kinds of exception:
Debugging:
System software has a program called debugger, which helps to find errors in a
program.
The debugger uses exceptions to provide two important facilities
They are
Trace
Breakpoint
Trace Mode:
Break point:
Here the program being debugged is interrupted only at specific points selected by
the user.
114 GupShupStudy
GupShupStudy 115
An instance called the Trap (or) software interrupt is usually provided for this
purpose.
While debugging the user may interrupt the program execution after instance „I‟
When the program is executed and reaches that point it examine the memory and
register contents.
Privileged Exception:
Starting address
Number of words in the block
Direction of transfer.
When a block of data is transferred , the DMA controller increment the memory
address for successive words and keep track of number of words and it also informs
the processor by raising an interrupt signal.
While DMA control is taking place, the program requested the transfer cannot
continue and the processor can be used to execute another program.
After DMA transfer is completed, the processor returns to the program that requested
the transfer.
Fig:Registes in a DMA Interface
31 30 1 0
Status &
Control Flag
IRQ Done
IE
Starting Address
Word Count
115 GupShupStudy
GupShupStudy 116
A DMA controller connects a high speed network to the computer bus . The disk
controller two disks, also has DMA capability and it provides two DMA channels.
To start a DMA transfer of a block of data from main memory to one of the disks,
the program write s the address and the word count inf. Into the registers of the
corresponding channel of the disk controller.
When DMA transfer is completed, it will be recorded in status and control
registers of the DMA channel (ie) Done bit=IRQ=IE=1.
Cycle Stealing:
Requests by DMA devices for using the bus are having higher priority than
processor requests .
Top priority is given to high speed peripherals such as ,
Disk
High speed Network Interface and Graphics display device.
Since the processor originates most memory access cycles, the DMA controller
can be said to steal the memory cycles from the processor.
This interviewing technique is called Cycle stealing.
116 GupShupStudy
GupShupStudy 117
Burst Mode:
The DMA controller may be given exclusive access to the main memory to
transfer a block of data without interruption. This is known as Burst/Block Mode
Bus Master:
The device that is allowed to initiate data transfers on the bus at any given time is
called the bus master.
Bus Arbitration:
It is the process by which the next device to become the bus master is selected and
the bus mastership is transferred to it.
Types:
There are 2 approaches to bus arbitration. They are,
Centralized Arbitration:
Here the processor is the bus master and it may grants bus mastership to one of its
DMA controller.
A DMA controller indicates that it needs to become the bus master by activating
the Bus Request line (BR) which is an open drain line.
The signal on BR is the logical OR of the bus request from all devices connected
to it.
When BR is activated the processor activates the Bus Grant Signal (BGI) and
indicated the DMA controller that they may use the bus when it becomes free.
This signal is connected to all devices using a daisy chain arrangement.
If DMA requests the bus, it blocks the propagation of Grant Signal to other
devices and it indicates to all devices that it is using the bus by activating open
collector line, Bus Busy (BBSY).
117 GupShupStudy
GupShupStudy 118
Fig: Sequence of signals during transfer of bus mastership for the devices
The timing diagram shows the sequence of events for the devices connected to the
processor is shown.
DMA controller 2 requests and acquires bus mastership and later releases the bus.
During its tenture as bus master, it may perform one or more data transfer.
After it releases the bus, the processor resources bus mastership
Distributed Arbitration:
It means that all devices waiting to use the bus have equal responsibility in carrying out
the arbitration process.
118 GupShupStudy
GupShupStudy 119
The net outcome is that the code on the four lines represents the request that has
the highest ID number.
The drivers are of open collector type. Hence, if the i/p to one driver is equal to 1,
the i/p to another driver connected to the same bus line is equal to „0‟(ie. bus the
is in low-voltage state).
Eg:
Assume two devices A & B have their ID 5 (0101), 6(0110) and their code is
0111.
Each devices compares the pattern on the arbitration line to its own ID starting
from MSB.
If it detects a difference at any bit position, it disables the drivers at that bit
position. It does this by placing „0‟ at the i/p of these drivers.
In our eg. „A‟ detects a difference in line ARB1, hence it disables the drivers on
lines ARB1 & ARB0.
This causes the pattern on the arbitration line to change to 0110 which means that
„B‟ has won the contention.
Buses
A bus protocol is the set of rules that govern the behavior of various devices
connected to the bus ie, when to place information in the bus, assert control
signals etc.
The bus lines used for transferring data is grouped into 3 types. They are,
Address line
Data line
Control line.
During data transfer operation, one device plays the role of a „Master‟.
Master device initiates the data transfer by issuing read / write command on the
bus. Hence it is also called as „Initiator‟.
The device addressed by the master is called as Slave / Target.
Types of Buses:
There are 2 types of buses. They are,
Synchronous Bus
Asynchronous Bus.
Synchronous Bus:-
In synchronous bus, all devices derive timing information from a common clock
line.
Equally spaced pulses on this line define equal time.
119 GupShupStudy
GupShupStudy 120
At time to, the master places the device address on the address lines & sends an
appropriate command on the control lines.
In this case, the command will indicate an input operation & specify the length of
the operand to be read.
The clock pulse width t1 – t0 must be longer than the maximum delay between
devices connected to the bus.
The clock pulse width should be long to allow the devices to decode the address
& control signals so that the addressed device can respond at time t1.
The slaves take no action or place any data on the bus before t1.
The picture shows two views of the signal except the clock.
One view shows the signal seen by the master & the other is seen by the salve.
The master sends the address & command signals on the rising edge at the
beginning of clock period (t0). These signals do not actually appear on the bus
until tam.
120 GupShupStudy
GupShupStudy 121
During, clock cycle1, the master sends address & cmd infn/. On the bus‟
requesting a „read‟ operation.
The slave receives this information & decodes it.
At the active edge of the clock (ie) the beginning of clock cycel2, it makes
accession to respond immediately.
The data become ready & are placed in the bus at clock cycle3.
At the same times, the slave asserts a control signal called „slave-ready‟.
The master which has been waiting for this signal, strobes, the data to its i/p
buffer at the end of clock cycle3.
The bus transfer operation is now complete & the master sends a new address to
start a new transfer in clock cycle4.
The „slave-ready‟ signal is an acknowledgement form the slave to the master
confirming that valid data has been sent.
Asynchronous Bus:-
An alternate scheme for controlling data transfer on. The bus is based on the use
of „handshake‟ between Master & the Slave. The common clock is replaced by
two timing control lines.
They are
121 GupShupStudy
GupShupStudy 122
Master–ready
Slave ready.
The delay t1 – t0 is intended to allow for any skew that may occurs on the bus.
The skew occurs when two signals simultaneously transmitted from one source
arrive at the destination at different time.
Thus to guarantee that the Master ready signal does not arrive at any device a
head of the address and command information the delay t1 – t0 should be larger
than the maximum possible bus skew.
At t2 The selected slave having decoded the address and command information
performs the required i/p operation by placing the data from its data
register on the data lines. At the same time, it sets the “slave – Ready”
signal to 1.
At t3 The slave ready signal arrives at the master indicating that the i/p data are
available on the bus.
At t4 The master removes the address and command information on the bus.
The delay between t3 and t4 is again intended to allow for bus skew.
Errorneous addressing may take place if the address, as seen by some
device on the bus, starts to change while the master – ready signal is still
equal to 1.
At t5 When the device interface receives the 1 to 0 tranitions of the Master –
ready signal. It removes the data and the slave – ready signal from the bus.
This completes the i/p transfer.
122 GupShupStudy
GupShupStudy 123
In this diagram, the master place the output data on the data lines and at the same
time it transmits the address and command information.
The selected slave strobes the data to its o/p buffer when it receives the Master-
ready signal and it indicates this by setting the slave – ready signal to 1.
At time t0 to t1 and from t3 to t4, the Master compensates for bus.
A change of state is one signal is followed by a change is the other signal. Hence
this scheme is called as Full Handshake.
It provides the higher degree of flexibility and reliability.
INTERFACE CIRCUITS:
The interface circuits are of two types.They are
Parallel Port
Serial Port
Parallel Port:
The output of the encoder consists of the bits that represent the encoded character
and one signal called valid,which indicates the key is pressed.
The information is sent to the interface circuits,which contains a data
register,DATAIN and a status flag SIN.
When a key is pressed, the Valid signal changes from 0 to1,causing the ASCII
code to be loaded into DATAIN and SIN set to 1.
The status flag SIN set to 0 when the processor reads the contents of the DATAIN
register.
The interface circuit is connected to the asynchronous bus on which transfers are
controlled using the Handshake signals Master ready and Slave-ready.
123 GupShupStudy
GupShupStudy 124
Serial Port:
A serial port used to connect the processor to I/O device that requires transmission one
bit at a time.
It is capable of communicating in a bit serial fashion on the device side and in a bit
parallel fashion on the bus side.
Bridge
124 GupShupStudy
GupShupStudy 125
Processor Bus
SCSI Bus
125 GupShupStudy
GupShupStudy 126
Data Transfer:
The data are transferred between cache and main memory is the bursts of several
words and they are stored in successive memory locations.
When the processor specifies an address and request a „read‟ operation from
memory, the memory responds by sending a sequence of data words starting at
that address.
During write operation, the processor sends the address followed by sequence of
data words to be written in successive memory locations.
PCI supports read and write operation.
A read / write operation involving a single word is treated as a burst of length one.
PCI has three address spaces. They are
HOST
PCI
BUS
126 GupShupStudy
GupShupStudy 127
Name Function
127 GupShupStudy
GupShupStudy 128
During clock cycle 3, the initiator asserts IRDY #, to indicate that it is ready to
receive data.
If the target has data ready to send then it asserts TRDY #. In our eg, the target
sends 3 more words of data in clock cycle 4 to 6.
The indicator uses FRAME # to indicate the duration of the burst, since it read 4
words, the initiator negates FRAME # during clock cycle 5.
After sending the 4th word, the target disconnects its drivers and negates DEVSEL
# during clockcycle 7.
The PCI has a configuration ROM memory that stores information about that
device.
The configuration ROM‟s of all devices are accessible in the configuration
address space.
The initialization s/w read these ROM‟s whenever the S/M is powered up or reset
In each case, it determines whether the device is a printer, keyboard, Ethernet
interface or disk controller.
Devices are assigned address during initialization process and each device has an
w/p signal called IDSEL # (Initialization device select) which has 21 address lines
(AD) (AD to AD31).
During configuration operation, the address is applied to AD i/p of the device and
the corresponding AD line is set to and all other lines are set to 0.
128 GupShupStudy
GupShupStudy 129
The connectors can be plugged only in compatible motherboards PCI bus can
operate with either 5 – 33V power supply.
The motherboard can operate with signaling system.
Because of these various options, SCSI connector may have 50, 68 or 80 pins.
The data transfer rate ranges from 5MB/s to 160MB/s 320Mb/s, 640MB/s.
The transfer rate depends on,
Length of the cable
Number of devices connected.
To achieve high transfer rat, the bus length should be 1.6m for SE signaling and
12m for LVD signaling.
The SCSI bus us connected to the processor bus through the SCSI controller.
The data are stored on a disk in blocks called sectors.
Each sector contains several hundreds of bytes. These data will not be stored in
contiguous memory location.
SCSI protocol is designed to retrieve the data in the first sector or any other
selected sectors.
Using SCSI protocol, the burst of data are transferred at high speed.
The controller connected to SCSI bus is of 2 types. They are,
Initiator
Target
Initiator:
129 GupShupStudy
GupShupStudy 130
It has the ability to select a particular target & to send commands specifying the
operation to be performed.
They are the controllers on the processor side.
Target:
The disk controller operates as a target.
It carries out the commands it receive from the initiator. The initiator establishes a
logical connection with the intended target.
Steps:
Consider the disk read operation, it has the following sequence of events.
The SCSI controller acting as initiator, contends process, it selects the target
controller & hands over control of the bus to it.
The target starts an output operation, in response to this the initiator sends a
command specifying the required read operation.
The target that it needs to perform a disk seek operation, sends a message to the
initiator indicating that it will temporarily suspends the connection between them.
Then it releases the bus.
The target controller sends a command to disk drive to move the read head to the
first sector involved in the requested read in a data buffer. When it is ready to
begin transferring data to initiator, the target requests control of the bus. After it
wins arbitration, it reselects the initiator controller, thus restoring the suspended
connection.
The target transfers the controls of the data buffer to the initiator & then suspends
the connection again. Data are transferred either 8 (or) 16 bits in parallel
depending on the width of the bus.
The target controller sends a command to the disk drive to perform another seek
operation. Then it transfers the contents of second disk sector to the initiator. At
the end of this transfer, the logical connection b/w the two controller is
terminated.
As the initiator controller receives the data, if stores them into main memory
using DMA approach.
The SCSI controller sends an interrupt to the processor to inform it that the
requested operation has been completed.
Bus Signals:-
The bus has no address lines.
Instead, it has data lines to identify the bus controllers involved in the selection /
reselection / arbitration process.
For narrow bus, there are 8 possible controllers numbered from 0 to 7.
For a wide bus, there are 16 controllers.
Once a connection is established b/w two controllers, these is no further need for
addressing & the datalines are used to carry the data.
130 GupShupStudy
GupShupStudy 131
131 GupShupStudy
GupShupStudy 132
Fig:Arbitration and selection on the SCSI bus.Device 6 wins arbitration and select
device 2
Selection:
Here Device wons arbitration and it asserts –BSY and –DB6 signals.
The Select Target Controller responds by asserting –BSY.
This informs that the connection that it requested is established.
Reselection:
The connection between the two controllers has been reestablished,with the target
in control the bus as required for data transfer to proceed.
It provide a simple, low cost & easy to use interconnection s/m that overcomes
the difficulties due to the limited number of I/O ports available on a computer.
It accommodate a wide range of data transfer characteristics for I/O devices
including telephone & Internet connections.
Enhance user convenience through ‘Plug & Play’ mode of operation.
132 GupShupStudy
GupShupStudy 133
Port Limitation:-
Normally the system has a few limited ports.
To add new ports, the user must open the computer box to gain access to the
internal expansion bus & install a new interface card.
The user may also need to know to configure the device & the s/w.
Merits of USB:-
USB helps to add many devices to a computer system at any time without opening the
computer box.
Device Characteristics:-
The kinds of devices that may be connected to a cptr cover a wide range of
functionality.
The speed, volume & timing constrains associated with data transfer to & from
devices varies significantly.
Eg:1 Keyboard Since the event of pressing a key is not synchronized to any other
event in a computer system, the data generated by keyboard are called asynchronous.
The data generated from keyboard depends upon the speed of the human operator which
is about 100bytes/sec.
The sound picked up by the microphone produces an analog electric signal, which
must be converted into digital form before it can be handled by the cptr.
This is accomplished by sampling the analog signal periodically.
The sampling process yields a continuous stream of digitized samples that arrive
at regular intervals, synchronized with the sampling clock. Such a stream is called
isochronous (ie) successive events are separated by equal period of time.
If the sampling rate in „S‟ samples/sec then the maximum frequency captured by
sampling process is s/2.
A standard rate for digital sound is 44.1 KHz.
Requirements for sampled Voice:-
It is important to maintain precise time (delay) in the sampling & replay process.
A high degree of jitter (Variability in sampling time) is unacceptable.
133 GupShupStudy
GupShupStudy 134
The main objective of USB is that it provides a plug & play capability.
The plug & play feature enhances the connection of new device at any time, while
the system is operation.
The system should,
Detect the existence of the new device automatically.
Identify the appropriate device driver s/w.
Establish the appropriate addresses.
Establish the logical connection for communication.
USB Architecture:-
USB has a serial bus format which satisfies the low-cost & flexibility
requirements.
Clock & data information are encoded together & transmitted as a single signal.
There are no limitations on clock frequency or distance arising form data skew, &
hence it is possible to provide a high data transfer bandwidth by using a high
clock frequency.
To accommodate a large no/. of devices that can be added / removed at any time,
the USB has the tree structure.
Each node of the tree has a device called „hub‟, which acts as an intermediate
control point b/w host & I/O devices.
At the root of the tree, the „root hub‟ connects the entire tree to the host computer.
The leaves of the tree are the I/O devices being served.
134 GupShupStudy
GupShupStudy 135
UNIT V
PART A
PART – B
1) Write the short notes on programmed I/O and memory mapped I/O
2) What is DMA? Describe how DMA is used to transfer data?
3) Explain briefly about PCI and USB Bus.
4) Discuss about the structure of a distributed shared memory system with various
interconnection schemes and message passing mechanism.
5) Explain the bus interconnection structure and characteristics of SCSI bus
Standard.
135 GupShupStudy
GupShupStudy 136
D 276
B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2003.
Fourth Semester
3. Define underflow.
5. Define microinstruction.
6. What is Pipelining?
9. What is DMA?
PART B — (5 16 = 80 marks)
12. (a) Explain the bit slice processor and its internal structure of the ALU.
Or
136 GupShupStudy
GupShupStudy 137
(b) How Floating point addition is implemented? Explain briefly with neat
diagram.
13. (a) Describe the Microprogrammed control unit based on Wilke’s original
design.
Or
14. (a) How Cache blocks are mapped to main memory module using direct
mapping method and Associate Mapping Method.
Or
15. (a) Write short notes on programmed I/O and memory mapped I/O.
Or
(b) What is DMA? Describe how DMA is used to transfer Data from
peripherals.
———————
137 GupShupStudy