Computer Science & Applications (Paper 2) (Code 87) · Unit 2 of 10

Computer System Architecture

कंप्यूटर आर्किटेक्चर

Unit overview: the topics below, with their summaries, are the syllabus for this unit. The comprehensive note further down covers every topic in full — explanations, definitions, worked examples, tables, exam points and practice questions — and the short revision note after it is only a quick recap. Standalone one-topic learning pages are not built yet — every topic on this page is covered in the notes and the practice questions below, and each topic card links to those sections.

Premium chapters for this unit

Digital logic & number systems → premium chapter · free preview · ~17 min · 4 practice questions

CPU, memory & I/O organisation → premium chapter · free preview · ~17 min · 4 practice questions

Instruction formats & RISC/CISC → premium chapter · free preview · ~14 min · 4 practice questions

Topics checklist — with weightage (platform estimate from past-question frequency, not an NTA guarantee)

Digital logic & number systems

High weightage

Boolean algebra, K-maps, flip-flops, counters.

CPU, memory & I/O organisation

High weightage

Pipelining, cache, addressing modes, interrupts.

Instruction formats & RISC/CISC

Medium

RISC vs CISC trade-offs, instruction cycle.

Comprehensive unit note · ~19 min read

Computer system architecture explains how a machine actually carries out a program: how numbers are represented in binary, how logic gates combine into adders and multiplexers, how a processor fetches and executes instructions, how memory is organised so that fast small storage and slow large storage work together, and how input and output devices exchange data without wasting processor time. This unit connects the abstract world of algorithms to physical hardware, and it is examined through a mix of calculation, circuit reasoning, and comparison questions. The unit opens with digital logic and number systems, the foundation of everything else. Binary, octal, and hexadecimal representations, signed-number complements, fixed-point and floating-point formats, Boolean algebra, and Karnaugh maps let you simplify logic and predict circuit behaviour before any gate is drawn. Combinational circuits produce outputs from current inputs alone, while sequential circuits add memory through flip-flops, registers, and counters, so the machine can remember state across clock cycles. The second strand is organisation: the central processing unit, its registers and control unit, the instruction cycle, addressing modes, and the choice between RISC and CISC design philosophies, including pipelining and its hazards. Memory organisation follows naturally: the hierarchy from registers through caches to main memory and disk, cache mapping policies and the average memory access time formula that quantifies their effect, virtual memory and the translation lookaside buffer, and finally input-output organisation through interrupts and direct memory access. Throughout, keep asking the engineering question behind each mechanism: what is being traded against what, speed against cost, simplicity against flexibility, or processor time against hardware complexity. Examinations reward that trade-off reasoning, especially when two similar-sounding mechanisms must be distinguished.

Learning objectives

  • Convert numbers between binary, octal, decimal, and hexadecimal, and perform signed arithmetic using complements and floating-point basics.
  • Simplify Boolean functions with algebra and Karnaugh maps, and design combinational and sequential circuits.
  • Explain the instruction cycle, addressing modes, control-unit types, and RISC versus CISC trade-offs.
  • Analyse pipelining, identify structural, data, and control hazards, and explain standard remedies.
  • Compare cache mapping policies and compute average memory access time and effective access time from hit rates and penalties.
  • Explain virtual memory, paging, TLB operation, interrupts, and DMA, and when each mechanism is used.

Digital logic & number systems

A number system is defined by its base and its digits. Binary uses base 2 with digits 0 and 1, octal base 8, decimal base 10, and hexadecimal base 16 with digits 0 to 9 and letters A to F for values 10 to 15. Conversion between bases follows place values: each digit is multiplied by the base raised to its position power, counting from zero at the rightmost integer digit, and fractional digits use negative powers. Binary to octal groups bits in threes from the binary point, binary to hexadecimal groups bits in fours, and decimal to another base uses repeated division by the base for the integer part and repeated multiplication by the base for the fraction, recording remainders or integer parts in order. These conversions are routine examination arithmetic, and errors usually come from grouping in the wrong direction or misreading hexadecimal letters.

