Yes, this is a homework question, I've tried working it out and was hoping I could get pointed in the right direction.
Here's the question:
You are designing the instruction set for a new type of computer. The computer has 64 instructions, 16 general-purpose registers. It supports a byte-addressable memory of up-to 32MB. Answer the following questions. a. For a 3-operand ADD instruction that only uses register addressing mode, how long (number of bits) should the instruction be? b. For a 2-operand ADD instruction, in which one of the operands is a memory location with direct addressing mode, how long (number of bits) should the instruction be?
I know the question's been asked recently but both questions and answers weren't helpful.
I know that with 64 instructions and 16 registers, there must be 4 bits per register. I don't exactly know the usage for the 32MB memory right now.
A similar example of part (a) exists on wikipedia, where it states 4 instructions are needed for a 3-operand register addressing mode (load reg1 into a, load reg2 into b, add reg1 and reg2 to reg3, store reg3 in c). Because it mentions 4 instructions, I thought that would be 1 bit, but that's a really small amount. There are 3 registers used in the instruction, which would be 12 bits.
For part (b), I believe one is a memory location with direct addressing mode (as stated) and the other is like part (a), using register addressing mode. There are only two operands, but only one is using register addressing mode, meaning only one register is used? In that case, the length of the instruction should be 4 bits.
I would appreciate any help! If I'm misunderstanding some of the terms please let me know! Thanks!