-1

I know that MARIE's instruction set has 16-bit per instruction, given that there are 9 instructions, doesn't it make sense that 16*9 = 144bits are needed to store all of the instruction? But apparently its wrong, whats wrong with my reasoning and can you guide me to the answer?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • 2
    9 instructions require `ceil(log2(9))` = 4 bits. The other 12 bits are probably used for operands. – Paul R Nov 26 '20 at 07:45
  • 1
    That's generally not what that phrasing means. I assume they're asking how wide a *single* instruction needs to be (since they're fixed-width), not to store one copy of each instruction. It's a weird question because using fewer bits would leave less room for memory addresses or branch displacements. – Peter Cordes Nov 26 '20 at 07:49
  • V=2^N, and, N=log2(V), where V is the number of different values that can be represented in N number of bits, and, 2 is for binary. So, 16=2^4, meaning 16 different values can be represented by 4 bits in binary. – Erik Eidt Nov 26 '20 at 15:38

1 Answers1

0

I think you are looking for the following data structure

-------------------------------------
| Opcode  | Address                 |
-------------------------------------
| _ _ _ _ | _ _ _ _ _ _ _ _ _ _ _ _ |
-------------------------------------
  Bit Bit   Bit                 Bit
   15  12    11                   0

as Paul R and Peter Cordes already mentioned in his comments.

U880D
  • 8,601
  • 6
  • 24
  • 40