Signed integers are commonly stored in two complement form. The one complement of a binary number flips every bit, and the two complement adds one to the one complement. Two complement representation has a single zero, a range from minus 2 to the power (n minus 1) to plus 2 to the power (n minus 1) minus 1 for n bits, and addition and subtraction use the same adder circuit, with overflow detected when the carry into the sign bit differs from the carry out of it. Floating-point numbers follow the form sign times mantissa times base to the exponent, with a biased exponent so that exponents can be compared as unsigned integers, and a normalised mantissa with an implicit leading one in the usual binary format. Precision is limited by mantissa width, range by exponent width, and rounding and overflow are consequences of finite representation, not programming errors.

Boolean algebra works on variables taking values 0 and 1, with operations AND, OR, and NOT, governed by identity, annihilator, idempotent, complement, commutative, associative, distributive, absorption, and De Morgan laws. A Boolean function can be written in sum-of-products form, a disjunction of product terms, or product-of-sums form, a conjunction of sum terms. Canonical forms use minterms, product terms covering exactly one combination of variables, and maxterms, the dual sum terms. A Karnaugh map arranges truth-table cells so adjacent cells differ in one variable, letting you group powers of two cells (1, 2, 4, 8) to eliminate variables that change within the group. Essential prime implicants must appear in every minimal cover, and do-not-care conditions may be treated as 0 or 1 whichever simplifies the result, but they must never be required to be covered.

Combinational circuits have outputs determined solely by current inputs. A half adder adds two bits giving sum and carry; a full adder adds two bits plus a carry-in. A multiplexer selects one of many inputs using select lines, so a 4-to-1 multiplexer needs two select lines, and a demultiplexer reverses the operation. A decoder activates exactly one output for each input combination, and an encoder does the reverse; a priority encoder resolves simultaneous requests. Sequential circuits add feedback and a clock, so outputs depend on current inputs and stored state. An SR flip-flop sets or resets on its inputs, a JK flip-flop removes the invalid SR condition by toggling, a D flip-flop copies its input to its output on the clock edge, and a T flip-flop toggles when its input is 1. Registers store multi-bit values, shift registers move bits serially, and counters cycle through states: a ripple counter chains flip-flop clocks with propagation delay accumulating, while a synchronous counter clocks all flip-flops together.

CPU, memory & I/O organisation

The central processing unit contains the arithmetic logic unit, which performs arithmetic and logical operations, the control unit, which directs data movement and interprets instructions, and registers, the fastest storage in the machine. Key registers include the program counter holding the address of the next instruction, the instruction register holding the current instruction, the accumulator or general-purpose registers holding operands and results, the memory address register, and the memory buffer register. The instruction cycle has four phases: fetch the instruction from memory using the program counter, decode it to identify the operation and operands, execute it in the arithmetic logic unit or through a memory or input-output operation, and store the result, after which the program counter advances. Interrupts may be recognised between instructions, with the processor saving state, jumping to a handler, and resuming afterwards.

The control unit may be hardwired, using fixed combinational logic that is fast but hard to change, or microprogrammed, using stored microinstructions that are slower but flexible and easier to modify. Memory is organised as a hierarchy because no single technology is simultaneously fast, large, and cheap: registers are fastest and smallest, cache is fast and moderately sized, main memory is larger and slower, and secondary storage is largest and slowest. The principle of locality explains why the hierarchy works: temporal locality means recently used items are likely to be reused, and spatial locality means nearby items are likely to be used soon, so caches and prefetching pay off. A cache holds blocks, also called lines, of main memory. In direct mapping, each block maps to exactly one cache line, giving fast lookup but many conflict misses. In fully associative mapping, a block may go in any line, giving fewest conflicts but requiring parallel comparison of all tags. In set-associative mapping, a block maps to one set but may occupy any line within it, balancing speed and flexibility; a 2-way or 4-way set-associative cache is the common compromise. Replacement policies such as least recently used, first-in first-out, and random decide which block to evict, and write policies decide whether writes update main memory immediately (write-through) or only on eviction (write-back, with a dirty bit).

