1
$\begingroup$

Not really sure if this is an exact CS question. I'm reading the Patt/Patel Introduction to computing systems Powerpoint presentation and I don't understand about the program counter and instruction register format in LC-2.

On the memory pages section in chapter 5, it writes there: "Direct mode addressing gets page number from PC[15:9] and page offset from IR[8:0]." My question is, I don't understand why the format of PC and IR is in [x:y], can anyone explain it to me? I read on Wikipedia and it says that it should be base + offset, but why does the base and offset both have 2 separate values?

Thanks.

$\endgroup$
1
$\begingroup$

The notation is as follows: FROM[left bit : right bit], so in your example PC[15:9] means take bitfield (number) from PC from fifteenth bit to ninth bit, inclusive, so 15 - 9 + 1 = 7 bits.
The same applies for IR[8:0] meaning take bitfield from IR from eight to zeroth bit inclusive.
For example PC[14:14] would be exactly one bit long and in such case by convention one would write PC[14].

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.