0% found this document useful (0 votes)
4 views

Microprocessor Lab Report

Uploaded by

nuhashbee
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Microprocessor Lab Report

Uploaded by

nuhashbee
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Introduction to Microprocessor &

Assembly Language

Introduction to microprocessor:
A microprocessor is a central processing unit (CPU) that serves as the brain of a computer or
electronic device. It performs arithmetic, logic, control, and input/output (I/O) operations based
on the instructions provided in its programming. Microprocessors are at the heart of most
modern electronics, ranging from computers to smartphones, embedded systems, appliances,
and other digital devices.

Functions of a Microprocessor:
1. Processing: The microprocessor performs the necessary arithmetic and logical
operations required to solve a task.
2. Control: It controls the operation of all components of the system by issuing control
signals.
3. Data Management: It handles data retrieval and storage from memory, registers,
and external devices.
4. Communication: It interacts with external systems, including memory, I/O devices,
and peripheral.

Components of a Microprocessor:
1. Arithmetic Logic Unit (ALU): The ALU performs all arithmetic (e.g., addition,
subtraction) and logical (e.g., AND, OR, NOT) operations.
2. Control Unit (CU): The control unit directs all the operations inside the
microprocessor by interpreting and executing instructions from memory.
3. Registers: Registers are small, high-speed storage locations within the
microprocessor used for temporary storage and quick access to data and
instructions.
4. Bus Interface: A microprocessor communicates with other devices through buses
(data, address, and control buses) that carry information to and from memory and
peripherals.
Types of Microprocessors:
1. General-Purpose Microprocessors: Used in desktop computers, laptops, servers, and
mobile devices (e.g., Intel’s x86 family, ARM processors). They can run multiple
applications and are programmable for a wide variety of tasks.
2. Embedded Microprocessors: Found in dedicated applications such as automobiles,
appliances, or industrial control systems. These processors typically perform specific
functions and are embedded within larger systems.
3. Digital Signal Processors (DSPs): These microprocessors are designed for high-speed
numeric processing and are used in applications such as audio, video, and
telecommunications.

Evolution of Microprocessors:
1. 4-bit Microprocessors: Early processors like the Intel 4004 (released in 1971) could
process 4 bits of data at a time.
2. 8-bit Microprocessors: Intel 8080 and Zilog Z80 were popular 8-bit processors
introduced in the 1970s. These were more powerful and formed the basis of early
home computers.
3. 16-bit Microprocessors: With the introduction of Intel’s 8086 and Motorola’s 68000
in the late 1970s and early 1980s, processing power increased, leading to more
complex computing applications.
4. Modern computers now use 32-bit and 64-bit microprocessors, which can process
data much faster and handle more complex operations. The move to 64-bit
architecture provides more memory addressing capabilities.

Modern Microprocessors:
1. Multiple Cores: Modern microprocessors contain multiple processing cores within a
single chip (e.g., dual-core, quad-core, etc.), allowing for parallel processing and
enhanced performance.
2. Cache Memory: Microprocessors have small amounts of high-speed memory (cache)
that store frequently accessed data, reducing the need to access slower main
memory.
3. Clock Speed: Measured in GHz, the clock speed indicates how fast the
microprocessor can execute instructions. Higher clock speeds usually translate to
faster processing.
4. Instruction Set Architecture (ISA): The set of instructions that the microprocessor
can execute (e.g., x86, ARM). The ISA defines how software interacts with the
processor.
5. Power Efficiency: Modern microprocessors are designed to balance performance
with power consumption, especially in mobile devices where battery life is crucial.
Data speed measure:
1. Kilo Instructions Per Second (KIP): KIP is a performance metric used to measure the
speed of a microprocessor. It indicates how many thousands of instructions the
processor can execute per second. 1 KIP = 1,000 instructions per second. This term is
part of the broader family of performance measures like MIPS (Million Instructions Per
Second).
2. Million Instructions Per Second (MPS): MPS or MIPS is a performance metric that
indicates how many millions of instructions a processor can execute per second. 1 MPS =
1 million instructions per second. This is a common benchmark used to compare the
performance of different processors.
3. IPS: IPS is a general measure of how many instructions a microprocessor can execute in
one second. It is the base measurement unit, and it can be scaled (KIPS, MIPS, GIPS,
etc.). Example: A processor that runs at 3 billion instructions per second operates at 3
GIPS.

