assemblyencodinginstruction-setmarie

Instruction Encoding relating to MARIE Assembly language


I am dealing with the following problem:

A 1 address computer is one whose instruction can contain at most one operand address. MARIE is an example of such a computer. Typically each instruction is stored as a single word in the memory. Assume the following machine details.

(i) A word contains n bits, and k bits (k < n) are used to encode each opcode. The remaining bits are used to specify memory address(es).

(ii) There are 100 distinct opcodes in the ISA.

(iii) The largest program requires 128M words(128x2^20) of memory to run.

(a)What is the minimum value of k required? What is the minimum value of n required? Keeping minimum value of k, what is the maximum number of opcodes that can be used?

(b)If the size of each word must be an integer number of bytes, what is the minimum value of n required? What is largest memory that can be used in this computer then?

So far I have come up with a but I am a little ify about my answer: a) The minimum amount of k is 7 as to have 100 opcodes you would need 7 bits in the opcode field. The minimum number of n would be 9(I am not sure if this is 9 or 8 as the question says "Keeping the minimum value of k, k being opcode bits). I am also not sure if this question is implicitly saying that the word has 16 bits or are there more.

For b I am confused as to the nature of the question, is it saying the new word will have 8 bits or is the word made out of bits? Ex: 1 word(16 bits) is 2 integer bytes. Also I am a little confused as to what the maximum program size is used for(128M words) when trying to solve this problem.


Solution

  • You got the k=7 part correct. That of course provides space for 2^7=128 opcodes. As for the n, you need to consider how much memory you have to address. This is given as 128x2^20 words, which is 2^27, so you need at least n=27. The total instruction size is then 34, which is not a multiple of 8. If you round that up to 40, you get n=33, which gives maximum addressable memory 2^33=8G words.