358 views
A computer has 170 different operations. Word size is 4 bytes one word instructions requires two address fields. One address for register and one address for memory. If there are 37 registers then the memory size is ______________(in KB).

Ans. 256KB
| 358 views
0

Instruction:-        Opcode , Register , Memory

Opcode bits = 8 bit

Register = 6 bit

So Memory = 32-8-6 = 18 Bits

So size of Memory :- 2^18 * 4 Byte (Because every word is of 4B)

Hence Size of Memory = 1024 KB

Please tell where i am wrong ?
+2

So size of Memory :- 2^18 * 4 Byte (Because every word is of 4B)

This is not correct.
Why you are multiplying by 4 when you have already converted 4 bytes to 32 bits above.
Memory size will be $2^{18} = 256 KB$

0
Here a word is divided into 3 fields right, a word is of 32 bit the remaining bits represent the memory word i.e. 18 bits, so total 2^18 words are there, but i should also multiply with 4 n.a. because a word is comprised of 4 bytes.

+1

No No..

The remaining bits represent the memory word i.e. 18 bits, so total $2^{18}$ words are there,​​​​

Where is it written that memory is word addressable so you are giving these addresses to words?
Always consider byte addressability unless otherwise specified.
So each byte will take a different address.
A memory address is of 18 bits. So with these 18 bits $2^{18}$ different addresses are possible and each of which is given to a different Byte of memory so memory size is $256 KB$

0
I know that, but when I say memory is of k bits it means that total 2^k words are present and by default every word is of 1 bytes so total 2^k bytes are there,with address given to every byte.

Say I have memory of k bits and every word is of 4Byte. Then can't I say total words are 2^k and each word is of 4 Byte. While giving address to each byte the total bytes would be 2^(k+2).

Please correct me @ Soumya if I am wrong somewhere :)
+2

@Na462(I don't know your real name) :)

when I say memory is of k bits it means that total 2^k words are present and by default every word is of 1 bytes so total 2^k bytes are there,with address given to every byte.

There is nothing like that.
By default, we consider memory is Byte Addressable. So when you say memory address is of k bits, it means $2^k$ bytes are there.
And if say word size is 4 byte then $\frac{2^k}{4}=2^{k-2} \ words$ are there.

But if it is given in the question that memory is word addressable then only you can say that memory address is of k bits, it means $2^k$ words are there.
And if say word size is 4 byte then $2^k*4=2^{k+2} \ bytes$ are there.

+1
Oh thanku so much Soumya that was really important thing you corrected in me. Thanx a lot :) by Boss (36.5k points)
selected
0
How that op and reg are 8 and 6
0
opcode represent the what type of operation which it is and it is given that there are 170 instructions so to represent 170 instructions we need 8 bits.

there are 37 registers to represent those registers we need 6 bits .