⚡ CCSU Meerut · BCA 3rd Semester · Exam Preparation
Computer Architecture & Assembly Language BCA-303 Most Important Questions & Solved Exam Notebook
Master chapter-wise solved notebook of recurring CCSU examination questions (2017–2021) for Computer Architecture and Assembly Language (BCA-303) with 8085 architecture, Booth's multiplication algorithm trace, DMA controller, instruction cycle RTL, and vector SVG diagrams.
Very Short Answer Questions & Core Architecture Definitions
CCSU Examination Blueprint: 5 Questions Compulsory • Total 15 Marks (75 Words Limit)
Q1. What is the use of a register in a computer? Name any two processor registers and explain their roles.
A processor register is an extremely fast, small, internal storage location built directly into the CPU chip using flip-flops. Registers provide temporary storage for data, memory addresses, and control instructions during instruction execution, eliminating slow memory bus latency.
Two Core Processor Registers:
- Program Counter (PC): A 16-bit register that holds the memory address of the next instruction to be fetched and executed. It is automatically incremented after every fetch cycle.
- Accumulator (AC / A): An 8-bit or 16-bit operational register that holds one of the input operands and retains the final mathematical or logical result generated by the Arithmetic Logic Unit (ALU).
Q2. What do you mean by Control Unit? Differentiate between Hardwired and Microprogrammed control.
The Control Unit (CU) acts as the central coordinator of the computer. It fetches instructions from main memory, decodes their opcodes, and issues synchronized micro-operations (control signals) to the ALU, registers, and memory buses.
| Feature | Hardwired Control | Microprogrammed Control |
|---|---|---|
| Implementation | Fixed combinational logic circuits (gates, flip-flops, decoders). | Micro-instructions stored in a dedicated Control ROM (Control Memory). |
| Operating Speed | Extremely fast (direct hardware signal propagation). | Slower (requires memory fetch for each microinstruction). |
| Flexibility & Updates | Rigid; modifying instructions requires total hardware redesign. | Highly flexible; new instructions added by updating microprogram in ROM. |
Q3. Explain in brief, how a Subroutine Call is different from a Software Interrupt.
Both mechanisms transfer program control to an out-of-sequence routine and return via a saved return address on the stack, but differ fundamentally in invocation and privilege:
- Invocation Nature: A Subroutine Call (e.g.,
CALL Addr) is an explicit, synchronous programming instruction inserted by the developer to execute modular code. A Software Interrupt (e.g.,INT 21h/RST n) is triggered by special trap instructions or system exceptions. - Target Resolution: Subroutine calls jump to an explicit target address specified in the instruction. Software interrupts transfer execution through a fixed Interrupt Vector Table (IVT) index.
- CPU Privilege Level: Subroutines execute in standard User Mode with existing flags. Software interrupts switch the CPU into Supervisor/Kernel mode and automatically push the Processor Status Word (PSW/Flags) onto the stack.
Q4. Discuss the Stack Organisation for a processor.
A Stack is a Last-In, First-Out (LIFO) storage structure managed by a specialized register called the Stack Pointer (SP), which always points to the top element of the stack. Stack organisation in processors is realized in two primary ways:
- Register Stack: A standalone collection of high-speed internal CPU flip-flop registers organized as a hardware stack with a fixed depth (e.g., 64 words). Fast, but size-constrained.
- Memory Stack: A contiguous block allocated in random-access main memory (RAM). When an item is pushed (
PUSH), SP is decremented (or incremented depending on architecture) and data is written: \(SP \leftarrow SP - 1, \; M[SP] \leftarrow DR\). OnPOP, data is read and SP is incremented: \(DR \leftarrow M[SP], \; SP \leftarrow SP + 1\).
Q5. What are the three major phases through which the control unit passes in an instruction cycle?
An instruction cycle is the complete sequence of hardware operations required by the CPU to process a single machine language instruction. The three fundamental phases are:
- Fetch Phase: The CPU loads the memory address from the Program Counter (PC) into the Address Register (AR), fetches the instruction code from memory into the Instruction Register (IR), and increments the PC: \[T_0: AR \leftarrow PC, \quad T_1: IR \leftarrow M[AR], \; PC \leftarrow PC + 1\]
- Decode & Effective Address Phase: The control unit decodes the operation code (opcode bits 12–14), inspects the addressing mode bit \(I\) (bit 15), and reads the effective memory address from RAM if indirect addressing is flagged: \[T_2: \text{Decode } IR(12\text{--}14), \; AR \leftarrow IR(0\text{--}11), \; I \leftarrow IR(15)\] \[T_3: AR \leftarrow M[AR] \quad (\text{if } I = 1)\]
- Execute Phase: The control unit generates micro-operation pulses to execute the decoded operation (e.g., arithmetic addition, logic AND, register transfer, or branch) and updates condition flags.
Q6. What do you understand by Interleaved DMA (Cycle Stealing)?
Interleaved DMA (commonly known as Cycle Stealing) is a high-efficiency Direct Memory Access data transfer technique where the DMA controller takes control of the system memory bus for exactly one bus cycle to transfer a single data word, and immediately returns the bus to the CPU.
Operational Advantage: Unlike Burst (Block) Transfer DMA—which locks the CPU out of memory for the entire block duration—Cycle Stealing interleaves I/O transfers during CPU internal instruction decoding or ALU cycles when the CPU does not require the memory bus. This keeps CPU latency minimal while achieving high sustained peripheral throughput.
Q7. What is Asynchronous Data Transfer? How does handshaking remove the disadvantage of the strobe method?
Asynchronous data transfer occurs between two independent digital units that do not share a common system clock generator. Their internal operations run at different frequencies and timing states.
Strobe Disadvantage: In the Strobe pulse method, the sender places data on the bus and sends a brief strobe pulse. However, there is no acknowledgement from the receiver. If the receiver is busy or slow, data is permanently lost without the transmitter's knowledge.
Handshaking Solution: Handshaking uses a two-line two-way protocol: (1) Data Valid from transmitter, and (2) Data Accepted acknowledgement from receiver. The transmitter refuses to drop data or send the next byte until the receiver explicitly asserts Data Accepted, guaranteeing 100% error-free asynchronous delivery.
Q8. Distinguish between Fixed Point and Floating Point representation of numbers.
| Comparison Parameter | Fixed Point Representation | Floating Point Representation (IEEE 754) |
|---|---|---|
| Radix Point Position | Fixed at a predefined bit boundary (e.g., integer or pure fraction). | Dynamic; the radix point floats according to the exponent value. |
| Number Format | Stored directly as Sign + Magnitude / 2's Complement. | Stored in three fields: Sign (\(S\)), Biased Exponent (\(E\)), and Mantissa (\(M\)): \((-1)^S \times 1.M \times 2^{E - \text{Bias}}\). |
| Dynamic Range | Severely limited range; prone to overflow with large values. | Extremely large dynamic range (e.g., \(10^{-38}\) to \(10^{+38}\) in 32-bit single precision). |
| Hardware Complexity | Simple, high-speed integer ALU circuits. | Requires dedicated Floating Point Unit (FPU) for exponent alignment and normalization. |
Q9. What is the role of an Assembler in computer programming?
An Assembler is a system translation program that converts low-level symbolic assembly language code (mnemonics, symbolic labels, and pseudo-ops) into executable binary machine code (0s and 1s) for the target CPU.
Key Roles in a Two-Pass Assembler:
- Pass 1 (Symbol Resolution): Scans the source file, increments the Location Counter (LC), and constructs a Symbol Table mapping every user-defined label to its absolute memory offset.
- Pass 2 (Code Generation): Replaces mnemonics (e.g.,
MOV,ADD) with binary opcodes, substitutes labels with resolved addresses from the symbol table, processes pseudo-instructions (ORG,END), and outputs the final object file.
Q10. What are Macros in assembly language? How do they differ from Subroutines?
A Macro is an open-subroutine programming construct defined with a name that represents a block of assembly statements. During assembly, whenever the macro name is invoked, the macro preprocessor performs inline macro expansion, copying the entire statement block directly into the source code at that location.
Difference from Subroutine:
- Execution Speed: Macros execute faster because there is zero
CALL/REToverhead or stack pointer pushing. - Memory Footprint: Macros increase binary program size because code is duplicated at every call point. Subroutines exist in memory exactly once and save space.
Q11. What is Cache Memory? Describe its operations in brief.
Cache Memory is a small, ultra-fast Static RAM (SRAM) buffer positioned between the high-speed CPU core and the slower Dynamic RAM (DRAM) main memory. Its goal is to bridge the CPU-memory speed gap based on the Principle of Locality of Reference (Spatial and Temporal).
Basic Operations:
- Cache Hit: When the CPU references a memory address, the cache controller checks if the requested block is present in cache. If found (Cache Hit), data is delivered to CPU registers in 1–2 clock cycles without accessing main memory.
- Cache Miss: If the block is not in cache (Cache Miss), the controller reads a fixed-size block (cache line) from main memory into cache and simultaneously forwards the word to the CPU, updating cache replacement lines (LRU/FIFO).
Q12. Differentiate between Isolated I/O and Memory-Mapped I/O.
| Criterion | Isolated I/O (Port-Mapped I/O) | Memory-Mapped I/O |
|---|---|---|
| Address Space | Separate address spaces for Memory and I/O (e.g., 8-bit port addresses 00H–FFH in 8085). |
Shared single address space; I/O ports are assigned addresses from standard RAM space. |
| CPU Instructions | Requires dedicated I/O instructions (e.g., IN and OUT). |
Standard memory access instructions (MOV, LDA, STA) work directly on I/O ports. |
| Control Lines | Requires separate control lines: \(\overline{IOR}\), \(\overline{IOW}\) vs \(\overline{MEMR}\), \(\overline{MEMW}\) (via \(IO/\overline{M}\) pin). | Uses existing memory control lines: \(\overline{MEMR}\) and \(\overline{MEMW}\). |
| Available RAM Size | Does not consume any system RAM address space. | Reduces available RAM space by consuming addresses for I/O ports. |
Q13. Define Booth's Algorithm and state its primary advantage in computer arithmetic.
Booth's Multiplication Algorithm is a hardware-oriented algorithm that multiplies two signed binary numbers encoded in 2's complement representation directly, without requiring sign-magnitude conversion or special sign correction at the end.
Core Advantages:
- Uniform Signed Handling: Handles positive and negative numbers identically in 2's complement without extra logic.
- Multiplication Speedup: Replaces consecutive strings of 1s in the multiplier (e.g., \(011110_2 = 30\)) with a single subtraction at the first 1 and a single addition after the last 1: \(2^{n+m} - 2^n\). This reduces the total number of addition/subtraction ALU cycles significantly.
Q14. Write a short note on the Flag Register of the 8085 Microprocessor.
The 8085 has an 8-bit Flag Register containing 5 active flip-flops that indicate the mathematical/logical status of the result generated in the Accumulator:
| Bit | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
|---|---|---|---|---|---|---|---|---|
| Flag | S (Sign) | Z (Zero) | X (Undefined) | AC (Aux Carry) | X | P (Parity) | X | CY (Carry) |
- Sign Flag (S): Set to 1 if bit D7 of the Accumulator is 1 (negative result); 0 if positive.
- Zero Flag (Z): Set to 1 if the ALU result is exactly zero (
00H); otherwise 0. - Auxiliary Carry (AC): Set to 1 if a carry occurs from bit D3 to bit D4 during BCD addition.
- Parity Flag (P): Set to 1 if the accumulator contains an even number of 1s (Even Parity); 0 for odd.
- Carry Flag (CY): Set to 1 if an arithmetic operation generates a carry out of bit D7 or requires a borrow during subtraction.
Q15. Write an assembly language program for the 8085 microprocessor to add two 8-bit numbers.
; Problem: Add two 8-bit numbers stored at memory locations 2050H and 2051H.
; Store the sum at 2052H and carry at 2053H.
LXI H, 2050H ; HL points to first operand address (2050H)
MVI C, 00H ; Clear register C to store carry (C = 0)
MOV A, M ; Load first number from memory into Accumulator
INX H ; HL points to second operand address (2051H)
ADD M ; Accumulator = A + M (Second number)
JNC SKIP_CARRY ; If CY == 0, jump to SKIP_CARRY
INR C ; Else, increment C to record carry
SKIP_CARRY:
INX H ; HL points to 2052H
MOV M, A ; Store sum into 2052H
INX H ; HL points to 2053H
MOV M, C ; Store carry into 2053H
HLT ; Terminate program execution
Q16. Differentiate between a Micro-instruction and a Micro-program.
In a microprogrammed control unit, control signals are generated by executing firmware stored in control memory:
- Micro-instruction: A single word stored in control memory that specifies one or more basic hardware control signals (micro-operations) to be executed simultaneously during a single clock cycle, along with the address of the next microinstruction.
- Micro-program: A structured sequence of micro-instructions stored in control memory whose collective execution decodes and completely executes a single machine language macro-instruction (e.g., executing the
ADD R1, [R2]instruction requires a microprogram of 4–5 microinstructions for fetch, memory read, ALU add, and writeback).
Q17. Convert the following infix expression into Reverse Polish Notation (RPN): \(A \times B + C\)
Reverse Polish Notation (RPN) is the postfix representation where operators appear immediately after their operands, removing the need for parentheses and precedence rules during stack evaluation.
Step-by-step Operator Precedence parsing:
- Given Infix Expression: \((A \times B) + C\)
- Multiplication (\(\times\)) holds higher precedence than addition (\(+\)): \[\text{Postfix of } (A \times B) \implies AB*\]
- Substitute intermediate token \(T_1 = AB*\): \[T_1 + C\]
- Convert outer addition (\(+\)): \[T_1 \, C + \implies AB*C+\]
Final Reverse Polish Notation: A B * C +
Q18. Discuss Basic Computer Organisation. How is it different from Computer Architecture?
Although frequently used interchangeably, they represent two distinct layers of computer engineering:
| Feature | Computer Architecture | Computer Organisation |
|---|---|---|
| Focus & Definition | Defines what the computer does from the programmer's perspective (conceptual structure and functional behavior). | Defines how the functional components are physically interconnected to implement the architecture. |
| Visibility | Directly visible to the machine/assembly programmer (instruction set, data bit formats, addressing modes). | Transparent to the programmer (internal clock signals, circuit design, memory physical interfacing, caching mechanisms). |
| Example | Intel x86-64 Instruction Set Architecture (ISA). | Intel Core i7 vs AMD Ryzen: both share the same x86 architecture, but feature completely different internal organisations (pipelining, branch predictors, cache layouts). |
Algorithmic Procedures, Assembly Programs & Logic Circuits
CCSU Examination Blueprint: Attempt Any 2 Out of 3 Questions • Total 15 Marks (200 Words Limit)
Q1. What are the steps required for a pipelined processor to process an instruction? Draw an arithmetic pipeline for the expression \(A + B \times D\).
Instruction Pipelining is an implementation technique where multiple instructions are overlapped in execution, dividing instruction processing into discrete sequential stages separated by high-speed interface registers.
Standard Steps in an Instruction Pipeline:
- FI (Fetch Instruction): Read instruction from memory into IR using PC.
- DA (Decode Instruction & Calculate Effective Address): Identify opcode and resolve memory operand address.
- FO (Fetch Operand): Retrieve operands from registers or cache memory.
- EX (Execute): Perform arithmetic/logical operation in ALU.
- WB (Write Back): Store result back into destination register or memory.
Arithmetic Pipeline for \(A + B \times D\):
The expression requires two sequential arithmetic operations: first multiplication (\(B \times D\)), followed by addition of \(A\). We decompose this into three pipeline segments:
Sub-operations performed per clock pulse:
- Clock 1: \(R1 \leftarrow B, \quad R2 \leftarrow D\)
- Clock 2: \(R3 \leftarrow R1 \times R2, \quad R4 \leftarrow A\)
- Clock 3: \(R5 \leftarrow R3 + R4\) (Final result ready in \(R5\))
Q2. Write an assembly language program for the 8085 microprocessor to subtract the number stored at memory location 2001H from the number stored at 2002H. Display the result at 2004H.
; Problem: Result = [2002H] - [2001H], Store at 2004H.
; If result is negative (borrow occurs), store borrow flag at 2005H.
ORG 0000H ; Program origin
LDA 2002H ; Load number from 2002H into Accumulator A
LXI H, 2001H ; HL pair points to memory location 2001H
MVI C, 00H ; Initialize register C = 00H (Borrow counter)
SUB M ; Accumulator = A - M[HL] = [2002H] - [2001H]
JNC STORE_RES ; If Carry/Borrow CY == 0, jump to STORE_RES
INR C ; Else Borrow occurred, set C = 01H
CMA ; Take 1's complement of Accumulator
ADI 01H ; Add 1 to get true magnitude (2's complement)
STORE_RES:
STA 2004H ; Store magnitude of result at 2004H
MOV A, C ; Move borrow flag to Accumulator
STA 2005H ; Store borrow indicator at 2005H (00H=Pos, 01H=Neg)
HLT ; Stop execution
Memory Trace Example:
- At
2001H:25H(\(37_{10}\)) - At
2002H:68H(\(104_{10}\)) - Calculation: \(68H - 25H = 43H\) (\(67_{10}\)), No borrow (\(CY=0\)).
- Result at
2004H:43H, at2005H:00H.
Q3. Define Interrupt. Explain its various classifications in computer architecture.
An Interrupt is an asynchronous signal sent to the processor by external hardware devices or internal software conditions that temporarily suspends the current program execution sequence, causing the CPU to execute an Interrupt Service Routine (ISR).
Major Classifications:
- Hardware vs Software Interrupts:
- Hardware: Initiated externally via physical CPU pins (e.g., keyboard keystroke, timer, disk read completion). Examples in 8085: TRAP, RST 7.5, RST 6.5, RST 5.5, INTR.
- Software: Triggered internally by program instructions to invoke operating system system calls or handle fatal exceptions (e.g., divide by zero, breakpoint trap). Examples:
INT 21H,RST 1toRST 7.
- Maskable vs Non-Maskable Interrupts (NMI):
- Maskable: Can be disabled or delayed by the programmer using instructions like
DI(Disable Interrupt). Example: INTR, RST 7.5. - Non-Maskable: Cannot be ignored or disabled by CPU software; reserved for catastrophic system emergencies (power failure, RAM parity error). Example: TRAP in 8085.
- Maskable: Can be disabled or delayed by the programmer using instructions like
- Vectored vs Non-Vectored Interrupts:
- Vectored: The interrupting device directly supplies the target memory vector address of its ISR (e.g., TRAP jumps to hardwired address \(0024H\)).
- Non-Vectored: The device does not supply an address; CPU must execute an external poll or acknowledge cycle to receive opcode from data bus (e.g., INTR in 8085).
Q4. Differentiate between Direct and Indirect Addressing with an example. How many references to memory are needed for each to bring an operand into a processor register?
The Addressing Mode specifies how the effective address (EA) of an operand is calculated from the address field of an instruction.
| Feature | Direct Addressing Mode (\(I = 0\)) | Indirect Addressing Mode (\(I = 1\)) |
|---|---|---|
| Definition | The address field directly contains the Effective Address (EA) where the operand resides. | The address field contains a pointer to a memory cell that holds the actual Effective Address (EA). |
| Effective Address Formula | \(\text{EA} = \text{Address Field}\) | \(\text{EA} = M[\text{Address Field}]\) |
| Assembly Syntax Example | LDA 2500H (Loads data directly from RAM cell 2500H into AC). |
ADD @500 or MOV A, M (HL pair holds the pointer). |
| Memory References Required | 2 Memory References: 1. Fetch instruction from memory. 2. Read operand from address. |
3 Memory References: 1. Fetch instruction from memory. 2. Read effective address pointer from memory. 3. Read actual operand from effective address. |
Q5. Explain the concept and implementation of Subroutines in Assembly Language using CALL and RET instructions.
A Subroutine (procedure or function) is a self-contained block of assembly instructions written once in memory and invoked multiple times from different points in the main program. It facilitates code reuse, modularity, and memory conservation.
Hardware Stack Mechanism:
- CALL Instruction (e.g.,
CALL SubAddr):- Saves the contents of the Program Counter (return address of the instruction following CALL) onto the stack: \[SP \leftarrow SP - 1, \; M[SP] \leftarrow PC_H\] \[SP \leftarrow SP - 1, \; M[SP] \leftarrow PC_L\]
- Loads the target subroutine start address into PC: \(PC \leftarrow \text{SubAddr}\).
- RET Instruction (e.g.,
RET):- Pops the 16-bit saved return address from the top of the stack back into the Program Counter: \[PC_L \leftarrow M[SP], \; SP \leftarrow SP + 1\] \[PC_H \leftarrow M[SP], \; SP \leftarrow SP + 1\]
- The main program resumes execution exactly where it left off.
Q6. Differentiate between RISC and CISC architectures. List five defining characteristics of RISC.
| Feature | RISC (Reduced Instruction Set Computer) | CISC (Complex Instruction Set Computer) |
|---|---|---|
| Instruction Size | Fixed-length instructions (typically 32-bit standard). | Variable-length instructions (1 byte to 15 bytes in x86). |
| Instruction Complexity | Simple instructions executing in exactly one clock cycle. | Complex, multi-clock instructions executing high-level tasks. |
| Memory Access Architecture | Load/Store Architecture: Only dedicated LOAD and STORE access RAM; all arithmetic is register-to-register. |
Memory operands can be used directly in arithmetic instructions (e.g., ADD EAX, [EBX]). |
| General Purpose Registers | Large register file (typically 32 to 128 general registers). | Fewer general registers (e.g., 8 in original x86 architecture). |
| Control Unit Type | Fast, hardwired control logic. | Microprogrammed control memory (ROM). |
| Pipelining Efficiency | Highly optimized for instruction pipelining with zero pipeline stalls. | Difficult to pipeline efficiently due to variable instruction lengths. |
Q7. Draw and explain a 4-bit Arithmetic Circuit capable of performing 7 arithmetic microoperations using Full Adders and Multiplexers.
A 4-bit arithmetic circuit consists of 4 parallel Full Adders (FA) whose \(A\) inputs receive operand \(A_i\) directly, while the \(B\) inputs receive the output \(Y_i\) of a \(4 \times 1\) Multiplexer controlled by selection lines \(S_1, S_0\). By controlling \(Y_i\) and the input carry \(C_{in}\), the circuit generates 7 distinct arithmetic operations:
| \(S_1\) | \(S_0\) | \(C_{in}\) | Input \(Y\) to Full Adder | Output Function \(D = A + Y + C_{in}\) | Microoperation Performed |
|---|---|---|---|---|---|
| 0 | 0 | 0 | \(B\) | \(D = A + B\) | Add |
| 0 | 0 | 1 | \(B\) | \(D = A + B + 1\) | Add with Carry |
| 0 | 1 | 0 | \(\overline{B}\) | \(D = A + \overline{B}\) | Subtract with Borrow |
| 0 | 1 | 1 | \(\overline{B}\) | \(D = A + \overline{B} + 1\) | Subtract (2's Complement) |
| 1 | 0 | 0 | 0 | \(D = A\) | Transfer A |
| 1 | 0 | 1 | 0 | \(D = A + 1\) | Increment A |
| 1 | 1 | 0 | 1 (All 1s) | \(D = A - 1\) | Decrement A |
Q8. Write an assembly language program for the 8085 microprocessor to add 'n' numbers stored in consecutive memory locations and store the result in memory location SUM.
; Problem: Count 'N' is stored at memory location 3000H.
; Numbers start at 3001H (NUM), 3002H (NUM+1), ...
; Store 16-bit total sum: Low byte at 4000H, High byte (carry) at 4001H.
ORG 0000H
LDA 3000H ; Load count N into Accumulator
MOV C, A ; Register C = Loop counter (N)
MVI B, 00H ; Register B = Carry accumulator (High byte of sum)
XRA A ; Clear Accumulator to 00H (Low byte of sum)
LXI H, 3001H ; HL points to first array element (NUM)
LOOP_ADD:
ADD M ; Add memory element to Accumulator: A = A + M[HL]
JNC NEXT_ELEM ; If no carry out, skip carry increment
INR B ; Increment high-byte sum in B
NEXT_ELEM:
INX H ; Increment memory pointer to next array element
DCR C ; Decrement loop counter C = C - 1
JNZ LOOP_ADD ; If C != 0, repeat addition loop
; Store the 16-bit accumulated result
STA 4000H ; Store lower 8 bits of SUM at 4000H
MOV A, B ; Move higher 8 bits of SUM to Accumulator
STA 4001H ; Store higher 8 bits of SUM at 4001H
HLT ; Terminate program
Q9. What are the steps for a simple instruction cycle? Explain the Fetch Cycle and Indirect Cycle using Register Transfer Language (RTL).
In Mano's Basic Computer architecture, timing signals \(T_0, T_1, T_2, \dots\) are generated by a 4-bit sequence counter (SC) connected to a \(4 \times 16\) decoder.
1. Fetch Phase Micro-operations:
T1: IR ← M[AR], PC ← PC + 1
T2: Decode Opcode in IR(12-14), AR ← IR(0-11), I ← IR(15)
2. Indirect Phase Micro-operations:
T3 (if I = 0 & Memory-Reference): Nothing (AR already holds Effective Address)
During \(T_3\), if mode bit \(I = 1\), the CPU initiates a second read cycle into memory to resolve the pointer address and overwrites AR with the true Effective Address.
Q10. Explain Programmed I/O with a flowchart and discuss its primary CPU performance drawback (Busy Waiting).
Programmed I/O is the simplest I/O control technique where all data movement between memory and external devices is executed entirely by CPU instructions.
Operational Flow:
- CPU issues an I/O command to the device interface.
- The device interface sets a status flag bit (e.g.,
BUSY = 1) and begins mechanical preparation. - The CPU enters a tight polling loop, continually reading the status register of the interface to check if
READY == 1. - Once ready, the CPU reads data into the Accumulator and writes it into RAM.
Critical Drawback (Busy-Waiting): Since mechanical I/O peripherals are thousands of times slower than electronic CPU clock speeds, the processor wastes millions of valuable clock cycles executing spin-loops doing nothing productive, completely degrading overall system throughput.
Comprehensive Long Answer Solutions & Hardware Circuit Diagrams
CCSU Examination Blueprint: Attempt Any 3 Out of 5 Questions • Total 45 Marks
Q1. What is Booth's Algorithm? Explain its mathematical principle and step-by-step procedure. Multiply \(24\) and \(-7\) using Booth's Algorithm with a complete register trace table.
1. Mathematical Principle of Booth's Algorithm:
Booth's algorithm efficiently multiplies two signed binary integers in 2's complement representation. In standard binary multiplication, every bit of the multiplier generates an addition of the multiplicand. Booth's algorithm recognizes that strings of consecutive 1s in the multiplier (such as \(011110_2 = 30_{10}\)) can be simplified:
\[2^4 + 2^3 + 2^2 + 2^1 = 2^5 - 2^1 = 32 - 2 = 30\]Therefore, Booth's algorithm performs a subtraction when entering a run of 1s (transition \(10\)), does nothing during the run (\(11\)), and performs an addition when exiting the run (transition \(01\)).
2. Detailed Numerical Problem: Multiply \(24\) and \(-7\)
- Multiplicand \(M = +24_{10}\): In 6-bit binary = \(011000_2\)
- Negative Multiplicand \(-M = -24_{10}\): Take 2's complement of \(011000 \implies 100111 + 1 = 101000_2\)
- Multiplier \(Q = -7_{10}\): \(+7 = 000111_2\). 2's complement of \(7 \implies 111000 + 1 = 111001_2\)
- Number of bits \(n = 6\). Registers: \(A = 000000_2\), \(Q = 111001_2\), \(Q_{-1} = 0\), \(\text{Count} = 6\).
Complete Step-by-Step Register Trace Table:
| Cycle | Operation | Accumulator (A) | Multiplier (Q) | \(Q_{-1}\) | Count |
|---|---|---|---|---|---|
| Init | Initial Values | 000000 |
111001 |
0 |
6 |
| 1 | \(Q_0 Q_{-1} = 10 \implies A = A - M\) (\(+ 101000\)) | 101000 |
111001 |
0 |
6 |
| Arithmetic Shift Right (ASHR) | 110100 |
011100 |
1 |
5 | |
| 2 | \(Q_0 Q_{-1} = 01 \implies A = A + M\) (\(+ 011000\)) | 001100 |
011100 |
1 |
5 |
| Arithmetic Shift Right (ASHR) | 000110 |
001110 |
0 |
4 | |
| 3 | \(Q_0 Q_{-1} = 00 \implies\) No Op, only ASHR | 000011 |
000111 |
0 |
3 |
| 4 | \(Q_0 Q_{-1} = 10 \implies A = A - M\) (\(+ 101000\)) | 101011 |
000111 |
0 |
3 |
| Arithmetic Shift Right (ASHR) | 110101 |
100011 |
1 |
2 | |
| 5 | \(Q_0 Q_{-1} = 11 \implies\) No Op, only ASHR | 111010 |
110001 |
1 |
1 |
| 6 | \(Q_0 Q_{-1} = 11 \implies\) No Op, only ASHR | 111101 |
011000 |
1 |
0 |
Result Verification:
Combine registers \(A\) and \(Q\): \([A, Q] = 111101 \; 011000_2\)
- The MSB is 1, indicating a negative result.
- Take the 2's complement of \([A, Q]\) to find its magnitude: \[111101011000 \xrightarrow{\text{1's comp}} 000010100111 \xrightarrow{+1} 000010101000_2\]
- Evaluate decimal value: \(2^7 + 2^5 + 2^3 = 128 + 32 + 8 = \mathbf{168_{10}}\)
- Hence, \([A, Q] = \mathbf{-168_{10}}\). Exactly matches \(24 \times (-7) = -168\)!
Q2. Draw the functional block diagram of the Intel 8085 Microprocessor architecture and explain all its functional units, internal registers, and flag register in detail.
Key Functional Blocks of 8085:
- Arithmetic and Logic Unit (ALU): An 8-bit processing core that executes arithmetic additions, subtractions, logical AND, OR, XOR, and rotates. Operates with the Accumulator and Temporary Register.
- General Purpose Register Array: Six 8-bit registers (
B, C, D, E, H, L) that can function independently or as 16-bit register pairs (BC, DE, HL). The HL pair acts as the primary data memory pointer. - Program Counter (PC): A 16-bit register tracking the address of the next byte to be fetched. Address range:
0000H to FFFFH(64 KB). - Stack Pointer (SP): A 16-bit register pointing to the top of the stack frame in read/write memory.
- Demultiplexing the Address/Data Bus (\(AD_0\text{--}AD_7\)): To minimize physical pin count (40 pins), the lower 8 address bits are time-multiplexed with the 8-bit data bus. The Address Latch Enable (ALE) pin outputs a high pulse during clock cycle \(T_1\) of each machine cycle to strobe \(A_0\text{--}A_7\) into an external latch (IC 74LS373), freeing the bus for data during \(T_2\) and \(T_3\).
Q3. Describe the concept of Direct Memory Access (DMA). Explain the hardware architecture and transfer mechanism of a DMA Controller with a block diagram.
1. Why DMA is Necessary:
In programmed I/O and interrupt-driven I/O, every single data byte moved between a high-speed peripheral (hard disk, SSD, network card) and main memory must travel through CPU registers (such as the Accumulator). This creates a massive performance bottleneck. Direct Memory Access (DMA) bypasses the CPU entirely, granting a specialized hardware controller direct ownership of the system buses to stream data directly between I/O and RAM at full memory-bus speeds.
2. Detailed DMA Transfer Sequence:
- Initialization: The CPU initializes the DMA controller by writing: (i) the starting RAM address into the Address Register, (ii) the total number of words into the Word Count Register, and (iii) the direction of transfer (Read/Write) into the Control Register.
- Bus Request: When the peripheral has data ready, it asserts DREQ (DMA Request) to the DMA controller.
- Hold Request: The DMAC asserts HOLD / HRQ to the CPU.
- Bus Grant: The CPU finishes its current machine cycle, floats its address, data, and control lines to high-impedance state (tristate), and replies with HLDA (Hold Acknowledge).
- Burst Transfer: The DMAC activates DACK to the peripheral, drives the RAM address onto the address bus, asserts \(\overline{IOR}\) and \(\overline{MEMW}\) simultaneously, transferring the byte directly from peripheral to RAM in a single bus cycle!
- Auto-Increment & Termination: DMAC increments the Address Register and decrements the Word Count Register. When Count reaches zero, DMAC asserts EOT (End of Process) / Interrupt to notify the CPU that the transfer is complete.
Q4. What do you mean by Addressing Modes? Explain various addressing modes with syntax examples, effective address formulas, and memory references.
The Addressing Mode dictates how the control unit calculates the Effective Address (EA)—the physical location in memory or registers where the operand actually lives.
| Addressing Mode | Effective Address (EA) Formula | Assembly Syntax | Mem Refs | Primary Use Case |
|---|---|---|---|---|
| 1. Immediate | Operand is inside instruction: \(\text{EA} = \text{PC}\) | MVI A, 25H / ADD #5 |
0 (operand fetched with opcode) | Initializing constant values and loop counters. |
| 2. Direct (Absolute) | \(\text{EA} = \text{Address Field}\) | LDA 3000H |
1 (Read operand from address) | Accessing fixed global variables. |
| 3. Indirect | \(\text{EA} = M[\text{Address Field}]\) | ADD @500 |
2 (Read pointer + Read operand) | Passing parameters by reference and linked structures. |
| 4. Register Mode | \(\text{EA} = \text{Register } R\) | MOV A, B |
0 (Fastest; purely on-chip registers) | High-speed mathematical computations. |
| 5. Register Indirect | \(\text{EA} = [R]\) (Register holds memory address) | MOV A, M (HL holds address) |
1 (Read operand from address in register) | Iterating through contiguous array buffers. |
| 6. Relative Addressing | \(\text{EA} = \text{PC} + \text{Address Offset}\) | JMP $+15 / BNE Loop |
0 (Branching) | Relocatable position-independent code (PIC) loops. |
| 7. Indexed Addressing | \(\text{EA} = \text{Index Register (XR)} + \text{Base Address}\) | MOV A, [XR + 1000H] |
1 | Scanning 1D arrays and lookup tables. |
| 8. Base Register Mode | \(\text{EA} = \text{Base Register (BR)} + \text{Offset}\) | LDR R1, [R2, #4] |
1 | Virtual memory relocation and program segment swapping. |
Q5. What do you mean by Input-Output Processor (IOP)? Explain its hardware organization and CPU-IOP communication with a block diagram.
1. IOP Concept (I/O Channel):
An Input-Output Processor (IOP) is an independent processor with its own specialized instruction set designed exclusively for managing I/O operations. While a DMA controller is purely hardware-driven, an IOP can execute its own software programs (known as Channel Programs or Channel Command Words - CCW), performing data formatting, character code translation (ASCII to EBCDIC), and error detection without interrupting the CPU.
CPU-IOP Communication Protocol:
- The CPU constructs an I/O Channel Program in Central Memory containing sequences of Channel Command Words (CCWs).
- The CPU issues a
START I/Oinstruction addressed to the specific IOP, providing the starting memory address of the channel program. - The IOP accesses Central Memory via cycle-stealing, fetches and executes its channel commands, and streams data between peripherals and memory autonomously.
- During this time, the CPU continues executing primary user applications at 100% capacity.
- Upon finishing the channel program, the IOP issues an I/O Complete Interrupt to the CPU and writes its completion status into a Memory Status Word.
Q6. What do you understand by the Instruction Cycle? Explain all phases (Fetch, Decode, Effective Address, Execute, and Interrupt) with a complete state flowchart and RTL expressions.
Interrupt Cycle RTL Representation:
If the Interrupt Enable flip-flop is set (\(IEN = 1\)) and an external interrupt line is asserted during execution, the hardware interrupt flip-flop \(R\) is set to 1, initiating the Interrupt Cycle instead of the Fetch Cycle:
T1': M[AR] ← TR, PC ← 0
T2': PC ← PC + 1, IEN ← 0, R ← 0, SC ← 0
This atomically saves the return address into memory location 0, loads address 1 (the pointer to the Interrupt Service Routine) into the Program Counter, disables interrupts, and clears the sequence counter to start processing the ISR.
Q7. What is a Priority Interrupt? Explain Hardware Daisy-Chaining Priority and Software Polling with a detailed schematic diagram.
1. Priority Interrupt Concept:
When multiple peripheral devices request CPU service simultaneously, a Priority Interrupt System establishes an arbitration hierarchy, ensuring that high-speed or critical devices (e.g., power-failure monitor, hard drive) are serviced immediately before lower-priority devices (e.g., keyboard, printer).
Comparison: Daisy-Chaining vs Software Polling:
| Criterion | Hardware Daisy-Chaining | Software Polling |
|---|---|---|
| Arbitration Speed | Extremely fast (signals propagate directly through gates in nanoseconds). | Slow (CPU executes an inspection loop polling device status registers sequentially). |
| Hardware Cost | Requires dedicated priority logic (PI/PO pins) built into each interface. | Zero extra hardware; implemented purely via software code loops. |
| Flexibility | Rigid; priority is physically fixed by wire connection order. | High; priority can be dynamically altered by changing the polling sequence order in code. |
Q8. Explain the architecture of a Microprogrammed Control Unit. Is it possible to have a hardwired control unit associated with a control memory?
1. Architectural Principle of Microprogrammed Control:
A microprogrammed control unit organizes control signals into structured micro-instructions stored inside a read-only Control Memory (ROM). Its four core blocks are:
- Control Address Register (CAR): Specifies the ROM address of the next micro-instruction to be read.
- Control Memory: High-speed internal ROM storing all microprograms.
- Control Data Register (CDR / Pipeline Register): Holds the currently fetched micro-instruction. The microinstruction is split into: (a) Control word fields (micro-operations) that drive the ALU and data paths, and (b) Next address fields that drive sequencing.
- Next Address Generator (Sequencer): Determines the next micro-address based on status flags, incrementer logic, or branch addresses.
2. Can Hardwired Control have a Control Memory?
Answer: NO. By absolute computer engineering definition, a Hardwired Control Unit generates control signals directly using fixed combinational logic gates, decoders, multiplexers, and state flip-flops without storing instructions in memory.
If a control unit stores control words in a memory matrix (ROM or PLA) and fetches them via an address register, it is a Microprogrammed Control Unit. Storing control signals in memory is the exact defining characteristic of microprogramming.
Q9. Draw and explain one stage of an Arithmetic Logic Unit (ALU) with shift capability along with the complete truth table of microoperations performed.
An ALU consists of \(n\) identical stages connected in parallel. One stage \(i\) consists of an Arithmetic Circuit, a Logic Circuit, and a \(4 \times 1\) Multiplexer with select inputs \(S_3, S_2\):
- When \(S_3 S_2 = 00\): Output of Arithmetic circuit is selected.
- When \(S_3 S_2 = 01\): Output of Logic circuit is selected.
- When \(S_3 S_2 = 10\): Shift Right operation is selected: \(G_i = A_{i+1}\).
- When \(S_3 S_2 = 11\): Shift Left operation is selected: \(G_i = A_{i-1}\).
| \(S_3\) | \(S_2\) | \(S_1\) | \(S_0\) | \(C_{in}\) | Operation Output \(G_i\) | Microoperation Function |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | \(A_i\) | Transfer A |
| 0 | 0 | 0 | 0 | 1 | \(A_i + 1\) | Increment A |
| 0 | 0 | 0 | 1 | 0 | \(A_i + B_i\) | Addition |
| 0 | 0 | 0 | 1 | 1 | \(A_i + B_i + 1\) | Add with Carry |
| 0 | 0 | 1 | 0 | 0 | \(A_i + \overline{B}_i\) | Subtract with Borrow |
| 0 | 0 | 1 | 0 | 1 | \(A_i + \overline{B}_i + 1\) | Subtract (2's Comp) |
| 0 | 0 | 1 | 1 | 0 | \(A_i - 1\) | Decrement A |
| 0 | 1 | 0 | 0 | X | \(A_i \land B_i\) | AND Logic |
| 0 | 1 | 0 | 1 | X | \(A_i \lor B_i\) | OR Logic |
| 0 | 1 | 1 | 0 | X | \(A_i \oplus B_i\) | XOR Logic |
| 0 | 1 | 1 | 1 | X | \(\overline{A}_i\) | NOT Logic (Complement A) |
| 1 | 0 | X | X | X | \(A_{i+1}\) | Shift Right A (shr) |
| 1 | 1 | X | X | X | \(A_{i-1}\) | Shift Left A (shl) |
Q10. Perform the following subtraction operations using complement arithmetic: (i) \(7452 - 1243\) using 10's complement, (ii) \(11010 - 1101\) using 2's complement. Explain the use of Macros in I/O instructions.
Part (i): Decimal Subtraction \(7452 - 1243\) using 10's Complement
- Find the 9's complement of the subtrahend (\(1243\)): \[9999 - 1243 = 8756\]
- Add 1 to obtain the 10's complement: \[8756 + 1 = 8757\]
- Add the 10's complement to the minuend (\(7452\)): \[7452 + 8757 = 16209\]
- An end carry of 1 is produced. Discard the end carry: \[16209 \xrightarrow{\text{Discard Carry}} \mathbf{6209}\]
- Verification: \(7452 - 1243 = 6209\). Correct!
Part (ii): Binary Subtraction \(11010_2 - 1101_2\) using 2's Complement
- Equalize bit lengths (5 bits): Minuend = \(11010_2\), Subtrahend = \(01101_2\).
- Find the 1's complement of \(01101_2 \implies 10010_2\).
- Add 1 to obtain the 2's complement: \[10010_2 + 1 = 10011_2\]
- Add the 2's complement to the minuend: \[\begin{array}{rl} 11010_2 & (26_{10}) \\ + 10011_2 & (-13_{10}) \\ \hline \mathbf{1}01101_2 & \end{array}\]
- An end carry of 1 is produced. Discard the carry: \[\mathbf{1}01101_2 \xrightarrow{\text{Discard Carry}} \mathbf{01101_2} \; (13_{10})\]
- Verification: \(26 - 13 = 13\). Correct!
Part (iii): Use of Macros in I/O Instructions:
In low-level programming, transferring data to peripherals involves repetitive sequences of instructions (checking status flags, masking ready bits, looping until ready, outputting data). Writing this boilerplate logic repeatedly bloats code readability. By encapsulating these steps into an OUT_CHAR or IN_BLOCK Macro, the developer invokes clean one-line statements while the assembler expands them inline for maximum I/O performance.
Q11. Explain Asynchronous Data Transfer using the Two-Wire Handshaking method. Draw timing waveforms and state sequences for Source-Initiated and Destination-Initiated handshaking.
Sequence of Events in Source-Initiated Handshaking:
- Step 1: The Source unit places valid data onto the data bus.
- Step 2: After allowing bus signals to settle, the Source activates the
Data Validcontrol line. - Step 3: The Destination unit detects
Data Valid == 1, reads the data from the bus into its internal buffer, and asserts theData Acceptedcontrol line. - Step 4: Detecting
Data Accepted == 1, the Source unit deactivatesData Validand removes the data from the bus. - Step 5: Upon sensing
Data Valid == 0, the Destination deactivatesData Accepted, completing the handshake cycle.
Q12. Write comprehensive technical notes on: (a) Flynn's Classification of Computer Systems, (b) Array Processors, and (c) Vector Processors.
1. Flynn's Classification of Parallel Architecture:
Michael J. Flynn categorized computer architectures into four distinct classes based on the multiplicity of hardware instruction streams and data streams:
- SISD (Single Instruction, Single Data): Traditional Von Neumann uniprocessor executing one instruction at a time on a single memory data item.
- SIMD (Single Instruction, Multiple Data): A single control unit broadcasts the same instruction to multiple Processing Elements (PEs), each executing it simultaneously on different data items (e.g., Vector processors, GPU matrix cores).
- MISD (Multiple Instruction, Single Data): Multiple processors execute different instructions concurrently on the same single data stream (rarely used; specialized fault-tolerant aerospace systems).
- MIMD (Multiple Instruction, Multiple Data): Multiple autonomous processors executing different instructions on completely independent data streams (modern multi-core CPUs and distributed compute clusters).
2. Array Processors:
An Array Processor is an SIMD multiprocessor system consisting of a master Control Unit (CU) and a two-dimensional grid of identical Processing Elements (PEs), each equipped with its own local memory. The master CU broadcasts a single operation (such as vector addition \(C[i] = A[i] + B[i]\)), and all \(n\) PEs perform the calculation in parallel across all indices in exactly one clock cycle.
3. Vector Processors:
A Vector Processor processes entire 1D arrays of numbers (vectors) using a single specialized instruction (e.g., VADD V1, V2, V3). Unlike scalar processors that require an assembly loop with increment, compare, and branch instructions for every element, a vector processor features pipelined functional units that stream successive array elements continuously through deeply pipelined adders and multipliers, achieving maximum floating-point throughput (FLOPS).