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

UT MP

Graphtheory

Uploaded by

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

UT MP

Graphtheory

Uploaded by

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

1.

Draw And explain architecture of 8085


ANS:

8085 consists of the following functional units −

Architecture of 8085 Microprocessor

The 8085 microprocessor is an 8-bit microprocessor designed by Intel in the 1970s. It has a
simple yet efficient architecture, consisting of several functional blocks that allow it to
perform arithmetic, logic, and control operations. Here is an explanation of its key
components:

1. Accumulator (A Register)

 8-bit register used for arithmetic, logical, and data transfer operations.
 Acts as the primary register where most operations are performed.
 It holds one of the operands and stores the result of the operation.

2. Arithmetic and Logic Unit (ALU)

 The ALU performs arithmetic operations such as addition, subtraction, and logical
operations like AND, OR, XOR.
 The result of these operations is stored in the accumulator.
 It works with 8-bit data and affects the flag register based on the result.

3. General-Purpose Registers
 The 8085 has six general-purpose registers, each of which is 8 bits:
o B, C, D, E, H, and L.
 These registers can be used individually or in pairs (BC, DE, HL) to hold 16-bit data.
 HL pair can also function as a memory pointer (it holds the memory address for
certain instructions).

4. Program Counter (PC)

 A 16-bit register that holds the address of the next instruction to be executed.
 As each instruction is fetched, the PC is incremented to point to the following
instruction.

5. Stack Pointer (SP)

 A 16-bit register that points to the top of the stack.


 The stack is an area of memory used for temporary data storage during function calls
and interrupts. It follows the Last In First Out (LIFO) principle.

6. Temporary Register

 An 8-bit register used internally by the microprocessor to store data temporarily


while performing operations.

7. Flag Register

 The flag register is an 8-bit register that stores the result of the ALU operations in the
form of flags (status bits).
 There are five significant flags:
1. Sign (S): Set if the result is negative.
2. Zero (Z): Set if the result is zero.
3. Auxiliary Carry (AC): Set if there’s a carry out from the lower nibble in
BCD arithmetic.
4. Parity (P): Set if the result has an even number of 1s (even parity).
5. Carry (CY): Set if there’s a carry out after an addition or a borrow in
subtraction.

8. Instruction Register and Decoder

 The instruction register temporarily holds the instruction fetched from memory.
 The decoder interprets the instruction and generates the necessary control signals to
execute it.

9. Timing and Control Unit

 Generates timing and control signals for various operations.


 Controls the operations of READ, WRITE, and interrupt handling.
 Includes signals such as:
o READY: Indicates if the peripheral is ready for data transfer.
o RD': Initiates the read operation.
o WR': Initiates the write operation.
o RESET: Resets the microprocessor to start execution from address 0000H.

10. Interrupt Control

 The 8085 microprocessor supports five interrupt signals:


1. INTR (Interrupt Request): Maskable interrupt.
2. RST 7.5, RST 6.5, RST 5.5: Maskable vectored interrupts.
3. TRAP: Non-maskable interrupt, used for critical tasks like power failure.
 When an interrupt occurs, the current execution is paused, and the processor jumps to
a pre-defined location to handle the interrupt.

11. Serial Input/Output Control

 The 8085 has two serial communication signals:


o SID (Serial Input Data): Reads serial input data.
o SOD (Serial Output Data): Sends serial output data.

12. Address Buffer and Address/Data Buffer

 The address buffer stores the content of the Program Counter and Stack Pointer,
which helps in address generation.
 The address/data buffer carries both address and data, helping with memory and I/O
communication.

13. Address Bus and Data Bus

 Address Bus: A 16-bit bus used to address memory and I/O devices (unidirectional).
 Data Bus: An 8-bit bus used to transfer data between the microprocessor and
peripherals (bidirectional).

2.2 Real Mode Addressing

 Real mode operation allows the microprocessor to address only first 1M byte of memory space.

 A combination of segment address and an offset address access memory location in real mode.

 All real mode memory addresses consist of segment address plus an offset address.

 The segment address located at one of the segment register, defines the beginning address of any
64K bytes memory segment.

 The offset address selects any located at one of the segment register defines the beginning
address of any 64K bytes memory segment.

 Segments in real mode always have a length of 64K byte memory segment.
2. Draw And explain architecture of 8086
ANS:

