Problem 1. Describe the typical life cycle for an instruction.
Problem 2. Suppose ‘a’ and ‘b’ are two signed integers. We would like to see whether ‘a’ is greater or equal to ‘b’. To check for the signed greater or equal (GE) condition, we evaluate whether the negative flag N is equal to the overflow flag V. If they are equal, then the GE condition is true. Explain the reasons why this works.
Instruction life cycle:
Instruction:An instruction is nothing but segement of code that may contains severel steps to be executed by processor.
Generally Instruction contains following stages:
1.Fetch
2.Decode
3.Execute
1). Fetch the instruction: In this stsge the intruction brings to the instruction storage. Whe need to know about Instruction Register,it is nothing but some storage location in memory that holds instructions for decoding.
2). Decode the instruction: Hardware determines what the opcode is(opcode is nothing but function), and determines the address of operands. The adress locations are either memory addresses or from register.If any operands from memory locations, CPU initiate memory read cycles to read them into CPU registers.This type of addresses are called as effective addresses.
3).Execute: In this stage CPU Performs the
function of the instruction. If the instruction need to execute any
arithmetic or logic operations, CPU utilizes the ALU circuits to
carry out the operation on data in registers.
Execute stage is the only stage of the instruction cycle that is
useful in user prospective.
One of the major goals of CPU design is spend a higher percentage
of the time in the execute stage.
Finally result will be stored in memory if necessary.Suppose
storage destination is a memory address, again CPU initiates a
memory write cycle to transfer the result from the CPU to
memory.
Get Answers For Free
Most questions answered within 1 hours.