- Information
- AI Chat
Was this document helpful?
RISC-V Refrence CARD - Green CARD
Course: Digital design (EC381)
8 Documents
Students shared 8 documents in this course
University: جامعة طرابلس
Was this document helpful?
RISC-V Instruction Set Summary "Green Card"
Figure B.1 RISC-V 32-bit instruction formats
Table B.1 RV32I: RISC-V integer instructions
op funct3 funct7 Type Instruction Description Operation
0000011 (3) 000 –Ilb rd, imm(rs1) load byte rd = SignExt([Address]7:0)
0000011 (3) 001 –Ilh rd, imm(rs1) load half rd = SignExt([Address]15:0)
0000011 (3) 010 –Ilw rd, imm(rs1) load word rd = [Address]31:0
0000011 (3) 100 –Ilbu rd, imm(rs1) load byte unsigned rd = ZeroExt([Address]7:0)
0000011 (3) 101 –Ilhu rd, imm(rs1) load half unsigned rd = ZeroExt([Address]15:0)
0010011 (19) 000 –Iaddi rd, rs1, imm add immediate rd = rs1 + SignExt(imm)
0010011 (19) 001 0000000*Islli rd, rs1, uimm shift left logical immediate rd = rs1 << uimm
0010011 (19) 010 –Islti rd, rs1, imm set less than immediate rd = (rs1 < SignExt(imm))
0010011 (19) 011 –Isltiu rd, rs1, imm set less than imm. unsigned rd = (rs1 < SignExt(imm))
0010011 (19) 100 –Ixori rd, rs1, imm xor immediate rd = rs1 ^ SignExt(imm)
0010011 (19) 101 0000000*Isrli rd, rs1, uimm shift right logical immediate rd = rs1 >> uimm
0010011 (19) 101 0100000*Israi rd, rs1, uimm shift right arithmetic imm. rd = rs1 >>> uimm
0010011 (19) 110 –Iori rd, rs1, imm or immediate rd = rs1 | SignExt(imm)
0010011 (19) 111 –Iandi rd, rs1, imm and immediate rd = rs1 & SignExt(imm)
0010111 (23) – – Uauipc rd, upimm add upper immediate to PC rd = {upimm, 12'b0} + PC
0100011 (35) 000 –Ssb rs2, imm(rs1) store byte [Address]7:0 = rs27:0
0100011 (35) 001 –Ssh rs2, imm(rs1) store half [Address]15:0 = rs215:0
0100011 (35) 010 –Ssw rs2, imm(rs1) store word [Address]31:0 = rs2
0110011 (51) 000 0000000 R add rd, rs1, rs2 add rd = rs1 + rs2
0110011 (51) 000 0100000 R sub rd, rs1, rs2 sub rd = rs1 — rs2
0110011 (51) 001 0000000 R sll rd, rs1, rs2 shift left logical rd = rs1 << rs24:0
0110011 (51) 010 0000000 R slt rd, rs1, rs2 set less than rd = (rs1 < rs2)
0110011 (51) 011 0000000 R sltu rd, rs1, rs2 set less than unsigned rd = (rs1 < rs2)
0110011 (51) 100 0000000 R xor rd, rs1, rs2 xor rd = rs1 ^ rs2
0110011 (51) 101 0000000 R srl rd, rs1, rs2 shift right logical rd = rs1 >> rs24:0
0110011 (51) 101 0100000 R sra rd, rs1, rs2 shift right arithmetic rd = rs1 >>> rs24:0
0110011 (51) 110 0000000 R or rd, rs1, rs2 or rd = rs1 | rs2
0110011 (51) 111 0000000 R and rd, rs1, rs2 and rd = rs1 & rs2
0110111 (55) – – Ului rd, upimm load upper immediate rd = {upimm, 12’b0}
1100011 (99) 000 –Bbeq rs1, rs2, label branch if = if (rs1 == rs2) PC = BTA
1100011 (99) 001 –Bbne rs1, rs2, label branch if ≠ if (rs1 ≠ rs2) PC = BTA
1100011 (99) 100 –Bblt rs1, rs2, label branch if < if (rs1 < rs2) PC = BTA
1100011 (99) 101 –Bbge rs1, rs2, label branch if ≥ if (rs1 ≥ rs2) PC = BTA
1100011 (99) 110 –Bbltu rs1, rs2, label branch if < unsigned if (rs1 < rs2) PC = BTA
1100011 (99) 111 –Bbgeu rs1, rs2, label branch if ≥ unsigned if (rs1 ≥ rs2) PC = BTA
1100111 (103) 000 –Ijalr rd, rs1, imm jump and link register PC = rs1 + SignExt(imm), rd = PC + 4
1101111 (111) – – Jjal rd, label jump and link PC = JTA, rd = PC + 4
• imm: signed immediate in imm11:0
• uimm: 5-bit unsigned immediate in imm4:0
• upimm: 20 upper bits of a 32-bit immediate, in imm31:12
• Address: memory address: rs1 + SignExt(imm11:0)
• [Address]: data at memory location Address
• BTA: branch target address: PC + SignExt({imm12:1, 1'b0})
• JTA: jump target address: PC + SignExt({imm20:1, 1'b0})
• label: text indicating instruction address
• SignExt: value sign-extended to 32 bits
• ZeroExt: value zero-extended to 32 bits
• csr: control and status register
*encoded in instr31:25, the upper seven bits of the immediate field