The 8086 microprocessor is a 16-bit processor developed by Intel, and its architecture
is more advanced compared to the 8085. The 8086 uses a 20-bit address bus to access up to
1 MB of memory and has a 16-bit data bus, making it capable of handling 16-bit data and
instructions.

The architecture of the 8086 can be divided into two main functional units:

1. Bus Interface Unit (BIU)


2. Execution Unit (EU)

Block Diagram of 8086 Architecture

The architecture of the 8086 is divided into several key components, as shown below.

-------------------------------
| Execution Unit |
| |
| General Purpose Registers |
| Instruction Decoder |
| ALU (Arithmetic Logic Unit) |
| Control Flags |
| Instruction Queue (6 bytes) |
-------------------------------
|
|
-------------------------------
| Bus Interface Unit |
| |
| Segment Registers (CS, DS, |
| SS, ES) |
| Instruction Pointer |
| Address Generation Circuit |
| Memory and I/O Interface |
| Address Bus (20-bits) |
| Data Bus (16-bits) |
-------------------------------

Components of 8086 Architecture

1. Bus Interface Unit (BIU)

The Bus Interface Unit is responsible for interfacing the microprocessor with the memory
and input/output devices. It handles the transfer of data, addresses, and instructions between
the processor and external memory or I/O devices.

 Segment Registers: The 8086 uses segment registers to access memory. The
memory in 8086 is divided into four segments, each of 64 KB.
o CS (Code Segment): Stores instructions to be executed.
o DS (Data Segment): Holds data for the program.
o SS (Stack Segment): Holds stack data (used for function calls, local variables).
o ES (Extra Segment): Used as an additional data segment.

 Instruction Pointer (IP): The IP is a 16-bit register that holds the address of the next
instruction to be executed. It works with the CS register to form the 20-bit address of
the instruction.
 Address Generation Circuit: The BIU generates the 20-bit physical address by
combining a segment register and an offset (e.g., the IP or other registers). The
address is used to access the memory.
 Instruction Queue: The 8086 features a 6-byte instruction queue that pre-fetches
instructions from memory. This allows it to fetch instructions while executing others,
enhancing performance through pipelining.
 Data and Address Bus:
o 20-bit Address Bus: Can access up to 1 MB of memory (2^20).
o 16-bit Data Bus: Transfers data between the processor and memory or I/O devices.

2. Execution Unit (EU)

The Execution Unit is responsible for decoding and executing instructions fetched by the
BIU. It handles arithmetic, logic, and control operations.

 General-Purpose Registers:
o AX (Accumulator): Used for arithmetic and data transfer operations.
o BX (Base Register): Primarily used for memory access with an offset.
o CX (Count Register): Used for loops and string operations.
o DX (Data Register): Used in input/output operations and division/multiplication.

These registers can also be split into 8-bit parts (e.g., AH/AL, BH/BL).

 Pointer and Index Registers:


o SP (Stack Pointer): Points to the top of the stack.
o BP (Base Pointer): Used to access data in the stack segment.
o SI (Source Index): Used for string operations.
o DI (Destination Index): Also used for string operations and memory access.

 Arithmetic and Logic Unit (ALU): The ALU performs arithmetic operations
(addition, subtraction) and logical operations (AND, OR, XOR, NOT). It works with
16-bit data and produces results that affect the flag register.
 Flags Register: The Flags Register contains status flags that are updated based on
the result of operations. The key flags include:
o Zero Flag (ZF): Set if the result of an operation is zero.
o Sign Flag (SF): Set if the result is negative.
o Carry Flag (CF): Set if there is a carry or borrow.
o Overflow Flag (OF): Set if there is an overflow in signed arithmetic.
o Parity Flag (PF): Set if the result has an even number of 1 bits.
o Auxiliary Carry Flag (AF): Used in BCD arithmetic.

 Instruction Decoder: The instruction decoder decodes the instructions fetched by


the BIU and sends them to the ALU or other functional units for execution.
 Control Unit: The control unit within the EU generates control signals that direct the
internal operations of the processor, like fetching, decoding, and executing
instructions.

Key Features of 8086:

