2021-02-08 06:46:00 +01:00
|
|
|
/*
|
2022-11-08 17:28:56 +01:00
|
|
|
* Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Reserved.
|
2021-02-08 06:46:00 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HEXAGON_INSN_H
|
|
|
|
#define HEXAGON_INSN_H
|
|
|
|
|
|
|
|
#include "cpu.h"
|
|
|
|
|
|
|
|
#define INSTRUCTIONS_MAX 7 /* 2 pairs + loopend */
|
|
|
|
#define REG_OPERANDS_MAX 5
|
|
|
|
#define IMMEDS_MAX 2
|
|
|
|
|
|
|
|
struct Instruction;
|
|
|
|
struct Packet;
|
|
|
|
struct DisasContext;
|
|
|
|
|
2022-11-08 17:28:56 +01:00
|
|
|
typedef void (*SemanticInsn)(struct DisasContext *ctx);
|
2021-02-08 06:46:00 +01:00
|
|
|
|
|
|
|
struct Instruction {
|
|
|
|
SemanticInsn generate; /* pointer to genptr routine */
|
|
|
|
uint8_t regno[REG_OPERANDS_MAX]; /* reg operands including predicates */
|
|
|
|
uint16_t opcode;
|
|
|
|
|
|
|
|
uint32_t iclass:6;
|
|
|
|
uint32_t slot:3;
|
2021-04-09 03:07:35 +02:00
|
|
|
uint32_t which_extended:1; /* If has an extender, which immediate */
|
|
|
|
uint32_t new_value_producer_slot:4;
|
|
|
|
|
|
|
|
bool part1; /*
|
2021-02-08 06:46:00 +01:00
|
|
|
* cmp-jumps are split into two insns.
|
|
|
|
* set for the compare and clear for the jump
|
|
|
|
*/
|
2021-04-09 03:07:35 +02:00
|
|
|
bool extension_valid; /* Has a constant extender attached */
|
|
|
|
bool is_endloop; /* This is an end of loop */
|
2021-02-08 06:46:00 +01:00
|
|
|
int32_t immed[IMMEDS_MAX]; /* immediate field */
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct Instruction Insn;
|
|
|
|
|
|
|
|
struct Packet {
|
|
|
|
uint16_t num_insns;
|
|
|
|
uint16_t encod_pkt_size_in_bytes;
|
2022-11-08 17:29:00 +01:00
|
|
|
uint32_t pc;
|
2021-02-08 06:46:00 +01:00
|
|
|
|
|
|
|
/* Pre-decodes about COF */
|
2021-04-09 03:07:35 +02:00
|
|
|
bool pkt_has_cof; /* Has any change-of-flow */
|
2022-11-08 17:28:59 +01:00
|
|
|
bool pkt_has_multi_cof; /* Has more than one change-of-flow */
|
2021-04-09 03:07:35 +02:00
|
|
|
bool pkt_has_endloop;
|
2021-02-08 06:46:00 +01:00
|
|
|
|
2021-04-09 03:07:35 +02:00
|
|
|
bool pkt_has_dczeroa;
|
2021-02-08 06:46:00 +01:00
|
|
|
|
2021-04-09 03:07:35 +02:00
|
|
|
bool pkt_has_store_s0;
|
|
|
|
bool pkt_has_store_s1;
|
2021-02-08 06:46:00 +01:00
|
|
|
|
2021-03-17 17:48:57 +01:00
|
|
|
bool pkt_has_hvx;
|
|
|
|
Insn *vhist_insn;
|
|
|
|
|
2021-02-08 06:46:00 +01:00
|
|
|
Insn insn[INSTRUCTIONS_MAX];
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct Packet Packet;
|
|
|
|
|
|
|
|
#endif
|