Taylor Simpson | 3e47405 | 2021-02-07 23:46:00 -0600 | [diff] [blame] | 1 | /* |
Taylor Simpson | 1e53633 | 2022-11-08 08:28:56 -0800 | [diff] [blame] | 2 | * Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Reserved. |
Taylor Simpson | 3e47405 | 2021-02-07 23:46:00 -0600 | [diff] [blame] | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | #ifndef HEXAGON_INSN_H |
| 19 | #define HEXAGON_INSN_H |
| 20 | |
| 21 | #include "cpu.h" |
| 22 | |
| 23 | #define INSTRUCTIONS_MAX 7 /* 2 pairs + loopend */ |
| 24 | #define REG_OPERANDS_MAX 5 |
| 25 | #define IMMEDS_MAX 2 |
| 26 | |
| 27 | struct Instruction; |
| 28 | struct Packet; |
| 29 | struct DisasContext; |
| 30 | |
Taylor Simpson | 1e53633 | 2022-11-08 08:28:56 -0800 | [diff] [blame] | 31 | typedef void (*SemanticInsn)(struct DisasContext *ctx); |
Taylor Simpson | 3e47405 | 2021-02-07 23:46:00 -0600 | [diff] [blame] | 32 | |
| 33 | struct Instruction { |
| 34 | SemanticInsn generate; /* pointer to genptr routine */ |
| 35 | uint8_t regno[REG_OPERANDS_MAX]; /* reg operands including predicates */ |
| 36 | uint16_t opcode; |
| 37 | |
| 38 | uint32_t iclass:6; |
| 39 | uint32_t slot:3; |
Taylor Simpson | 92cfa25 | 2021-04-08 20:07:35 -0500 | [diff] [blame] | 40 | uint32_t which_extended:1; /* If has an extender, which immediate */ |
| 41 | uint32_t new_value_producer_slot:4; |
| 42 | |
| 43 | bool part1; /* |
Taylor Simpson | 3e47405 | 2021-02-07 23:46:00 -0600 | [diff] [blame] | 44 | * cmp-jumps are split into two insns. |
| 45 | * set for the compare and clear for the jump |
| 46 | */ |
Taylor Simpson | 92cfa25 | 2021-04-08 20:07:35 -0500 | [diff] [blame] | 47 | bool extension_valid; /* Has a constant extender attached */ |
| 48 | bool is_endloop; /* This is an end of loop */ |
Taylor Simpson | 3e47405 | 2021-02-07 23:46:00 -0600 | [diff] [blame] | 49 | int32_t immed[IMMEDS_MAX]; /* immediate field */ |
| 50 | }; |
| 51 | |
| 52 | typedef struct Instruction Insn; |
| 53 | |
| 54 | struct Packet { |
| 55 | uint16_t num_insns; |
| 56 | uint16_t encod_pkt_size_in_bytes; |
Taylor Simpson | 4008590 | 2022-11-08 08:29:00 -0800 | [diff] [blame] | 57 | uint32_t pc; |
Taylor Simpson | 3e47405 | 2021-02-07 23:46:00 -0600 | [diff] [blame] | 58 | |
| 59 | /* Pre-decodes about COF */ |
Taylor Simpson | 92cfa25 | 2021-04-08 20:07:35 -0500 | [diff] [blame] | 60 | bool pkt_has_cof; /* Has any change-of-flow */ |
Taylor Simpson | fb67c2b | 2022-11-08 08:28:59 -0800 | [diff] [blame] | 61 | bool pkt_has_multi_cof; /* Has more than one change-of-flow */ |
Taylor Simpson | 92cfa25 | 2021-04-08 20:07:35 -0500 | [diff] [blame] | 62 | bool pkt_has_endloop; |
Taylor Simpson | 3e47405 | 2021-02-07 23:46:00 -0600 | [diff] [blame] | 63 | |
Taylor Simpson | 92cfa25 | 2021-04-08 20:07:35 -0500 | [diff] [blame] | 64 | bool pkt_has_dczeroa; |
Taylor Simpson | 3e47405 | 2021-02-07 23:46:00 -0600 | [diff] [blame] | 65 | |
Taylor Simpson | 92cfa25 | 2021-04-08 20:07:35 -0500 | [diff] [blame] | 66 | bool pkt_has_store_s0; |
| 67 | bool pkt_has_store_s1; |
Taylor Simpson | 3e47405 | 2021-02-07 23:46:00 -0600 | [diff] [blame] | 68 | |
Taylor Simpson | a155953 | 2021-03-17 11:48:57 -0500 | [diff] [blame] | 69 | bool pkt_has_hvx; |
| 70 | Insn *vhist_insn; |
| 71 | |
Taylor Simpson | 3e47405 | 2021-02-07 23:46:00 -0600 | [diff] [blame] | 72 | Insn insn[INSTRUCTIONS_MAX]; |
| 73 | }; |
| 74 | |
| 75 | typedef struct Packet Packet; |
| 76 | |
| 77 | #endif |