riscv-formal-nmigen/rvfi/insns/README.md

120 lines
4.7 KiB
Markdown
Raw Normal View History

2020-08-11 10:08:11 +08:00
# RISC-V Instructions
## Instructions
2020-08-11 10:08:11 +08:00
Below is a table of RISC-V instructions supported by the original riscv-formal framework at the time of writing, categorized by instruction type.
| Instruction type | Instructions |
| --- | --- |
| R-type | ADD, ADDW, AND, DIV, DIVU, DIVUW, DIVW, MUL, MULH, MULHSU, MULHU, MULW, OR, REM, REMU, REMUW, REMW, SLL, SLLW, SLT, SLTU, SRA, SRAW, SRL, SRLW, SUB, SUBW, XOR |
| I-type | ADDI, ADDIW, ANDI, JALR, LB, LBU, LD, LH, LHU, LW, LWU, ORI, SLTI, SLTIU, XORI |
| I-type (shift variation) | SLLI, SLLIW, SRAI, SRAIW, SRLI, SRLIW |
| S-type | SB, SD, SH, SW |
| SB-type | BEQ, BGE, BGEU, BLT, BLTU, BNE |
| U-type | AUIPC, LUI |
2020-08-06 16:44:54 +08:00
| UJ-type | JAL |
| CI-type | C\_ADD, C\_ADDI, C\_ADDIW, C\_JALR, C\_JR, C\_LI, C\_MV |
| CI-type (SP variation) | C\_ADDI16SP |
| CI-type (ANDI variation) | C\_ANDI |
| CI-type (LSP variation, 32 bit version) | C\_LWSP |
| CI-type (LSP variation, 64 bit version) | C\_LDSP |
| CI-type (LUI variation) | C\_LUI |
| CI-type (SLI variation) | C\_SLLI |
| CI-type (SRI variation) | C\_SRAI, C\_SRLI |
| CIW-type | C\_ADDI4SPN |
| CS-type (ALU version) | C\_ADDW, C\_AND, C\_OR, C\_SUB, C\_SUBW, C\_XOR |
| CS-type (32 bit version) | C\_SW |
| CS-type (64 bit version) | C\_SD |
| CSS-type (32 bit version) | C\_SWSP |
| CSS-type (64 bit version) | C\_SDSP |
| CB-type | C\_BEQZ, C\_BNEZ |
| CJ-type | C\_J, C\_JAL |
| CL-type (32 bit version) | C\_LW |
| CL-type (64 bit version) | C\_LD |
2020-08-07 12:54:31 +08:00
## Class Synopsis
2020-08-13 12:19:40 +08:00
### Instructions
2020-08-11 10:08:11 +08:00
Below is a list of instructions currently supported by this port of the riscv-formal framework and is expected to grow over time. The instructions are roughly grouped by instruction type but sometimes with further specializations - the hierarchy of the lists reflects the hierarchy of inheritance in the classes used to represent various instructions.
2020-08-07 12:54:31 +08:00
- `Insn`: General RISC-V instruction
2020-08-07 16:06:15 +08:00
- `InsnRV32IRType`: RV32I R-Type Instruction
- `InsnAdd`: ADD instruction
- `InsnSub`: SUB instruction
- `InsnSll`: SLL instruction
- `InsnSlt`: SLT instruction
- `InsnSltu`: SLTU instruction
- `InsnXor`: XOR instruction
- `InsnSrl`: SRL instruction
- `InsnSra`: SRA instruction
- `InsnOr`: OR instruction
- `InsnAnd`: AND instruction
2020-08-10 12:59:00 +08:00
- `InsnRV32IITypeShift`: RV32I I-Type Instruction (Shift Variation)
- `InsnSlli`: SLLI instruction
- `InsnSrli`: SRLI instruction
- `InsnSrai`: SRAI instruction
2020-08-10 14:14:40 +08:00
- `InsnRV32IIType`: RV32I I-Type Instruction
- `InsnJalr`: JALR instruction
2020-08-10 16:47:09 +08:00
- `InsnRV32IITypeLoad`: RV32I I-Type Instruction (Load Variation)
- `InsnLb`: LB instruction
- `InsnLh`: LH instruction
- `InsnLw`: LW instruction
- `InsnLbu`: LBU instruction
- `InsnLhu`: LHU instruction
2020-08-10 17:37:47 +08:00
- `InsnRV32IITypeArith`: RV32I I-Type Instruction (Arithmetic Variation)
- `InsnAddi`: ADDI instruction
- `InsnSlti`: SLTI instruction
- `InsnSltiu`: SLTIU instruction
- `InsnXori`: XORI instruction
- `InsnOri`: ORI instruction
- `InsnAndi`: ANDI instruction
2020-08-11 14:54:27 +08:00
- `InsnRV32ISType`: RV32I S-Type Instruction
- `InsnSb`: SB instruction
- `InsnSh`: SH instruction
- `InsnSw`: SW instruction
2020-08-11 16:59:02 +08:00
- `InsnRV32ISBType`: RV32I SB-Type Instruction
- `InsnBeq`: BEQ instruction
- `InsnBne`: BNE instruction
- `InsnBlt`: BLT instruction
- `InsnBge`: BGE instruction
- `InsnBltu`: BLTU instruction
- `InsnBgeu`: BGEU instruction
2020-08-11 17:12:27 +08:00
- `InsnJal`: JAL instruction
2020-08-11 17:33:50 +08:00
- `InsnRV32IUType`: RV32I U-Type Instruction
- `InsnLui`: LUI instruction
- `InsnAuipc`: AUIPC instruction
2020-08-26 17:21:27 +08:00
- `InsnRV32MRType`: RV32M R-Type Instruction
- `InsnMul`: MUL instruction
- `InsnMulh`: MULH instruction
- `InsnMulhsu`: MULHSU instruction
- `InsnMulhu`: MULHU instruction
- `InsnDiv`: DIV instruction
- `InsnDivu`: DIVU instruction
- `InsnRem`: REM instruction
- `InsnRemu`: REMU instruction
2020-08-27 12:30:57 +08:00
- `InsnRV64IIType`: RV64I I-Type Instruction
- `InsnRV64IITypeLoad`: RV64I I-Type Instruction (Load Variation)
- `InsnLwu`: LWU instruction
- `InsnLd`: LD instruction
2020-08-27 13:12:23 +08:00
- `InsnAddiw`: ADDIW instruction
2020-08-27 12:54:28 +08:00
- `InsnSd`: SD instruction
2020-08-13 12:19:40 +08:00
### ISAs
2020-08-13 14:28:42 +08:00
- `IsaRV32I`: RV32I Base ISA
2020-08-27 10:32:49 +08:00
- `IsaRV32M`: RV32M Standard Extension
2020-08-13 12:19:40 +08:00
2020-08-21 10:33:02 +08:00
## Core-specific parameters
2020-08-13 12:19:40 +08:00
2020-08-21 10:33:02 +08:00
The following core-specific parameters are currently supported:
2020-08-13 12:19:40 +08:00
| Parameter | Description | Valid value(s) |
2020-08-21 10:33:02 +08:00
| --- | --- | --- |
| `params.ilen` | Max length of instruction retired by core | `32` |
| `params.xlen` | Width of integer registers | `32` |
| `params.csr_misa` | Support for MISA CSRs enabled | `True`, `False` |
| `params.compressed` | Support for compressed instructions | `True`, `False` |
| `params.aligned_mem` | Require aligned memory accesses | `True`, `False` |
2020-08-26 17:21:27 +08:00
| `params.altops` | Use alternative operations for multiplication/division | `True`, `False` |