Lecture1
Introduction to Microprocessors
By
Dr. Mohammed Y.M Alnaham
A microprocessor
• A microprocessor is a central processing unit
(CPU) implemented on a single integrated
circuit (IC) chip.
• It is the essential component of a computer
that performs arithmetic and logical
operations, controls the computer's operation,
and manages the flow of information to and
from other components of the computer
system.
The key characteristics of a microprocessor
• 1. Integration: A microprocessor integrates multiple
electronic components, including the CPU, memory, and
input/output interfaces, onto a single silicon chip.
• 2. Programmability: Microprocessors are programmable
devices, which means they can be instructed to perform
a wide range of tasks by executing software programs.
• 3. General-purpose: Modern microprocessors are
designed to be general-purpose, allowing them to be
used in a variety of applications, from personal
computers to embedded systems.
• 4. Performance: Microprocessor performance is
measured in terms of clock speed (frequency),
number of cores, and other architectural features
that enable faster processing of instructions.
• 5. Power efficiency: Advances in microprocessor
design and manufacturing have led to
increasingly power-efficient microprocessors,
making them suitable for use in portable and
battery-powered devices.
• Microprocessors are the backbone of
modern computing and are found in
a wide range of devices, including
personal computers, smartphones,
tablets, servers, gaming consoles,
and a vast array of embedded
systems like industrial machinery,
household appliances, and
automotive electronics.
Introduction to Computer Architecture
Primary registers of a microprocessor in Von
Neumann architecture
• 1. Program Counter (PC): The program counter
stores the memory address of the next
instruction to be fetched and executed. It is used
to keep track of the current position in the
program.
• 2. Accumulator (ACC): The accumulator is a
central register that holds the results of
arithmetic and logic operations. It is used to store
intermediate results during computational tasks.
• 3. Memory Address Register (MAR): The memory
address register holds the memory address from
which data is to be read or to which data is to be
written.
• 4. Memory Data Register (MDR): The memory data
register holds the data that is to be written to or
read from memory.
Microprocessor Fundamentals
• Instruction Set,
• Registers,
• Memory Addressing Modes,
• ALU
Instruction Set
The instruction set of a microprocessor refers to the
collection of machine-level instructions that the
processor can execute.
• 1. Instruction Format:
- Opcode: Specifies the operation to be performed
(e.g., add, subtract, load, store)
- Operands: Specifies the data or addresses involved in
the operation
 - Addressing Modes: Specify how the operands are
accessed (e.g., immediate, direct, indirect)
Instruction Set
• 2. Instruction Types:
 - Data Transfer Instructions: Load, store, move data
between registers, memory, and I/O
 - Arithmetic and Logical Instructions: Add, subtract,
multiply, divide, logical operations (AND, OR, XOR, NOT)
 - Control Transfer Instructions: Conditional and
unconditional jumps, calls, returns
 - Comparison Instructions: Compare values and set
flags - Interrupt Instructions: Enable, disable, and
handle interrupts
Instruction Set
• 3. Instruction Execution Cycle:
 - Fetch: Retrieve the instruction from memory
- Decode: Interpret the instruction and
determine the operation to be performed
 - Execute: Perform the specified operation
 - Write Back: Store the result of the
operation
Instruction Set
• 4. Addressing Modes:
 - Immediate: The operand is a constant value
specified in the instruction
- Direct: The operand is located at a specific
memory address
- Indirect: The operand's address is stored in a
register
- Indexed: The operand's address is calculated by
adding an index value to a base address
Instruction Set
• 5. Microarchitecture:
- Pipelining: Allows multiple instructions to be
executed concurrently, improving performance
 - Superscalar: Allows multiple instructions to be
executed in parallel, further improving
performance
 - RISC vs. CISC: Reduced Instruction Set
Computer (RISC) vs. Complex Instruction Set
Computer (CISC) architectures
Memory addressing modes
In a microprocessor there are the different ways in which the
processor can access memory locations to retrieve or store data.
1. Immediate Addressing:
- The operand is a constant value directly specified in the
instruction.
- Example: MOV AX, 0x12342.
2. Direct Addressing:
- The operand's memory address is directly specified in the
instruction.
- Example: MOV AX, [0x1000]
Memory addressing modes
• 3. Indirect Addressing:
 - The operand's memory address is stored in
