-2

Question:

For a 16 bit word with 6 bits for an opcode

  • How many different instructions could I fit into the instruction set?
  • What is the largest number that I could use as data?

Answer:

  • Number of instructions: 26 = 64
  • largest operand: 210 - 1 = 1023

Source

My question is how did they calculated 210 from 16 bit word?

Nicol Bolas
  • 11,813
  • 4
  • 37
  • 46
mertyildiran
  • 265
  • 1
  • 3
  • 8
  • 2^10-1 = 1023. There are 1024 possible values for 10-bit numbers, but since 0 is usually included, then we think of 10 bits as capable of representing 0 to 1023. Or, -512 to 511 if we have a signed 10-bit number. – Erik Eidt Jul 19 '16 at 23:56
  • Possible duplicate of [How do we go from assembly to machine code(code generation)](http://programmers.stackexchange.com/questions/227983/how-do-we-go-from-assembly-to-machine-codecode-generation) – gnat Jul 20 '16 at 06:32

1 Answers1

4

If a number takes up 16 bits, and you use 6 of them for something, that leaves 10 bits.

Nicol Bolas
  • 11,813
  • 4
  • 37
  • 46
  • Could you explain the difference between 16 bits and 16 bit word. – mertyildiran Jul 19 '16 at 22:31
  • 2
    This is like asking "what is the difference between 'red' and 'a red cat'". A 16 bit word is a word that consists of 16 bits. – Stephen C Jul 19 '16 at 22:34
  • Oh so that means "word" is the the instruction set size. I didn't know that, I'm ignorant about machine level sorry for bad question. – mertyildiran Jul 19 '16 at 22:38
  • 2
    We think of bytes as 8 bits now, but in the octal days some systems had 6 or 9 bits because it made sense then. They are all correctly called a byte. An x86 machine calls a word 16 bits, an arm calls a words 32 bits, doesnt necessarily have anything to do with their register nor instruction nor address bus sizes, just someone there decided to use that convention. Because of the different conventions we now sometimes have to use terms like 16 bit word and 32 bit word if there is not enough context to just say word or byte or double word. – old_timer Jul 21 '16 at 01:59