Answer
a) 0010 0011 0000 0100
b) 1011
c) 0010 1010 0101
Work Step by Step
Each machine instruction = 16 bits
- Opcode = first 4 bits
- Operand = remaining 12 bits
Hexadecimal digits → 4 bits each.
a)
1. Convert the first number to binary.
0x2 is equal to 2. In binary that is 0010 (8*0+4*0+2*1+1*0)
2. Convert the second number to binary.
0x3 is equal to 3. In binary that is 0011 (8*0+4*0+2*1+1*1)
3. Convert the third number to binary.
0x0 is equal to 0. In binary that is 0000 (8*0+4*0+2*0+1*0)
4. Convert the fourth number to binary.
0x4 is equal to 4. In binary that is 0100 (8*0+4*1+2*0+1*0)
5. Combine all numbers and the instruction of "0x2304" is "0010 0011 0000 0100" in binary.
We do not need to pad the answer with zeros, since it is already in 16 bits.
b)
Instruction: B2A5 → hex digits: B 2 A 5
Opcode = first hex digit = B
In binary: 1011
c)
Operand field of B2A5 → 12 bits
Operand = last 3 hex digits = 2 A 5
Convert each hex digit → 4-bit binary:
2 0010
A 1010
5 0101
Concatenate: 001010100101