a register. - Example: MOV AX, [BX]
• 4. Indexed Addressing:
 - The operand's memory address is calculated
by adding an index value (in a register) to a
base address. - Example: MOV AX, [BX + SI]
Memory addressing modes
• 5. Base-Indexed with Displacement Addressing:
- The operand's memory address is calculated by
adding a base register, an index register, and a
constant displacement value. - Example: MOV AX,
[BX + SI + 0x10]
• 6. Relative Addressing:
- The operand's memory address is calculated by
adding a signed offset to the current instruction's
address (program counter). - Example: JMP [PC +
0x100].
Arithmetic & Logic Unit (ALU)
ALU is a fundamental component in the central
processing unit (CPU) of a computer. It is
responsible for performing arithmetic and
logical operations on data.
ALU
The main functions of an ALU include:
• 1. Arithmetic Operations:
 - Addition
 - Subtraction
 - Multiplication
 - Division
ALU
• 2. Logical Operations:
 - AND
- OR
 - NOT
- XOR
- Shift operations (left/right shift)
Introduction to Assembly Language
Assembly language is a low-level programming language
that provides a direct interface to a computer's
hardware.
• Machine Code and Instruction Set
• Each instruction in the machine code has a
corresponding mnemonic (a short, meaningful
abbreviation) in the assembly language.
• An assembler is a program that translates assembly
language code into machine code that the CPU can
execute.
Introduction to Assembly Language
• Assembly language programs often need to
work with registers directly
• 5. Assembly language programs need to be
able to access memory locations, both for
reading and writing data. This is done through
memory addressing schemes, which are
specified in the assembly language.
Introduction to Assembly Language
• Each assembly language has its own syntax and
structure, which can vary depending on the
specific CPU architecture. However, most
assembly languages share common elements,
such as instructions, operands, and labels
• Assembly help us to understand how
computers work at a fundamental level and
understanding how high-level programming
languages are implemented.
•What instruction
execution cycle mean?
•Define the assembler?
Power efficiency in microprossesor