Unit of Data
1. Bit: A bit is the most basic unit of data in a computer, representing a binary value of
either 0 or 1. 1 Bit is the smallest data unit, and multiple bits combine to form higher
units like a byte or word.
2. Byte: A byte consists of 8 bits and is the basic unit of information storage in computing.
1 Byte = 8 bits. It’s the smallest addressable unit of memory in most modern computer
systems, used to represent a single character such as 'A', or a small integer in
programming.
3. Nibble: A nibble is a collection of 4 bits. Since a bit is the smallest unit of data in
computing (representing a 0 or 1), a nibble is half of a byte (which is 8 bits). 1 Nibble = 4
bits. Nibbles are often used when dealing with hexadecimal (base 16) representation of
data.
4. Double Word: A double word consists of 4 bytes or 32 bits. It is twice the size of a word
(a word is usually 16 bits or 2 bytes). Example: In 32-bit processors, data is typically
handled in double-word sizes.
5. Quad Word: A quad word is a unit of data that consists of 8 bytes or 64 bits. It is twice
the size of a double word. Example: In 64-bit processors, data is often handled in quad-
word sizes.
Assembly Language:
A more convenient language to use is assembly language. In assembly language, we use
symbolic names to represent operations, registers, and memory locations. If location 0 is
symbolized by A. It is a low-level programming language that provides a symbolic representation
of a computer's machine code. It uses human-readable mnemonics like MOV, ADD, and JMP to
represent instructions, offering direct control over hardware resources. Assembly is specific to a
particular CPU architecture, such as x86 or ARM, and is often used for system programming,
embedded systems, and performance-critical applications. Unlike high-level languages,
assembly code is closely tied to machine instructions, making it highly efficient but less portable
and more complex to write.

High Level Language:


A high-level language (HLL) is a programming language that is abstracted from the machine's
hardware and focuses on ease of use and readability. Unlike low-level languages like assembly,
high-level languages use English-like syntax, making them easier for programmers to write, read,
and maintain. Examples include Python, Java, C++, and JavaScript.

Characteristics of high-level language:


1. Abstraction: Hides the complexity of hardware, allowing programmers to focus on
problem-solving.
2. Portability: HLLs are platform-independent; programs can run on different systems with
minimal changes.
3. Productivity: Writing in HLL is faster due to simpler syntax and built-in libraries.

Importance:
1. Ease of Learning: HLLs are accessible to a broader range of programmers, fostering
innovation and collaboration.
2. Code Maintainability: Easier to read and debug, making long-term development more
manageable.
3. Rapid Development: Built-in libraries and tools streamline development, reducing time
to market.
4. Efficiency in Complex Projects: Ideal for large-scale applications where managing
hardware details manually would be impractical.

Low Level Language:


A low-level language is a programming language that provides little to no abstraction from a
computer's hardware, making it closely tied to the architecture of the machine. Examples
include machine code (binary) and assembly language. Low-level languages deal directly with a
system's memory, CPU registers, and I/O, offering full control over hardware resources.
Characteristics of low-level language:
1. Hardware-Specific: Instructions are tailored for a specific CPU architecture.
2. Efficient Execution: Low-level code runs faster and uses fewer resources since it directly
interacts with hardware.
3. Minimal Abstraction: Provides detailed control over memory management, CPU
operations, and hardware interaction.
8085 program to add two 8-bit numbers:
1. Load the first number from memory location 2050 to accumulator.
2. Move the content of accumulator to register H.
3. Load the second number from memory location 2051 to accumulator.
4. Then add the content of register H and accumulator using “ADD” instruction and storing
result at 3050.
5. The carry generated is recovered using “ADC” command and is stored at memory
location 3051.

Translator (Assembler, Compiler, Interpreter):


 Assembler: Converts assembly code into machine code. Each assembly instruction is translated
into binary code that the processor can execute directly.
 Compiler: Transforms high-level language code into machine code, creating an executable file.
Examples include the GCC (GNU Compiler Collection) for C/C++.
 Interpreter: Translates high-level language code into machine code line-by-line, without
creating an executable file. Examples include the Python interpreter.

Addressing Methods:

Addressing methods (or addressing modes) are ways of specifying where an operand (data) is
located for a given instruction in assembly or machine language. These methods tell the CPU
how to interpret and access data needed for operations, such as arithmetic and logic.
Addressing methods allow for flexible and efficient ways to access data, which is crucial in
assembly language programming and microprocessor operations. Different addressing modes
optimize the way instructions interact with data, impacting the speed and efficiency of code
execution.
Types of Addressing Methods

1. Immediate Addressing
o The operand is specified directly within the instruction.
o Example: MOV AX, 5 – Here, 5 is the immediate value being moved directly into the AX
register.

