You are designing an instruction set for your computer. All the instructions are of same size (11 bits long). The size of an address field is 4 bits. You have already designed six 2-address instructions and 30 1-address instructions. How many 0-address instructions still you can fit? Justify your answer.

Think about how many different combinations of zeros and ones exist in eleven bits, then subtract the number of patterns taken up by the existing instructions.

although i know the answer to life is 42. your answer is 79

```
000000000 1 cache flush instruction*
000000 iiiii 31 zero addresses (range 1 -> 31)
00 iiiii zzzz 30 addresses of zzzz (iiiii range 2 -> 31)
01 i yyyy zzzz 2 addresses of yyyy:zzzz
1 ii yyyy zzzz 4 addresses of yyyy:zzzz (6 * two addresses)
* CPU Errata: it was determined that this instruction set
has a security vulnerability (spectre NG), therefore 1 additional
instruction is needed to prevent speculation
```

1 Like