Average memory access time combines hit time, hit rate, and miss penalty: AMAT equals hit time plus miss rate times miss penalty. If a cache has several levels, the miss penalty of one level is the access time of the next, so the formula nests. Virtual memory gives each program the illusion of a large private address space by paging: virtual addresses split into a page number and an offset, a page table maps pages to frames in physical memory, and pages not present cause a page fault that loads the page from disk. The translation lookaside buffer is a small fast cache of recent page-table entries; a TLB hit avoids a full page-table walk, while a TLB miss costs extra memory accesses. Effective access time with a TLB therefore weights the TLB hit time against the miss cost, exactly like a cache calculation.

Input and output organisation must move data without tying up the processor unnecessarily. Programmed input-output makes the processor poll device status and transfer every byte, which is simple but wasteful. Interrupt-driven input-output lets the device signal readiness, so the processor works on other tasks until interrupted, but each transfer still passes through the processor. Direct memory access goes further: a DMA controller takes over the bus, transfers a whole block between device and memory, and interrupts the processor only once when the block is complete, freeing the processor for other work. DMA modes include burst mode, which holds the bus for the whole block, and cycle stealing, which interleaves DMA cycles with processor cycles. Interrupts themselves are classified as maskable or non-maskable, vectored or non-vectored, and internal or external, and interrupt priority and nesting decide which handler runs when several requests arrive together.

Instruction formats & RISC/CISC

An instruction encodes an operation code, or opcode, plus operands. Instruction formats vary in length and in the number of explicit operand addresses. A three-address instruction names two sources and a destination, as in ADD R1, R2, R3, and is expressive but long. A two-address instruction overwrites one source with the result, a one-address instruction uses an accumulator implicitly, and a zero-address instruction works on a stack, with operations popping operands and pushing results. Fixed-length formats simplify decoding and pipelining but waste bits on short instructions, while variable-length formats save space at the cost of complex decoding. Addressing modes determine how the operand address is computed from the instruction fields. Immediate addressing embeds the operand value itself, direct addressing gives the operand address, indirect addressing gives the address of the address, register addressing names a register, register-indirect addressing uses a register as a pointer, indexed addressing adds an index register to a base address for array access, and relative addressing adds an offset to the program counter for branches. Effective address calculations and the number of memory accesses per mode are standard examination questions: immediate needs no memory access for the operand, direct needs one, and indirect needs at least two.

Reduced instruction set computing, RISC, uses a small set of simple fixed-length instructions, load-store architecture in which only load and store instructions access memory, many registers, hardwired control, and heavy reliance on compiler optimisation and pipelining. Complex instruction set computing, CISC, uses many variable-length instructions, memory-to-memory operations, fewer registers, microprogrammed control, and complex instructions that do more work each, at the cost of harder decoding and pipelining. Neither is universally better: RISC tends to give higher clock rates and simpler pipelines, CISC tends to give denser code and simpler compilers for hand-written assembly, and modern processors often blend the two, decoding CISC instructions into RISC-like internal operations.

Pipelining overlaps instruction execution by dividing it into stages, typically fetch, decode, execute, memory access, and write-back, so that while one instruction executes, the next is decoded and another is fetched. In the ideal case a pipeline completes one instruction per cycle after filling, giving a speedup approaching the number of stages, but hazards reduce this. Structural hazards arise when two stages need the same resource in the same cycle, for example a single memory port for fetch and data access, and are fixed by duplicating resources or stalling. Data hazards arise when an instruction needs a result not yet written back, and are handled by forwarding (bypassing the result directly to the needing stage), by stalling with bubbles, or by compiler reordering. Control hazards arise from branches, whose target is unknown until late in the pipeline, and are handled by stalling, by branch prediction, or by delayed branching. Distinguish these three hazard types by their cause: resource conflict, data dependence, or control flow. A final organisation point is bus structure: a system bus carries address, data, and control signals between processor, memory, and input-output, and bus width and clock rate bound transfer bandwidth, which is why DMA and cache design matter as much as raw processor speed.

