The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
0 votes

A CPU has $64$-bit instructions. A program starts at address $0x10FEB2019$. Which one of the following is a legal program counter (all values in hexadecimal)?

  1. $0x11011415B$
  2. $0x11011415D$
  3. $0x110114142$
  4. $0x110114153$
asked in CO & Architecture by Boss (17.2k points)
edited by | 102 views

2 Answers

+2 votes

None of the options is correct.

Hexadecimal differences for 





And we don't need to add final +1 to the value in hexadecimal.Why?Suppose your PC starts at 300 in decimal and instructions are 3 byte long.Valid PC are 300,303,306....

Moreover a hexadecimal number is divisible by 8, if it's last Hex digit ends in 0 or 8.


So, here we can directly pick up the last digit of Given PC content-$(9)_{16}$ and subtract this from the last Hex digit options to check which one gives us 0 or 8.





So, none of the given option is a valid PC content.

Here probably no one gave.

You can also check results and verify

answered by Boss (25.3k points)
0 votes
Since the word size is 64 bits or 8 bytes, the PC will jump by 8 bytes each time. If the  difference between any address from given address is multiple of 8 then that address will be a valid PC value.
Taking only last three hex-digits will suffice to know such a number which is multiple of 8.
(A)$ 15B_{16}-019_{16}+1_{16}=143_{16}$ Not a multiple of 8.
(B) $15D_{16}-019_{16}+1_{16}=145_{16}$ Not a multiple of 8.
(C) $129_{16}-019_{16}+1=130_{16}$ This is a multiple of 8.
(D) $153_{16}-019_{16}+1_{16}=13B_{16}$ Not a multiple of 8.
answered by Boss (17.2k points)
$142_{16}-019_{16}+1=129_{16}+1=12A_{16}$. This is not a multiple of 8.

None of the options is legal program counter.

There is no need to add $+1$ after taking differences. Say, program starts at $2000$ and there is $4B$ long instructions then next address is $2004$. Difference $2004-2000=4$.
YES! given answer is wrong none of above are divisible by 8.

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,117 questions
53,218 answers
70,454 users