2.6k views
0 votes
(a) How many locations of memory can you address with 12-bit memory address? (b) How many bits are required to address a 2-Mega-location memory, i.e, what should the length of the memory address be in order to access a 2M memory? (c) Assume intArray is an integer array with 20 elements stored in memory and its starting memory address is in $s2. What is the memory address for element intArray [10]? (d) Assume charArray is a character array with 20 elements stored in memory and its starting memory address is in $t5. What is the memory address for element charArray[5]?

User Semuzaboi
by
6.2k points

1 Answer

5 votes

Answer:

Follows are the solution to this question:

Step-by-step explanation:

In point a:

Let,

The address of 1-bit memory to add in 2 location:


\to (0)/(1) =2^1 \ ((m)/(m) \ location)

The address of 2-bit memory to add in 4 location:


\to ((00)/(01))/((10)/(11)) =2^2 \ ((m)/(m) \ location)

similarly,

Complete 'n'-bit memory address' location number is =
2^n.Here, 12-bit memory address, i.e. n = 12, hence the numeral. of the addressable locations of the memory:


= 2^n \\\\ = 2^(12) \\\\ = 4096

In point b:


\to Let \ Mega= 10^6


=10^3* 10^3\\\\= 2^(10) * 2^(10)

So,


\to 2 \ Mega =2 * 2^(20)


= 2^1 * 2^(20)\\\\= 2^(21)

The memory position for '
2^n' could be 'n' m bits'

It can use
2^(21) bits to address the memory location of 21.

That is to say, the 2-mega-location memory needs '21' bits.

Memory Length = 21 bit Address

In point c:


i^(th) element array addresses are given by:


\to address [i] = B+w * (i-LB)


_(where), \\\\B = \text {Base address}\\w= \text{size of the element}\\L B = \text{lower array bound}


\to B=\$ 52\\\to w= 4 byte\\ \to L B= 0\\\to address = 10


\to address [10] = \$ 52 + 4 * (10-0)\\


= \$ 52 + 40 \ bytes\\

1 term is 4 bytes in 'MIPS,' that is:


= \$ 52 + 10 \ words\\\\ = \$ 512

In point d:


\to base \ address = \$ t 5

When MIPS is 1 word which equals to 32 bit :

In Unicode, its value is = 2 byte

In ASCII code its value is = 1 byte

both sizes are < 4 byte

Calculating address:


\to address [5] = \$ t5 + 4 * (5-0)\\


= \$ t5 + 4 * 5\\ \\ = \$ t5 + 20 \\\\= \$ t5 + 20 \ bytes \\\\= \$ t5 + 5 \ words \\\\= \$ t 10 \ words \\\\

User Tkdave
by
5.7k points