⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 i370-opc.c

📁 基于4个mips核的noc设计
💻 C
📖 第 1 页 / 共 4 页
字号:
/* i370-opc.c -- Instruction 370 (ESA/390) architecture opcode list   Copyright 1994, 1999, 2000 Free Software Foundation, Inc.   PowerPC version written by Ian Lance Taylor, Cygnus Support   Rewritten for i370 ESA/390 support by Linas Vepstas <linas@linas.org> 1998, 1999This file is part of GDB, GAS, and the GNU binutils.GDB, GAS, and the GNU binutils are free software; you can redistributethem and/or modify them under the terms of the GNU General PublicLicense as published by the Free Software Foundation; either version2, or (at your option) any later version.GDB, GAS, and the GNU binutils are distributed in the hope that theywill be useful, but WITHOUT ANY WARRANTY; without even the impliedwarranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  Seethe GNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this file; see the file COPYING.  If not, write to the FreeSoftware Foundation, 59 Temple Place - Suite 330, Boston, MA02111-1307, USA.  */#include <stdio.h>#include "sysdep.h"#include "opcode/i370.h"/* This file holds the i370 opcode table.  The opcode table   includes almost all of the extended instruction mnemonics.  This   permits the disassembler to use them, and simplifies the assembler   logic, at the cost of increasing the table size.  The table is   strictly constant data, so the compiler should be able to put it in   the .text section.   This file also holds the operand table.  All knowledge about   inserting operands into instructions and vice-versa is kept in this   file.  *//* Local insertion and extraction functions.  */static i370_insn_t insert_ss_b2  PARAMS (( i370_insn_t, long, const char **));static i370_insn_t insert_ss_d2  PARAMS (( i370_insn_t, long, const char **));static i370_insn_t insert_rxf_r3  PARAMS (( i370_insn_t, long, const char **));static long extract_ss_b2 PARAMS (( i370_insn_t, int *));static long extract_ss_d2 PARAMS (( i370_insn_t, int *));static long extract_rxf_r3 PARAMS (( i370_insn_t, int *));/* The operands table.   The fields are bits, shift, insert, extract, flags, name.   The types:   I370_OPERAND_GPR register, must name a register, must be present   I370_OPERAND_RELATIVE displacement or legnth field, must be present   I370_OPERAND_BASE base register; if present, must name a register                      if absent, should take value of zero   I370_OPERAND_INDEX index register; if present, must name a register                      if absent, should take value of zero   I370_OPERAND_OPTIONAL other optional operand (usuall reg?)*/const struct i370_operand i370_operands[] ={  /* The zero index is used to indicate the end of the list of     operands.  */#define UNUSED 0  { 0, 0, 0, 0, 0, "unused" },  /* The R1 register field in an RR form instruction.  */#define RR_R1 (UNUSED + 1)#define RR_R1_MASK (0xf << 4)  { 4, 4, 0, 0, I370_OPERAND_GPR, "RR R1" },  /* The R2 register field in an RR form instruction.  */#define RR_R2 (RR_R1 + 1)#define RR_R2_MASK (0xf)  { 4, 0, 0, 0, I370_OPERAND_GPR, "RR R2" },  /* The I field in an RR form SVC-style instruction.  */#define RR_I (RR_R2 + 1)#define RR_I_MASK (0xff)  { 8, 0, 0, 0, I370_OPERAND_RELATIVE, "RR I (svc)" },  /* The R1 register field in an RRE form instruction.  */#define RRE_R1 (RR_I + 1)#define RRE_R1_MASK (0xf << 4)  { 4, 4, 0, 0, I370_OPERAND_GPR, "RRE R1" },  /* The R2 register field in an RRE form instruction.  */#define RRE_R2 (RRE_R1 + 1)#define RRE_R2_MASK (0xf)  { 4, 0, 0, 0, I370_OPERAND_GPR, "RRE R2" },  /* The R1 register field in an RRF form instruction.  */#define RRF_R1 (RRE_R2 + 1)#define RRF_R1_MASK (0xf << 4)  { 4, 4, 0, 0, I370_OPERAND_GPR, "RRF R1" },  /* The R2 register field in an RRF form instruction.  */#define RRF_R2 (RRF_R1 + 1)#define RRF_R2_MASK (0xf)  { 4, 0, 0, 0, I370_OPERAND_GPR, "RRF R2" },  /* The R3 register field in an RRF form instruction.  */#define RRF_R3 (RRF_R2 + 1)#define RRF_R3_MASK (0xf << 12)  { 4, 12, 0, 0, I370_OPERAND_GPR, "RRF R3" },  /* The R1 register field in an RX or RS form instruction.  */#define RX_R1 (RRF_R3 + 1)#define RX_R1_MASK (0xf << 20)  { 4, 20, 0, 0, I370_OPERAND_GPR, "RX R1" },  /* The X2 index field in an RX form instruction.  */#define RX_X2 (RX_R1 + 1)#define RX_X2_MASK (0xf << 16)  { 4, 16, 0, 0, I370_OPERAND_GPR | I370_OPERAND_INDEX, "RX X2"},  /* The B2 base field in an RX form instruction.  */#define RX_B2 (RX_X2 + 1)#define RX_B2_MASK (0xf << 12)  { 4, 12, 0, 0, I370_OPERAND_GPR | I370_OPERAND_BASE, "RX B2"},  /* The D2 displacement field in an RX form instruction.  */#define RX_D2 (RX_B2 + 1)#define RX_D2_MASK (0xfff)  { 12, 0, 0, 0, I370_OPERAND_RELATIVE, "RX D2"}, /* The R3 register field in an RXF form instruction.  */#define RXF_R3 (RX_D2 + 1)#define RXF_R3_MASK (0xf << 12)  { 4, 12, insert_rxf_r3, extract_rxf_r3, I370_OPERAND_GPR, "RXF R3" },  /* The D2 displacement field in an RS form instruction.  */#define RS_D2 (RXF_R3 + 1)#define RS_D2_MASK (0xfff)  { 12, 0, 0, 0, I370_OPERAND_RELATIVE, "RS D2"},  /* The R3 register field in an RS form instruction.  */#define RS_R3 (RS_D2 + 1)#define RS_R3_MASK (0xf << 16)  { 4, 16, 0, 0, I370_OPERAND_GPR, "RS R3" },  /* The B2 base field in an RS form instruction.  */#define RS_B2 (RS_R3 + 1)#define RS_B2_MASK (0xf << 12)  { 4, 12, 0, 0, I370_OPERAND_GPR | I370_OPERAND_BASE | I370_OPERAND_SBASE, "RS B2"},  /* The optional B2 base field in an RS form instruction.  */  /* Note that this field will almost always be absent */#define RS_B2_OPT (RS_B2 + 1)#define RS_B2_OPT_MASK (0xf << 12)  { 4, 12, 0, 0, I370_OPERAND_GPR | I370_OPERAND_OPTIONAL, "RS B2 OPT"},  /* The R1 register field in an RSI form instruction.  */#define RSI_R1 (RS_B2_OPT + 1)#define RSI_R1_MASK (0xf << 20)  { 4, 20, 0, 0, I370_OPERAND_GPR, "RSI R1" },  /* The R3 register field in an RSI form instruction.  */#define RSI_R3 (RSI_R1 + 1)#define RSI_R3_MASK (0xf << 16)  { 4, 16, 0, 0, I370_OPERAND_GPR, "RSI R3" },  /* The I2 immediate field in an RSI form instruction.  */#define RSI_I2 (RSI_R3 + 1)#define RSI_I2_MASK (0xffff)  { 16, 0, 0, 0, I370_OPERAND_RELATIVE, "RSI I2" },  /* The R1 register field in an RI form instruction.  */#define RI_R1 (RSI_I2 + 1)#define RI_R1_MASK (0xf << 20)  { 4, 20, 0, 0, I370_OPERAND_GPR, "RI R1" },  /* The I2 immediate field in an RI form instruction.  */#define RI_I2 (RI_R1 + 1)#define RI_I2_MASK (0xffff)  { 16, 0, 0, 0, I370_OPERAND_RELATIVE, "RI I2" }, /* The I2 index field in an SI form instruction.  */#define SI_I2 (RI_I2 + 1)#define SI_I2_MASK (0xff << 16)  { 8, 16, 0, 0, I370_OPERAND_RELATIVE, "SI I2"}, /* The B1 base register field in an SI form instruction.  */#define SI_B1 (SI_I2 + 1)#define SI_B1_MASK (0xf << 12)  { 4, 12, 0, 0, I370_OPERAND_GPR, "SI B1" },  /* The D1 displacement field in an SI form instruction.  */#define SI_D1 (SI_B1 + 1)#define SI_D1_MASK (0xfff)  { 12, 0, 0, 0, I370_OPERAND_RELATIVE, "SI D1" }, /* The B2 base register field in an S form instruction.  */#define S_B2 (SI_D1 + 1)#define S_B2_MASK (0xf << 12)  { 4, 12, 0, 0, I370_OPERAND_GPR | I370_OPERAND_BASE | I370_OPERAND_SBASE, "S B2" },  /* The D2 displacement field in an S form instruction.  */#define S_D2 (S_B2 + 1)#define S_D2_MASK (0xfff)  { 12, 0, 0, 0, I370_OPERAND_RELATIVE, "S D2" },  /* The L length field in an SS form instruction. */#define SS_L (S_D2 + 1)#define SS_L_MASK (0xffff<<16)  { 8, 16, 0, 0, I370_OPERAND_RELATIVE | I370_OPERAND_LENGTH, "SS L" }, /* The B1 base register field in an SS form instruction.  */#define SS_B1 (SS_L + 1)#define SS_B1_MASK (0xf << 12)  { 4, 12, 0, 0, I370_OPERAND_GPR, "SS B1" },  /* The D1 displacement field in an SS form instruction.  */#define SS_D1 (SS_B1 + 1)#define SS_D1_MASK (0xfff)  { 12, 0, 0, 0, I370_OPERAND_RELATIVE, "SS D1" }, /* The B2 base register field in an SS form instruction.  */#define SS_B2 (SS_D1 + 1)#define SS_B2_MASK (0xf << 12)  { 4, 12, insert_ss_b2, extract_ss_b2, I370_OPERAND_GPR | I370_OPERAND_BASE | I370_OPERAND_SBASE, "SS B2" },  /* The D2 displacement field in an SS form instruction.  */#define SS_D2 (SS_B2 + 1)#define SS_D2_MASK (0xfff)  { 12, 0, insert_ss_d2, extract_ss_d2, I370_OPERAND_RELATIVE, "SS D2" },};/* The functions used to insert and extract complicated operands.  *//*ARGSUSED*/static i370_insn_tinsert_ss_b2 (insn, value, errmsg)     i370_insn_t insn;     long value;     const char **errmsg;{  insn.i[1] |= (value & 0xf) << 28;  return insn;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -