So I went to my prof. for help with a particular problem and this is the answer I got. I understand the majority of the answer but I have a few more pointed questions.
4. (6 points)
A computer has 32-bit instructions and 12-bit addresses. Suppose there are 250 two-address
instructions. How many one-address instructions can be formulated? Explain your answer.
There are 250 2-address instructions. There are only a total of 256 2-address
instructions allowed if we have 32-bit instructions (two addresses take up 24 bits,
leaving only 8 bits for the opcode). Looking at the 8 bit opcode, assume bit patterns
00000000 (0) through 11111001 (249) are used for the 250 two-address instructions.
Then there are 6 bit patterns left for one address instructions. However, each one of
these can use the remaining 12 bits gained from having only one operand, so we
have 6 * 2^12 one address instructions.
1. Alright, I'm not sure how we determined a grand total of 256 total 2-address instructions allowed. I assume it has to do with the fact we have 32 bits at our disposal.
2. Are the bit patterns she chose just arbitrary? **00000000 (0) through 11111001 (249)**
3. I understand there are 6 bit patterns left. I have 12 bits left after giving 12 to an address and 8 to an opcode, which leads to having 6 * 2^12 one address instructions. So how can I use this logic to figure out how many two address instructions I could theoretically have in total? (obviously the answer is 256 but I'm not sure how I'd reach that number)
Thanks in advance, this will really help me understanding basic concepts before programming more advanced C and Assembly projects