ELEC1303 - Lecture 18
Intro to Computer Architecture & Assembly Language - Slides
What is a Computer?
- A computer is a general-purpose data processing machine
- Operated automatically under the control of a list of instructions
- Known as a program
- See: Overview of Computer Hardware
Inside a CPU
- Components:
- Control Unit decodes instructions, instructs other components
- Arithmetic Logic Unit (ALU) performs math and logic operations
- Registers temporary storage devices

Types of Registers
- Instruction Register (IR) holds code of instruction being executed
- Memory Address Register (MAR) stores memory location for data
- Program Counter (PC) holds address of next instruction
- General Purpose Registers temporary storage
- Condition Code Register (CCR) or Status Register holds status flags
- Provides information about operations performed by CPU
Machine Instructions
- Instructions are a sequence of bits
- These bits define:
- Operations to be executed (operation code)
- Source of the data to be used (source operands)
- Data is stored in registers
- Where to store result (destination operand)
- How to continue after finished

The Instruction Cycle
- Sequence of operations required to execute an instruction are:
- Instruction fetch retrieve instruction from memory and transfer it to the instruction register
- Decode generate control signals to execute instruction
- Fetch operand find additional information that may be required
- Instruction can have any number of operands (including 0)

Opcodes and Operands
- An instruction consists of a unique opcode and potentially an operand/s
- Opcode → tells CPU which instruction to execute
- Also tells CPU if operands are required
- Operand → provides additional information needed for instruction
- Opcode → tells CPU which instruction to execute