Computer Architecture Computer Architecture
Computer Architecture Computer Architecture
Computer Architecture
SOLUTION BANK
Unit - I
DIGITAL LOGIC CIRCUITS: Logic gates Boolean algebra, map simplification,
combinational circuits, flip-flop, sequential circuits. INTEGRATED CIRCUITS AND
DIGITAL FUNCTIONS: Digital integrated circuits, IC flip –flops and registers, decoders
and multiplexers, binary counters, shift registers, random –access memories (RAM) read –
only memories (ROM). [12 Hours]
Unit - II
DATA REPRESENTATION: Data types, fixed-point representation, floating – point
representation, other binary codes, error detection codes. DATA TRANSFER
OPERATIONS: Register Transfer, Memory Transfer and I/O Transfer. [12 Hours]
Unit – III
BASIC COMPUTER ORGANISATION AND DESIGN: Instruction codes, computer
instruction, timing and control, execution and instruction, input-output and interrupt, design
of computer. [12 Hours]
Unit - IV
CENTRAL PROCESSOR ORGANIZATION: Processor bus organization, arithmetic logic
unit (ALU) instruction formats, addressing modes, data transfer and manipulation, program
control, microprocessor organization. [12 Hours]
Unit – V
INPUT-OUTPUT ORGANISATION: Peripheral devices. asynchronous data transfer, direct
memory access (DMA), priority interrupt, input –output processor (IOP). MEMORY
ORGANIZATION: Auxiliary memory, microcomputer memory hierarchy, associative
memory, virtual memory, cache memory. [12 Hours]
Text Books:
1. M. Morris Mano, Computer System, Architecture, 2nd Edition Prentice Hall of India.
Reference Books:
1. Heuring and Jordan, Computer systems design and Architecture, Pearson Edition
2. William Stallings, Computer Organization and Architecture, Pearson Education
3. Floyd, Digital Fundamentals,8th Edition, Pearson Education.
4. Andrew S. Tanenbaum, Structured Computer Organization, 3rd Edition; Prentice Hall of
India.
5. David Patterson & Hennessy, Computer Organization & Design, Elsevier.
SECTION – A ( 2 Marks)
UNIT-I
[ Nov / Dec 2015 ]
1. State and prove De-Morgan’s theorem
2. Draw the logic diagram of Boolean function using
NAND gates only.
3. What is decoder expansion?
4. What is unidirectional and bidirectional shift register
SECTION – A ( 2 Marks)
UNIT-II
[ Nov / Dec 2015 ]
1. Convert (736.4)8 into decimal and binary
2. What is self-complementing code and weighted code?
SECTION – A ( 2 Marks)
UNIT-III
[ Nov / Dec 2015 ]
1. What are the two types of control organization?
2. How many bits are needed to specify an address for a memory unit of 4096 words.
SECTION – A ( 2 Marks)
UNIT-IV
[ Nov / Dec 2015 ]
1. What is PSW?
2. What is an external interrupt? Give an example?
SECTION – A ( 2 Marks)
UNIT-V
[ Nov / Dec 2015 ]
1. What are peripherals?
2. What is memory management system?
SECTION – B ( 5 Marks )
UNIT-I
[ Nov / Dec 2015 ]
1. Simplify the Boolean function F(A,B,C,D)=∑(0,1,2,5,8,9,10) in both SOP and POS .
2. Design 4-to-1 multiplexer.
SECTION – B ( 5 Marks )
UNIT-II
[ Nov / Dec 2015 ]
1. Define r and (r-1)’s complement. Represent -14 using integer representation stored in
an 8 bit register.
SECTION – B ( 5 Marks )
UNIT-III
[ Nov / Dec 2015 ]
1. List the micro operations of ADD and ISZ instruction.
2. Explain with neat block diagram the input-output configuration.
SECTION – B ( 5 Marks )
UNIT-IV
[ Nov / Dec 2015 ]
1. Explain register stack with a neat block diagram.
SECTION – B ( 5 Marks )
UNIT-V
[ Nov / Dec 2015 ]
1. What is polling? Explain.
2. Explain Associative memory with a neat diagram.
4. Define counter. With a neat diagram explain 4-bit synchronous binary counter.
5. Explain octal to binary encoder with diagram.
Unit – II
1. Explain floating point representation in brief.
2. Explain in brief Gray code.
3. What is Excess 3 code? Explain.
4. What is cyclic code? Explain.
5. Explain code conversion with an example.
Unit – III
1. What is stored program organization? Explain.
2. Explain computer registers.
3. Explain instruction execution.
4. Explain computer instruction with an example.
5. Explain the design of the computer with a flowchart.
Unit – IV
1. Explain Bus organization with a neat diagram.
2. Explain the formats of instructions.
3. What is program interrupt? Explain.
4. Distinguish between RISC and CISC.
5. Explain the arithmetic and logic unit.
Unit – V
1. Give the difference between Isolated I/O vs Memory mapped I/O.
2. Explain strobe control with an example.
3. Explain DMA with a neat diagram.
4. Explain in brief Cache memory and Virtual memory.
5. Explain classification of memory. Explain in brief.
*****
11111111111111111111111111111111111 SN - 664
V Semester B.C.A. Degree Examination, NovJDec. 2017
(CBCS) (F + R) (2016-17 and Onwards)
BCA 503 : COMPUTER ARCHITECTURE
SECTION-A
SECTION-B
II. Answer any five questions. Each question carries five marks. (5x5=25)
13) Explain the steps involved in the design of the sequential circuits.
14) Explain synchronous binary counter with logic diagram.
15) Discuss on error detection and correction codes briefly.
16) Explain any five register reference instructions.
17) With a block diagram, explain how BSA instruction executes.
18) Explain the addressing modes.
19) Explain DMA controller with a block diagram.
20) Write a note on virtual memory.
p.T.a.
SN-664 11111111111111111111111111111111111
SECTION-C
21) a) Simplify F(ABCD) = l: m (1,3,7, 11, 15) + l:d (0, 2, 5) using K-map. 7
b) What is a half adder? Design a half adder using only NAND gates. 8
22) a) Explain decoder expansion with neat diagram. 7
b) Discuss the parity generator and parity checker. 8
23) a) Explain common bus organization of basic computer with neat diagram. 8
b) Distinguish between FGI and FGO. 7
24) a) What is a sub-routine? Explain CALL and RETURN instructions. 8
b) Explain the arithmetic logic shift with a neat diagram. 7
25) a) Explain I/O interface unit with a neat diagram. 8
b) Write a note on isolated vs memory mapped I/O. 7
SECTION-D
14. What are the two types of computer architecture based on registers?
1.Von Neumann architecture
2. Harvard architecture
20. Write the symbol, logical expression and truth table of NAND gate?
The Logical symbol and truth table
Logical Expression:
Z=(X.Y)’
De-multiplexer(DMUX) is also a device with one input and multiple output lines. It is
used to send a signal to one of the many devices. The main difference between a
multiplexer and a de-multiplexer is that a multiplexer takes two or more signals and
encodes them on a wire, whereas a de-multiplexer does reverse to what the multiplexer
does.
29. How many bits are needed to specify an address for a memory until of 4096 words?
For a memory unit with 4096 words, weneed 12 bits to specify and address since
212 = 4096.
A NAND gate is a universal gate, meaning that any other gate can be represented as
a combination of NAND gates.
From the above table, the output Y2 becomes 1 if any of the digits D4 or D5 or D6
or D7 is one. Thus, we can write its expression as
Y2 = D4 + D5 + D6 + D7
Similarly, Y1 = D2 + D3 + D6 + D7 and
Y0 = D1 + D3 + D5 + D7
Also it is to be observed that D0 does not exist in any of the expressions so it is
considered as don’t care. From the above expressions, we can implement the octal
to binary encoder using set of OR gates as shown in figure below
There is ambiguity in the octal to binary encoder that when all the inputs are zero,
an output with all 0’s is generated. Also, when Do is 1, the output generated is zero.
This is a major problem in this type of encoder. This can be resolved by specifying
the condition that none of the inputs are active with an additional output
5. What is half adder? Design a half adder using only NAND gates
Half Adder is the digital circuit which can generate the result of the addition of two
1-bit numbers. It consists of two input terminals through which 1-bit numbers can
be given for processing. After this, the half adder generates the sum of the numbers
and carry if present.
The half adder can also be designed with the help of NAND gates. NAND gate is
considered as a universal gate. A universal gate can be used for designing of any
digital circuitry. It is always simple and efficient to use the minimum number of
gates in the designing process of our circuit. The minimum number of NAND gates
required to design half adder is 5.
The first NAND gate takes the inputs which are the two 1-bit numbers. The
resultant NAND operated inputs will be again given as input to 3- NAND gates
along with the original input. Out of these 3 NAND gates, 2-NAND gates will
generate the output which will be given as input to the NAND gate connected at the
end. The gate connected at the end will generate the sum bit. Out of the 3
considered NAND gates, the third NAND gate will generate the carry bit.
Truth table :
1. With inputs S=0 and R=0, the clock pulse has no effect on output X. The flip
flop is in the idle or hold mode.
2. With inputs S=0 and R=1, when the clock pulse is applied, the active high signal
on R resets or clears the flip flop to 0. Then flip flop is said to be in reset mode.
3. With inputs S=1 and R=0, when the clock pulse is applied, the active high signal
on S sets the flip flop to 1. Then flip flop is said to be in set mode.
4. With inputs S=1 and R=1, when the clock pulse is applied, the flip flop to 0.
The flip flop enters the prohibited or forbidden state. This sate cannot be used.
8. Explain 8 to 3 Encoder
The 8 to 3 Encoder or octal to Binary encoder consists of 8 inputs : Y7 to Y0 and 3
outputs : A2, A1 & A0. Each input line corresponds to each octal digit and three
outputs generate corresponding binary code.
The figure below shows the logic symbol of octal to binary encoder:
A2 = Y7 + Y6 + Y5 + Y4
A1 = Y7 + Y6 + Y3 + Y2
A0 = Y7 + Y5 + Y3 + Y1
The above two Boolean functions A2, A1 and A0 can be implemented using four
input OR gates :
Truth Table :
The logic diagram for Full Adder can be developed from the 2 logical expressions
for S (sum) Cout Carry.
S = AB’Cin + A’BC’in + ABC’in + ABCin
Cout = A’BCin + AB’Cin + ABC’in + ABCin
PARITY GENERATOR
• When this device is used as an even parity generator, the parity bit is taken
at the odd output because this output is a0 if there is an even number of
input bits, and it is a 1 if there is an odd number. When used an odd parity
generator, the parity bit is taken at the a 0 even output because it is a0 when
the number of inputs is odd.
• Parity Code:-It is easy to include (append) one parity bit either to the left of
MSB or to the right of LSB of original bit stream. There are two types of parity
codes, namely even parity code and odd parity code based on the type of parity
being chosen.
• Even Parity Code:-The value of even parity bit should be zero, if even number
of ones present in the binary code. Otherwise, it should be one. So that, even
number of ones present in even parity code. Even parity code contains the data
bits and even parity bit.
The following table shows the even parity codes corresponding to each 3-bit binary
code. Here, the even parity bit is included to the right of LSB of binary code.
Binary Even Parity Even Parity
Code bit Code
000 0 0000
001 1 0011
010 1 0101
011 0 0110
100 1 1001
101 0 1010
110 0 1100
111 1 1111
• Odd Parity Code The value of odd parity bit should be zero, if odd number of ones
present in the binary code. Otherwise, it should be one. So that, odd number of
ones present in odd parity code. Odd parity code contains the data bits and odd
parity bit.
The following table shows the odd parity codes corresponding to each 3-bit binary code.
Here, the odd parity bit is included to the right of LSB of binary code.
1. The parity bit can be attached to the code at the beginning or the end,
depending on how the system is designed.
2. At the sending end, the message is applied to a parity generator, where the
required the required parity bit is generated.
3. The message, including the parity bit, is transmitted to its destination.
4. At the receiving end, all the incoming bits are applied to a parity checker that
checks the proper parity adopted (odd or even).
5. If the checked parity does not conform to the adopted parity, an error is
detected.
• The basic computer has eight registers, a memory unit, and a control unit . Paths
must be provided to transfer information from one register to another and between
memory and registers
• The number of wires will be excessive if connections are made between the outputs
of each register and the inputs of the other registers.
• A more efficient scheme for transferring information in a system with many
registers is to use a common bus.
• The connection of the registers and memory of the basic computer to a common bus
system is shown in Fig. below. The outputs of seven registers and memory are
connected to the common bus.
The specific output that is selected for the bus lines at any given time is determined
from the binary value of the selection variables S2, S1, and S0.
• The number along each output shows the decimal equivalent of the required binary
selection. For example, the number along the output of DR is 3.
• The 16-bit outputs of DR are placed on the bus lines when S2S1S0 = 011 since this is
the binary value of decimal 3.
• The lines from the common bus are connected to the inputs of each register and the
data inputs of the memory. The particular register whose LD (load) input is enabled
receives the data from the bus during the next clock pulse transition.
• The memory receives the contents of the bus when its write input is activated. The
memory places its 16-bit output onto the bus when the read input is activated and
S2S1S0 = 111.
• Four registers, DR, AC, IR, and TR, have 16 bits each. Two registers, AR
• and PC, have 12 bits each since they hold a memory address. When the contents of
AR or PC are applied to the 16-bit common bus, the four most significant bits are
set to 0's.
• When AR or PC receive information from the bus, only the 12 least significant bits
are transferred into the register. The input register INPR and the output register
OUTR have 8 bits each and communicate with the eight least significant bits in the
bus.
• INPR is connected to provide information to the bus but OUTR can only receive
information from the bus.
• This is because INPR receives a character from an input device which is then
transferred to AC. OUTR receives a character from AC and delivers it to an output
device. There is no transfer from OUTR to any of the other registers.
• The 16 lines of the common bus receive information from six registers and the
memory unit. The bus lines are connected to the inputs of six registers and the
memory. Five registers have three control inputs: LD (load), INR (increment), and
CLR (clear).
• This type of register is equivalent to a binary counter with parallel load and
synchronous clear. The increment operation is achieved by enabling the count input
of the counter. Two registers have only a LD input.
• The input data and output data of the memory are connected to the common bus,
but the memory address is connected to AR. Therefore, AR must always be used to
specify a memory address.
• By using a single register for the address, we eliminate the need for an address bus
that would have been needed otherwise. The content of any register can be specified
for the memory data input during a write operation. Similarly, any register can
receive the data from memory after a read operation except AC .
• The 16 inputs of AC come from an adder and logic circuit. This circuit has three
sets of inputs. One set of 16-bit inputs come from the outputs of AC . They are used
to implement register micro operations such as complement AC and shift AC .
• Another set of 16-bit inputs come from the data register DR. The inputs from DR
and AC are used for arithmetic and logic rnlcro operations, such as add DR to AC
or AND DR to AC.
• The result of an addition is transferred to AC and the end carry-out of the addition
is transferred to flip-flop E (extended AC bit). A third set of 8-bit inputs come from
the input register INPR.
• Note that the content of any register can be applied onto the bus and an operation
can be performed in the adder and logic circuit during the same clock cycle. The
clock transition at the end of the cycle transfers the content of the bus into the
designated destination register and the output of the adder and logic circuit into
AC.
It consists of a 3bit opcode, a 12 bit address and a mode bit 1 which is 0 for direct address.
A direct address instruction is placed is address 22 in memory.
Indirect Address mode:
The address field of the instruction gives the address where the effective address is stored
in memory. Control fetches the instruction from memory and uses its address part to
access memory again to read the effective address. One bit of the instruction code can be
used to distinguish between a direct and an indirect address.
The instruction is placed in address 35. The mode bit 1 and so is indirect address. The
address part is binary of 300. The control goes to address 300 to find the address of the
operand. The operand found in address 1350 is then added to the content of AC.
Memory Reference – These instructions refer to memory address as an operand. The other
operand is always accumulator. Specifies 12-bit address, 3-bit opcode (other than 111) and
1-bit addressing mode for direct and indirect addressing.
1. Arithmetic, logical and shift instructions (and, add, complement, circulate left,
right, etc)
2. To move information to and from memory (store the accumulator, load the
accumulator)
3. Program control instructions with status conditions (branch, skip)
4. Input output instructions (input character, output character)
17. What is addressing mode? Explain the different types of addressing modes.
The addressing mode gives or indicates a rule to identify the operands location.
Computers use addressing mode techniques for the purpose of accommodating the
following provisions.
• To give programming versatility to the user.
• To reduce the number of bits in the address field of the instruction.
• To provide flexibility for writing programs.
The various addressing modes available are:
• Implied mode:
In this mode the operands are specified implicitly in the definition of the
instruction. All register reference instructions that use an accumulator ar+
e implied mode instruction.
Ex: CMA
• Immediate mode:
The purpose of an address is to identify an operand value to be used in executing
the instruction. Sometimes the operand values is contained in the instruction
itself, this mode of operand specification is called immediate addressing mode.
Ex: MVI A, 45
• Register mode:
In this mode the operand are in registers which reside within the CPU. The
register is selected from the register field in the instruction.
Ex: MOV AX, BX
• Register indirect mode:
In this instruction, the address field specifies a processor register in the CPU
whose contents give the address of the operand in memory.
Ex: LXI H E000 ; memory address placed in processor register.
CISC RISC
1. Large number of instructions 1. Fewer instructions
2. Emphasis is on hardware 2.Emphasis is on software
3. It includes multi-clock complex 3.It includes single-clock, reduced
instructions instruction only
4. Memory-to-memory: “LOAD” 4.Register to register: “LOAD” and
and “STORE” incorporated in “STORE” are independent
instructions instructions
5. Code size is small but complex. 5.Code size is large but simple. Low
High cycles per second cycles per second
6. Variable length instruction 6.Fixed length instruction format
format
7. Large variety of addressing 7.Few addressing modes
modes
o When executed, the BSA instruction stores the address of the next
instruction in sequence (which is available in PC) into a memory location
specified by the effective address.
• Unconditional Return instruction: RET is the instruction used to mark the end of
sub-routine. It has no parameter. After execution of this instruction program
control is transferred back to main program from where it had stopped. Value of
PC (Program Counter) is retrieved from the memory stack and value of SP (Stack
Pointer) is incremented by 2.
When executed, the BSA instruction stores the address of the next instruction in
sequence (which is available in PC) into a memory location specified by the
effective address.
The effective address plus one is then transferred to PC to serve as the address of
the first instruction in the subroutine.
This operation was specified with the following register transfer: A numerical
example that demonstrates how this instruction is used with a subroutine
The input register INPR consists of eight bits and holds alphanumeric input
information.
The 1-bit input flag FGI is a control flip-flop.
The flag bit is set to 1 when new information is available in the input device and
is cleared to 0 when the information is accepted by the computer.
The output register OUTR works similarly but the direction of information flow
is reversed.
Initially, the output flag FGO is set to 1.
The computer checks the flag bit; if it is 1, the information from AC is
transferred in parallel to OUTR and FGO is cleared to 0.
The output device accepts the coded information, prints the corresponding
character, and when the operation is completed, it sets FGO to 1.
Input-Output Instructions:
Input and output instructions are needed for transferring information to and
from AC register, for checking the flag bits, and for controlling the interrupt
facility.
Input-output instructions have an operation code 1111 and are recognized by the
control when D7 = 1 and I = 1.
The remaining bits of the instruction specify the particular operation.
Example –
IR register contains = 1111100000000000, i.e. INP after fetch and decode cycle we
find out that it is an input/output instruction for inputing character. Hence, INPUT
character from peripheral device.
30. Explain input and output interface unit with neat diagram?
Input Output Interface provides a method for transferring information between
internal storage and external I/O devices. Peripherals connected to a computer need
special communication links for interfacing them with the central processing unit.
The purpose of communication link is to resolve the differences that exist between
the central computer and each peripheral.
The Major Differences are:-
• Peripherals are electro technical and electromagnetic devices and CPU and
memory are electronic devices. Therefore, a conversion of signal values may be
needed.
• The data transfer rate of peripherals is usually slower than the transfer rate of
CPU and consequently, a synchronization mechanism may be needed.
• Data codes and formats in the peripherals differ from the word format in the
CPU and memory.
• The operating modes of peripherals are different from each other and must be
controlled so as not to disturb the operation of other peripherals connected to
the CPU
I/O BUS and Interface Module: It defines the typical link between the processor
and several peripherals. The I/O Bus consists of data lines, address lines and control
lines. The I/O bus from the processor is attached to all peripherals interface. To
communicate with a particular device, the processor places a device address on
address lines. Each Interface decodes the address and control received from the I/O
bus, interprets them for peripherals and provides signals for the peripheral
controller. It is also synchronizing the data flow and supervises the transfer between
peripheral and processor. Each peripheral has its own controller.
For example, the printer controller controls the paper motion, the print timing. The
control lines are referred as I/O command. The commands are as following:
Control command- A control command is issued to activate the peripheral and to
inform it what to do.
Status command- A status command is used to test various status conditions in the
interface and the peripheral.
Data Output command- A data output command causes the interface to respond by
transferring data from the bus into one of its registers.
Data Input command- The data input command is the opposite of the data output.
In this case the interface receives on item of data from the peripheral and places it
in its buffer register. I/O Versus Memory Bus
In first case it is simple because both have different set of address space and
instruction but require more buses.
Isolated I/O
Then we have Isolated I/O in which we Have common bus(data and address) for I/O
and memory but separate read and write control lines for I/O. So when CPU decode
instruction then if data is for I/O then it places the address on the address line and
set I/O read or write control line on due to which data transfer occurs between CPU
and I/O. As the address space of memory and I/O is isolated and the name is so. The
address for I/O here is called ports. Here we have different read-write instruction
for both I/O and memory.
Separate instruction control read and write Same instructions can control both I/O and
operation in I/O and Memory Memory
In this I/O address are called ports. Normal memory address are for both
It is complex due to separate separate logic Simpler logic is used as I/O is also treated
is used to control both. as memory only.
(i) Source places data on the data bus and enable Data valid signal.
(ii) Destination accepts data from the data bus and enable Data accepted signal.
(iii) After this, disable Data valid signal means data on data bus is invalid now.
(iv) Disable Data accepted signal and the process ends.
Now there is surety that destination has read the data from the data bus through
data accepted signal. Signals can be seen as:
• The key register provides a mask for choosing a particular field or key in the
argument word.
• Those bits in the argument that have 1’s in their corresponding position of
the key register are compared.
36. What are the important characteristics of memory?
Characteristics of memory:
1.Location 2.Capacity 3.Unit of transfer 4.Access Method 5.Performance
6.Physical type 7.Physical characteristics 8.Organization
1. Location:
It deals with location of the memory device in the computer system. There
are three possible locations:
• CPU : This is often in the form of CPU registers and small amount of cache.
• Internal or main: This is the main memory like RAM or ROM.The CPU can
directly access the main memory
• External or secondary: It comprises of secondary storage devices like hard
disks, magnetic tapes.
2. Capacity:
The capacity of any memory device is expressed in terms of:1) Word size
2)Number of words
• Word size: words are expressed in bytes(8 bits). A word can however mean
my number of bytes.
• Number of words: This specifies the number of words available in the
particular memory device.
3. Unit of transfer:
It is the maximum number of bits that can be read or written into the
memory.
4. Access Methods:
It is fundamental characteristics of memory devices. It is the sequence or order in
which memory can be accessed.
5. Performance
The performance of system is determined using three parameters:
• Access Time : In random access memories, it is the time taken by memory
to complete the read/write operation from the instant that an address is sent
to the memory.
• Memory cycle time: It is defined only for random access memories and is
the sum of the access time and the additional time required before the
second access can commence.
• Transfer rate: It is defined as the rate at which data can be transferred into
or out of a memory unit.
6. Physical rate:
Memory devices can be either semiconductor memory(like RAM) or magnetic
surface memory(Like hard disks).
7. Physical Characteristics:
✓ Volatile/Non Volatile: If a memory devices continues hold data even if power
is turned off. The memory device is non-volatile else it is volatile.
8. Organizations:
✓ Erasable/Non-erasable: The memories in which data once programmed
cannot be erased are called Non-erasable memories. Memory device in which
data in the memory can be erased is called erasable memory.
CPU is the master while the IOP is a slave processor. The CPU performs the task of
initiating all operations.
The operations include
✓ Starting an I/O transfer
✓ Testing I/O status conditions needed for making decisions on various
I/O activities.
I/O instructions are executed in the IOP. The IOP asks for the attention of the CPU
by means of an interrupt. It also responds to CPU requests by placing a status word
in a prescribed location in memory to be examined by CPU program.
For an I/O operation execution, the CPU informs the IOP where to find the I/O
program and then leaves the transfer details to the IOP.
The instructions that are read from memory by an IOP are sometimes called
Commands, to distinguish them from instructions that are read by the CPU.
38. Write a note on cache memory.
The active portions of the program and data are placed in a fast small memory.
This reduces the average memory access time and hence the total execution time of
the program. This memory is called Cache memory. It is placed between the CPU
and the main memory. Performance of cache memory is frequently measured in
terms of a quantity called Hit ratio. Loops and subroutines tend to localize the
references to memory for fetching instruction. Reference to memory at any given
interval of time tend to be confined within a few localized areas in memory. This
phenomenon is known as the property of locality of reference.
Programmed I/O :
• Programmed I/O instructions are the result of I/O instructions written in
computer program. Each data item transfer is initiated by the instruction in
the program. Usually the program controls data transfer to and from CPU
and peripheral. Transferring data under programmed I/O requires constant
monitoring of the peripherals by the CPU.
while the transfer is in progress and receive an interrupt from the DMA controller
when the transfer has been completed.
During the DMA transfer, the CPU is idle and has no control of the memory buses.
A DMA Controller takes over the buses to manage the transfer directly between the
I/O device and memory.
The CPU may be placed in an idle state in a variety of ways. One common method
extensively used in microprocessor is to disable the buses through special control
signals
such as:
◼ Bus Request (BR)
◼ Bus Grant (BG)
These two control signals in the CPU that facilitates the DMA transfer. The Bus
Request
(BR) input is used by the DMA controller to request the CPU. When this input is
active, theCPU terminates the execution of the current instruction and places the
address bus, data bus and read write lines into a high Impedance state. High
Impedance state means that the output is disconnected
The CPU activates the Bus Grant (BG) output to inform the external DMA that the
Bus Request (BR) can now take control of the buses to conduct memory transfer
without processor. When the DMA terminates the transfer, it disables the Bus
Request (BR) line. The CPU disables the Bus Grant (BG), takes control of the buses
and return to its normal operation.
The transfer can be made in several ways that are:
i. DMA Burst
ii. Cycle Stealing
i) DMA Burst :- In DMA Burst transfer, a block sequence consisting of a number of
memory words is transferred in continuous burst while the DMA controller is
master
of the memory buses.
ii) Cycle Stealing :- Cycle stealing allows the DMA controller to transfer one data
word at a time, after which it must returns control of the buses to the CPU.
• DMA controller has to share the bus with the processor to make the data
transfer. The device that holds the bus at a given time is called bus master.
When a transfer from I/O device to the memory or vice versa has to be
made, the processor stops the execution of the current program,
increments the program counter, moves data over stack then sends a DMA
select signal to DMA controller over the address bus. If the DMA controller
is free, it requests the control of bus from the processor by raising the bus
request signal. Processor grants the bus to the controller by raising the bus
grant signal, now DMA controller is the bus master. The processor initiates
the DMA controller by sending the memory addresses, number of blocks of
data to be transferred and direction of data transfer. After assigning the
data transfer task to the DMA controller, instead of waiting ideally till
completion of data transfer, the processor resumes the execution of the
program after retrieving instructions from the stack.
When the program not residing in main memory is needed by the CPU, they are
brought in from auxiliary memory. Programs not currently needed in main
memory are transferred into auxiliary memory to provide space in main memory
for other programs that are currently in use.
The cache memory is used to store program data which is currently being executed
in the CPU. Approximate access time ratio between cache memory and main
memory is about 1 to 7~10.
Virtual memory was developed at a time when physical memory -- the installed
RAM -- was expensive. Computers have a finite amount of RAM, so memory can
run out, especially when multiple programs run at the same time. A system using
virtual memory uses a section of the hard drive to emulate RAM. With virtual
memory, a system can load larger programs or multiple programs running at the
same time, allowing each one to operate as if it has infinite memory and without
having to purchase more RAM.
While copying virtual memory into physical memory, the OS divides memory into
pagefiles or swap files with a fixed number of addresses. Each page is stored on a
disk and when the page is needed, the OS copies it from the disk to main memory
and translates the virtual addresses into real addresses.
*****