Download presentation
Presentation is loading. Please wait.
Published byTracy Bradley Modified over 6 years ago
1
Instruction format Instruction is a command to microprocessor to perform a given task on specified data. Each instruction has two parts: One is the task to be performed: called Operation code (op-code). Second is the data to be operated on called the Operand. The operand or data can be specified in various ways. It may include 8-bit(16-bit) data, an internal register, a memory location’s data. In some instructions, operand is in implicit in instruction.
2
Addressing Modes MOV A,B; MVI A,0FH; LDAX B
In above instructions the micropro. Copy 8-bit from a source into a destination. Source can be a register or input port or an 8-bit data. Destination can be register or memory location. The various formats of specifying the operands are called “addressing modes”.
3
Types of Addressing modes
Immediate MVI R, 8-bit data Register MOV Rd, Rs Direct IN/OUT 8-bit port address LXI Rp, 16-bit address Indirect LDAX Rp Implicit CMA
4
Opcode format To understand, operation code, examine how an instruction is designed into the microprocessor. This information will be useful in reading a user’s manual, in which operation codes are specified in binary format and 8-bits are divided in various groups. In the design the 8085 microprocessor chip, all operations, registers and status flags are identified with a specific code:-
5
Code Registers Code Reg Pair 000 B 00 BC 001 C 01 DE 010 D 10 HL
E AF OR SP H L A Reserved for memory related operation MOV Rd, Rs 1 D S
6
Instruction Word Size Instruction can be categorized according to word size as follows: One word or 1-byte MOV C,A; ADD B; CMA Two word or 2-byte MVI A,0FH Three word or 3-byte LXI H, 2030H; STA 3500H
7
Instruction Timing It is one of the best way to understand to process of micro-processor/controller. With the help of timing diagram we can understand the working of any system, step by step working of each instruction and its execution, etc. It is the graphical representation of process in steps with respect to time. The timing diagram represents the clock cycle and duration, delay, content of address bus and data bus, type of operation ie. Read/write/status signals.
8
As the heartbeat is required for the survival of the human being, the CLK is required for the proper operation of different sections of the microprocessors. All actions in the microprocessor is controlled by either leading or trailing edge of the clock. Example: 6 bags of wheat, each of 100kg, one person may take 6-times to perform transfer these bags from one location to another location. But stronger man might perform same task in 3 times only. Same apply on microprocessor. One processor may take 6 machine cycles other take 3 machine cycles.
9
Each machine cycle is composed of many clock cycle.
Since, the data and instructions, both are stored in the memory, the μP performs fetch operation to read the instruction or data and then execute the instruction. The μP in doing so may take several cycles to perform fetch and execute operation. The 3-status signals : IO / M, S1, and S0 are generated at the beginning of each machine cycle. The unique combination of these 3-status signals identify read or write operation and remain valid for the duration of the cycle.
11
The execution of instruction always requires read and writes operations to transfer data to or from the μP and memory or I/O devices. Each read/ write operation constitutes one machine cycle. Each machine cycle consists of many clock periods/ cycles, called T-states. The heartbeat of the microprocessor is the clock period. Each and every operation inside the microprocessor is under the control of the clock cycle. The clock signal determines the time taken by the microprocessor to execute any instruction. The clock cycle has two edges (leading and trailing or lagging). State is defined as the time interval between 2-trailing or leading edges of the clock. Machine cycle is the time required to transfer data to or from memory or I/O devices.
13
Processor Cycle The function of the microprocessor is divided into fetch and execute cycle of any instruction of a program. The program is nothing but number of instructions stored in the memory in sequence. In the normal process of operation, the microprocessor fetches (receives or reads) and executes one instruction at a time in the sequence until it executes the halt (HLT) instruction. Thus, an instruction cycle is defined as the time required to fetch and execute an instruction. For executing any program, basically 2-steps are followed sequentially with the help of clocks Fetch, and Execute. The time taken by the μP in performing the fetch and execute operations are called fetch and execute cycle. Thus, sum of the fetch and execute cycle is called the instruction cycle.
15
Opcode Fetch cycle
16
Operation of opcode fetch
The μP fetches opcode of the instruction from the memory as per the sequence below:--- A low IO/M means microprocessor wants to communicate with memory. The μP sends a high on status signal S1 and S0 indicating fetch operation. The μP sends 16-bit address. AD bus has address in 1st clock of the 1st machine cycle,T1. AD7 to AD0 address is latched in the external latch when ALE = 1. AD bus now can carry data. In T2, the RD control signal becomes low to enable the memory for read operation. The memory places opcode on the AD bus. The data is placed in the data register (DR) and then it is transferred to IR. During T3 the RD signal becomes high and memory is disabled. During T4 the opcode is sent for decoding and decoded in T4. The execution is also completed in T4 if the instruction is single byte. More machine cycles are essential for 2- or 3-byte instructions. The 1st machine cycle M1 is meant for fetching the opcode. The machine cycles M2 and M3 are required either to read/ write data or address from the memory or I/O devices.
17
Memory Read
18
Memory Write
19
I/O Read
20
Execution time Clock frequency=2 MHz T state=clock period(1/f)=05. µs
Execution time for opcode fetch= 4T X 0.5=2 µs Execution time for memory read= 3T X 0.5=1.5 µs Execution time of instruction= 7T X 0.5=3.5 µs
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.