9,855 views

A CPU has $24$-$bit$ instructions. A program starts at address $300$ (in decimal). Which one of the following is a legal program counter (all values in decimal)?

1. $400$
2. $500$
3. $600$
4. $700$

### Subscribe to GO Classes for GATE CSE 2022

Option $(C)$. $24$ bits = $3$ bytes instructions. So, PC will have multiples of $3$ in it.
by

reshown
Why would PC increment in steps of Instruction size ?

1. Shouldn't program counter increment in steps of word size ?

2. In CISC machine instructions are not of uniform length, the question does not mention uniform instruction length. so what if few instructions were of few of only two bytes ?
Aren't you reading the question? It says "24 bit" instructions. And PC always increments in instruction size as it is nothing but pointer to instructions.
Why wont we consider it bit wise ,is memory by default byte addressable....Plz explain me
PC content would always be $300+(k-1)*3$ where $kth$ instruction we want to fetch. And this is divisible by 3.
It is not given that CPU is byte addressable. So, let us consider bit addressable first. Therefore,

24* (something) +300 = options.

So, if we put any value in something (integer), we are unable to satisfy above equation.

This means that the CPU is byte addressable.

Hence, answer is  $Option$  $C$.

@Akash Papnai

But why to consider bit addressable?

Its always word/Byte addressable. Isn't it??

​​​​​@Arjun Sir's comment.

@jeet

Actually you're right. We should always consider a byte-addressable CPU. But this doesn't mean that you'll neglect to consider a bit addressable CPU. There are bit-addressable CPUs and they are faster comparatively but it will increase the cost of the system.

In the future, if such kind of question comes, then you should directly apply byte-addressable since modern computers are byte-addressable.
But I have never heard of bit addressable.

Thanks.
CPU is byte addressable always if not given
bit addressable naya aya hh kya market me? 😁

C) is the ans

size of instruction  =  24/8 = 3 bytes.

Program Counter can shift 3 bytes at a time to jump to next instruction.

So the given options must be divisible by 3. only 600 is satisfied.

Can you explain  why you divided 24 by 8?
Converting bit to byte and as a instruction size is 3 bytes each,program counter will shift 3 bytes each time so address will be multiple of 3.
After each instruction cycle the PC needs to be updated to point to the next instruction in memory.

INSTRUCTION SIZE : 24BITS or 3Bytes

Address of next instruction : 303 then 306 and so on.

So it is an AP series and only 600 comes under this series. So answer is C

Actually the question is incomplete. It should be mentioned in the question that the

CPU is byte-addressible so that the PC will increment byte by byte. Now because the instruction is 3byte, the PC has to increment 3 times.

So the answer is 600, since it is the only option which is multiple of 3.

by

When nothing is given, we always have to assume byte addressability.

So, 1 instruction = 3 B.

From mem location 300, load 99 instructions. We'll be on mem location 597, and PC would point to 600.

Or simply, look for multiples of 3.

Option C

Option (C) will be the answer because here because here 24 bits = 3 bytes. Assuming system to be byte addressable the address of the instructions will increase by 3 bytes or 6 bytes or 9 bytes or.... etc for continuous instructions. so as 300 is multiple of 3 and as subsequent addresses are also multiple of 3 the answer will be 600 because it is the only multiple of 3 present in the options.

C.P.U will use 24- bit instructions and instructions size(bytes) is 24/8 = 3 bytes

Program execution will start from address at 300 and from there on words every operation will takes 3- bytes and so on , So the address should be multiple of “3”. From the given options only 600 address value is valid.
by
Yes, PC will have multiples of 3.

*as we considered the system as byte addressable, each instruction contains 3 bytes, so PC will increment by 3.

But, for this reason we can't just say that the answer would be multiple of 3. This might not be true all the time.

Here it worked because the starting address is multiple of 3. (300+answer) should be multiple of 3.

What if the starting address is not a multiple of 3.

In that case, we must subtract the starting address from all the options, the result which is multiple of 3 would be the answer.

So, (Option - starting_address) must be multiple of 3.

(600 - 300) = 300, is a multiple of 3.

# almost all the given answers are correct, but mine is an extension, where the starting address is not a multiple of 3.