Key definitions

  • Two complement: A signed representation in which negation is obtained by flipping all bits and adding one; it has a single zero and one adder handles addition and subtraction.
  • Minterm: A product term that is 1 for exactly one combination of input variables in a Boolean function.
  • Multiplexer: A combinational circuit that selects one of many data inputs, under control of select lines, and routes it to a single output.
  • Flip-flop: A bistable sequential element that stores one bit and changes state only on a clock edge or specified trigger.
  • Instruction cycle: The fetch, decode, execute, and store sequence by which a processor carries out one instruction.
  • Addressing mode: The rule by which an instruction field determines the location or value of its operand.
  • Cache: A small fast memory between processor and main memory that holds copies of recently or frequently used blocks, exploiting locality.
  • AMAT: Average memory access time, equal to hit time plus miss rate times miss penalty, measuring effective memory speed.
  • TLB: Translation lookaside buffer, a small cache of recent virtual-to-physical page translations that speeds up address translation.
  • Page fault: An exception raised when a referenced virtual page is not present in physical memory, requiring it to be loaded from disk.
  • DMA: Direct memory access, a mechanism by which a controller transfers a block of data between device and memory without processor involvement per byte.
  • Pipeline hazard: A situation that prevents the next instruction in a pipeline from executing in its designated cycle, requiring a stall or other remedy.
  • RISC: Reduced instruction set computing: simple fixed-length instructions, load-store architecture, many registers, and pipelining-friendly design.
  • CISC: Complex instruction set computing: many variable-length instructions, memory operands, and complex operations per instruction.
  • Interrupt: A signal that suspends current execution, saves processor state, and transfers control to a handler, resuming afterwards.

Formulas

  • Two complement range for n bits: from -(2^(n-1)) to +(2^(n-1) - 1).
  • Number of select lines for a multiplexer with N inputs: log2(N); a 2^k-to-1 multiplexer needs k select lines.
  • AMAT = Hit time + Miss rate x Miss penalty.
  • Effective access time with TLB = TLB hit rate x (TLB time + memory time) + TLB miss rate x (TLB time + page-table time + memory time), in simplified form.
  • Ideal pipeline speedup approaches the number of pipeline stages; actual speedup is reduced by stalls from hazards.
  • Cache lines in direct mapping: main-memory block b maps to cache line (b mod number of cache lines).

Worked examples

Example 1: Convert decimal 25.5 to binary, and find the 8-bit two complement representation of minus 25.

Integer part 25 in binary: repeated division by 2 gives remainders 1, 0, 0, 1, 1 read backwards, so 11001. Fractional part 0.5 times 2 equals 1.0, so the fraction is .1. Hence 25.5 in binary is 11001.1. For minus 25 in 8 bits: plus 25 is 00011001, its one complement is 11100110, adding 1 gives 11100111, which is minus 25 in two complement. Check by adding 00011001 plus 11100111 equals 100000000, and discarding the carry beyond 8 bits leaves 00000000, as expected.

Example 2: Simplify F(A, B, C) equals sum of minterms (1, 3, 5, 7) using a Karnaugh map.

Minterms 1 (001), 3 (011), 5 (101), and 7 (111) all have C equal to 1 and differ in A and B. On a 3-variable Karnaugh map these four cells form a group of four covering both values of A and both values of B while C stays 1. Grouping eliminates A and B, leaving F equals C. Verify: when C equals 1, F equals 1 for all A and B, matching minterms 1, 3, 5, 7, and when C equals 0, F equals 0, matching the absence of minterms 0, 2, 4, 6.

Example 3: A cache has hit time 10 ns, miss rate 5 percent, and miss penalty 100 ns. Compute AMAT. If the miss rate doubles, what is the new AMAT?

