Computer Architecture (C2310C2) · Continuous Evaluation Test 2 · 7 October 2025 · 30 marks · 12:30 – 2:00 pm ITM SLS Baroda University · Semester 3. Question 1 is compulsory. Questions transcribed from the original paper. Solutions are written by CampusLoop; check them against your class notes.
Q1. Multiple choice questions [6]
1. In stack organization, the top-of-stack (TOS) register is used to: a) store base address of stack · b) point to current top element · c) store instruction opcode · d) perform indirect addressing Answer: (b). (The stack pointer holds the address of the top item.)
2. The process of determining the next microinstruction address is called: a) Address sequencing · b) Instruction decoding · c) Micro-branching · d) Pipeline control Answer: (a) Address sequencing.
3. Flynn's taxonomy classifies systems based on: a) Memory hierarchy · b) Number of instruction and data streams · c) Type of ALU · d) Bus architecture Answer: (b).
4. The main difference between RISC and CISC processors is: a) RISC uses simple, fixed-length instructions · b) CISC uses fewer instructions · c) RISC requires microprogramming · d) CISC executes in single cycle Answer: (a).
5. The full form of MIPS is: a) Micro Instruction Processing System · b) Million Instructions Per Second · c) Microprocessor Instruction Pipeline System · d) Multiple Instruction Processing System Answer: (b) Million Instructions Per Second.
6. In assembly programming, a subroutine is mainly used for: a) Data storage · b) Code reuse and modularity · c) Loop termination · d) Interrupt handling Answer: (b).
Q2. Answer any 3 out of 5 (3 marks each) [9]
Q2.1 What is a subroutine in assembly language and how is it invoked and returned from?
A subroutine is a self-contained block of instructions that performs a task and can be called from many places in a program (code reuse, modularity).
- Invoke (call): the calling instruction saves the return address (current PC) and jumps to the subroutine. In the basic computer:
BSA SUB→ M[SUB] ← PC (return address), PC ← SUB + 1. In stack machines:CALL: SP ← SP − 1, M[SP] ← PC, PC ← address. - Return: jump back to the saved address. Basic computer:
BUN SUB I(indirect branch through the stored return address). Stack machines:RET: PC ← M[SP], SP ← SP + 1. Parameters can be passed in registers, after the call instruction, or on the stack.
Q2.2 Differentiate between machine language and assembly language.
| Machine language | Assembly language |
|---|---|
Binary (or hex) codes, e.g. 0010 0000 0101 0100 | Mnemonics and symbols, e.g. LDA X |
| Directly executed by the CPU | Needs an assembler to translate |
| Very hard to read, write and debug | Easier to read and debug |
| No symbolic addresses | Uses labels and symbolic addresses |
| Machine-specific | Also machine-specific, one-to-one with machine code |
| No translation time | Translation step required |
Q2.3 Explain Flynn's taxonomy with examples.
Based on the number of instruction streams and data streams:
- SISD (single instruction, single data): conventional uniprocessor, e.g. classic von Neumann PC.
- SIMD (single instruction, multiple data): one instruction operates on many data elements at once, e.g. array/vector processors, GPU SIMD units, SSE/AVX.
- MISD (multiple instruction, single data): several instructions on the same data stream; rare, e.g. fault-tolerant systems, systolic arrays (theoretical).
- MIMD (multiple instruction, multiple data): independent processors on different data, e.g. multicore CPUs, clusters.
Q2.4 Write an assembly program for adding two numbers.
Basic-computer assembly:
ORG 100
LDA A ; AC ← M[A]
ADD B ; AC ← AC + M[B]
STA C ; M[C] ← AC
HLT
A, DEC 83
B, DEC -23
C, DEC 0 ; result 60
END
Q2.5 What is control memory in a microprogrammed control unit?
Control memory is a (usually read-only) memory inside the control unit that stores the microprogram: the microinstructions for the fetch routine and for every machine instruction. The control address register (CAR) gives the address of the next microinstruction; the word read goes to the control data register and its bits drive the micro-operations. The next address is generated by the sequencer (increment, branch, mapping from the opcode, subroutine call/return). Advantage: changing the instruction set means changing the memory contents rather than rewiring.
Q3. Answer any 3 out of 5 (5 marks each) [15]
Q3.1 Define addressing modes. Explain any three with examples.
Addressing modes specify how the effective address (EA) of the operand is found from the instruction's address field. They give flexibility (pointers, arrays, loops) and can shorten instructions.
| Mode | Operand / EA | Example |
|---|---|---|
| Immediate | the operand is in the instruction | LOAD #25 → AC ← 25 |
| Register | operand in a register | ADD R1 → AC ← AC + R1 |
| Register indirect | EA = contents of a register | LOAD (R1) → AC ← M[R1] |
| Direct | EA = address field | LOAD 500 → AC ← M[500] |
| Indirect | EA = M[address field] | LOAD @500 → AC ← M[M[500]] |
| Relative | EA = PC + address field | branch to PC + 20 |
| Indexed | EA = XR + address field | arrays: LOAD 500(XR) |
| Base register | EA = base register + address | relocation |
| Auto-increment/decrement | register indirect, register updated after/before use | stack, array scanning |
Worked example: memory word 500 contains 800 and word 800 contains 300, address field = 500: direct → operand 800; indirect → operand 300; immediate → operand 500.
Q3.2 What is pipelining? Give an example with a space–time diagram.
Pipelining overlaps the stages of successive instructions: while one instruction executes, the next is fetched, and so on. With k stages and n instructions, time = (k + n − 1) clock cycles instead of n·k, speedup ≈ k. Four-stage example (FI, DA, FO, EX) for 4 instructions completes in 7 cycles instead of 16. Full space–time table: COA end-sem 2025, Q4.3.
Q3.3 What is stack organization? Register stack vs memory stack.
LIFO storage accessed with a stack pointer; PUSH: SP ← SP + 1, M[SP] ← DR; POP: DR ← M[SP], SP ← SP − 1; FULL/EMTY flags. Comparison table: COA end-sem 2025, Q2.4.
Q3.4 Explain different instruction formats with examples.
Instruction formats differ by the number of address fields. Example: evaluate X = (A + B) × (C + D).
Three-address:
ADD R1, A, B ; R1 ← M[A] + M[B]
ADD R2, C, D ; R2 ← M[C] + M[D]
MUL X, R1, R2 ; M[X] ← R1 × R2
Short programs, long instructions.
Two-address:
MOV R1, A ; ADD R1, B ; R1 ← A + B
MOV R2, C ; ADD R2, D ; R2 ← C + D
MUL R1, R2 ; MOV X, R1 ; X ← R1 × R2
One-address (accumulator):
LOAD A ; ADD B ; STORE T ; T ← A + B
LOAD C ; ADD D ; MUL T ; AC ← (C + D) × T
STORE X
Zero-address (stack, postfix A B + C D + ×):
PUSH A ; PUSH B ; ADD
PUSH C ; PUSH D ; ADD
MUL ; POP X
Also RISC (load/store) format: only LOAD/STORE access memory; arithmetic uses registers.
Q3.5 Differentiate between RISC and CISC characteristics.
Full comparison table: COA end-sem 2025, Q3.5. In short: RISC has few, simple, fixed-length instructions, load/store architecture, many registers, hardwired control and one instruction per cycle; CISC has many complex variable-length instructions, many addressing modes, memory operands and microprogrammed control.