I'm interested to know what this assembly code do knowing that X1 is full of zeroes.
ori X2, X0, 0xFFF
slli X2, X2, 12
ori X2, X2, 0xFFF
slli X2, X2, 8
ori X2, X2, 0xFF
xor X2, X2, X1
addi X2, X2, 1
and X2, X2, X1
The problem is that I don't understand what 0xFFF and 0xFF are. How am I supposed to know their values at all?
Best Answer
These look like instructions for a RISC-V microprocessor.
https://riscv.org/wp-content/uploads/2017/05/riscv-spec-v2.2.pdf
These are integer literal values written in hexadecimal. The value shown literally is their value. We can guess based on the fact that these are all literal type instructions that the numeric operands are literals rather than a memory address.
Writing the numbers in hexadecimal improves the readability of the code. Especially because the code contains several bit-wise instructions.
Note that the X0 register is a hardwired zero per page 109 of the "RISC-V User-Level ISA V2.2".