Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2004, Psyent Corporation <www.psyent.com> |
| 4 | * Scott McNutt <smcnutt@psyent.com> |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __ASM_NIOS2_OPCODES_H_ |
| 8 | #define __ASM_NIOS2_OPCODES_H_ |
| 9 | |
| 10 | #define OPCODE_OP(inst) ((inst) & 0x3f) |
| 11 | #define OPCODE_OPX(inst) (((inst)>>11) & 0x3f) |
| 12 | #define OPCODE_RA(inst) (((inst)>>27) & 01f) |
| 13 | #define OPCODE_RB(inst) (((inst)>>22) & 01f) |
| 14 | #define OPCODE_RC(inst) (((inst)>>17) & 01f) |
| 15 | |
| 16 | /* I-TYPE (immediate) and J-TYPE (jump) opcodes |
| 17 | */ |
| 18 | #define OPCODE_CALL 0x00 |
| 19 | #define OPCODE_LDBU 0x03 |
| 20 | #define OPCODE_ADDI 0x04 |
| 21 | #define OPCODE_STB 0x05 |
| 22 | #define OPCODE_BR 0x06 |
| 23 | #define OPCODE_LDB 0x07 |
| 24 | #define OPCODE_CMPGEI 0x08 |
| 25 | #define OPCODE_LDHU 0x0B |
| 26 | #define OPCODE_ANDI 0x0C |
| 27 | #define OPCODE_STH 0x0D |
| 28 | #define OPCODE_BGE 0x0E |
| 29 | #define OPCODE_LDH 0x0F |
| 30 | #define OPCODE_CMPLTI 0x10 |
| 31 | #define OPCODE_XORI 0x1C |
| 32 | #define OPCODE_ORI 0x14 |
| 33 | #define OPCODE_STW 0x15 |
| 34 | #define OPCODE_BLT 0x16 |
| 35 | #define OPCODE_LDW 0x17 |
| 36 | #define OPCODE_CMPNEI 0x18 |
| 37 | #define OPCODE_BNE 0x1E |
| 38 | #define OPCODE_CMPEQI 0x20 |
| 39 | #define OPCODE_LDBUIO 0x23 |
| 40 | #define OPCODE_MULI 0x24 |
| 41 | #define OPCODE_STBIO 0x25 |
| 42 | #define OPCODE_BEQ 0x26 |
| 43 | #define OPCODE_LDBIO 0x27 |
| 44 | #define OPCODE_CMPGEUI 0x28 |
| 45 | #define OPCODE_ANDHI 0x2C |
| 46 | #define OPCODE_STHIO 0x2D |
| 47 | #define OPCODE_BGEU 0x2E |
| 48 | #define OPCODE_LDHIO 0x2F |
| 49 | #define OPCODE_CMPLTUI 0x30 |
| 50 | #define OPCODE_CUSTOM 0x32 |
| 51 | #define OPCODE_INITD 0x33 |
| 52 | #define OPCODE_ORHI 0x34 |
| 53 | #define OPCODE_STWIO 0x35 |
| 54 | #define OPCODE_BLTU 0x36 |
| 55 | #define OPCODE_LDWIO 0x37 |
| 56 | #define OPCODE_RTYPE 0x3A |
| 57 | #define OPCODE_LDHUIO 0x2B |
| 58 | #define OPCODE_FLUSHD 0x3B |
| 59 | #define OPCODE_XORHI 0x3C |
| 60 | |
| 61 | /* R-Type (register) OPX field encodings |
| 62 | */ |
| 63 | #define OPCODE_ERET 0x01 |
| 64 | #define OPCODE_ROLI 0x02 |
| 65 | #define OPCODE_ROL 0x03 |
| 66 | #define OPCODE_FLUSHP 0x04 |
| 67 | #define OPCODE_RET 0x05 |
| 68 | #define OPCODE_NOR 0x06 |
| 69 | #define OPCODE_MULXUU 0x07 |
| 70 | #define OPCODE_CMPGE 0x08 |
| 71 | #define OPCODE_BRET 0x09 |
| 72 | #define OPCODE_ROR 0x0B |
| 73 | #define OPCODE_FLUSHI 0x0C |
| 74 | #define OPCODE_JMP 0x0D |
| 75 | #define OPCODE_AND 0x0E |
| 76 | |
| 77 | #define OPCODE_CMPLT 0x10 |
| 78 | #define OPCODE_SLLI 0x12 |
| 79 | #define OPCODE_SLL 0x13 |
| 80 | #define OPCODE_OR 0x16 |
| 81 | #define OPCODE_MULXSU 0x17 |
| 82 | #define OPCODE_CMPNE 0x18 |
| 83 | #define OPCODE_SRLI 0x1A |
| 84 | #define OPCODE_SRL 0x1B |
| 85 | #define OPCODE_NEXTPC 0x1C |
| 86 | #define OPCODE_CALLR 0x1D |
| 87 | #define OPCODE_XOR 0x1E |
| 88 | #define OPCODE_MULXSS 0x1F |
| 89 | |
| 90 | #define OPCODE_CMPEQ 0x20 |
| 91 | #define OPCODE_CMPLTU 0x30 |
| 92 | #define OPCODE_ADD 0x31 |
| 93 | #define OPCODE_DIVU 0x24 |
| 94 | #define OPCODE_DIV 0x25 |
| 95 | #define OPCODE_RDCTL 0x26 |
| 96 | #define OPCODE_MUL 0x27 |
| 97 | #define OPCODE_CMPGEU 0x28 |
| 98 | #define OPCODE_TRAP 0x2D |
| 99 | #define OPCODE_WRCTL 0x2E |
| 100 | |
| 101 | #define OPCODE_BREAK 0x34 |
| 102 | #define OPCODE_SYNC 0x36 |
| 103 | #define OPCODE_INITI 0x29 |
| 104 | #define OPCODE_SUB 0x39 |
| 105 | #define OPCODE_SRAI 0x3A |
| 106 | #define OPCODE_SRA 0x3B |
| 107 | |
| 108 | /*Full instruction encodings for R-Type, without the R's ;-) |
| 109 | * |
| 110 | * TODO: BREAK, BRET, ERET, RET, SYNC (as needed) |
| 111 | */ |
| 112 | #define OPC_TRAP 0x003b683a |
| 113 | |
| 114 | #endif /* __ASM_NIOS2_OPCODES_H_ */ |