Dark Mode

248 views

6 votes

Best answer

32 bit instructions - totally $2^{32}$ possible encodings (encodings with only address part being different are not separate instructions).

No. of encodings taken by 250 two address instructions $= 250 \times 2^{12} \times 2^{12}$.

Since nothing is given I assume no 0 address instructions and hence $2^{32} - 250 \times 2^{12} \times 2^{12}$ encodings are available for 1 address instructions. But of these $2^{12}$ of them are same due to address part. So, total number of 1 address instructions possible is

$\frac{2^{32} - 250 \times 2^{12} \times 2^{12}}{2^{12}} \\= 2^{20} - 250 \times 2^{12} \\= (250+6) \times 2^{12} - 250 \times 2^{12} \\= 6 \times 2^{12} \\= 2^{14}+ 2^13 \\= 16,384+8,192=24,576$

No. of encodings taken by 250 two address instructions $= 250 \times 2^{12} \times 2^{12}$.

Since nothing is given I assume no 0 address instructions and hence $2^{32} - 250 \times 2^{12} \times 2^{12}$ encodings are available for 1 address instructions. But of these $2^{12}$ of them are same due to address part. So, total number of 1 address instructions possible is

$\frac{2^{32} - 250 \times 2^{12} \times 2^{12}}{2^{12}} \\= 2^{20} - 250 \times 2^{12} \\= (250+6) \times 2^{12} - 250 \times 2^{12} \\= 6 \times 2^{12} \\= 2^{14}+ 2^13 \\= 16,384+8,192=24,576$

why the answer is not 6 ? please explain . instruction is of type opcode(8bits) address1(12bits) address2(12bits). i dont think we have to permute on address part . bcoz opcode is the one decide what type of instrcution it is not the address. Risc instrcution are of type opcode +mode+address for a instrcution.

0

4 votes

instruction is 32 bit , among them 8 bit opcode, 12 bit for address 1 , 12 bit for address 2 .

total 2^8 =256 combinations are there, among them 250 two address instructions , then 256-250= 6 combinations are used for one address instructions .

now maximum number of one address instructions are 6* 2^12 = 24, 576

total 2^8 =256 combinations are there, among them 250 two address instructions , then 256-250= 6 combinations are used for one address instructions .

now maximum number of one address instructions are 6* 2^12 = 24, 576

1 vote

8 | 12 | 12 |

Opcode | Operand1 | Operand2 |

Opcode = 8bits because total size = 32bits.

Opcode specifies how many different operations can be performed. In Layman's terms, you can think that Opcode tells you how many different instructions can be there.

See the last part of the answer for difference between an instruction and an instruction encoding

Here, Opcode = 8bits => 256 different instructions can exist.

250 of those are already taken by 2 Add. Instructions. (binary operations)

Hence, we're left with just 6 different instructions for unary operations (ie 1 Address Instructions)

Here, in the operand field, we still get 12 bits. This means $2^{12}$ different operands can be fused with 6 different instruction formats.

=> Encodings possible = $6*2^{12}$

=> $24,576$ (Answer)

An instruction is a command.

Like, multiply, add, move, load, store, increment.

An instruction encoding is the whole instruction specifically stated.

ie, multiply 2 and 3. Or, Load #666 in R2.

instructions that can be

formulatedare

If I have one instruction, say, ADD and two 12-bit operands

I can formulate various instructions like:

- 2 + 3
- 99 + 75
- 169 + 48

Each such "formulation" or an "instance" will be an encoding.

But all these are not distinct instructions because it's just addition.

Opcode specifies the type of instruction. Length of Opcode decides the number of instructions you can have.

Length of the whole instruction decides how many different formulations/encodings you can have.