A uni-processor system, having single core, has 8 general purpose registers. The machine has 256- byte RAM. The size of every register and memory word is 16 bits. The computer uses fixed length instructions of size 16 bits each. An instruction of the machine can have only one operand, which can be either a direct memory operand or a register operand. Both these operands use direct addressing. An instruction of a machine consists of bits for operation code, one bit for addressing mode, and bits for memory operand or register operand. The machine has about 128 different operation codes. The addressing mode bits specifies addressing mode as:
The special purpose registers, which are other than general purpose registers, are - Program Counter
(PC), Memory Address Register (MAR), Data Register (DR) and Flag registers (FR). The first
register of the general-purpose registers can be used as Accumulator Register. The size of Integer
operands on the machine may be assumed to be equal to the size of accumulator register. In order to
execute instructions the machine has another special register called Instruction Register (IR) of size
16 bits, as each instruction is of this size. Perform the following tasks for the machine. (Make and
state suitable assumptions, if any.)
1) Design suitable instruction formats for the machine. Specify the size of different fields that are needed in the instruction format. Also indicate how many bits of the instructions are unused for this machine. Explain your design of instruction format. Also indicate the size of each register.
2) List at least two valid instructions; put some valid data values in registers and memory locations; and demonstrate examples of different addressing modes for this machine.
(iii) Assuming that the instructions are first fetched to Instruction Register (IR), memory operand is brought to DR register and result of an operation is stored in the Accumulator register; write and explain the sequence of micro-operations that are required to fetch and execute an instruction, which performs addition of register operand to the accumulator register. Make and state suitable assumptions, if any.
Certainly! Let's tackle the problem step by step.
Given:
The instruction format can be designed as follows:
Thus, the layout of the instruction will be:
| Opcode (7 bits) | Addressing Mode (1 bit) | Operand (8 bits) |
No bits are unused in this format, as the sum of bits is precisely 16.
0000001 1 00000010
0000001
(Assume it's an ADD instruction)1
(register operand)00000010
(2nd register)0000010 0 00001111
0000010
(Assume it's a LOAD instruction)0
(memory operand)00001111
(address 15)Assume the operation is adding a register to the accumulator.
Fetch Phase:
MAR ← PC
(Load next instruction address into MAR)DR ← Memory[MAR]
(Fetch the instruction into DR)IR ← DR
(Move fetched instruction to the Instruction Register)PC ← PC + 1
(Increment PC for next instruction)Decode Phase:
Execute Phase for ADD (register operand):
Assuming the Accumulator is the first register:
RegisterIndex ← IR[Operand]
(Extract register index from IR)DR ← Register[RegisterIndex]
(Fetch the register operand)Accumulator ← Accumulator + DR
(Perform the addition)This design outlines an efficient use of bits in the instruction format and provides a clear path forward for managing executing operations in a simple machine model. Each step ensures that the machine can handle operations systematically and efficiently.
Answered By