/* Table of opcodes for the DLX microprocess.
Copyright (C) 2002-2024 Free Software Foundation, Inc.
This file is part of GDB and GAS.
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 3 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, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA.
Initially created by Kuang Hwa Lin, 2002. */
/* Following are the function codes for the Special OP (ALU). */
#define ALUOP 0x00000000
#define SPECIALOP 0x00000000
#define SEQF 0x00000028
#define SNEF 0x00000029
#define SLTF 0x0000002A
#define SGTF 0x0000002B
#define SLEF 0x0000002C
#define SGEF 0x0000002D
/* Following special functions was not mentioned in the
Hennessy's book but was implemented in the RTL. */
#define MVTSF 0x00000030
#define MVFSF 0x00000031
#define BSWAPF 0x00000032
#define LUTF 0x00000033
/* Following special functions was mentioned in the
Hennessy's book but was not implemented in the RTL. */
#define MULTF 0x00000005
#define MULTUF 0x00000006
#define DIVF 0x00000007
#define DIVUF 0x00000008
/* Following 3 ops was added to provide the MP atonmic operation. */
#define LSBUOP 0x98000000
#define LSHUOP 0x9c000000
#define LSWOP 0xb0000000
/* Following opcode was defined in the Hennessy's book as
"normal" opcode but was implemented in the RTL as special
functions. */
#if 0
#define MVTSOP 0x50000000
#define MVFSOP 0x54000000
#endif
struct dlx_opcode
{
/* Name of the instruction. */
const char *name;
/* Opcode word. */
unsigned long opcode;
/* A string of characters which describe the operands.
Valid characters are:
, Itself. The character appears in the assembly code.
a rs1 The register number is in bits 21-25 of the instruction.
b rs2/rd The register number is in bits 16-20 of the instruction.
c rd. The register number is in bits 11-15 of the instruction.
f FUNC bits 0-10 of the instruction.
i An immediate operand is in bits 0-16 of the instruction. 0 extended
I An immediate operand is in bits 0-16 of the instruction. sign extended
d An 16 bit PC relative displacement.
D An immediate operand is in bits 0-25 of the instruction.
N No opperands needed, for nops.
P it can be a register or a 16 bit operand. */
const char *args;
};
static const struct dlx_opcode dlx_opcodes[] =
{
/* Arithmetic and Logic R-TYPE instructions. */
{ "nop", (ALUOP|NOPF), "N" }, /* NOP */
{ "add", (ALUOP|ADDF), "c,a,b" }, /* Add */
{ "addu", (ALUOP|ADDUF), "c,a,b" }, /* Add Unsigned */
{ "sub", (ALUOP|SUBF), "c,a,b" }, /* SUB */
{ "subu", (ALUOP|SUBUF), "c,a,b" }, /* Sub Unsigned */
{ "mult", (ALUOP|MULTF), "c,a,b" }, /* MULTIPLY */
{ "multu", (ALUOP|MULTUF), "c,a,b" }, /* MULTIPLY Unsigned */
{ "div", (ALUOP|DIVF), "c,a,b" }, /* DIVIDE */
{ "divu", (ALUOP|DIVUF), "c,a,b" }, /* DIVIDE Unsigned */
{ "and", (ALUOP|ANDF), "c,a,b" }, /* AND */
{ "or", (ALUOP|ORF), "c,a,b" }, /* OR */
{ "xor", (ALUOP|XORF), "c,a,b" }, /* Exclusive OR */
{ "sll", (ALUOP|SLLF), "c,a,b" }, /* SHIFT LEFT LOGICAL */
{ "sra", (ALUOP|SRAF), "c,a,b" }, /* SHIFT RIGHT ARITHMETIC */
{ "srl", (ALUOP|SRLF), "c,a,b" }, /* SHIFT RIGHT LOGICAL */
{ "seq", (ALUOP|SEQF), "c,a,b" }, /* Set if equal */
{ "sne", (ALUOP|SNEF), "c,a,b" }, /* Set if not equal */
{ "slt", (ALUOP|SLTF), "c,a,b" }, /* Set if less */
{ "sgt", (ALUOP|SGTF), "c,a,b" }, /* Set if greater */
{ "sle", (ALUOP|SLEF), "c,a,b" }, /* Set if less or equal */
{ "sge", (ALUOP|SGEF), "c,a,b" }, /* Set if greater or equal */
{ "sequ", (ALUOP|SEQUF), "c,a,b" }, /* Set if equal unsigned */
{ "sneu", (ALUOP|SNEUF), "c,a,b" }, /* Set if not equal unsigned */
{ "sltu", (ALUOP|SLTUF), "c,a,b" }, /* Set if less unsigned */
{ "sgtu", (ALUOP|SGTUF), "c,a,b" }, /* Set if greater unsigned */
{ "sleu", (ALUOP|SLEUF), "c,a,b" }, /* Set if less or equal unsigned*/
{ "sgeu", (ALUOP|SGEUF), "c,a,b" }, /* Set if greater or equal */
{ "mvts", (ALUOP|MVTSF), "c,a" }, /* Move to special register */
{ "mvfs", (ALUOP|MVFSF), "c,a" }, /* Move from special register */
{ "bswap", (ALUOP|BSWAPF), "c,a,b" }, /* ??? Was not documented */
{ "lut", (ALUOP|LUTF), "c,a,b" }, /* ????? same as above */
/* Arithmetic and Logical Immediate I-TYPE instructions. */
{ "addi", ADDIOP, "b,a,I" }, /* Add Immediate */
{ "addui", ADDUIOP, "b,a,i" }, /* Add Usigned Immediate */
{ "subi", SUBIOP, "b,a,I" }, /* Sub Immediate */
{ "subui", SUBUIOP, "b,a,i" }, /* Sub Unsigned Immedated */
{ "andi", ANDIOP, "b,a,i" }, /* AND Immediate */
{ "ori", ORIOP, "b,a,i" }, /* OR Immediate */
{ "xori", XORIOP, "b,a,i" }, /* Exclusive OR Immediate */
{ "slli", SLLIOP, "b,a,i" }, /* SHIFT LEFT LOCICAL Immediate */
{ "srai", SRAIOP, "b,a,i" }, /* SHIFT RIGHT ARITH. Immediate */
{ "srli", SRLIOP, "b,a,i" }, /* SHIFT RIGHT LOGICAL Immediate*/
{ "seqi", SEQIOP, "b,a,i" }, /* Set if equal */
{ "snei", SNEIOP, "b,a,i" }, /* Set if not equal */
{ "slti", SLTIOP, "b,a,i" }, /* Set if less */
{ "sgti", SGTIOP, "b,a,i" }, /* Set if greater */
{ "slei", SLEIOP, "b,a,i" }, /* Set if less or equal */
{ "sgei", SGEIOP, "b,a,i" }, /* Set if greater or equal */
{ "sequi", SEQUIOP, "b,a,i" }, /* Set if equal */
{ "sneui", SNEUIOP, "b,a,i" }, /* Set if not equal */
{ "sltui", SLTUIOP, "b,a,i" }, /* Set if less */
{ "sgtui", SGTUIOP, "b,a,i" }, /* Set if greater */
{ "sleui", SLEUIOP, "b,a,i" }, /* Set if less or equal */
{ "sgeui", SGEUIOP, "b,a,i" }, /* Set if greater or equal */
/* Macros for I type instructions. */
{ "mov", ADDIOP, "b,P" }, /* a move macro */
{ "movu", ADDUIOP, "b,P" }, /* a move macro, unsigned */
#if 0
/* Move special. */
{ "mvts", MVTSOP, "b,a" }, /* Move From Integer to Special */
{ "mvfs", MVFSOP, "b,a" }, /* Move From Special to Integer */
#endif
/* Load high Immediate I-TYPE instruction. */
{ "lhi", LHIOP, "b,i" }, /* Load High Immediate */
{ "lui", LHIOP, "b,i" }, /* Load High Immediate */
{ "sethi", LHIOP, "b,i" }, /* Load High Immediate */
{ "", 0x0, "" } /* Dummy entry, not included in NUM_OPCODES.
This lets code examine entry i + 1 without
checking if we've run off the end of the table. */
};