Coa Iat-2 QB Soln
Coa Iat-2 QB Soln
Coa Iat-2 QB Soln
Module 3
Q1. Draw & explain six stage CPU instruction pipeline.
Ans-
1. A typical instruction cycle can be split into many sub cycles like Fetch instruction,
Decode instruction, Execute and Store. The instruction cycle and the corresponding
sub cycles are performed for each instruction. These sub cycles for different
instructions can thus be interleaved or in other words these sub cycles of many
instructions can be carried out simultaneously, resulting in reduced overall execution
time. This is called instruction pipelining.
2. The more are the stages in the pipeline, the more the throughput is of the CPU.
3. If the instruction processing is split into six phases, the pipelined CPU will have six
different stages for the execution of the sub phases.
4. The six stages are as follows:
Eg. The timing diagram of a six stage instruction pipeline is shown in Figure 6:
6. Assuming that the sub cycles of the instruction cycle take exactly the same time to
complete i.e. one clock cycle in this case.
7. In case the time required by each of the sub phase is not same appropriate delays need to
be introduced. From this timing diagram it is clear that the total execution time of 3
instructions in this 6 stages pipeline is 8-time units. The first instruction gets completed after
6 time unit, and thereafter in each time unit it completes one instruction. Without pipeline, the
total time required to complete 3 instructions would have been 18 (6 3) time units. Therefore,
there is a speed up in pipeline processing and the speed up is related to the number of stages.
➢ Types of Hazards:
a. Structural Hazards (Resource Bound)
b. Control Hazards ( Pipelining Bubbles)
c. Data Hazards ( Data dependencies)
a. Structural Hazards (Resource Bound)
1. During the pipelining, the overlapped execution of instructions requires pipelining of
functional units and duplication of resources to allow all possible combinations of
instructions in the pipeline.
2. If some combination of instructions cannot be accommodated because of a resource
conflict, the machine is said to have a structural hazard.
Common instances of structural hazards arise when:
1) Some functional unit is not fully pipelined then a sequence of instructions using that un-
pipelined unit cannot proceed at the rate of one per clock cycle.
2) Some resource has not been duplicated enough to allow all combinations of instructions in
the pipeline to execute. This type of hazards occurs when two activities require the same
resource simultaneously
If machine has shared a single-memory pipeline for data and instructions. As a result, when
an instruction contains a datamemory reference (load-MEM), it will conflict with the
instruction reference for a later instruction (instr 3-IF):
1. Micro-instruction
A microinstruction is a low-level instruction that a computer's control unit uses to execute
machine instructions. Microinstructions are typically executed very quickly and are used to
perform simple operations such as incrementing a register or fetching data from memory.
2. Micro-operation
A micro-operation, also known as a micro-op, is a low-level operation that a computer's
processor performs as part of executing a single machine instruction. Micro-operations are
performed by the processor's arithmetic and logic units (ALUs) and can include operations
such as addition, subtraction, bitwise operations, and comparisons.
3. Micro-program
A micro-program is a low-level program that defines the sequence of microinstructions that a
computer's control unit uses to execute machine instructions. Micro-programs are stored in
read-only memory (ROM) and are used to control the behavior of the computer's control unit.
Module 4
Q6. Discuss the floating-point representation IEEE standard 754 with examples.
Ans-
Floating-point representation IEEE standard 754 must be:
➢ Standard for floating point storage
➢ 32 and 64 bit double format,
➢ 8 and 11 bit exponent respectively
➢ Extended formats (both mantissa and exponent) for intermediate results
Example 1: Represent (178.1875)10 in single & double precision floating point format.
1. Convert the given number in binary format.
(178.1875)10 = (10110010.0011)2
2. Normalization:
10110010.0011=1.01100100011 X 2^7
3. Represent in Single precision format:
(1.N).2^(E-127)
4. Bias for single precision format = 127
127+7=134=(10000110)2
Sign Exponent Mantissa
0 10000110 01100100011
5.Represent in double precision format:
(1.N).2^(E-1023)
6. Bias for double precision format = 1023
1023+7=1030=(10000000110)2
Sign Exponent Mantissa
0 10000000110 01100100011
Q8. Examples on IEEE 754 single and double precision standard of floating-point
representation.
Ans- Refer the Data Representation Algorithm ppt
Module 5
Q9. Classify the types of memories based on the hierarchy of speed and size.
Ans-
Memory Hierarchy, in Computer System Design, is an enhancement that helps in organising
the memory so that it can actually minimise the access time. The development of the Memory
Hierarchy occurred on a behaviour of a program known as locality of references. Here is a
figure that demonstrates the various levels of memory hierarchy clearly:
Memory Hierarchy Design
This Hierarchy Design of Memory is divided into two main types. They are:
1. Location of a Memory
• CPU Memory – Cache memory
• Internal Memory – Main / Primary memory
• External Memory – Peripheral storage devices such as disk & tape
2. Capacity (Size)
• Expressed in terms of bytes or words
• For internal memory- 8,16,32 bits etc.
• For external memory – kilo-bytes, megabytes etc.
3. Unit of Transfer
• For main memory, the unit of transfer is the number of bits read out of or written into
memory at a time.
• For external memory, data are transferred in much larger units than a word referred as
blocks.
4. Physical Characteristics
a.Semiconductor memory
• Main or primary memory
• In the form of IC
• RAM, ROM,DRAM, SRAM
b.Magnetic memory
• Secondary memory
• Disks & tapes
5. Performance
6. Access Methods
Q11. Explain cache coherence.
Ans-
1. Two copies of same data –one in cache & another in main memory may become
different. This data inconsistency is called cache coherence problem.
2. Cache updating systems eliminates this problem by cache write operations.
Coherency with Multiple Caches
• Bus Watching with write through
o mark a block as invalid when another cache writes back that block, or
o update cache block in parallel with memory write
• Hardware transparency (all caches are updated simultaneously)
• I/O must access main memory through cache or update cache(s)
• Multiple Processors & I/O only access non-cacheable memory blocks
Q12. What is locality of reference? List and define different types of locality.
Ans-
a. Program contains loops, procedures that repeatedly call each other.
b. Many instructions are executed repeatedly during some time period & remainder of
program is accessed infrequently.
c. This is referred as Locality of Reference.
d. Two aspects: temporal & spatial
Temporal Locality - Temporal means that a recently executed instruction is likely to be
executed again very soon.
Spatial Locality - Spatial means that instructions stored near by to the recently executed
instruction are also likely to be executed soon.
Q15. Compare and contrast DMA, Programmed I/O and Interrupt Driven I/O.
Ans-
• DMA
➢ Interrupt driven and programmed I/O require active CPU intervention
➢ Transfer rate is limited
➢ CPU is tied up DMA is the answer
➢ Additional Module (hardware) on bus
➢ DMA controller takes over from CPU for I/O