Академический Документы
Профессиональный Документы
Культура Документы
The sequence of actions that a CPU performs to execute each machine code instruction in a program. p g The Instruction Fetch Execute Cycle can g steps: p be broken down into the following
1. Fetch Cycle 2. Decode Cycle 3. Execute Cycle 4. Interrupt Cycle
Fetch Cycle
The fetch cycle begins with retrieving the address stored in the Program Counter (PC). (PC) This is the memory address of the instruction to be executed. The Th CPU fetches f t h the th instruction i t ti stored t d at t this thi address from the memory and transferring this instruction to Instruction Register (IR). The program counter is incremented to point to the next address from which the new instruction is to be fetched.
Decode Cycle
From the instruction register, the data forming the instruction is decoded by the instruction decoder. The Opcode of the instruction are being determined. determined The operands are retrieved from the addresses dd as needed d db by th the O Opcode. d
Execute Cycle
The decoded information is used by Control Unit to perform the operation required by the instruction instruction. Ex: reading values from registers, passing values to the ALU ALU, adding valus etc etc. The result generated by the operation is stored t di in th the main i memory, registers, i t or sent to an output device.
Interrupt Cycle
An interrupt can occur any time during the program execution. Wh Whenever i it i is caused, d a series i of f events take k place l so that h the h instruction fetch execute cycle can again resume after the interrupt. Therefore, when an interrupt occurs, the following steps are p performed: 1. Suspend the execution of current instruction. 2. Push the address of current instruction on the Stack Pointer (SP). 3 Loading 3. L di th the PC with ith th the address dd of f th the interrupt i t t handler. h dl 4. Perform the interrupt routine. 5. Once the execution of the interrupt handler complete, the address of the next instruction to be executed is obtained from popping the value of the address in the Stack Pointer. 6. Resume the suspended instruction execution. This cycle of fetching a new instruction, decoding it and finally executing ti it continues ti until til th the computer t i is t turned d off. ff
T-State: The time taken by the processor to execute a machine cycle is expressed in T-states. 1 T-state T state = 1/ operating frequency of 8085 Microprocessor
For example operating frequency = 2MHz, then time required to execute 1 T-state = 0.5 uSec
Timing Diagram
Timing Diagram is a graphical representation which represents the execution time taken by each instruction in a graphical format. The timing diagram of an instruction are obtained by drawing the timing diagrams of the machine cycles of that instruction, one by one in the order of execution. The execution time is represented in T-states T-states. The T-state starts at the falling edge of a clock.
Opcode fetch cycle (4T) M Memory read d cycle (3T) Status signals: write IO/M(bar) Memory : cycle y 1(I/O) 0 (Memory) (3T) S1 | S0 | I/O read cycle 0 | 0 | Halt (3T) 0 | 1 | Write I/O write 1 | 0 | Read cycle 1 | 1 | Opcode(3T) fetch
Fetching the Opcode 06H from the memory 2000H. (OF machine cycle) R d( Read (move) ) th the d data t 43H f from memory 2001H 2001H. ( (memory read) d) ALE - Address Latch Enable. This signal helps to capture the lower order address presented on the multiplexed address / data bus.
STA means Store Accumulator -The contents of the accumulator is stored in the specified address (526A). The opcode of the STA instruction is said to be 32H. It is fetched from the memory 41FFH Then the lower order memory y address is read(6A). ( ) - Memory y Read Machine Cycle y Read the higher order memory address (52).- Memory Read Machine Cycle The combination of both the addresses are considered and the content from accumulator is written in 526A. - Memory Write Machine Cycle Assume the memory address for the instruction and let the content of accumulator is C7H. So, C7H from accumulator is now stored in 526A.
Opcode fetch cycle (4T) Memory read cycle (3T) Status signals: write IO/M(bar) Memory : cycle 1(I/O) 0 (Memory) (3T) S1 | S0 | I/O read cycle 0 | 0 | Halt (3T) 0 | 1 | Write I/O write rite 1 | 0 | Read cycle 1 | 1 | Opcode(3T) fetch
ALE - Address Latch Enable. This signal helps to capture the lower order address presented on the multiplexed address / data bus.