C8 Computer organization · Practice
Machine code and instruction encoding
Problems dealt one at a time, with new numbers every time. The kinds you miss come back more often, and you can keep going as long as you like.
0 solved
0 in a row
0 of 10 kinds solid
Check
Encode addi x10, x0, 7 as eight hex digits.
Check
Encode add x10, x2, x12 (R-type, opcode 0x33, funct3 and funct7 zero).
Check
What destination register number (rd) does the instruction 00812503 write?
Check
What is the opcode of 00812503, in hex?
Check
A field holds a 20-bit two's-complement immediate. What is the largest value it can hold?
Check
lui a0, 4096 is followed by addi a0, a0, 100. What value does a0 hold?
Check
Encode addi x10, x2, 2000 (I-type: imm in bits 31:20, rs1 in 19:15, funct3 000, rd in 11:7, opcode 0x13).
(a)
What's the 32-bit encoding?
(b)
What does bits 31:24 of that word hold, as a number? (They're the top 8 bits of the 12-bit immediate.)
Check
What is rd = x5 shifted into its field (bits 11:7), as a 32-bit word?
Check
How many different values does a 7-bit field hold?
Check
Write the 12-bit immediate field for −16 in hex.
A kind of problem counts as solid once you've got it right on the first try twice in a row. Back to the lesson · Practice every topic in C8