2,556 views
1 votes
1 votes

Consider the following program segment:

Instruction Meaning        Size (words)

I1 LOAD r0, 500                  2

I2 MOV r1, r0                       1

I3 ADD ro, r1                        1

I4 INC r0                              1

I5 INC r1                               1

I6 ADD r0, r1                        1

I7 Store r1,                           2

I8 Halt Stop                           1

Assume that memory is word addressable with word size 32 bits. Program is loaded into memory location (3000)10 onwards. The value of PC at the end of execution of above program is _____

2 Answers

Best answer
3 votes
3 votes
Generally halt instructions are used for power saving purposes , so when it goes into the halt state , the processor will not fetch the next instruction as the PC will not be incremented , unless a external input comes and disturbs the halt state

 

The program will be halted if it executes the I8 instruction and the instruction is in the memory at location 3009 . So the contents of PC will be 3009 . So answer is 3009
selected by
2 votes
2 votes
The halt is implemented by pointing the program counter to the halt instruction itself so it get into a type of loop. o the HALT instruction will be at 3009 as the memeory is word addressable use word instead of bits. answer will be 3009 instead of 3010.

Related questions

2 votes
2 votes
1 answer
2
Hrithik Vashishtha asked Jul 4, 2022
390 views
#include <stdio.h int main () { int i, j; int a [8] = {1, 2, 3, 4, 5, 6, 7, 8}; for(i = 0; i < 3; i++) { a[i] = a[i] + 1; i++; } i ; for (j = 7; j 4; j ) { int i = j/2; ...