Sossenbinder
Sossenbinder

Reputation: 5302

Memory range calculation

I have a question about calculating memory addresses:

I am given 3 Memory blocks:

- 1x 1KByte (IC1) - 2^10 Byte
- 2x 4KByte (IC2 + IC3)  2^12 Byte

So far I calculated these memory addresses:

IC1:

0000 0000 0000 0000 (Starting adress)
0000 0011 1111 1111 (Ending adress, I got this from inverting the last 10 digits)

IC2:

0000 0100 0000 0000 (Starting adress)- Last ending adress +1
0000 1011 1111 1111 (Ending adress, I got this from inverting the last 12 digits)

However, at IC3 there has to be some method to get a carry bit into my first 0000-block, as I am running out of space when only using 3 the last 3 hex digits:

IC2:

0000 1100 0000 0000 (Starting adress)- Last ending adress +1

What is the ending address now? If I would invert the last 12 digits again, I would get a hex address which is already in use. It's pretty obvious that the next hex digit has to be increased to 1, but I can't find a rule to do this.

Any advice?

Upvotes: 0

Views: 511

Answers (1)

PeteB
PeteB

Reputation: 372

I'm not sure why you're using bit flipping for this, it looks like it should be a very efficient implementation if it works, but it doesn't seem to:

Your IC2 block starting address (in Hex) is 400 (which is 1K from the start of memory, all good so far), but the ending address in hex is BFF when it should be 13FF (1k+4k = 5k) in binary that is 0001 0011 1111 1111

Is there a reason why you cannot calculate these addresses using addition instead of bit-flipping?

Upvotes: 1

Related Questions