Ques. Define Instruction Cycle and divide instruction cycle into sub cycles with the help of diagram,explain the sequence in which sub Cycles are executed.
OR
Explain the different cycles of an instruction execution.
OR
Explain all the phases of instruction cycles.
AKTU 2018-19,Marks 3.5
Answer:
Instruction Cycle:
A program residing in the memory unit of a computer consists of a sequence of instructions. These instructions are executed by the processor by going through a cycle for each instruction.
Instruction Cycle is subdivided into following subcycles:
1. Fetch instruction from memory.(At the beginning of the fetch cycle, the address of the next instruction to be executed is in the Program Counter(PC))
2. Decode the instruction.(Decoder circuit examines the opcode of the instruction.Result is selecting a unique decoder output line.)
3. Read the effective address from memory.
4. Execute the instruction(Microcode for the instruction, selected by the decoder output line, is executed by the ALU.)
Ques. Write the steps in fetching a word from memory.Differentiate between a branch instruction and call subroutine instruction.
AKTU 2014-15,Marks 10
Answer:
Steps involved in fetching a word from memory:
1. CPU transfers the address of the needed information word to the memory address register (MAR). Address of the needed word is transferred to the primary memory.
2. In the meantime, the CPU uses the control lines of the memory bus to mention that a read operation is needed.
3. After issuing this request, the CPU waits till it retains an answer from the memory, informing it that the required function has been finished. It is accomplished through the use of another control signal on the memory bus, which will be denoted as Memory Function Completed (MFC).
4. The memory sets this signal to one to mention that the contents of the particular location in the memory have been read and are available on the data lines of the memory bus.
5. We will suppose that as soon as the MFC signal is set to one, the information on the data lines is loaded into MDR and is therefore available for use inside the CPU.
Ques. Assuming that all registers initially contain 0,what is the value of R1 after the following instruction sequence is executed:
MOV R1,#6
MOV R2,#5
ADD R3,R1,R1
SUB R1,R3,R2
MUL R3,R1,R1
Answer:
MOV R1,#6:Directly move 6 to the register R1
MOV R2,#5:Directly move 5 to the register R2
ADD R3,R1,R1:Value stored in R1 added to R1 again and then stored in R3.Thus R3 has a value of 12
SUB R1,R3R2:Value of R2 is subtracted from R3 and then stored in R1.Thus R1 has a value of 7(12-5)
MUL R3,R1,R1:Multiply R1 with R1 and store into R3.
Thus,the final execution of this statement will give 49 and R1 contains 7 as value stored in it.
0 Comments