MASTER OF COMPUTER APPLICATIONS
Course Code : MCS-012
Course Title : Computer Organisation and Assembly Language Programming
Assignment Number : MCA(I)/012/Assignment/15-16
Maximum Marks : 100
Weightage : 25%
A hypothetical machine has 22 registers. Out of these 6 registers are used as segment registers. Assume that the machine uses segment registers to find physical address in the similar way as is done in 8086 processor. Remaining 16 registers are general purpose registers. All the registers and memory word for the machine are of 16 bits. The machine has 1 M Word RAM. An instruction of the machine is of 32 bits which includes opcode – 5 bits, addressing mode specification – 3 bits and remaining bits for specifying the operand addresses.
Each instruction contains at most two operand addresses – at most one memory operand and remaining register operand(s). What would be the size of memory address, if direct addressing is used? What would be the size of the direct register operand? The machine is to be used for calculations involving arrays and floating point numbers. Design five different types of addressing modes for this machine. Give justification of the selection of every addressing mode.
Total general purpose registers = 32
All Register equal size = 16 bits
Registers used as stack for subroutine calls = 16
Main memory = 1 M Word
Memory word size = 16 bits
Instructions size = one memory word = 16 bits
Opcode = 5 bits
Addressing mode = 3 bits
Remaining bits = operand addresses
Please note the following points:
- The opcode size is 5 bits. So, in general it will have 25 = 16 operations.
- There is three operand address machine.
- There are two bits for addressing modes. Therefore, there are 23 = 6 different addressing modes possible for this machine.
- The last field (8 – 32 bits = 24 bits) here is the operands or the addresses of operands field.
Each instruction contains at most two operand addresses – at most one memory operand and remaining register operand(s). Hence one register operand has to be involved in all Addressing modes, so we have to use first operand as Register for all modes and this will be common for all.
IMMEDIATE addressing mode:
ADD R 12 13 R = 12 + 13
In case of immediate operand the maximum size of the unsigned operand would be 210
DIRECT addressing mode:
ADD R A B R = A + B
In case it is an address of operand in memory, then the maximum physical memory size supported by this machine is 210 = 1 KB.
REGISTER addressing mode:
ADD R1 R2 R3 R1 = R2 + R3
There are 64 general purpose registers. Therefore, there is 64 = 26 (6-bits for Register address)
REGISTER INDIRECT addressing mode:
ADD R1 R2 R3 R1 = R2 + R3
ADD R1 (R2 ) (R3 ) R1 = (R2 ) + (R3 )
ADD R A B R = A + B
There are 64 general purpose registers. Therefore, there is 64 = 26(6-bits for Register address).