What is the machine code that corresponds to the AVR Assembly
Language Instruction
and r31, r0
(Enter your answer as a 16 bit binary number. There must be no
spaces or punctuation marks - just enter sixteen 1's or 0's.)
Convert the following AVR Assembly Language Instruction to machine code:
and r31, r0
Answer: 0010000111110000 (Binary)
Description:
• Instruction: and - Logical AND
• Instruction Format: and Rd, Rr
The above instruction performs the Logical AND between Rd and Rr register and place the result in Rd register. Here, 0 ≤ r ≤ 31 and 0 ≤ d ≤ 31.
Rd ← Rd • Rr or Rd ← Rd AND Rr
• 16-bit opcode: and r31, r0
• Here, opcode for and is: 001000 (bits 15 - 10)
• Register Rr = r0. So, r rrrr is 00000 (bit 9 and bits 3 - 0)
• Register Rd = r31. So, d dddd is 11111 (bits 8 - 4)
• So, 16-bit Binary machine code is: 0010000111110000.
Hexadecimal: 0x21F0
Get Answers For Free
Most questions answered within 1 hours.