1. Pipelining: The 8086 uses pipelining by pre-fetching instructions while the current
instruction is being executed. This allows the processor to improve execution speed.
2. 16-bit Processing: It can process 16-bit data at a time, making it faster than 8-bit processors
like the 8085.
3. 1 MB Memory Access: With its 20-bit address bus, the 8086 can address up to 1 MB of
memory.
4. Multipurpose Registers: General-purpose registers can be used for various functions, making
programming flexible.
5. Segmentation: Memory is divided into segments (code, data, stack, extra), which helps in
organizing large programs efficiently.

3. Which Are the Types of addressing modes available Classify it


ANS:
In the 8086 microprocessor, addressing modes define how the operand of an
instruction is chosen. Addressing modes tell the processor where to look for data—whether
it’s in a register, memory, or included as an immediate value.

The 8086 microprocessor supports several types of addressing modes. These are classified
broadly into Data Addressing Modes, Program Memory Addressing Modes, and Stack
Memory Addressing Modes. Each category has specific modes to handle various types of
data access.

1. Data Addressing Modes:

These modes are used to access data stored in registers or memory.

 Register Addressing Mode: The operand is in a register.


o Example: MOV AX, BX (copies the content of BX into AX).
 Immediate Addressing Mode: The operand is part of the instruction itself (a constant
value).
o Example: MOV AX, 1234H (moves the value 1234H directly into AX).
 Direct Addressing Mode: The address of the operand is specified in the instruction.
o Example: MOV AX, [1234H] (moves the value from memory address 1234H
into AX).
 Register Indirect Addressing Mode: The memory address of the operand is in a
register.
o Example: MOV AX, [BX] (moves the value at the memory address stored in
BX into AX).
 Base-Plus-Index Addressing Mode: Combines a base register and an index register
to calculate the effective memory address.
o Example: MOV AX, [BX+SI] (the effective address is calculated by adding BX
and SI, and the data at this address is moved to AX).
 Register Relative Addressing Mode: A base register plus a displacement is used to
form the effective memory address.
o Example: MOV AX, [BX+4] (adds the value 4 to BX to form the effective
address, and moves data from that memory location to AX).
 Base Relative-Plus-Index Addressing Mode: A base register, index register, and
displacement are used to form the memory address.
o Example: MOV AX, [BX+SI+4] (adds BX, SI, and 4 to calculate the effective
memory address, and moves the data from that location to AX).
 Scaled Index Addressing Mode: Similar to base-plus-index but uses a scaling factor
on the index register to handle larger data sizes.
o Example: MOV AX, [EBX + 2*ECX] (multiplies ECX by 2 and adds it to EBX
to form the address).

2. Program Memory Addressing Modes:

These modes are used to access instructions and are typically used for control flow changes
like jumps, calls, and loops.
 Direct Program Memory Addressing Mode: The instruction specifies the full
address of the next instruction.
o Example: JMP 1234H (jumps to the instruction at memory location 1234H).
 Relative Program Memory Addressing Mode: The address is given relative to the
current instruction pointer (IP).
o Example: JMP SHORT +10H (jumps to a location 10 bytes ahead of the current
IP).
 Indirect Program Memory Addressing Mode: The jump address is stored in a
register or memory location.
o Example: JMP [BX] (jumps to the address stored in BX).

3. Stack Memory Addressing Modes:

These modes deal with data stored on the stack, primarily used in function calls and interrupt
handling.

 PUSH and POP Instructions: Data is pushed onto or popped from the stack. The
stack pointer (SP) is used to keep track of the top of the stack.
o Example: PUSH AX (pushes the contents of AX onto the stack), POP AX (pops
the top value from the stack into AX).

4. Describe the register addressing mode of 8086


ANS:
Register Addressing Mode of 8086

In the 8086 microprocessor, the register addressing mode is one of the most common ways
to access data. In this mode, data is transferred directly between registers, or operations are
performed using registers as operands. The source and destination operands can both be
registers, and no memory access is needed, making this mode fast and efficient.

Key Characteristics:

1. Operands: The operands in the instruction are registers.


2. No Memory Access: The data to be operated on is already available in the CPU’s registers, so
no additional memory fetch is required, making the operation faster.
3. Registers Involved: The 8086 microprocessor has several 8-bit, 16-bit, and segment registers
that can be used in this mode.

Types of Registers:

 8-bit Registers: AH, AL, BH, BL, CH, CL, DH, DL.
 16-bit Registers: AX, BX, CX, DX, SP, BP, SI, DI.
 Segment Registers: CS (Code Segment), DS (Data Segment), SS (Stack Segment), ES (Extra
Segment).
Example of Register Addressing Mode:

MOV AX, BX ; Move the contents of register BX into register AX


ADD AX, CX ; Add the contents of register CX to AX
XOR DX, CX ; Perform XOR between DX and CX, result is stored in DX

 MOV AX, BX: The contents of register BX are copied into register AX. Both are 16-bit
registers.
 ADD AX, CX: Adds the value of register CX to AX, and the result is stored in AX.
 XOR DX, CX: Performs a bitwise XOR between DX and CX. The result is stored in DX.

Advantages of Register Addressing Mode:

1. Speed: Since the data resides in registers, the processor doesn’t need to access memory,
leading to faster operations.
2. Simple Instructions: The instructions are shorter because the operands are registers, not
memory addresses.

Limitations:

1. Limited Storage: The size of the registers is limited, so only a small amount of data can be
held in registers at any given time.
2. Register Constraints: The number of available registers is limited, and not all registers can be
used for every operation.

5. Explain About program memory addressing mode


ANS:
Program Memory Addressing Modes

Program memory addressing modes are used to determine how the processor accesses
instructions stored in memory. These modes specify how to locate the next instruction to be
fetched and executed. In microprocessors like the 8086, there are three primary types of
program memory addressing modes:

1. Direct Program Memory Addressing


2. Relative Program Memory Addressing
3. Indirect Program Memory Addressing

1. Direct Program Memory Addressing:

 In this mode, the address of the instruction or data to be accessed is explicitly provided as
part of the instruction itself.
 The memory address is stored along with the opcode, which makes it easy for the processor
to jump to or call the specific memory location.
Example:

 JMP 1000H — This instruction tells the processor to jump directly to memory location
1000H for the next instruction.
 Usage: This type of addressing is typically used in long jumps or far calls where the
full address is required. In a long jump, the instruction provides a 16-bit address.

2. Relative Program Memory Addressing:

 In relative addressing mode, the address of the target instruction is specified relative to the
current value of the instruction pointer (IP).
 Instead of giving a full address, a displacement (offset) is provided. The displacement is
added to the current IP to calculate the address of the next instruction.

Example:

 JMP SHORT +05H — This instruction makes the processor jump to a location that is 5
bytes ahead of the current instruction pointer value.
 Usage: This is used in conditional jumps and loops within a short range. It's efficient
because it doesn't need the full address, just the relative offset.

3. Indirect Program Memory Addressing:

 In indirect addressing, the memory address is not explicitly stated in the instruction. Instead,
it is stored in a register, or memory location, which is then accessed to determine the target
address.
 The instruction contains the reference to a register or memory location that holds the
address of the next instruction.

Example:

 JMP [BX] — This instruction tells the processor to jump to the memory location
stored in the BX register.
 Usage: This is commonly used for subroutines or interrupt handling where the
jump addresses are stored in specific locations and retrieved when needed.
6. Explain about 8051 microcontroller and compare microcontroller and microprocessor

ANS:
The 8051 microcontroller was first introduced by Intel in 1981 and quickly became
one of the most widely used microcontrollers in embedded systems. It's known for being
highly versatile, with applications in various fields like robotics, automotive control,
consumer electronics, and more.

Key Features of 8051 Microcontroller:

1. 8-bit Architecture: It processes 8-bit data at a time, meaning it can handle 8 bits of
data in one operation.
2. On-chip Memory:
o 4 KB ROM (Program Memory): This is used to store the program code.
o 128 bytes of RAM (Data Memory): For storing temporary data.
3. Data Bus and Address Bus:
o 8-bit Data Bus: Used for carrying data.
o 16-bit Address Bus: Used to address 64KB of memory.
4. I/O Ports: It has four 8-bit I/O ports which can be configured as input or output.
5. Timers: It has two 16-bit timers, which are used for generating time delays or as
counters.
6. Instruction Cycle: The instruction cycle is 1 microsecond when using a 12 MHz
clock crystal.
7. Interrupts: It supports 5 interrupts, allowing the microcontroller to pause the current
task and address an urgent need (like an external input).
8. Serial Communication: Supports serial communication using UART (Universal
Asynchronous Receiver-Transmitter).
9.

7. Explain the following instruction