AMAT equals hit time plus miss rate times miss penalty equals 10 plus 0.05 times 100 equals 10 plus 5 equals 15 ns. If the miss rate doubles to 10 percent, AMAT equals 10 plus 0.10 times 100 equals 10 plus 10 equals 20 ns. Note the miss penalty contributes only in proportion to the miss rate, so halving the miss rate saves 5 ns here, not 50 ns.

Example 4: A TLB has hit ratio 90 percent, TLB lookup time 10 ns, memory access time 100 ns, and a TLB miss costs one extra memory access for the page table. Compute effective access time.

On a TLB hit, time equals TLB time plus memory time equals 10 plus 100 equals 110 ns. On a TLB miss, time equals TLB time plus page-table access plus memory time equals 10 plus 100 plus 100 equals 210 ns. Effective access time equals 0.90 times 110 plus 0.10 times 210 equals 99 plus 21 equals 120 ns. This shows that even a 10 percent TLB miss rate raises effective time from 110 ns to 120 ns.

Cache mapping policies compared

PolicyPlacement ruleAdvantageDisadvantage
Direct mappedEach block to exactly one lineFast, simple lookupMany conflict misses
Fully associativeBlock to any lineFewest conflict missesCostly parallel tag comparison
Set associativeBlock to one set, any line in itGood balance of speed and flexibilityModerate hardware cost

RISC versus CISC

FeatureRISCCISC
Instruction setSmall, simple instructionsLarge, complex instructions
Instruction lengthFixedVariable
Memory accessLoad-store onlyMemory operands allowed
RegistersManyFewer
Control unitUsually hardwiredUsually microprogrammed
PipeliningEasierHarder

Flip-flops compared

Flip-flopBehaviourNote
SRSet on S, reset on RS equals R equals 1 is invalid
JKJ sets, K resets, both toggleRemoves the SR invalid condition
DOutput follows input on clock edgeUsed in registers and storage
TToggles when T equals 1Used in counters

Pipeline hazards compared

HazardCauseCommon remedy
StructuralTwo stages need the same resourceDuplicate resource or stall
DataInstruction needs a not-yet-written resultForwarding, stalling, reordering
ControlBranch target unknown until latePrediction, stalling, delayed branch

Diagrams (described)

Instruction cycle flowchart: program counter gives address, fetch instruction into instruction register, decode opcode and addressing mode, fetch operands if needed, execute in ALU or memory, store result, increment program counter, check for interrupts, repeat.

Memory hierarchy pyramid diagram: registers at the top (smallest, fastest, costliest per bit), then cache, then main memory, then secondary storage at the base (largest, slowest, cheapest per bit).

Five-stage pipeline timing diagram: rows are instructions, columns are cycles, stages fetch, decode, execute, memory, write-back run diagonally, so after filling, one instruction completes per cycle in the ideal case.

DMA transfer diagram: processor programs the DMA controller with source, destination, and count, the controller requests the bus, transfers the block directly between device and memory, then interrupts the processor once on completion.

Exam points

  • Two complement has a single zero; overflow is detected when carry into the sign bit differs from carry out of it.
  • A 2-to-the-power-k to 1 multiplexer needs k select lines; a decoder with n inputs has 2 to the power n outputs.
  • Karnaugh map groups must contain 1, 2, 4, or 8 cells; a group eliminates every variable that changes within it.
  • JK flip-flop toggles when J and K are both 1, which is the condition that is invalid for SR.
  • Ripple counters accumulate propagation delay; synchronous counters clock all flip-flops together and avoid it.
  • AMAT equals hit time plus miss rate times miss penalty; a common error is to use hit rate instead of miss rate in the second term.
  • Direct mapping is fastest to look up but suffers conflict misses; fully associative minimises conflicts but costs the most hardware.
  • Write-through updates main memory on every write; write-back updates it only on eviction and uses a dirty bit.
  • Immediate addressing needs no memory access for the operand; indirect addressing needs at least one extra access.
  • DMA transfers a whole block and interrupts once at the end; interrupt-driven input-output still passes every transfer through the processor.

