In: Computer Science
3. In a typical service routine, to go back to the previous code we do RTI. Suppose we replace RTI by a sequence of two instructions:
POPpc
POPpsw
The POPpc instruction will pop the PC value from the control stack (assume that PC, PSW values are on the stack in the right order) and put it into the PC register. The POPpsw instruction will pop the PSW value from the control stack and put it in the PSW register.
Assume that all logical addresses are the same as the physical addresses.
Will this scheme work? Explain in LESS THAN 50 WORDS.
Yes,this will work just fine.when a typical service routine is over,then it is required to fill the PC with the next address of instruction which was keep on hold to service that particular routine.
This functionality is actually automatic,when service routine is over,this will invoke pop operation which will then pop the PC and PSW values from control stack which were actually pushed when PC was initialised with address of service routine.
PSW is also required to continue effectively and to produce correct results.PSW contain Accumulator and flag registers which explicitly define the state of program upto where program was preempted.this state information is also required because in most cases instructions are dependent on each other.without this information ,program can't be executed effectively if they execute somehow then it is not guaranteed that it will generate correct output.