Before even attempting to read or write assembly language you need to get the documentation. For the instruction set you are using, is this a MIPS question (the image you posted) or a risc-v question as documented in the text of the title, etc?
Assuming risc-v go to risc-v.org and follow the links to the documentation, they have made it extremely easy to find.
LUI in risc-v is defined as such
33222222222211111111 11
10987654321098765432 10987 6543210
imm[31:12] rd opcode
bits 31:12 of the instruction are the immediate
bits 11:7 of the instruction are the destination register
bits 6:0 of the instruction are the opcode
Obviously every instruction needs some bits for the processor to decode to know
what instruction it is, only one can have the pattern zero so there are non-zero
bits in most opcodes. Likewise you need a destination register, where the value
get stored, encoded in the instruction as well.
LUI (load upper immediate) is used to build 32-bit constants and uses the U-type format. LUI places the U-immediate value in the top 20 bits of the destination register rd, filling in the lowest 12 bits with zeros.
Painfully obvious how this instruction works.
I will admit the risc-v documentation could have been done better, finding the opcode...0b0110111 or 0x37.
Not sure what the confusion is about how humans read numbers
0b0110111 = 0x37 = 067 (octal) = 55 (decimal)
these all describe the same value, which all describe the same bit pattern in the instruction.
so that means they could have just put that in the instruction definition like everyone else.
33222222222211111111 11
10987654321098765432 10987 6543210
imm[31:12] rd 0110111
So knowing that we can for example construct
.word 0x12345137
assemble then disassemble
Disassembly of section .text:
00000000 <.text>:
0: 12345137 lui x2,0x12345
Okay, so let's try that forward:
.word 0x12345137
lui x2,0x12345
assemble and disassemble
Disassembly of section .text:
00000000 <.text>:
0: 12345137 lui x2,0x12345
4: 12345137 lui x2,0x12345
So there we go, instruction encoding solved.
LUI (load upper immediate) is used to build 32-bit constants and uses the U-type format. LUI places the U-immediate value in the top 20 bits of the destination register rd, filling in the lowest 12 bits with zeros.
So this was quite clear the 32 bit constant is in this case
0x12345000
gets stored in register x2 in this case.
Both the encoding and the operation of all of the instructions are defined, most should be easy to understand. The encoding is very straight forward and easy to understand.
Now if this was a MIPS question and not a risc-v question then in this case it is as equally easy to understand. The 16 bit immediate goes into bits 31:16 of the constant being constructed with bits 15:0 all being zeros and that constant being stored in the register encoded in the instruction. Along with an opcode so the processor can know what instruction this is.