Common mistakes

  • Mistake: using hit rate instead of miss rate in AMAT. Correction: AMAT equals hit time plus miss rate times miss penalty; the penalty is paid only on misses.
  • Mistake: confusing one complement with two complement. Correction: one complement flips bits only; two complement flips bits and adds one, giving a single zero.
  • Mistake: grouping a non-power-of-two number of cells in a Karnaugh map. Correction: groups must have 1, 2, 4, or 8 cells, and only variables constant across the whole group survive.
  • Mistake: saying RISC is always faster and CISC always slower in every respect. Correction: compare on specific axes: code density, decoding complexity, pipelining ease, and compiler burden differ in opposite directions.
  • Mistake: treating a data hazard as a structural hazard. Correction: structural hazards are resource conflicts, data hazards are result dependencies, control hazards are branch uncertainties.
  • Mistake: thinking virtual memory increases physical memory size. Correction: it increases the usable address space per program by paging to disk; physical memory size is unchanged and page faults cost time.
  • Mistake: thinking DMA eliminates interrupts entirely. Correction: DMA eliminates per-byte processor involvement, but still interrupts once per block on completion.

Practice questions from this note (original practice — not official PYQs)

Checking login…

Quick revision: Number systems first: group bits in threes for octal and fours for hexadecimal, two complement by flip and add one, floating point by sign, biased exponent, and mantissa. Boolean logic next: simplify by algebra or Karnaugh groups of powers of two, then build with adders, multiplexers, decoders, and flip-flops, remembering JK toggles where SR is invalid. Processor organisation: fetch, decode, execute, store, with program counter and instruction register at the centre, hardwired versus microprogrammed control, and addressing modes ranked by memory accesses. RISC means fixed length and load-store, CISC means variable length and memory operands, and pipelining trades hazards for throughput: structural from resources, data from dependencies, control from branches. Memory closes the unit: hierarchy by locality, cache mapping by placement rule, AMAT by hit time plus miss rate times penalty, virtual memory by paging, TLB by cached translations, and input-output by polling versus interrupts versus DMA block transfer.

Unit revision note (quick recap)

Architecture is about trade-offs: speed vs cost, hardware vs software, and how the CPU, memory and I/O cooperate to run a program.

Learning objectives

  • Simplify Boolean expressions
  • Explain pipelining, cache and addressing
  • Compare RISC and CISC

Key concepts

  • Absorption law: A + AB = A. Boolean algebra simplifies circuits before they are built.
  • Cache average access time: Hit ratio × hit time + miss ratio × miss time (miss time includes hit time + penalty).
  • Pipelining: Overlapping instruction stages so several instructions progress at once.
  • RISC vs CISC: RISC: simple, fixed-length instructions, many registers. CISC: complex instructions, fewer registers, variable length.

Formulas

  • Avg access = h × t_hit + (1 − h) × t_miss
  • A + AB = A

Worked examples

  • 90% hits, 10 ns hit, 100 ns penalty: average = 0.9×10 + 0.1×110 = 20 ns.

Exam points

  • K-maps minimise Boolean functions; flip-flops store one bit.
  • Cache misses: compulsory, capacity, conflict.

Common mistakes

  • Forgetting that a miss still pays the hit time when computing average access time.

Quick revision: Digital logic, number systems, CPU datapath, memory hierarchy, I/O, interrupts.

Practice questions from the whole unit bank (33 in the bank)

This unit's practice bank — the note above has its own smaller practice set drawn from the same bank, so a question can appear in both lists. The list below shows the free sample or the full bank depending on your plan.

Checking login…

Related tests

Unit test for this unit (33 bank questions, 40 min) · Full Mock — CS Paper 2 (100 questions) · Combined 150-question mock (180 min). All +2 per correct, no negative marking.

Revision summary

Digital logic, number systems, CPU datapath, memory hierarchy, I/O, interrupts.

After revising, take the unit test above, then check your unit-wise report on the Dashboard to find weak topics.