introduction to microprocessor and assembly language

  • 1.
  • 2.
    A microprocessor • Amicroprocessor is a central processing unit (CPU) implemented on a single integrated circuit (IC) chip. • It is the essential component of a computer that performs arithmetic and logical operations, controls the computer's operation, and manages the flow of information to and from other components of the computer system.
  • 3.
    The key characteristicsof a microprocessor • 1. Integration: A microprocessor integrates multiple electronic components, including the CPU, memory, and input/output interfaces, onto a single silicon chip. • 2. Programmability: Microprocessors are programmable devices, which means they can be instructed to perform a wide range of tasks by executing software programs. • 3. General-purpose: Modern microprocessors are designed to be general-purpose, allowing them to be used in a variety of applications, from personal computers to embedded systems.
  • 4.
    • 4. Performance:Microprocessor performance is measured in terms of clock speed (frequency), number of cores, and other architectural features that enable faster processing of instructions. • 5. Power efficiency: Advances in microprocessor design and manufacturing have led to increasingly power-efficient microprocessors, making them suitable for use in portable and battery-powered devices.
  • 5.
    • Microprocessors arethe backbone of modern computing and are found in a wide range of devices, including personal computers, smartphones, tablets, servers, gaming consoles, and a vast array of embedded systems like industrial machinery, household appliances, and automotive electronics.
  • 6.
  • 7.
    Primary registers ofa microprocessor in Von Neumann architecture • 1. Program Counter (PC): The program counter stores the memory address of the next instruction to be fetched and executed. It is used to keep track of the current position in the program. • 2. Accumulator (ACC): The accumulator is a central register that holds the results of arithmetic and logic operations. It is used to store intermediate results during computational tasks.
  • 8.
    • 3. MemoryAddress Register (MAR): The memory address register holds the memory address from which data is to be read or to which data is to be written. • 4. Memory Data Register (MDR): The memory data register holds the data that is to be written to or read from memory.
  • 9.
    Microprocessor Fundamentals • InstructionSet, • Registers, • Memory Addressing Modes, • ALU
  • 10.
    Instruction Set The instructionset of a microprocessor refers to the collection of machine-level instructions that the processor can execute. • 1. Instruction Format: - Opcode: Specifies the operation to be performed (e.g., add, subtract, load, store) - Operands: Specifies the data or addresses involved in the operation  - Addressing Modes: Specify how the operands are accessed (e.g., immediate, direct, indirect)
  • 11.
    Instruction Set • 2.Instruction Types:  - Data Transfer Instructions: Load, store, move data between registers, memory, and I/O  - Arithmetic and Logical Instructions: Add, subtract, multiply, divide, logical operations (AND, OR, XOR, NOT)  - Control Transfer Instructions: Conditional and unconditional jumps, calls, returns  - Comparison Instructions: Compare values and set flags - Interrupt Instructions: Enable, disable, and handle interrupts
  • 12.
    Instruction Set • 3.Instruction Execution Cycle:  - Fetch: Retrieve the instruction from memory - Decode: Interpret the instruction and determine the operation to be performed  - Execute: Perform the specified operation  - Write Back: Store the result of the operation
  • 13.
    Instruction Set • 4.Addressing Modes:  - Immediate: The operand is a constant value specified in the instruction - Direct: The operand is located at a specific memory address - Indirect: The operand's address is stored in a register - Indexed: The operand's address is calculated by adding an index value to a base address
  • 14.
    Instruction Set • 5.Microarchitecture: - Pipelining: Allows multiple instructions to be executed concurrently, improving performance  - Superscalar: Allows multiple instructions to be executed in parallel, further improving performance  - RISC vs. CISC: Reduced Instruction Set Computer (RISC) vs. Complex Instruction Set Computer (CISC) architectures
  • 15.
    Memory addressing modes Ina microprocessor there are the different ways in which the processor can access memory locations to retrieve or store data. 1. Immediate Addressing: - The operand is a constant value directly specified in the instruction. - Example: MOV AX, 0x12342. 2. Direct Addressing: - The operand's memory address is directly specified in the instruction. - Example: MOV AX, [0x1000]
  • 16.
    Memory addressing modes •3. Indirect Addressing:  - The operand's memory address is stored in a register. - Example: MOV AX, [BX] • 4. Indexed Addressing:  - The operand's memory address is calculated by adding an index value (in a register) to a base address. - Example: MOV AX, [BX + SI]
  • 17.
    Memory addressing modes •5. Base-Indexed with Displacement Addressing: - The operand's memory address is calculated by adding a base register, an index register, and a constant displacement value. - Example: MOV AX, [BX + SI + 0x10] • 6. Relative Addressing: - The operand's memory address is calculated by adding a signed offset to the current instruction's address (program counter). - Example: JMP [PC + 0x100].
  • 18.
    Arithmetic & LogicUnit (ALU) ALU is a fundamental component in the central processing unit (CPU) of a computer. It is responsible for performing arithmetic and logical operations on data.
  • 19.
    ALU The main functionsof an ALU include: • 1. Arithmetic Operations:  - Addition  - Subtraction  - Multiplication  - Division
  • 20.
    ALU • 2. LogicalOperations:  - AND - OR  - NOT - XOR - Shift operations (left/right shift)
  • 21.
    Introduction to AssemblyLanguage Assembly language is a low-level programming language that provides a direct interface to a computer's hardware. • Machine Code and Instruction Set • Each instruction in the machine code has a corresponding mnemonic (a short, meaningful abbreviation) in the assembly language. • An assembler is a program that translates assembly language code into machine code that the CPU can execute.
  • 22.
    Introduction to AssemblyLanguage • Assembly language programs often need to work with registers directly • 5. Assembly language programs need to be able to access memory locations, both for reading and writing data. This is done through memory addressing schemes, which are specified in the assembly language.
  • 23.
    Introduction to AssemblyLanguage • Each assembly language has its own syntax and structure, which can vary depending on the specific CPU architecture. However, most assembly languages share common elements, such as instructions, operands, and labels • Assembly help us to understand how computers work at a fundamental level and understanding how high-level programming languages are implemented.
  • 24.
    •What instruction execution cyclemean? •Define the assembler?
  • 25.
    Power efficiency inmicroprossesor