Question

A digital computer has a memory unit with 32 bits per word. The instruction set consists of 150 different operations. All instructions have an operation code part (opcode), a register operand part (specifying one of 10 different registers) and a memory operand address part. Each instruction is stored in one word of memory.

(d) Can an instruction for this computer use (i) two memory operands and (ii) two register operands? If it can, explain how; if it cannot, explain why not.

I'm really not sure about this question. I think the answer to the first part is that an instruction be using two memory operands if a specified register contains a memory address and the instruction is something like ADD? Or am I not understanding the question?

As for (ii), I feel that the answer must be that it can, but I'm not sure how it's done and don't know how to search for the answer. edit: is the answer simply that a register operand can be placed in the memory operand part of the instruction?

Was it helpful?

Solution

From the instruction encoding it follows that of the 32 bits that every instruction occupies, 8 are used to encode the instruction/operation, 4 are used to encode a register and the remaining 20 are used to encode an address in memory.

Given the above, I see no reason why there can't be an instruction such as ADD, OR, MOV, XCHG, etc etc that would manipulate 2 memory operands, whose addresses are in those 20 bits and the register selected by those other 4 bits.

Likewise, I see no reason why the registers can't reside in the main memory and be selected by either the 4 bit field of the instruction or the appropriate address in the 20 bit field of the instruction. There exist many CPUs whose registers don't have storage separate from the main memory and are just fixed locations of the main memory.

The problem, as stated, allows for yes being the answer to both questions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top