i. IMUL ii. DAA iii. DEC iv. MVI v. PUSH, POP
ANS:
i. IMUL (Integer Multiply):

 Description: The IMUL instruction performs signed multiplication of two operands.


This instruction is commonly used in assembly for multiplying signed integers.
 Operation: It multiplies the contents of a register or memory location by another
register or an immediate value.
o For example:
 IMUL AX, BX multiplies AX by BX and stores the result in AX.
 IMUL AX, 5 multiplies AX by 5.
 Effect on Flags: The carry (CF) and overflow (OF) flags are set if there’s an overflow
in the result.

ii. DAA (Decimal Adjust Accumulator):

 Description: The DAA instruction is used after performing an addition operation on


two packed BCD (Binary-Coded Decimal) numbers. It adjusts the result in the
accumulator to ensure it represents a valid BCD number.
 Operation: The DAA instruction checks if the lower nibble (4 bits) or upper nibble of
the accumulator exceeds 9, and then adds 6 (06H) to correct the value.
o For example:
 If you add 09 and 02 in packed BCD form, you get 0B (11 in
hexadecimal). DAA converts it to the valid BCD number 11 (0001
0001 in binary).
 Effect on Flags: Affects the carry (CF), auxiliary carry (AC), and zero (ZF) flags.

iii. DEC (Decrement):

 Description: The DEC instruction decreases the value of a register or memory


location by 1.
 Operation: It subtracts 1 from the destination operand.
o For example:
 DEC AX decreases the value of the AX register by 1.
 DEC [BX] decreases the value stored in the memory location pointed
by BX by 1.
 Effect on Flags: Affects the zero (ZF), sign (SF), and overflow (OF) flags, but it does
not affect the carry flag.

iv. MVI (Move Immediate):

 Description: The MVI instruction is used to load an 8-bit immediate value into a
register or memory location.
 Operation: Copies an 8-bit immediate data value into a specified register or memory.
o For example:
 MVI A, 25H moves the value 25H into the accumulator (A register).
 MVI B, 0AH moves 0AH into the B register.
 Effect on Flags: It does not affect any flags.

v. PUSH and POP:

 PUSH:
o Description: The PUSH instruction stores the contents of a register pair or
segment register onto the stack.
o Operation: Decreases the stack pointer (SP) by 2 and stores the data from the
specified register or memory onto the stack.
 For example:
 PUSH AX stores the value in the AX register onto the stack.
 Stack pointer decreases by 2 because the data is stored in two
consecutive memory locations (since the stack works on a 16-bit
register).
o Effect on Flags: Does not affect any flags.
 POP:
o Description: The POP instruction retrieves the data from the stack and stores
it back into a specified register or memory location.
o Operation: Copies data from the stack to the specified register or memory
location and then increases the stack pointer (SP) by 2.
 For example:
 POP AX restores the value from the stack back into the AX
register.
o Effect on Flags: Does not affect any flags.

7. Write down the 8085 programs of addition and subtraction of two 8-bit numbers
ANS: Program:

MVI A, 25H ; Load the first number (25H) into accumulator A


MVI B, 15H ; Load the second number (15H) into register B
ADD B ; Add the contents of register B to accumulator A (A = A +
B)
HLT ; Halt the program

 Explanation:
o MVI A, 25H: Loads 25H (first number) into the accumulator.
o MVI B, 15H: Loads 15H (second number) into register B.
o ADD B: Adds the contents of register B to accumulator A.
o The result is stored in the accumulator (A).
o HLT: Ends the program.

Simple 8085 Program for Subtraction of Two 8-bit Numbers:

Program:
MVI A, 30H ; Load the first number (30H) into accumulator A
MVI B, 10H ; Load the second number (10H) into register B
SUB B ; Subtract the contents of register B from accumulator A (A
= A - B)
HLT ; Halt the program

 Explanation:
o MVI A, 30H: Loads 30H (first number) into the accumulator.
o MVI B, 10H: Loads 10H (second number) into register B.
o SUB B: Subtracts the contents of register B from accumulator A.
o The result is stored in the accumulator (A).
o HLT: Ends the program.

Notes:

 In both programs, the result is stored in the accumulator (A).


 Flags are affected:
o The Zero Flag (Z) is set if the result is zero.
o The Carry Flag (CY) is set if there’s a carry or borrow.

8.

You might also like