GATE / CS ARCHIVE

GATE CSE 2016 SET 2 / QUESTION 31

GATE CSE 2016 Set 2 Q31

Computer Organization & Architecture · Instructions & Addressing Modes · Full GATE CSE 2016 Set 2 paper

GATE 2016 Set 2, Q31 2 marks · NAT
Report issue

Instructions & Addressing Modes

Question 31, GATE 2016: A machine has 64 registers and 12 instructions. Each instruction has opcode, two source registers, one destination register, and a 12-bit immediate. Instructions must be individually byte aligned. Find bytes used by 100 instructions.
Tap to enlarge
Answer & solution

Official answer: 500.0 : 500.0

Our answer: 500

Twelve opcodes need 4 bits; each of three register identifiers needs 6 bits for 64 registers; immediate uses 12. Total 34 bits per instruction. Byte alignment requires ceiling(34/8)=5 bytes per instruction, so 100 instructions occupy 500 bytes.

The bit fields require 4+6+6+6+12=34 bits. Individually byte-aligned storage rounds each instruction up to 40 bits, leaving six padding bits per instruction. Rounding only the aggregate 3400 bits would give 425 bytes but pack subsequent instructions at nonbyte boundaries, contrary to the stated alignment rule.

Original paper, page 33 · Answer key