COA Important Questions
COA Important Questions
COA Important Questions
UNIT 2
Multiplication
Division
Instructions fetch from memory
Register organization
CPU structure
RISC vs CISC
Multiplication
Division
CPU performance sums
Amdahl’s law sums
MIPS sums
SOLVE https://drive.google.com/drive/folders/1Lb8Lvirsto04N3FniTGcfl8-YC_JQopU
https://drive.google.com/drive/folders/1UQyBmLkp3t3nOd4rZsdM5_SN3oi3zf05
Speedup= 1/(1-F)+F/S
MIPS (Million Instructions Per Second) is a measure of a computer's processor speed. It refers to how many
millions of instructions a processor can execute in one second. It's often used as a performance metric to
compare processors based on how fast they execute instructions.
Instruction execution speed: MIPS represents the rate at which a processor executes instructions. A
higher MIPS value generally indicates faster performance.
Simple comparison metric: It provides a simple way to compare processors, but it doesn't give a
complete picture of overall system performance because it only counts instruction execution, without
considering the complexity of different instructions.
CPU-dependent: MIPS is highly dependent on the Instruction Set Architecture (ISA) of the
processor and the efficiency of the instructions being executed.
We need to satisfy the following conditions if we want to use MIPS for comparison of 2 microprocessors
Data Bus:
Purpose: Carries data between the CPU, memory, and I/O devices.
Address Bus:
Purpose: Carries the memory addresses from the CPU to memory or I/O devices.
Control Bus:
Purpose: Carries control signals from the CPU to other components, determining how the system functions.
General Purpose Registers
• AX
— Accumulator Register
— Preferred register to use in arithmetic, logic and data transfer instructions because it generates the
shortest Machine Language Code
— Must be used in multiplication and division operations
— Must also be used in 1/0 operations
BX
— Base Register
— Also serves as an address register
CX
— Count register
— Used as a loop counter
— Used in shift and rotate operations
DX
— Data register
— Used in multiplication and division
— Also used in 1/0 operations
Pointers and indexes
IAS Structure
X86 Evolution
8080
First General Purpose Microprocessor
8-bit data path
8086
16 bit
Instruction cache
8088
Used in first IBM PC
80286
16MB memory instead of 1MB
80386
First processor to support multitasking
Translated 32-bit virtual address to 32-bit physical address
80486
Co-processor for math
Pentium
Used super scalar technique as multiple instructions started executing in parallel
Pentium Pro
32 bit virtual to 36-bit physical
Pentium II
Able to process audio, video and graphics efficiently
Pentium 4
48 bit to 48 bit
Core
First with 2 processors in single chip
Core 2
64 bit
Core 2 Quad
4 processors in single chip
1. Computer Architecture
1. Hardware (Technology):
Impact on Clock Time: Advances in hardware technology, such as smaller transistor sizes and better
fabrication techniques, can reduce the time it takes to complete a single clock cycle. Faster transistors
mean quicker switching, which lowers the clock cycle time, allowing for higher clock speeds.
2. CPU Organization:
Impact on Clock Time: Improved parallelism or pipelining can often offset this and lead to better
overall performance.
Impact on CPI: The organization of the CPU can have a significant impact on CPI. Techniques like
pipelining, superscalar execution, and out-of-order execution can reduce the number of cycles per
instruction by allowing multiple instructions to be processed simultaneously.
Impact on CPI: A RISC architecture typically has a lower CPI because its instructions are designed to
execute in a fixed number of cycles (often one cycle). In contrast, CISC instructions may take multiple
cycles to complete, leading to a higher CPI.
Impact on Instruction Count: A CISC architecture might reduce the instruction count since complex
operations can be performed in a single instruction. On the other hand, RISC architectures may require
more instructions to perform the same task, increasing the instruction count.
4. Compiler:
Impact on CPI: A well-optimized compiler can reduce CPI by generating efficient machine code that
takes advantage of the CPU’s architecture, such as minimizing cache misses, pipeline stalls, and making
efficient use of hardware resources.
Impact on Instruction Count: The compiler has a direct impact on instruction count. A good compiler
can optimize the code, reducing the number of instructions required to perform a task through
techniques like loop unrolling, in lining functions, and eliminating unnecessary instructions.
Impact on CPI: Programs with frequent cache misses, branch mispredictions, or complex dependencies
between instructions can increase CPI. For example, memory-bound programs or programs with poor
locality of reference (requiring frequent memory accesses) will result in higher CPI due to delays in
fetching data.
Impact on Instruction Count: Different algorithms or program designs can lead to vastly different
instruction counts. A well-optimized program can reduce the number of instructions required to
complete a task, while inefficient code can unnecessarily increase instruction count
Set Computer) in table format:
MSE22
1.
Given Data:
(a) Which processor has the highest performance expressed in instructions per second?
The performance in terms of instructions per second can be calculated using the formula:
P2 has the highest performance with 2.5 billion instructions per second.
(b) If the processors each execute a program in 10 seconds, find the number of cycles and the number of
instructions.
For P2:
For P3:
(c) We are trying to reduce the execution time by 30% but this leads to a 20% increase in the CPI. What
clock rate should we have to get this time reduction?
Given:
Target reduction in execution time = 30%, so new execution time = 70% of original time.
New Execution Time=0.7×10 seconds=7 seconds\text{New Execution Time} = 0.7 \times 10 \
text{ seconds} = 7 \text{ seconds}New Execution Time=0.7×10 seconds=7 seconds
CPI increases by 20%, so new CPI = 1.2 \times original CPI.
Using the number of instructions calculated for each processor, we calculate the required clock rate for each
case.
For P1:
3.
In a computer system, an instruction goes through a series of states from the moment it is fetched from memory
until it is executed. The sequence of these states can be represented using a Finite State Machine (FSM),
which helps visualize the flow of control and data in a processor’s datapath during instruction execution.
The execution of an instruction can generally be divided into the following states:
+-------------------+
| | (Start)
| Instruction Fetch |
+-------------------+
|
V
+-------------------+
| |
| Instruction Decode |
+-------------------+
|
V
+-------------------+ --> Memory Operation? -------> No
| | |
| Operand Fetch | V
+-------------------+ +-------------------+
| | |
V | Memory Access |
+-------------------+ +-------------------+
| | |
| Execution | V
+-------------------+ +-------------------+
| | |
V | Write Back |
+-------------------+ +-------------------+
| | |
| Write Back/Commit | <------------------------------+
+-------------------+
|
(End)
4.
+--------------------+
| Instruction |
| Register (IR) |
+--------------------+
|
V
+------------------+---------------------+
| | |
V V V
+--------------+ +----------------+ +--------------+
| Program | | Memory Address | | Memory Data |
| Counter (PC)| | Register (MAR) | | Register (MDR)|
+--------------+ +----------------+ +--------------+
| | |
V V |
+--------------+ +--------------------+ |
| ALU |<----| Memory Unit |<-------+
+--------------+ +--------------------+
| |
V |
+--------------+ |
| General-Purpose |<-------------------+
| Registers (R1, |
| R2, etc.) |
+--------------+
(a) Conceptual Difference and Necessity of Visible Register (PC) and Hidden Register (MAR)
(b) Control Sequence for ADD R2, LOCA (Direct Addressing Mode)
In this instruction (ADD R2, LOCA), the content at the memory location LOCA is added to the contents of
register R2, and the result is stored back into R2. The instruction uses direct addressing mode, meaning the
operand is located directly at the specified memory address (LOCA).
Given:
VAX11/780:
o Frequency: 5 MHz
o Performance: 1 MIPS
o CPU Time: 12 * xxx seconds
IBM RS/6000:
o Frequency: 25 MHz
o Performance: 18 MIPS
o CPU Time: xxx seconds
(a) What is the relative size of the instruction count of the machine code for this benchmark program
running on the two machines?
Let the instruction count of VAX11/780 be IVAXI_{\text{VAX}}IVAX and the instruction count of IBM
RS/6000 be IIBMI_{\text{IBM}}IIBM.
For VAX11/780:
Now, the relative size of the instruction count is the ratio IVAXIIBM\frac{I_{\text{VAX}}}{I_{\
text{IBM}}}IIBMIVAX:
IVAXIIBM=12x18x=1218=23\frac{I_{\text{VAX}}}{I_{\text{IBM}}} = \frac{12x}{18x} = \frac{12}{18}
= \frac{2}{3}IIBMIVAX=18x12x=1812=32
Thus, the relative size of the instruction count of VAX11/780 to IBM RS/6000 is 2:3.
(b) What are the CPI values for the two machines?
The CPI (Cycles Per Instruction) can be calculated using the formula:
Conclusion: