2078 1

CSC114 ยท 2078 ยท 10 marks

Differentiate analog computer with digital computer. What is CPU and how it works? What does an instruction cycle in CPU consist of?

Differentiate analog computer with digital computer. What is CPU and how it works? What does an instruction cycle in CPU consist of?[10]

Introduction to Information TechnologyChapter 2: The Computer System HardwareCentral Processing Unit

Quick answer

A Central Processing Unit (CPU) is the primary component of a computer that carries out the instructions of a computer program.

Differentiate Analog Computer with Digital Computer. What is CPU and How it Works? What Does an Instruction Cycle in CPU Consist of?


Part 1: Difference Between Analog Computer and Digital Computer (3 marks)

Analog Computer: A computer that uses continuously changeable aspects of physical phenomena such as electrical, mechanical, etc. Examples: Planimeter, Nomogram.

Digital Computer: A computer that is used to process information with quantities using digits, usually the binary number system. Examples: IBM PC, Apple Macintosh.

BasisAnalog ComputerDigital Computer
DefinitionWorks with continuous physical quantities (voltage, current, etc.)Works with discrete digits, usually binary (0s and 1s)
Data RepresentationRepresents data as continuous signalsRepresents data as discrete digits
AccuracyLess accurateHighly accurate
SpeedSlower for general-purpose tasksVery fast in processing
OutputOutput is in the form of graphs or dialsOutput is in the form of numbers, text, images
MemoryDoes not have significant memoryHas large memory capacity
ExamplesPlanimeter, Nomogram, SpeedometerIBM PC, Apple Macintosh
UsageUsed in scientific and engineering measurementsUsed for general-purpose computing
CostGenerally less expensiveCan be more expensive
ProgrammingNot easily programmableEasily programmable

Part 2: What is CPU and How it Works? (4 marks)

Definition of CPU

A Central Processing Unit (CPU) is the primary component of a computer that carries out the instructions of a computer program. As noted in the reference:

Microprocessor: An integrated circuit that contains all the functions of a central processing unit of a computer is called a microprocessor.

The CPU is often called the "brain of the computer" because it controls all operations of the computer system.


Components of CPU

The CPU consists of three main components:

1. Arithmetic and Logic Unit (ALU)

  • Performs all arithmetic operations (addition, subtraction, multiplication, division)
  • Performs all logical operations (AND, OR, NOT, comparison)

2. Control Unit (CU)

  • Directs and coordinates all operations of the CPU
  • Fetches instructions from memory, decodes them, and controls execution
  • Acts as the manager of the CPU

3. Registers

  • Small, high-speed temporary storage locations inside the CPU
  • Examples: Program Counter (PC), Instruction Register (IR), Accumulator (ACC), Memory Address Register (MAR), Memory Buffer Register (MBR)

How CPU Works

The CPU works by following a continuous cycle of operations:

  1. Fetch: The Control Unit fetches the next instruction from main memory using the address stored in the Program Counter (PC).
  2. Decode: The fetched instruction is decoded by the Control Unit to determine what operation needs to be performed. As noted in the reference, the Opcode tells the processor what to do with the data.
  3. Execute: The ALU or other components carry out the instruction (arithmetic, logical, or data transfer operation).
  4. Store/Write Back: The result is stored back into a register or memory location.

This process repeats continuously as long as the computer is running.


Instruction Format (Supporting Detail)

An instruction format is a binary format which specifies a computer instruction. It specifies:

  • Opcode: Tells the processor what operation to perform
  • Operand: Stores the data to be operated or manipulated
  • Addressing Mode: Specifies how the operand is accessed

Part 3: Instruction Cycle in CPU (3 marks)

The Instruction Cycle (also called the Fetch-Decode-Execute Cycle) is the complete process the CPU follows to process a single instruction. It consists of the following steps:


Steps of the Instruction Cycle

+----------+     +----------+     +-----------+     +----------+
|  FETCH   | --> |  DECODE  | --> |  EXECUTE  | --> |  STORE   |
+----------+     +----------+     +-----------+     +----------+
      ^                                                    |
      |____________________________________________________|
                    (Cycle repeats)

Step 1: Fetch

  • The CPU fetches the instruction from main memory
  • The Program Counter (PC) holds the address of the next instruction
  • The instruction is loaded into the Instruction Register (IR)
  • The PC is incremented to point to the next instruction

Step 2: Decode

  • The Control Unit decodes the instruction stored in the IR
  • It identifies the Opcode (what operation to do) and the Operand (what data to use)
  • In RISC architecture, decoding is simple (CPI range: ~1.5)
  • In CISC architecture, decoding is complex (CPI range: 2 to 15)

Step 3: Execute

  • The decoded instruction is executed by the ALU or other units
  • Arithmetic or logical operations are performed on the operands
  • RISC does not require external memory for calculations; CISC does

Step 4: Store (Write Back)

  • The result of the execution is written back to a register or memory location
  • The cycle then repeats for the next instruction

Summary Table of Instruction Cycle

PhaseActionUnit Involved
FetchGet instruction from memoryControl Unit, PC, IR
DecodeInterpret the opcode and operandControl Unit
ExecutePerform the operationALU
StoreSave the resultRegisters / Memory

Key Note: RISC vs CISC in Instruction Cycle

FeatureRISCCISC
CPI~1.52 to 15
DecodingSimple

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.