Encoding a signed immediate instruction

Encode addi x18, x9, -24 for an RV32I controller. The instruction's fields appear from most significant bit to least significant bit in this order:


Field

Width in bits

Immediate

12

Source register rs1

5

funct3

3

Destination register rd

5

Opcode

7


For addi, funct3 is 000 and the opcode is 0010011. Use 12-bit two's complement for the immediate.


Report the immediate field interpreted as an unsigned decimal integer, with no decimal places. Also report the complete 32-bit machine word as exactly eight hexadecimal digits, without a prefix or spaces.

Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Machine and Assembly Language Programming Questions: