m10300-opc.c
来自「基于4个mips核的noc设计」· C语言 代码 · 共 1,153 行 · 第 1/5 页
C
1,153 行
/* Assemble Matsushita MN10300 instructions. Copyright 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.This program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe 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 ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *//* This file is formatted at > 80 columns. Attempting to read it on a screeen with less than 80 columns will be difficult. */#include "sysdep.h"#include "opcode/mn10300.h"const struct mn10300_operand mn10300_operands[] = {#define UNUSED 0 {0, 0, 0}, /* dn register in the first register operand position. */#define DN0 (UNUSED+1) {2, 0, MN10300_OPERAND_DREG},/* dn register in the second register operand position. */#define DN1 (DN0+1) {2, 2, MN10300_OPERAND_DREG},/* dn register in the third register operand position. */#define DN2 (DN1+1) {2, 4, MN10300_OPERAND_DREG},/* dm register in the first register operand position. */#define DM0 (DN2+1) {2, 0, MN10300_OPERAND_DREG},/* dm register in the second register operand position. */#define DM1 (DM0+1) {2, 2, MN10300_OPERAND_DREG},/* dm register in the third register operand position. */#define DM2 (DM1+1) {2, 4, MN10300_OPERAND_DREG},/* an register in the first register operand position. */#define AN0 (DM2+1) {2, 0, MN10300_OPERAND_AREG},/* an register in the second register operand position. */#define AN1 (AN0+1) {2, 2, MN10300_OPERAND_AREG},/* an register in the third register operand position. */#define AN2 (AN1+1) {2, 4, MN10300_OPERAND_AREG},/* am register in the first register operand position. */#define AM0 (AN2+1) {2, 0, MN10300_OPERAND_AREG},/* am register in the second register operand position. */#define AM1 (AM0+1) {2, 2, MN10300_OPERAND_AREG},/* am register in the third register operand position. */#define AM2 (AM1+1) {2, 4, MN10300_OPERAND_AREG},/* 8 bit unsigned immediate which may promote to a 16bit unsigned immediate. */#define IMM8 (AM2+1) {8, 0, MN10300_OPERAND_PROMOTE},/* 16 bit unsigned immediate which may promote to a 32bit unsigned immediate. */#define IMM16 (IMM8+1) {16, 0, MN10300_OPERAND_PROMOTE},/* 16 bit pc-relative immediate which may promote to a 16bit pc-relative immediate. */#define IMM16_PCREL (IMM16+1) {16, 0, MN10300_OPERAND_PCREL | MN10300_OPERAND_RELAX | MN10300_OPERAND_SIGNED},/* 16bit unsigned displacement in a memory operation which may promote to a 32bit displacement. */#define IMM16_MEM (IMM16_PCREL+1) {16, 0, MN10300_OPERAND_PROMOTE | MN10300_OPERAND_MEMADDR},/* 32bit immediate, high 16 bits in the main instruction word, 16bits in the extension word. The "bits" field indicates how many bits are in the main instruction word for MN10300_OPERAND_SPLIT! */#define IMM32 (IMM16_MEM+1) {16, 0, MN10300_OPERAND_SPLIT},/* 32bit pc-relative offset. */#define IMM32_PCREL (IMM32+1) {16, 0, MN10300_OPERAND_SPLIT | MN10300_OPERAND_PCREL},/* 32bit memory offset. */#define IMM32_MEM (IMM32_PCREL+1) {16, 0, MN10300_OPERAND_SPLIT | MN10300_OPERAND_MEMADDR},/* 32bit immediate, high 16 bits in the main instruction word, 16bits in the extension word, low 16bits are left shifted 8 places. The "bits" field indicates how many bits are in the main instruction word for MN10300_OPERAND_SPLIT! */#define IMM32_LOWSHIFT8 (IMM32_MEM+1) {16, 8, MN10300_OPERAND_SPLIT | MN10300_OPERAND_MEMADDR},/* 32bit immediate, high 24 bits in the main instruction word, 8 in the extension word. The "bits" field indicates how many bits are in the main instruction word for MN10300_OPERAND_SPLIT! */#define IMM32_HIGH24 (IMM32_LOWSHIFT8+1) {24, 0, MN10300_OPERAND_SPLIT | MN10300_OPERAND_PCREL},/* 32bit immediate, high 24 bits in the main instruction word, 8 in the extension word, low 8 bits are left shifted 16 places. The "bits" field indicates how many bits are in the main instruction word for MN10300_OPERAND_SPLIT! */#define IMM32_HIGH24_LOWSHIFT16 (IMM32_HIGH24+1) {24, 16, MN10300_OPERAND_SPLIT | MN10300_OPERAND_PCREL},/* Stack pointer. */#define SP (IMM32_HIGH24_LOWSHIFT16+1) {8, 0, MN10300_OPERAND_SP},/* Processor status word. */#define PSW (SP+1) {0, 0, MN10300_OPERAND_PSW},/* MDR register. */#define MDR (PSW+1) {0, 0, MN10300_OPERAND_MDR},/* Index register. */#define DI (MDR+1) {2, 2, MN10300_OPERAND_DREG},/* 8 bit signed displacement, may promote to 16bit signed displacement. */#define SD8 (DI+1) {8, 0, MN10300_OPERAND_SIGNED | MN10300_OPERAND_PROMOTE},/* 16 bit signed displacement, may promote to 32bit displacement. */#define SD16 (SD8+1) {16, 0, MN10300_OPERAND_SIGNED | MN10300_OPERAND_PROMOTE},/* 8 bit signed displacement that can not promote. */#define SD8N (SD16+1) {8, 0, MN10300_OPERAND_SIGNED},/* 8 bit pc-relative displacement. */#define SD8N_PCREL (SD8N+1) {8, 0, MN10300_OPERAND_SIGNED | MN10300_OPERAND_PCREL | MN10300_OPERAND_RELAX},/* 8 bit signed displacement shifted left 8 bits in the instruction. */#define SD8N_SHIFT8 (SD8N_PCREL+1) {8, 8, MN10300_OPERAND_SIGNED},/* 8 bit signed immediate which may promote to 16bit signed immediate. */#define SIMM8 (SD8N_SHIFT8+1) {8, 0, MN10300_OPERAND_SIGNED | MN10300_OPERAND_PROMOTE},/* 16 bit signed immediate which may promote to 32bit immediate. */#define SIMM16 (SIMM8+1) {16, 0, MN10300_OPERAND_SIGNED | MN10300_OPERAND_PROMOTE},/* Either an open paren or close paren. */#define PAREN (SIMM16+1) {0, 0, MN10300_OPERAND_PAREN}, /* dn register that appears in the first and second register positions. */#define DN01 (PAREN+1) {2, 0, MN10300_OPERAND_DREG | MN10300_OPERAND_REPEATED},/* an register that appears in the first and second register positions. */#define AN01 (DN01+1) {2, 0, MN10300_OPERAND_AREG | MN10300_OPERAND_REPEATED},/* 16bit pc-relative displacement which may promote to 32bit pc-relative displacement. */#define D16_SHIFT (AN01+1) {16, 8, MN10300_OPERAND_PCREL | MN10300_OPERAND_RELAX | MN10300_OPERAND_SIGNED},/* 8 bit immediate found in the extension word. */#define IMM8E (D16_SHIFT+1) {8, 0, MN10300_OPERAND_EXTENDED},/* Register list found in the extension word shifted 8 bits left. */#define REGSE_SHIFT8 (IMM8E+1) {8, 8, MN10300_OPERAND_EXTENDED | MN10300_OPERAND_REG_LIST},/* Register list shifted 8 bits left. */#define REGS_SHIFT8 (REGSE_SHIFT8 + 1) {8, 8, MN10300_OPERAND_REG_LIST},/* Reigster list. */#define REGS (REGS_SHIFT8+1) {8, 0, MN10300_OPERAND_REG_LIST},/* UStack pointer. */#define USP (REGS+1) {0, 0, MN10300_OPERAND_USP},/* SStack pointer. */#define SSP (USP+1) {0, 0, MN10300_OPERAND_SSP},/* MStack pointer. */#define MSP (SSP+1) {0, 0, MN10300_OPERAND_MSP},/* PC . */#define PC (MSP+1) {0, 0, MN10300_OPERAND_PC},/* 4 bit immediate for syscall. */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?