Computer Organization Architecture
Computer Organization Architecture
Organization
PEN-Drive / G-Drive Course / VOD & Tablet Users
Workbook
GATE / PSUs
Workbook
EC
No part of this publication may be reproduced or distributed in any form or by any means,
electronic, mechanical, photocopying, recording, or otherwise or stored in a database or retrieval
system without the prior written permission of the publishers. The program listings (if any) may be
entered, stored and executed in a computer system, but they may not be reproduced for
publication.
Printing of books passes through many stages - writing, composing, proof reading, printing etc. We
try our level best to make the book error- free. If any mistake has inadvertently crept in, we regret
it and would be deeply indebted to those who point it out. We do not take any legal responsibility.
Edition : CO-HPD-161121
GATE ACADEMY ®
Table of Contents
Sr. Chapter Pages
3. Pipelining ……………………………..………….….…………..…....…. 16
Video Lecture Information
Sr. Lecture Name Duration
Gate Academy Shop Address : Street 04, Narsingh Vihar, Katulbod, Bhilai 490022 (C.G.), Contact : 97131-13156 Online Test Series
https://www.gateacademy.shop/ Live class room: https://play.google.com/store/apps/details?id=com.gateacademy1 http://onlinetestseries.gateacademy.co.in
Computer Organization & Architecture [Workbook] 6 GATE ACADEMY®
(A) Immediate addressing mode Q.39 Assume that the memory is byte addressable
(B) Indirect addressing mode and the word size is 32 bits. If an interrupt
(C) Extended addressing mode occurs during the execution of the instruction
(D) None of the above "INC R3", what return address will be pushed
on to the stack?
Common Data for (A) 1005 (B) 1020
Questions 37, 38 & 39
(C) 1024 (D) 1040
Consider the following program segment. Here R1, R2 Self-Practice Questions :
and R3 are the general purpose registers. Q.1 Suppose a processor does not have any stack
Instructions Operation Instructions pointer register. Which of the following
size (number of statements is true?
words) (A) It cannot have subroutine call instruction
MOV R1, R1 ← M 2 (B) It can have subroutine call instruction, but
3000 [3000] no nested subroutine calls
LOOP; 1 (C) Nested subroutine calls are possible, but
MOV R2, R1 R2 ← M [R3] 1 interrupts are not
ADD R2, R1 R2 ← R1+R2 1 (D) All sequences of subroutine call and also
MOV (R3), M [R3] ← R2 1 interrupts are possible
R2 [GATE 2001, IIT Kanpur]
INCR3 R3 ← R3+1 1 Q.2 A processor needs software interrupt to
DEC R1 R1 ← R1-1 1 (A) Test the interrupt system of the processor
BNZ LOOP Branch on not 2 (B) Implement co-routines
zero (C) Obtain system services which need
HALT Stop 1 execution of privileged instructions
(D) Return from subroutine
Assume that the content of memory location 3000 is [GATE 2001, IIT Kanpur]
10 and the content of the register R3 is 2000. The
Q.3 A CPU generally handles an interrupt by
content of each of the memory locations from 2000 to
executing an interrupt service routine
2010 is 100. The program is loaded from the memory
(A) As soon as an interrupt is raised
location 100. All the numbers are in decimal.
[GATE 2007, IIT Kanpur] (B) By checking the interrupt register at the
end of fetch cycle
Q.37 Assume that the memory is word addressable.
The number of memory references for (C) By checking the interrupt register after
accessing the data in executing the program finishing the execution of the current
completely is instruction
(A) 10 (B) 11 (D) By checking the interrupt register at fixed
time intervals.
(C) 20 (D) 21
Q.38 Assume that the memory is word addressable. [GATE 2009, IIT Roorkee]
After the execution of this program, the Q.4 The following register holds the instruction
content of memory location 2010 is before it goes for decode? [ESE 2012]
(A) 100 (B) 101 (A) Data register
(C) 102 (D) 110 (B) Accumulator
Gate Academy Shop Address : Street 04, Narsingh Vihar, Katulbod, Bhilai 490022 (C.G.), Contact : 97131-13156 Online Test Series
https://www.gateacademy.shop/ Live class room: https://play.google.com/store/apps/details?id=com.gateacademy1 http://onlinetestseries.gateacademy.co.in
GATE ACADEMY® 7 Addressing Modes
(C) Address register Q.11 Consider the following :
(D) Instruction register 1. Operation code
Q.5 In a microprocessor, the register which holds 2. Source operand reference
address of the next instruction to be fetched? 3. Result operand reference
[ESE 2014] 4. Next instruction reference
(A) Accumulator Which of the above are typical elements of
(B) Program counter machine instructions?
(A) 1, 2 and 3 only
(C) Stack Pointer
(B) 1, 2, and 4 only
(D) Instruction register
(C) 3 and 4 only
Q.6 Which of the following 2 registers are used to
(D) 1, 2, 3 and 4
access the memory?
Q.12 An addressing mode in which the location of
(A) Instruction register and program counter
the data is contained within the mnemonic, is
(B) Address register and program counter known as
(C) Program counter and stack pointer (A) Immediate addressing mode
(D) Address register and data register (B) Implied addressing mode
Q.7 Which is not a CPU architecture? (C) Register addressing mode
(A) Single accumulator architecture (D) Direct addressing mode
(B) General register architecture Q.13 An instruction is stored at location X with its
(C) Base register architecture address field at location X+1. The address field
(D) Stack register has the value Y. A processor register contains
the number Z. evaluate the effective address, if
Q.8 Effective address is calculated by adding or
addressing mode is
subtracting displacement value to
1. Direct
(A) Immediate address
2. Immediate
(B) Relative address
3. Relative
(C) Absolute address
4. Register indirect
(D) Base address
5. Index addressing
Q.9 In case the code is position independent, the Q.14 A relative branch mode type instruction is
most suitable addressing mode is stored in memory at address 300. The branch
(A) Direct mode is made to an address 450.
(B) Indirect mode What should be the value of relative address
(C) Relative mode field of the instruction?
(D) Indexed mode Q.15 Which of the following is/are true of the auto-
Q.10 The addressing mode that permits relocation, increment addressing mode?
without any change whatsoever in the code is I. It is useful in creating self-relocating
(A) Indirect addressing code.
(B) Base register addressing II. If it is included in an instruction set
architecture, then an additional ALU is
(C) Indexed register
required for effective address calculation
(D) PC relative addressing
III. The amount of increment depends on the
[GATE 1998, IIT Delhi] size of the data item accessed
Gate Academy Shop Address : Street 04, Narsingh Vihar, Katulbod, Bhilai 490022 (C.G.), Contact : 97131-13156 Online Test Series
https://www.gateacademy.shop/ Live class room: https://play.google.com/store/apps/details?id=com.gateacademy1 http://onlinetestseries.gateacademy.co.in
Computer Organization & Architecture [Workbook] 8 GATE ACADEMY®
(A) I only (B) II only field of instruction contains value 230. The
(C) III only (D) II and III value of Program Counter (PC) before the
fetch of this instructions (assume all the
Q.16 A computer has instruction size of 16 bits and
numbers in decimal) is _______.
has 16 programmer visible registers. Each
instruction has two source and one destination (A) 326 (B) 330
operands and uses only register direct (C) 334 (D) 322
addressing. The maximum number of op-codes Q.20 In which addressing mode, the effective
that this processor can have is equal to address of the operand is generated by adding
(A) 64 (B) 32 a constant value to the content of a register?
(C) 16 (D) 8 (A) Absolute mode
(B) Indirect mode
Q.17 Match List-I with List-II and select the correct
(C) Immediate mode
answer using the codes given below the lists.
(D) Index mode
List-I
Q.21 The register which keeps track of the execution
A. Indirect addressing of a program and which contains the memory
B. Immediate addressing address of the instruction which is to be
C. Auto decrement addressing executed next is known as______.
List-II (A) Index-Register
1. Loops (B) Memory address register
(C) Program counter
2. Pointers
(D) Instruction registers
3. Constants
Q.22 Relative Addressing Mode is used to write
Codes : position-independent code because
A B C (A) The Code in this mode is easy to atomize
(A) 3 2 1 (B) The Code in this mode is easy to
(B) 1 3 2 (C) The Code in this mode is easy to make
(C) 2 3 1 resident.
(D) Code executes faster in this mode.
(D) 3 1 2
Q.23 The register which contains the data to be
Q.18 A certain processor supports only the
written into or read out to the addressed
immediate and the direct addressing modes.
location is known as
Which of the following programming language
(A) Memory address register
features cannot be implemented on this
(B) Memory data register
processor?
(C) Program computer
(A) Pointers
(D) Index register
(B) Arrays
Q.24 An interrupt that can be temporarily ignored by
(C) Records the counter is known as
(D) Recursive procedures with local variable (A) Vectored interrupt
Q.19 An instruction of size 48 is stored in memory (B) Non- maskable interrupt
which is a branch instruction and it uses PC (C) Maskable interrupt
relative mode. The target for this instruction is (D) Low priority interrupt
stored on address 560. The relative address
Gate Academy Shop Address : Street 04, Narsingh Vihar, Katulbod, Bhilai 490022 (C.G.), Contact : 97131-13156 Online Test Series
https://www.gateacademy.shop/ Live class room: https://play.google.com/store/apps/details?id=com.gateacademy1 http://onlinetestseries.gateacademy.co.in
GATE ACADEMY® 9 Addressing Modes
Q.25 Consider a high-level language statement Assuming that memory location 100 contains
while [*i − − ] then which addressing mode is the value 35 (Hex), and the memory location
suitable for it? 200 contains the value A4 (Hex), what could
(A) Autoincrement be said about the final result?
(B) Indexed (A) Memory location 100 contains value A4
(C) Displacement (B) Memory location 100 contains value D4
(D) Autodecrement (C) Memory location 100 contains value D9
Q.26 Addressing mode is _____. (D) Memory location 200 contains value 35
(A) Explicitly specified Q.29 MOV [BX], AL type of data addressing is
called [ISRO 2011]
(B) Implied by the instruction
(A) Register addressing
(C) Both (a) and (b)
(B) Immediate addressing
(D) Neither (a) nor (b)
(C) Register indirect addressing
Q.27 Match List-I with List –II and select the correct
answer using the code given below the lists: (D) Register relative
List-I Q.30 The immediate addressing mode can be used
for
A. MOV X,R1
1. Loading internal registers with initial
B. STORE X
values 1.
C. POP X
2. Perform arithmetic or logical operation on
List-II data contained in instructions 2.
1. Three-address instruction Which of the following is true ? [ISRO 2020]
2. Zero-address instruction (A) Only 1
3. One-address instruction (B) Only 2
4. Two-address instruction (C) Both 1 and 2
Codes: (D) Immediate mode refers to data in cache
A B C
(A) 4 3 2
(B) 3 2 1
(C) 2 3 4
(D) None of these
Q.28 A certain processor executes the following set
of machine instructions sequentially.
MOV R0 , #0
MOV R1 ,100( R0 )
ADD R1 , 200( R0 )
MOV 100( R0 ), R1
Gate Academy Shop Address : Street 04, Narsingh Vihar, Katulbod, Bhilai 490022 (C.G.), Contact : 97131-13156 Online Test Series
https://www.gateacademy.shop/ Live class room: https://play.google.com/store/apps/details?id=com.gateacademy1 http://onlinetestseries.gateacademy.co.in
Computer Organization & Architecture [Workbook] 10 GATE ACADEMY®
Answers :
1. A 2. B 3. D 4. B 5. C
6. D 7. 50 8. D 9. D 10. D
640,
8, 24, 301,
16. 17. 18. 436 19. –16 20. B
224 × 32 942,
260
21. C 22. C 23. C 24. A 25. A
Self-Practice Questions
1. A 2. C 3. C 4. D 5. B
6. D 7. C 8. D 9. D 10. D
Y, X+1,
11. D 12. B 13. X+1+Y, 14. –150 15. C
Z, Y+Z
16. C 17. C 18. A 19. A 20. D
Gate Academy Shop Address : Street 04, Narsingh Vihar, Katulbod, Bhilai 490022 (C.G.), Contact : 97131-13156 Online Test Series
https://www.gateacademy.shop/ Live class room: https://play.google.com/store/apps/details?id=com.gateacademy1 http://onlinetestseries.gateacademy.co.in
2 Control Unit
Q.14 Statement (I) : The data path contains all Q.17 A microprogrammed control unit.
circuits to process data within the CPU with (A) Is faster than a hard- wired control unit.
help of which data is suitably transformed. (B) facilitates easy implementation of new
Statement (II) : It is the responsibility of the co instructions.
path to generate control and timing signals as (C) Is useful when very small programs are to
required by the opcode. be run.
Codes : (D) Usually refers to the control unit of a
(A) Both statement (I) and Statement (II) are microprocessor.
individually true and Statement (II) is the Q.18 In Flynn’s classification of computers, the
correct explanation of Statement (I) vector and array classes of machines belong to
(B) Both Statement (I) and Statement (II) are (A) Single instruction and single data category
individually true but Statement (II) is not (B) Single instruction and multiple data
the correct explanation of Statement (I) category
(C) Statement (I) is true but Statement (II) is (C) Multiple instruction and single data
false category
(D) Statement (I) is false but Statement (II) is (D) Multiple instruction and multiple data
true category
Q.15 In a microprocessor, the service routine for a Q.19 The following are the some of the sequences of
certain interrupt starts from a fixed location of operations in instruction cycle, which one is
memory which cannot be externally set, but the correct sequence?
interrupt can be delayed or rejected. Such an (A)
interrupt is PC → Address register
(A) Non-maskable and non-vectored Data from memory → Data register
(B) Maskable and non-vectored Data register → IR
PC + 1 → PC
(C) Non-maskable and vectored
(B)
(D) Maskable and vectored
Address register → PC
Q.16 Consider the following statements :
Data register → Data from memory
1. The processor interrupts the program
Data register → IR
currently being executed.
PC+1 → PC
2. The action requested by the interrupt is
performed by the ISR.
(C)
3. Interrupts are enabled and execution of
Data from memory → Data register
the interrupted program is resumed.
PC → Address register
4. The device raises an interrupt request.
Data register → IR
5. The device is informed that its request has
PC+1 → PC
been recognized and in response, it
deactivates the interrupt request signal. (D) None of these
Gate Academy Shop Address : Street 04, Narsingh Vihar, Katulbod, Bhilai 490022 (C.G.), Contact : 97131-13156 Online Test Series
https://www.gateacademy.shop/ Live class room: https://play.google.com/store/apps/details?id=com.gateacademy1 http://onlinetestseries.gateacademy.co.in
GATE ACADEMY® 15 Control Unit
(D) Once these microoperations are executed, Q.12 A CPU runs at 80MHZ and executing
the control unit must determine its next instructions with average cycles per instruction
address. Therefore, all bits of the micro (CPI) as 1.6. The MIPS (million instructions
instruction are used to control the per second) count of the CPU is
generation of the address for the next (A) 50 (B) 60
micro instruction. (C) 500 (D) 600
Q.11 During DMA transfer, DMA controller takes
over the busses to manage the transfer
(A) Directly from CPU to memory
(B) Directly from memory to CPU
(C) Indirectly between the I/O device and
memory
(D) Directly between the I/O device and
memory
Answers :
1. B 2. D 3. B 4. D 5. B
Self-Practice Questions
1. D 2. B 3. C 4. C 5. B
6. A 7. D 8. D 9. C 10. D
11. D 12. A
Gate Academy Shop Address : Street 04, Narsingh Vihar, Katulbod, Bhilai 490022 (C.G.), Contact : 97131-13156 Online Test Series
https://www.gateacademy.shop/ Live class room: https://play.google.com/store/apps/details?id=com.gateacademy1 http://onlinetestseries.gateacademy.co.in
3 Pipelining
Classroom Practice Questions : clock cycles for the EX stage depends on the
instruction. The ADD and SUB instructions
Q.1 The performance of a pipelined processor
need 1 clock cycle and the MUL instruction
suffers if
needs 3 clock cycles in the EX stage. Operand
(A) The pipeline stages have different delays
forwarding is used in the pipelined processor.
(B) Consecutive instructions are dependent on
What is the number of clock cycles taken to
each other
complete the following sequence of
(C) The pipeline stages share dependent instructions?
hardware resources
ADD R2, R1, R0, R 2 ← R1 + R 0
(D) All of the above
[GATE 2002, IISc Bangalore] MUL R4, R3, R2, R 4 ← R3* R 2
Q.2 A 4-stage pipeline has the stage delays as 150, SUB R6, R5, R4, R 6 ← R5 − R 4
120, 160 and 140 nanoseconds respectively.
(A) 7 (B) 8
Registers that are used between the stages have
(C) 10 (D) 14
a delay and 5 nanoseconds each. Assuming
constant clocking rate, the total time taken to [GATE 2007, IIT Kanpur]
process 1000 data items on this pipeline will be Q.4 Consider a 4-stage pipeline processor. The
(A) 120.4 microseconds number of cycles needed by the four
(B) 160.5 microseconds instructions I1 , I 2 , I 3 , I 4 in stages
(C) 165.5 microseconds S1 , S 2 , S3 , S 4 is shown below.
(D) 590.0 microseconds S1 S2 S3 S4
[GATE 2004, IIT Delhi]
I1 2 1 1 1
Q.3 Consider a pipelined processor with the
following four stages. I2 1 3 2 2
IF : Instruction Fetch I3 2 1 1 3
ID : Instruction Decode and
Operand Fetch I4 1 2 2 2
EX : Execute
What is the number of cycles needed to
WB : Write Back execute the following loop?
The IF, ID and WB stages take one clock cycle
For (i = 1 to 2){(I1; I2; I3; I4)}
each to complete the operation. The number of
Gate Academy Shop Address : Street 04, Narsingh Vihar, Katulbod, Bhilai 490022 (C.G.), Contact : 97131-13156 Online Test Series
https://www.gateacademy.shop/ Live class room: https://play.google.com/store/apps/details?id=com.gateacademy1 http://onlinetestseries.gateacademy.co.in
GATE ACADEMY® 17 Pipelining
(A) 214 nsec (B) 202 nsec The average operand fetch rate of CPU is
(C) 86 nsec (D) 200 nsec ______.
Q.6 What will be the efficiency (in percentage) of (A) 40.8 (B) 56.8
the pipeline if 5 stage pipelined with the (C) 60.8 (D) 58.7
respective delay of 20, 30, 40, 50, 60? Q.9 A 5 stage pipelined processor has IF, ID, EXE,
Q.7 Consider a pipelined system with four stages : MEM and WB. WB stage operation is divided
IF, ID, EX, WB. Following chart shows the into two parts. In the first part register write
clock cycles required by each instruction to operation and in the second part register read
complete each stage. operation is performed. The latencies of all
Instruction Instruction Write those stages are 300, 400, 500, 500 and 300 (in
Instru- Instruction
Decode Execute Back nano second) respectively. Consider the
ctions Fetch (IF)
(ID) (EX) (WB) following code is executed on this processor.
I0 1 1 2 1 I1 : ADD R3 , R2 , R4 ; R3 → R2 + R4
I1 2 2 3 1 I 2 : SUB R6 , R4 , R3 ; R6 → R4 − R3
I2 2 2 2 2 I3 : ADD R7 , R5 , R3 ; R7 → R5 + R3
I3 2 1 1 1 I 4 :SUB R1 , R7 , R4 ; R1 → R7 − R4
I4 3 2 1 2 Find minimum number of nop instructions (no
operation) to eliminate hazards without using
How many clock cycles are required to operand forwarding. (Assume each instruction
complete the above instructions? takes one cycle to complete its operation in
(A) 16 (B) 9 ever stage).
(C) 14 (D) 13 Q.10 Comparing the time T 1 taken for a single
Q.8 Consider a hypothetical processor operating on instruction on a pipelined CPU with time T 2
500 MHz frequency which uses different taken on a non-pipelined but identical CPU, we
operand accessing mode described below : can say that [GATE 2000, IIT Kharagpur]
Operand Fetching Frequency (A) T 1 ≤ T 2
Mode (%) (B) T 1 ≥ T 2
Indirect addressing mode 25 (C) T 1 < T 2
Direct addressing mode 30 (D) T 1 is T 2 plus the time taken for one
instruction fetch cycle
Register addressing mode 20
Q.11 For a pipelined CPU with a single ALU,
Register indirect 15
consider the following situations
addressing mode
1. The j + 1 instruction uses the result of the
Indexed addressing mode 10
j − th instruction as an operand
Consider the following data regarding different 2. The execution of a conditional jump
operations performed : instruction
Operation No. of cycle needed 3. The j − th and j + 1 instructions require
Memory reference (MR) 8 the ALU at the same time
ALU operation 4 Which of the above can cause a hazard?
Register reference (RR) 0 [GATE 2003, IIT Madras]
Gate Academy Shop Address : Street 04, Narsingh Vihar, Katulbod, Bhilai 490022 (C.G.), Contact : 97131-13156 Online Test Series
https://www.gateacademy.shop/ Live class room: https://play.google.com/store/apps/details?id=com.gateacademy1 http://onlinetestseries.gateacademy.co.in
Computer Organization & Architecture [Workbook] 20 GATE ACADEMY®
(A) 1 and 2 only (B) 2 and 3 only Q.13 A non pipelined single cycle processor
(C) 3 only (D) All of above operating at 100 MHz is converted into a
synchro-nous pipelined processor with five
Q.12 Consider an instruction pipeline with four
stages requiring 2.5 nsec, 1.5 nsec, 2 nsec, 1.5
stages (S1, S2, S3 and S4) each with
nsec and 2.5 nsec, respectively. The delay of
combinational circuit only. The pipeline
the latches is 0.5 nsec. The speedup of the
registers are required between each stage and
pipeline processor for a large number of
at the end of the last stage. Delays for the
instructions is
stages and for the pipeline registers are as
given in the figure. [GATE 2008, IISc Bangalore]
(A) 4.5 (B) 4.0
Pipeline Register (Delay 1 ns)
Answers :
1. D 2. C 3. B 4. D 5. 219
6. D 7. A 8. C 9. A 10. C
Self-Practice Questions
1. C 2. C 3. b 4. A 5. B
6. 67 7. A 8. B 9. 4 10. B
Gate Academy Shop Address : Street 04, Narsingh Vihar, Katulbod, Bhilai 490022 (C.G.), Contact : 97131-13156 Online Test Series
https://www.gateacademy.shop/ Live class room: https://play.google.com/store/apps/details?id=com.gateacademy1 http://onlinetestseries.gateacademy.co.in