2. Direct Addressing
o The address of the operand is specified in the instruction itself, typically within a
memory location.
o Example: MOV AX, [1234h] – The data at memory address 1234h is loaded into the AX
register.

3. Indirect Addressing
o A register holds the address of the operand rather than the operand itself.
o Example: MOV AX, [BX] – The BX register contains the address of the data, and the value
at that address is loaded into AX.

4. Register Addressing
o The operand is located in a specific register and is directly accessed by naming that
register.
o Example: ADD AX, BX – Here, AX and BX are registers, and the value in BX is added to the
value in AX.

5. Indexed Addressing
o Combines a base address (in a register) with an offset (in another register or specified
value) to calculate the operand’s address.
o Example: MOV AX, [BX + SI] – The address is determined by adding the values in BX and SI,
and the value at that computed address is loaded into AX.

6. Base-Indexed Addressing
o Uses both a base register and an index register to calculate the address, often for
accessing data structures like arrays.
o Example: MOV AX, [BX + DI] – Combines the values of BX (base) and DI (index) to get the
operand's address.

7. Relative Addressing
o The address is calculated relative to the current program counter (useful for loops or
conditional jumps).
o Example: JMP label – The CPU calculates the target address relative to the current
instruction pointer.

Register in the Arithmetic Unit (AU):


A Register in the Arithmetic Unit (AU), often called the Arithmetic Logic Unit (ALU), is part of
the microprocessor responsible for executing arithmetic and logical operations. It performs
fundamental operations, such as addition, subtraction, multiplication, division, and logical
operations (AND, OR, NOT, XOR). Registers within the AU temporarily store the data or results
of these operations.

Key Components of the Arithmetic Unit

1. Arithmetic Logic Unit (ALU):


o The ALU is the central part of the CPU that actually performs arithmetic and logic
operations.
o It uses registers as temporary storage for the operands (data to be processed) and the
results of computations.

2. Registers:
o Registers are small, high-speed storage locations directly within the CPU. They hold data
that the ALU processes, including operands for operations and intermediate results.
o Examples include registers like AX, BX, CX, and DX in the 8086 microprocessor, which are
general-purpose registers used by the ALU for various tasks.

3. Control Unit (CU):


o Though separate from the AU, the Control Unit works closely with the ALU. It interprets
instructions and directs the ALU on which operation to perform.

How Registers and the ALU Work Together

1. Loading Operands: The Control Unit loads data into registers from memory or inputs.
2. Processing: The ALU performs the operation (e.g., addition) on data in the registers.
3. Storing Results: After processing, the ALU stores the result in a register or sends it back to
memory for further use.

Example: For an instruction like ADD AX, BX:

 The contents of AX and BX are sent to the ALU.


 The ALU performs the addition operation.
 The result is stored in AX or another register as specified.

Registers in the AU are crucial for processing tasks at high speed because they avoid the need
to frequently access slower main memory. This close integration of the AU, ALU, and registers
makes basic operations extremely efficient, which is essential for a microprocessor’s
performance.

Opcode & Operand:


Opcode and Operand are the two main parts of a machine-level or assembly instruction that
together tell the CPU what to do and on what data to do it.
1. Opcode (Operation Code)

 Definition: The opcode is the part of the instruction that specifies the operation to
perform. It tells the CPU what action is needed, such as addition, subtraction, loading, or
storing data.
 Examples:
o MOV (move data from one place to another)
o ADD (add two values)
o SUB (subtract one value from another)
o JMP (jump to another part of the program)
 Purpose: Each opcode is a command for the CPU to execute a specific task. The opcode
is typically represented by a mnemonic in assembly language (like ADD) but is stored in
binary in machine language.

2. Operand:
 Definition: The operand is the part of the instruction that specifies the data or the
addresses on which the operation (opcode) should act. It can be a value, a memory
location, or a register.
 Examples:
o MOV AX, 5 – Here, 5 is the operand, an immediate value moved into register AX.
o ADD AX, BX – Both AX and BX are operands, with the addition performed on the
values in these registers.
o MOV AX, [1234h] – [1234h] is the operand, indicating the data at this memory
address.
 Types of Operands:
o Immediate Operand: A fixed value in the instruction itself, like 5 in MOV AX, 5.
o Register Operand: Data in a CPU register, like AX or BX.
o Memory Operand: A memory location address where data resides.

Instruction Example: ADD AX, BX

 Opcode: ADD (the operation to perform—addition).


 Operands: AX and BX (the data locations, which in this case are registers that contain the
numbers to be added).

In essence, the opcode tells the CPU what action to take, and the operand tells it which data to
use. Together, they form a complete instruction that the CPU can execute.

You might also like