Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Suppose the processor is transferring data to a printer using the above instruction cycle (when
there is no interrupts). After each write operation, the processor must pause and remain idle until
the printer catches up. The length of this pause may be on the order of many hundreds or even
thousands of instruction cycles that do not involve memory. This is a very wasteful use of the
processor.
The problem with programmed I/O is that the processor has to wait a long time for the I/O
module of concern to be ready for either reception or transmission of data. The processor, while
waiting, must repeatedly interrogate the status of the I/O module. As a result, the level of the
performance of the entire system is severely degraded.
An alternative is for the processor to issue an I/O command to a module and then go on to do
some other useful work. The I/O module will then interrupt the processor to request service when
it is ready to exchange data with the processor. The processor then executes the data transfer, as
before, and then resumes its former processing.
Thus, interrupts increase the CPU efficiency by using instruction cycle (with interrupts) below
shown.
b) How does the program execution transfer happen due to an interrupt? Use an appropriate
diagram to explain
Let’s consider an interrupt occurs during instruction N. After the execution of instruction N,
CPU checks for possible interrupts and finds information on the occurred interrupt. Then,
Execution process pass to first instruction of ISR (Interrupt service Routine). CPU executes ISR
instructions from begin to last. Then executes RFTFIE. After completing ISR execution,
execution returns to instruction N+1.
c) How does the Interrupt Vector table (IVT) is been utilized in Intel x86 processors to
implement interrupts?
An interrupt vector table is a group of several memory addresses. An interrupt vector is only one
memory address of one interrupt handler. On the x86 architecture, the interrupt vector table
specifies the addresses of all 256 interrupt handlers used in real mode. It means IVT contains 256
vectors holding ISR addresses of all 256 interrupt types.
IVT is in memory address space from address 0000h to 03FFh. The block diagram of an IVT is
shown below.
INTR
INTA
FI – Fetch Instruction
DI – Decode instruction
CO – Calculate Operands
FO – Fetch Operands
EI – Execute Instructions
WR – Write Results /WO – write operand which store the results in memory
a) Draw the timing diagram for the instruction pipeline operation for 9 instructions,
assuming no branches.
b) Derive the general formula for the total time required to execute n instructions by the
pipeline as a function of pipeline cycle time T and number of pipeline stages k.
n = number of instructions
k = 5;
Instruction 2 = (5+2-1) T = 6T
Instruction 3 = (5+3-1) T = 7T
Instruction n = (5+n-1) T
Therefore,
𝑛𝑘𝑇 𝑛𝑘
Therefore, 𝑆𝑘,𝑛 = =
(𝑘+𝑛−1)𝑇 (𝑘+𝑛−1)
d) Calculate the speedup for 25000 instructions.
𝑛𝑘𝑇 𝑛𝑘
𝑆𝑘,𝑛 = =
(𝑘 + 𝑛 − 1)𝑇 (𝑘 + 𝑛 − 1)
𝑛 𝑛
When 𝑘 → ∞; 𝑆𝑘→∞,𝑛 = 𝑛−1 = =𝑛
1+( ) 1
𝑘
e) What will happen if 3rd instruction is a branch instruction. Describe by using a timing
diagram.
Assume that instruction 3 is a conditional branch to instruction 15. There is no way to knowing
which instruction will come next until the instruction is executed. If the branch is taken
(determined at the end of time unit 7), the pipeline must be cleared of instructions that are not
useful. During time unit 8, instruction 15 enters the pipeline. No instructions complete during
time units 9 through 12; this is the performance penalty incurred due to branch.
f) Name and describe an available architectural solution to the problem of branching in
pipelines.