Unit 4 of 4 · BCA Sem 1

Unit 4: Computer organization

Computer Architecture notes · PTU syllabus (UGCC2502)

5 min read6 topics18 exam questions
On this page
  1. Unit summary
  2. Computer and CPU organisation
  3. Stored program concept, Von Neumann and Harvard architectures
  4. RISC and CISC
  5. Register transfer and micro-operations
  6. Instruction formats
  7. Common bus system
  8. Key terms
  9. Quick revision
  10. Important questions

Unit summary

A computer is a system of processor, memory and input–output units working together under a stored program. This unit introduces computer and CPU organisation, the stored program concept, the Von Neumann and Harvard architectures, RISC and CISC, register transfer and micro-operations, instruction formats (memory reference, register reference and I/O) and the common bus system with data, control and address buses.

After this unit you can

  • Describe the functional units of a computer and the organisation of the CPU
  • Explain the stored program concept and compare Von Neumann and Harvard architectures
  • Compare RISC and CISC
  • Write register transfer statements and perform micro-operations
  • Describe instruction formats and the common bus system

PTU syllabus topics

  • Introduction to computer and CPU organization
  • stored program concept
  • Von Neumann and Harvard architectures
  • RISC and CISC architecture
  • register transfer and micro-operations
  • instruction formats (memory reference, register reference, I/O instructions)
  • common bus system — data
  • control and address buses
1

Topic 1

Computer and CPU organisation

ProcessFunctional units of a computer
  1. 1Input unit

    Keyboard, mouse, sensors — data and instructions enter

  2. 2Memory unit

    Stores programs and data

  3. 3CPU

    Control unit and ALU process the data

  4. 4Output unit

    Display, printer

  5. 5Secondary storage

    Disk and SSD

GraphBlock diagram of a computer
ControlUnitALURegistersMainmemoryInputOutputSecondarystorageCPU

Instructions and data travel between the units on buses; the control unit directs every unit

ClassificationOrganisation of the CPU
CPU
  • Control unit

    Fetches and decodes instructions, issues control signals

  • Arithmetic logic unit (ALU)

    Arithmetic and logic operations

  • Registers

    Fast storage inside the CPU

  • Internal buses and clock

    Move data and synchronise

Important CPU registers

Function
Program counter (PC)Holds the address of the next instruction
Instruction register (IR)Holds the instruction being executed
Memory address register (MAR / AR)Address of the memory location to access
Memory data register (MDR / DR)Data read from or to be written to memory
Accumulator (AC)Holds ALU operands and results
Status (flag) registerCarry, zero, sign, overflow flags
Stack pointer (SP)Top of the stack
General-purpose registersTemporary data and addresses
ProcessInstruction cycle
  1. 1

    Fetch — PC gives the address, instruction is read into IR, PC is incremented

  2. 2

    Decode — control unit interprets the opcode

  3. 3

    Fetch operands if needed

    From memory or registers

  4. 4

    Execute — ALU or data transfer

  5. 5

    Store the result

  6. 6

    Check for interrupt and repeat

ComparisonCPU organisations
Operands kept in
Example

Single accumulator

One accumulator

Early machines, 8085

General register

Many registers

x86, ARM, MIPS

Stack

Stack — zero-address

JVM, calculators

Example

One fetch cycle: the program counter (PC) holds 100. The address goes to the memory address register (MAR ← PC). The instruction at address 100 is read into the instruction register (IR ← M[MAR]). The PC is increased to 101. The control unit then decodes and executes the instruction.

2

Topic 2

Stored program concept, Von Neumann and Harvard architectures

Stored program concept: both the instructions and the data are stored in the same read-write memory as binary numbers, so a program can be loaded, changed and run without rewiring the machine. The CPU fetches instructions one after another using the program counter.

ProcessStored program operation
  1. 1

    Program and data are loaded into memory

  2. 2

    PC is set to the first instruction address

  3. 3

    Fetch the instruction from memory

  4. 4

    Decode and execute

  5. 5

    PC points to the next instruction (or a branch target)

  6. 6

    Repeat until halt

Von Neumann architecture

GraphVon Neumann architecture (one memory, one bus)
CPU (CU, ALU,registers)Main memory(instructions and data)InputOutputShared system bus

Instructions and data share the same memory and bus, so they cannot be fetched at the same moment

Harvard architecture

GraphHarvard architecture (separate instruction and data memories)
InstructionmemoryCPUDatamemoryInstructionbusDatabus

Separate memories and buses let the CPU fetch an instruction while reading or writing data

ComparisonVon Neumann vs Harvard
Von Neumann
Harvard

Memory

One memory for instructions and data

Separate instruction and data memories

Buses

Single set

Separate buses for each

Speed

Von Neumann bottleneck — one access at a time

Faster — parallel access

Cost and complexity

Simple, cheaper

More hardware

Flexibility

Program can modify itself

Instructions are protected

Used in

General-purpose PCs

DSPs, microcontrollers (AVR, PIC), cache split in modern CPUs

Exam tip

Modern processors use a modified Harvard design — separate instruction and data caches but a single main memory.

Example

Where each is used: a desktop PC follows the Von Neumann design, with programs and data in the same memory, which is simple and flexible. Many microcontrollers and digital signal processors use the Harvard design, with separate program and data memories, so an instruction and its data can be fetched at the same time.

Exam tip

The Von Neumann bottleneck: instructions and data share one bus, so the CPU waits on memory.

3

Topic 3

RISC and CISC

RISC and CISC are two approaches to designing a processor's instruction set. RISC uses a small set of simple instructions that each run in one clock cycle. CISC uses a large set of complex instructions, some of which do several operations at once.

ComparisonRISC vs CISC
RISC (Reduced Instruction Set Computer)
CISC (Complex Instruction Set Computer)

Instructions

Few, simple, fixed length

Many, complex, variable length

Execution

Mostly one clock cycle

Several clock cycles

Addressing modes

Few

Many

Memory access

Only LOAD and STORE instructions

Most instructions can access memory

Registers

Large register file

Fewer registers

Control unit

Hardwired (fast)

Micro-programmed

Pipelining

Easy and efficient

Difficult

Program size

Larger

Smaller

Examples

ARM, MIPS, RISC-V, SPARC

Intel x86, VAX, Motorola 68000

Key formulasPerformance equation
  • CPU time

    CPU time = Instruction count × CPI × Clock cycle time

  • RISC

    Larger instruction count but CPI close to 1

  • CISC

    Smaller instruction count but higher CPI

Key termsWhere each is used
RISC
Mobile phones, embedded systems, servers (ARM, RISC-V)
CISC
Desktop and laptop PCs (x86)
Modern trend
CISC chips translate instructions into RISC-like micro-operations inside

Example

Multiplying two numbers in memory: a CISC processor may do it with one instruction, MULT A, B, which loads both values, multiplies and stores the result. A RISC processor uses four simple instructions: LOAD R1, A; LOAD R2, B; MUL R1, R2; STORE A, R1. More instructions, but each is fast and easy to pipeline.

Exam tip

ARM processors in mobile phones are RISC. Intel x86 processors in most PCs are CISC.

4

Topic 4

Register transfer and micro-operations

A micro-operation is an elementary operation on data stored in registers. Register Transfer Language (RTL) describes them symbolically. Register transfer notation

Meaning
R2 ← R1Copy the contents of R1 into R2
P: R2 ← R1Transfer only if the control condition P = 1
R1 ← R1 + R2Add and store in R1
AR ← PCTransfer between registers
DR ← M[AR]Memory read — word at address AR goes to DR
M[AR] ← DRMemory write
R2 ← R1, R1 ← R2Simultaneous exchange (same clock pulse)
ClassificationTypes of micro-operations
Micro-operations
  • Register transfer

    Move data between registers

  • Arithmetic

    Add, subtract, increment, decrement, complement

  • Logic

    AND, OR, XOR, complement, clear, selective set or clear

  • Shift

    Logical, circular, arithmetic

Bus transfer using multiplexers

Logic circuitBus transfer: a 4-to-1 multiplexer selects which register drives the bus
R0R1R2R3S1S04×1 MUXR0R1R2R3S1S0BusBus

Select lines S1 S0 = 00, 01, 10, 11 connect R0, R1, R2, R3 to the bus; one MUX per bit gives a multi-bit bus

Arithmetic micro-operations

ComparisonArithmetic micro-operations
Symbolic
Meaning

Addition

R3 ← R1 + R2

Sum of R1 and R2

Subtraction

R3 ← R1 + R2′ + 1

2's complement subtraction

Increment

R1 ← R1 + 1

Add one

Decrement

R1 ← R1 − 1

Subtract one

Complement

R1 ← R1′

1's complement

Negate

R1 ← R1′ + 1

2's complement

Logic micro-operations

OperationSymbolicR1 = 1100, R2 = 1010 gives
AND (mask)R1 ← R1 ∧ R21000
OR (selective set)R1 ← R1 ∨ R21110
XOR (selective complement)R1 ← R1 ⊕ R20110
ComplementR1 ← R1′0011
ClearR1 ← 00000

Shift micro-operations

ShiftSymbolicR = 1011 becomes
Logical shift leftshl R0110 (0 enters at the right)
Logical shift rightshr R0101 (0 enters at the left)
Circular shift left (rotate)cil R0111
Circular shift rightcir R1101
Arithmetic shift rightashr R1101 (sign bit kept)
Arithmetic shift leftashl R0110 (overflow — sign changed)
Key termsShift uses
Shift left
Multiplies a binary number by 2
Shift right
Divides by 2 (arithmetic shift keeps the sign)
Rotate
Moves bits without loss
Serial transfer
Moving data through a shift register

Example

Reading RTL: R2 ← R1 copies the contents of R1 into R2; R1 is unchanged. P: R2 ← R1 does so only when control signal P is 1. R3 ← R1 + R2 is an arithmetic micro-operation. R1 ← shl R1 shifts left: 0011 (3) becomes 0110 (6).

5

Topic 5

Instruction formats

An instruction has an opcode (operation) and operands (addresses or data). Instruction formats by number of addresses (X = (A + B) × (C + D))

Program
Three-addressADD R1, A, B ; ADD R2, C, D ; MUL X, R1, R2
Two-addressMOV R1, A ; ADD R1, B ; MOV R2, C ; ADD R2, D ; MUL R1, R2 ; MOV X, R1
One-address (accumulator)LOAD A ; ADD B ; STORE T ; LOAD C ; ADD D ; MUL T ; STORE X
Zero-address (stack)PUSH A ; PUSH B ; ADD ; PUSH C ; PUSH D ; ADD ; MUL ; POP X

Addressing modes

Operand found…
ImmediateIn the instruction itself
DirectAt the address given in the instruction
IndirectThe instruction address holds the address of the operand
RegisterIn a CPU register
Register indirectRegister holds the operand's address
IndexedAddress = address field + index register

The basic computer instruction format (16-bit)

Bit 15Bits 14–12Bits 11–0
IOpcode (3 bits)Address (12 bits)
ComparisonMemory-reference, register-reference and I/O instructions
Format
Examples

Memory-reference

Opcode 000 to 110; I = 0 direct, I = 1 indirect; 12-bit address

AND, ADD, LDA, STA, BUN, BSA, ISZ

Register-reference

Opcode 111 and I = 0; bits 11–0 select one register operation

CLA, CMA, CIR, CIL, INC, HLT

Input–output

Opcode 111 and I = 1; bits 11–0 select one I/O operation

INP, OUT, SKI, SKO, ION, IOF

ProcessDeciding the instruction type from the opcode and I
  1. 1Look at bits 14–12
  2. 2If not 111 — memory-reference instruction
  3. 3If 111, look at bit 15 (I)
  4. 4I = 0 — register-reference instruction
  5. 5I = 1 — input–output instruction

Memory-reference instructions

Operation
ANDAC ← AC ∧ M[AR]
ADDAC ← AC + M[AR], carry to E
LDAAC ← M[AR]
STAM[AR] ← AC
BUNPC ← AR (branch unconditionally)
BSAM[AR] ← PC, PC ← AR + 1 (branch and save return address)
ISZM[AR] ← M[AR] + 1; skip next instruction if zero

Example

The 16-bit code 0001 0000 0000 0100 has I = 0, opcode 001 (ADD) and address 004: it adds the word at address 4 to the accumulator.

6

Topic 6

Common bus system

Registers and memory exchange data over a shared set of wires called the bus; a control signal decides which register places data on it.

GraphCommon bus system of the basic computer (16-bit bus)
Memory unitARPCDRACIRTROUTR16-bit common bus

Memory, AR, PC, DR, AC, IR, TR and OUTR connect to one bus; the selection lines S2 S1 S0 pick the register that drives the bus

S2 S1 S0Register placed on the bus
0 0 0None
0 0 1AR
0 1 0PC
0 1 1DR
1 0 0AC
1 0 1IR
1 1 0TR
1 1 1Memory
ClassificationTypes of buses
System buses
  • Data bus

    Bidirectional; carries data; width = word size (8, 16, 32, 64 bits)

  • Address bus

    Unidirectional from CPU; carries the memory address; width decides memory size (n lines = 2ⁿ locations)

  • Control bus

    Carries read, write, clock, interrupt and reset signals

Data bus vs address bus vs control bus

Data busAddress busControl bus
DirectionBoth waysFrom CPU to memory and I/OBoth ways, mostly from CPU
CarriesData and instructionsMemory or port addressTiming and command signals
Width decidesWord sizeMemory sizeNumber of control functions
Key termsBus operation
Memory read
AR gives the address; read signal; data appears on the data bus and enters DR
Memory write
Address on the address bus; data from DR; write signal
Tri-state buffers
Let many registers share one bus; only the selected one drives it
16-bit address lines
Address 2¹⁶ = 64 K locations
Bus conflict
Two registers driving the bus at once — prevented by the selection lines

Example

A system with a 16-bit address bus can address 2¹⁶ = 65,536 memory locations; with a 32-bit address bus 2³² = 4 GB of byte-addressable memory.

Key terms

Stored program concept
Instructions and data are kept in the same memory
Von Neumann architecture
One memory and bus for instructions and data
Harvard architecture
Separate memories and buses for instructions and data
RISC
Reduced instruction set computer with simple fixed-length instructions
CISC
Complex instruction set computer with many powerful instructions
Register transfer language
Symbolic notation for micro-operations
Micro-operation
Elementary operation on register contents
Opcode
Part of an instruction that specifies the operation
Bus
Common set of wires shared by units

Quick revision

  • CPU = control unit + ALU + registers; instruction cycle = fetch, decode, execute.
  • Stored program: instructions and data share memory; Von Neumann has one bus (bottleneck), Harvard has separate memories and buses.
  • RISC: simple, fixed length, load/store, pipelined; CISC: complex, variable length, many addressing modes.
  • RTL: R2 ← R1; P: R2 ← R1; DR ← M[AR].
  • Micro-operations: transfer, arithmetic, logic, shift.
  • Basic computer format: I (1 bit), opcode (3 bits), address (12 bits); opcode 111 for register/I-O.
  • Buses: data (bidirectional), address (unidirectional), control; select lines pick the register for the common bus.

Important exam questions

Practice questions written to the PTU exam pattern for this unit's syllabus: short answers (Section A style) and long answers (Sections B and C style).

Short-answer questions

  1. Q1.State the stored program concept.
  2. Q2.Differentiate between Von Neumann and Harvard architectures.
  3. Q3.What is the Von Neumann bottleneck?
  4. Q4.Name any four CPU registers and their functions.
  5. Q5.Differentiate between RISC and CISC.
  6. Q6.What is a micro-operation?
  7. Q7.Explain the RTL statement P: R2 ← R1.
  8. Q8.Perform a circular left shift on 1011.
  9. Q9.Write the format of a memory-reference instruction.
  10. Q10.How is a register-reference instruction identified?
  11. Q11.Name the three types of buses.
  12. Q12.How many locations can a 16-bit address bus address?

Long-answer questions

  1. Q1.Explain the organisation of a computer and the CPU with the instruction cycle.
  2. Q2.Explain the stored program concept and compare Von Neumann and Harvard architectures.
  3. Q3.Compare RISC and CISC architectures in detail.
  4. Q4.Explain register transfer and the types of micro-operations with examples.
  5. Q5.Explain the instruction formats of the basic computer and the number of addresses in instructions.
  6. Q6.Explain the common bus system with the data, address and control buses.

Stuck on this unit?

Message SBS on WhatsApp for help with Computer Architecture, or to ask about studying BCA at Synetic.

WhatsApp us