2012-02-28 15:46:26 +08:00
|
|
|
//===-- MipsInstrFormats.td - Mips Instruction Formats -----*- tablegen -*-===//
|
2007-06-06 15:42:06 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-06-06 15:42:06 +08:00
|
|
|
//
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 15:42:06 +08:00
|
|
|
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 15:42:06 +08:00
|
|
|
// Describe MIPS instructions format
|
|
|
|
//
|
2008-06-08 09:39:36 +08:00
|
|
|
// CPU INSTRUCTION FORMATS
|
2007-06-06 15:42:06 +08:00
|
|
|
//
|
|
|
|
// opcode - operation code.
|
|
|
|
// rs - src reg.
|
|
|
|
// rt - dst reg (on a 2 regs instr) or src reg (on a 3 reg instr).
|
|
|
|
// rd - dst reg, only used on 3 regs instr.
|
|
|
|
// shamt - only used on shift instructions, contains the shift amount.
|
|
|
|
// funct - combined with opcode field give us an operation code.
|
|
|
|
//
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 15:42:06 +08:00
|
|
|
|
2011-10-19 01:50:36 +08:00
|
|
|
// Format specifies the encoding used by the instruction. This is part of the
|
|
|
|
// ad-hoc solution used to emit machine instruction encodings by our machine
|
|
|
|
// code emitter.
|
|
|
|
class Format<bits<4> val> {
|
|
|
|
bits<4> Value = val;
|
|
|
|
}
|
|
|
|
|
|
|
|
def Pseudo : Format<0>;
|
|
|
|
def FrmR : Format<1>;
|
|
|
|
def FrmI : Format<2>;
|
|
|
|
def FrmJ : Format<3>;
|
|
|
|
def FrmFR : Format<4>;
|
|
|
|
def FrmFI : Format<5>;
|
|
|
|
def FrmOther : Format<6>; // Instruction w/ a custom format
|
|
|
|
|
2013-04-20 03:03:11 +08:00
|
|
|
class MMRel;
|
|
|
|
|
|
|
|
def Std2MicroMips : InstrMapping {
|
|
|
|
let FilterClass = "MMRel";
|
|
|
|
// Instructions with the same BaseOpcode and isNVStore values form a row.
|
|
|
|
let RowFields = ["BaseOpcode"];
|
|
|
|
// Instructions with the same predicate sense form a column.
|
|
|
|
let ColFields = ["Arch"];
|
|
|
|
// The key column is the unpredicated instructions.
|
|
|
|
let KeyCol = ["se"];
|
|
|
|
// Value columns are PredSense=true and PredSense=false
|
|
|
|
let ValueCols = [["se"], ["micromips"]];
|
|
|
|
}
|
|
|
|
|
2015-04-22 21:27:34 +08:00
|
|
|
class StdMMR6Rel;
|
|
|
|
|
|
|
|
def Std2MicroMipsR6 : InstrMapping {
|
|
|
|
let FilterClass = "StdMMR6Rel";
|
|
|
|
// Instructions with the same BaseOpcode and isNVStore values form a row.
|
|
|
|
let RowFields = ["BaseOpcode"];
|
|
|
|
// Instructions with the same predicate sense form a column.
|
|
|
|
let ColFields = ["Arch"];
|
|
|
|
// The key column is the unpredicated instructions.
|
|
|
|
let KeyCol = ["se"];
|
|
|
|
// Value columns are PredSense=true and PredSense=false
|
|
|
|
let ValueCols = [["se"], ["micromipsr6"]];
|
|
|
|
}
|
|
|
|
|
2013-04-20 03:03:11 +08:00
|
|
|
class StdArch {
|
|
|
|
string Arch = "se";
|
|
|
|
}
|
|
|
|
|
2007-06-06 15:42:06 +08:00
|
|
|
// Generic Mips Format
|
2012-08-01 03:13:07 +08:00
|
|
|
class MipsInst<dag outs, dag ins, string asmstr, list<dag> pattern,
|
|
|
|
InstrItinClass itin, Format f>: Instruction
|
2007-06-06 15:42:06 +08:00
|
|
|
{
|
|
|
|
field bits<32> Inst;
|
2011-10-19 01:50:36 +08:00
|
|
|
Format Form = f;
|
2007-06-06 15:42:06 +08:00
|
|
|
|
|
|
|
let Namespace = "Mips";
|
|
|
|
|
2012-04-18 02:03:21 +08:00
|
|
|
let Size = 4;
|
|
|
|
|
2011-10-19 01:50:36 +08:00
|
|
|
bits<6> Opcode = 0;
|
2007-06-06 15:42:06 +08:00
|
|
|
|
2011-10-19 01:50:36 +08:00
|
|
|
// Top 6 bits are the 'opcode' field
|
|
|
|
let Inst{31-26} = Opcode;
|
2011-03-05 01:51:39 +08:00
|
|
|
|
2011-10-19 01:50:36 +08:00
|
|
|
let OutOperandList = outs;
|
|
|
|
let InOperandList = ins;
|
2007-08-18 10:01:28 +08:00
|
|
|
|
2007-06-06 15:42:06 +08:00
|
|
|
let AsmString = asmstr;
|
|
|
|
let Pattern = pattern;
|
2007-08-22 00:06:45 +08:00
|
|
|
let Itinerary = itin;
|
2011-10-19 01:50:36 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// Attributes specific to Mips instructions...
|
|
|
|
//
|
|
|
|
bits<4> FormBits = Form.Value;
|
|
|
|
|
|
|
|
// TSFlags layout should be kept in sync with MipsInstrInfo.h.
|
|
|
|
let TSFlags{3-0} = FormBits;
|
2012-04-18 02:03:21 +08:00
|
|
|
|
|
|
|
let DecoderNamespace = "Mips";
|
|
|
|
|
|
|
|
field bits<32> SoftFail = 0;
|
2012-08-01 03:13:07 +08:00
|
|
|
}
|
2012-05-22 11:10:09 +08:00
|
|
|
|
2012-08-01 03:13:07 +08:00
|
|
|
// Mips32/64 Instruction Format
|
|
|
|
class InstSE<dag outs, dag ins, string asmstr, list<dag> pattern,
|
2013-04-20 03:03:11 +08:00
|
|
|
InstrItinClass itin, Format f, string opstr = ""> :
|
2014-05-07 18:27:09 +08:00
|
|
|
MipsInst<outs, ins, asmstr, pattern, itin, f>, PredicateControl {
|
|
|
|
let EncodingPredicates = [HasStdEnc];
|
2013-04-20 03:03:11 +08:00
|
|
|
string BaseOpcode = opstr;
|
|
|
|
string Arch;
|
2007-06-06 15:42:06 +08:00
|
|
|
}
|
|
|
|
|
2007-10-09 10:55:31 +08:00
|
|
|
// Mips Pseudo Instructions Format
|
2012-12-20 12:20:09 +08:00
|
|
|
class MipsPseudo<dag outs, dag ins, list<dag> pattern,
|
|
|
|
InstrItinClass itin = IIPseudo> :
|
|
|
|
MipsInst<outs, ins, "", pattern, itin, Pseudo> {
|
2011-10-19 01:50:36 +08:00
|
|
|
let isCodeGenOnly = 1;
|
2011-09-27 12:57:54 +08:00
|
|
|
let isPseudo = 1;
|
|
|
|
}
|
2007-06-06 15:42:06 +08:00
|
|
|
|
2012-08-01 03:13:07 +08:00
|
|
|
// Mips32/64 Pseudo Instruction Format
|
2012-12-20 12:20:09 +08:00
|
|
|
class PseudoSE<dag outs, dag ins, list<dag> pattern,
|
2014-05-07 18:27:09 +08:00
|
|
|
InstrItinClass itin = IIPseudo> :
|
|
|
|
MipsPseudo<outs, ins, pattern, itin>, PredicateControl {
|
|
|
|
let EncodingPredicates = [HasStdEnc];
|
2012-08-01 03:13:07 +08:00
|
|
|
}
|
|
|
|
|
Implement methods that enable expansion of load immediate
macro instruction (li) in the assembler.
We have identified three possible expansions depending on
the size of immediate operand:
1) for 0 ≤ j ≤ 65535.
li d,j =>
ori d,$zero,j
2) for −32768 ≤ j < 0.
li d,j =>
addiu d,$zero,j
3) for any other value of j that is representable as a 32-bit integer.
li d,j =>
lui d,hi16(j)
ori d,d,lo16(j)
All of the above have been implemented in ths patch.
Contributer: Vladimir Medic
llvm-svn: 165199
2012-10-04 12:03:53 +08:00
|
|
|
// Pseudo-instructions for alternate assembly syntax (never used by codegen).
|
|
|
|
// These are aliases that require C++ handling to convert to the target
|
|
|
|
// instruction, while InstAliases can be handled directly by tblgen.
|
|
|
|
class MipsAsmPseudoInst<dag outs, dag ins, string asmstr>:
|
|
|
|
MipsInst<outs, ins, asmstr, [], IIPseudo, Pseudo> {
|
|
|
|
let isPseudo = 1;
|
|
|
|
let Pattern = [];
|
|
|
|
}
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 15:42:06 +08:00
|
|
|
// Format R instruction class in Mips : <|opcode|rs|rt|rd|shamt|funct|>
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 15:42:06 +08:00
|
|
|
|
Change instruction description to split OperandList into OutOperandList and
InOperandList. This gives one piece of important information: # of results
produced by an instruction.
An example of the change:
def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
=>
def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
llvm-svn: 40033
2007-07-19 09:14:50 +08:00
|
|
|
class FR<bits<6> op, bits<6> _funct, dag outs, dag ins, string asmstr,
|
2007-08-18 10:01:28 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2012-08-01 02:55:01 +08:00
|
|
|
InstSE<outs, ins, asmstr, pattern, itin, FrmR>
|
2007-06-06 15:42:06 +08:00
|
|
|
{
|
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
bits<5> shamt;
|
|
|
|
bits<6> funct;
|
|
|
|
|
2011-10-19 01:50:36 +08:00
|
|
|
let Opcode = op;
|
2007-06-06 15:42:06 +08:00
|
|
|
let funct = _funct;
|
|
|
|
|
|
|
|
let Inst{25-21} = rs;
|
2011-03-05 01:51:39 +08:00
|
|
|
let Inst{20-16} = rt;
|
2007-06-06 15:42:06 +08:00
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = shamt;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 15:42:06 +08:00
|
|
|
// Format I instruction class in Mips : <|opcode|rs|rt|immediate|>
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 15:42:06 +08:00
|
|
|
|
2007-08-18 10:01:28 +08:00
|
|
|
class FI<bits<6> op, dag outs, dag ins, string asmstr, list<dag> pattern,
|
2012-08-01 02:55:01 +08:00
|
|
|
InstrItinClass itin>: InstSE<outs, ins, asmstr, pattern, itin, FrmI>
|
2007-06-06 15:42:06 +08:00
|
|
|
{
|
|
|
|
bits<5> rt;
|
|
|
|
bits<5> rs;
|
|
|
|
bits<16> imm16;
|
|
|
|
|
2011-10-19 01:50:36 +08:00
|
|
|
let Opcode = op;
|
2007-06-06 15:42:06 +08:00
|
|
|
|
|
|
|
let Inst{25-21} = rs;
|
2011-03-05 01:51:39 +08:00
|
|
|
let Inst{20-16} = rt;
|
2007-06-06 15:42:06 +08:00
|
|
|
let Inst{15-0} = imm16;
|
|
|
|
}
|
|
|
|
|
2011-12-06 11:34:48 +08:00
|
|
|
class BranchBase<bits<6> op, dag outs, dag ins, string asmstr,
|
2011-10-12 02:49:17 +08:00
|
|
|
list<dag> pattern, InstrItinClass itin>:
|
2012-08-01 02:55:01 +08:00
|
|
|
InstSE<outs, ins, asmstr, pattern, itin, FrmI>
|
2011-10-12 02:49:17 +08:00
|
|
|
{
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
bits<16> imm16;
|
|
|
|
|
2011-10-19 01:50:36 +08:00
|
|
|
let Opcode = op;
|
2011-10-12 02:49:17 +08:00
|
|
|
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-0} = imm16;
|
|
|
|
}
|
|
|
|
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 15:42:06 +08:00
|
|
|
// Format J instruction class in Mips : <|opcode|address|>
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 15:42:06 +08:00
|
|
|
|
2013-10-30 00:38:59 +08:00
|
|
|
class FJ<bits<6> op> : StdArch
|
2007-06-06 15:42:06 +08:00
|
|
|
{
|
2012-12-22 07:03:50 +08:00
|
|
|
bits<26> target;
|
2007-06-06 15:42:06 +08:00
|
|
|
|
2012-12-22 07:03:50 +08:00
|
|
|
bits<32> Inst;
|
2011-03-05 01:51:39 +08:00
|
|
|
|
2012-12-22 07:03:50 +08:00
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-0} = target;
|
2007-06-06 15:42:06 +08:00
|
|
|
}
|
2007-10-09 10:55:31 +08:00
|
|
|
|
2013-01-05 03:38:05 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2012-10-06 09:17:37 +08:00
|
|
|
// MFC instruction class in Mips : <|op|mf|rt|rd|0000000|sel|>
|
|
|
|
//===----------------------------------------------------------------------===//
|
2013-01-05 03:13:49 +08:00
|
|
|
class MFC3OP_FM<bits<6> op, bits<5> mfmt>
|
2012-10-06 09:17:37 +08:00
|
|
|
{
|
|
|
|
bits<5> rt;
|
|
|
|
bits<5> rd;
|
|
|
|
bits<3> sel;
|
|
|
|
|
2013-01-05 03:13:49 +08:00
|
|
|
bits<32> Inst;
|
2012-10-06 09:17:37 +08:00
|
|
|
|
2013-01-05 03:13:49 +08:00
|
|
|
let Inst{31-26} = op;
|
2012-10-06 09:17:37 +08:00
|
|
|
let Inst{25-21} = mfmt;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-3} = 0;
|
|
|
|
let Inst{2-0} = sel;
|
|
|
|
}
|
|
|
|
|
2013-04-20 03:03:11 +08:00
|
|
|
class ADD_FM<bits<6> op, bits<6> funct> : StdArch {
|
2012-12-20 11:34:05 +08:00
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = 0;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2013-04-20 03:03:11 +08:00
|
|
|
class ADDI_FM<bits<6> op> : StdArch {
|
2012-12-20 11:40:03 +08:00
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
bits<16> imm16;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-0} = imm16;
|
|
|
|
}
|
|
|
|
|
2013-04-25 09:11:15 +08:00
|
|
|
class SRA_FM<bits<6> funct, bit rotate> : StdArch {
|
2012-12-20 11:44:41 +08:00
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rt;
|
|
|
|
bits<5> shamt;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0;
|
|
|
|
let Inst{25-22} = 0;
|
|
|
|
let Inst{21} = rotate;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = shamt;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2013-04-25 09:11:15 +08:00
|
|
|
class SRLV_FM<bits<6> funct, bit rotate> : StdArch {
|
2012-12-20 11:48:24 +08:00
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rt;
|
|
|
|
bits<5> rs;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-7} = 0;
|
|
|
|
let Inst{6} = rotate;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2013-11-04 22:53:22 +08:00
|
|
|
class BEQ_FM<bits<6> op> : StdArch {
|
2012-12-20 12:10:13 +08:00
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
bits<16> offset;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-0} = offset;
|
|
|
|
}
|
|
|
|
|
2013-11-04 22:53:22 +08:00
|
|
|
class BGEZ_FM<bits<6> op, bits<5> funct> : StdArch {
|
2012-12-20 12:13:23 +08:00
|
|
|
bits<5> rs;
|
|
|
|
bits<16> offset;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = funct;
|
|
|
|
let Inst{15-0} = offset;
|
|
|
|
}
|
|
|
|
|
2015-01-21 00:10:51 +08:00
|
|
|
class BBIT_FM<bits<6> op> : StdArch {
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> p;
|
|
|
|
bits<16> offset;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = p;
|
|
|
|
let Inst{15-0} = offset;
|
|
|
|
}
|
|
|
|
|
2013-04-20 03:03:11 +08:00
|
|
|
class SLTI_FM<bits<6> op> : StdArch {
|
2012-12-20 12:27:52 +08:00
|
|
|
bits<5> rt;
|
|
|
|
bits<5> rs;
|
|
|
|
bits<16> imm16;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-0} = imm16;
|
|
|
|
}
|
|
|
|
|
2013-09-06 20:53:21 +08:00
|
|
|
class MFLO_FM<bits<6> funct> : StdArch {
|
2012-12-22 06:39:17 +08:00
|
|
|
bits<5> rd;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0;
|
|
|
|
let Inst{25-16} = 0;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = 0;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2013-09-06 20:53:21 +08:00
|
|
|
class MTLO_FM<bits<6> funct> : StdArch {
|
2012-12-22 06:39:17 +08:00
|
|
|
bits<5> rs;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-6} = 0;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2013-09-14 14:49:25 +08:00
|
|
|
class SEB_FM<bits<5> funct, bits<6> funct2> : StdArch {
|
2012-12-22 06:41:52 +08:00
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rt;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x1f;
|
|
|
|
let Inst{25-21} = 0;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = funct;
|
2012-12-22 07:21:32 +08:00
|
|
|
let Inst{5-0} = funct2;
|
2012-12-22 06:41:52 +08:00
|
|
|
}
|
|
|
|
|
2013-09-14 14:49:25 +08:00
|
|
|
class CLO_FM<bits<6> funct> : StdArch {
|
2012-12-22 06:43:58 +08:00
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x1c;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = 0;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
let rt = rd;
|
|
|
|
}
|
|
|
|
|
2013-09-14 15:35:41 +08:00
|
|
|
class LUI_FM : StdArch {
|
2012-12-22 06:46:07 +08:00
|
|
|
bits<5> rt;
|
|
|
|
bits<16> imm16;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0xf;
|
|
|
|
let Inst{25-21} = 0;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-0} = imm16;
|
|
|
|
}
|
|
|
|
|
2014-03-20 18:18:24 +08:00
|
|
|
class JALR_FM {
|
2013-02-08 03:48:00 +08:00
|
|
|
bits<5> rd;
|
2012-12-22 07:03:50 +08:00
|
|
|
bits<5> rs;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = 0;
|
2013-02-08 03:48:00 +08:00
|
|
|
let Inst{15-11} = rd;
|
2012-12-22 07:03:50 +08:00
|
|
|
let Inst{10-6} = 0;
|
|
|
|
let Inst{5-0} = 9;
|
|
|
|
}
|
|
|
|
|
2013-11-04 22:53:22 +08:00
|
|
|
class BGEZAL_FM<bits<5> funct> : StdArch {
|
2012-12-22 07:15:59 +08:00
|
|
|
bits<5> rs;
|
|
|
|
bits<16> offset;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 1;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = funct;
|
|
|
|
let Inst{15-0} = offset;
|
|
|
|
}
|
|
|
|
|
2013-12-20 00:25:00 +08:00
|
|
|
class SYNC_FM : StdArch {
|
2012-12-22 07:17:36 +08:00
|
|
|
bits<5> stype;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0;
|
|
|
|
let Inst{10-6} = stype;
|
|
|
|
let Inst{5-0} = 0xf;
|
|
|
|
}
|
|
|
|
|
2014-11-28 01:28:10 +08:00
|
|
|
class SYNCI_FM : StdArch {
|
|
|
|
// Produced by the mem_simm16 address as reg << 16 | imm (see getMemEncoding).
|
|
|
|
bits<21> addr;
|
|
|
|
bits<5> rs = addr{20-16};
|
|
|
|
bits<16> offset = addr{15-0};
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0b000001;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = 0b11111;
|
|
|
|
let Inst{15-0} = offset;
|
|
|
|
}
|
|
|
|
|
2013-04-20 03:03:11 +08:00
|
|
|
class MULT_FM<bits<6> op, bits<6> funct> : StdArch {
|
2012-12-22 07:17:36 +08:00
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-6} = 0;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2013-09-14 14:49:25 +08:00
|
|
|
class EXT_FM<bits<6> funct> : StdArch {
|
2012-12-22 07:21:32 +08:00
|
|
|
bits<5> rt;
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> pos;
|
|
|
|
bits<5> size;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x1f;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = size;
|
|
|
|
let Inst{10-6} = pos;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2014-11-19 19:25:50 +08:00
|
|
|
class RDHWR_FM : StdArch {
|
2012-12-22 07:21:32 +08:00
|
|
|
bits<5> rt;
|
|
|
|
bits<5> rd;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x1f;
|
|
|
|
let Inst{25-21} = 0;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = 0;
|
|
|
|
let Inst{5-0} = 0x3b;
|
|
|
|
}
|
|
|
|
|
2013-11-07 22:35:24 +08:00
|
|
|
class TEQ_FM<bits<6> funct> : StdArch {
|
2013-05-21 02:07:43 +08:00
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
bits<10> code_;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-6} = code_;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2013-11-13 21:15:03 +08:00
|
|
|
class TEQI_FM<bits<5> funct> : StdArch {
|
2013-08-26 18:02:40 +08:00
|
|
|
bits<5> rs;
|
|
|
|
bits<16> imm16;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 1;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = funct;
|
|
|
|
let Inst{15-0} = imm16;
|
|
|
|
}
|
2013-12-20 00:25:00 +08:00
|
|
|
|
|
|
|
class WAIT_FM : StdArch {
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x10;
|
|
|
|
let Inst{25} = 1;
|
|
|
|
let Inst{24-6} = 0;
|
|
|
|
let Inst{5-0} = 0x20;
|
|
|
|
}
|
|
|
|
|
2014-04-03 02:40:43 +08:00
|
|
|
class EXTS_FM<bits<6> funct> : StdArch {
|
|
|
|
bits<5> rt;
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> pos;
|
|
|
|
bits<5> lenm1;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x1c;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = lenm1;
|
|
|
|
let Inst{10-6} = pos;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2014-04-02 02:35:26 +08:00
|
|
|
class MTMR_FM<bits<6> funct> : StdArch {
|
|
|
|
bits<5> rs;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x1c;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-6} = 0;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2014-03-20 19:51:58 +08:00
|
|
|
class POP_FM<bits<6> funct> : StdArch {
|
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rs;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x1c;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = 0;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = 0;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
|
|
|
class SEQ_FM<bits<6> funct> : StdArch {
|
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x1c;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = 0;
|
|
|
|
let Inst{5-0} = funct;
|
2014-04-05 00:21:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
class SEQI_FM<bits<6> funct> : StdArch {
|
|
|
|
bits<5> rs;
|
|
|
|
bits<5> rt;
|
|
|
|
bits<10> imm10;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x1c;
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-6} = imm10;
|
|
|
|
let Inst{5-0} = funct;
|
2014-03-20 19:51:58 +08:00
|
|
|
}
|
|
|
|
|
2013-07-12 17:25:35 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// System calls format <op|code_|funct>
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2013-12-20 00:25:00 +08:00
|
|
|
class SYS_FM<bits<6> funct> : StdArch
|
2013-07-12 17:25:35 +08:00
|
|
|
{
|
|
|
|
bits<20> code_;
|
|
|
|
bits<32> Inst;
|
|
|
|
let Inst{31-26} = 0x0;
|
|
|
|
let Inst{25-6} = code_;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Break instruction format <op|code_1|funct>
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2013-12-20 00:25:00 +08:00
|
|
|
class BRK_FM<bits<6> funct> : StdArch
|
2013-07-12 17:25:35 +08:00
|
|
|
{
|
|
|
|
bits<10> code_1;
|
|
|
|
bits<10> code_2;
|
|
|
|
bits<32> Inst;
|
|
|
|
let Inst{31-26} = 0x0;
|
|
|
|
let Inst{25-16} = code_1;
|
|
|
|
let Inst{15-6} = code_2;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2013-07-17 22:05:19 +08:00
|
|
|
// Exception return format <Cop0|1|0|funct>
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2013-12-20 00:25:00 +08:00
|
|
|
class ER_FM<bits<6> funct> : StdArch
|
2013-07-17 22:05:19 +08:00
|
|
|
{
|
|
|
|
bits<32> Inst;
|
|
|
|
let Inst{31-26} = 0x10;
|
|
|
|
let Inst{25} = 1;
|
|
|
|
let Inst{24-6} = 0;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2013-08-12 21:07:23 +08:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Enable/disable interrupt instruction format <Cop0|MFMC0|rt|12|0|sc|0|0>
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2013-12-20 00:25:00 +08:00
|
|
|
class EI_FM<bits<1> sc> : StdArch
|
2013-08-12 21:07:23 +08:00
|
|
|
{
|
|
|
|
bits<32> Inst;
|
|
|
|
bits<5> rt;
|
|
|
|
let Inst{31-26} = 0x10;
|
|
|
|
let Inst{25-21} = 0xb;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = 0xc;
|
|
|
|
let Inst{10-6} = 0;
|
|
|
|
let Inst{5} = sc;
|
|
|
|
let Inst{4-0} = 0;
|
|
|
|
}
|
|
|
|
|
2013-07-17 22:05:19 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2008-06-08 09:39:36 +08:00
|
|
|
//
|
2008-07-09 12:45:36 +08:00
|
|
|
// FLOATING POINT INSTRUCTION FORMATS
|
2008-06-08 09:39:36 +08:00
|
|
|
//
|
|
|
|
// opcode - operation code.
|
|
|
|
// fs - src reg.
|
|
|
|
// ft - dst reg (on a 2 regs instr) or src reg (on a 3 reg instr).
|
|
|
|
// fd - dst reg, only used on 3 regs instr.
|
|
|
|
// fmt - double or single precision.
|
|
|
|
// funct - combined with opcode field give us an operation code.
|
|
|
|
//
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2008-06-08 09:39:36 +08:00
|
|
|
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
llvm-svn: 53146
2008-07-06 03:05:21 +08:00
|
|
|
// Format FI instruction class in Mips : <|opcode|base|ft|immediate|>
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2008-06-08 09:39:36 +08:00
|
|
|
|
2011-03-05 01:51:39 +08:00
|
|
|
class FFI<bits<6> op, dag outs, dag ins, string asmstr, list<dag> pattern>:
|
2012-08-01 02:55:01 +08:00
|
|
|
InstSE<outs, ins, asmstr, pattern, NoItinerary, FrmFI>
|
2008-06-08 09:39:36 +08:00
|
|
|
{
|
|
|
|
bits<5> ft;
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
llvm-svn: 53146
2008-07-06 03:05:21 +08:00
|
|
|
bits<5> base;
|
2008-06-08 09:39:36 +08:00
|
|
|
bits<16> imm16;
|
|
|
|
|
2011-10-19 01:50:36 +08:00
|
|
|
let Opcode = op;
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
llvm-svn: 53146
2008-07-06 03:05:21 +08:00
|
|
|
|
|
|
|
let Inst{25-21} = base;
|
2011-03-05 01:51:39 +08:00
|
|
|
let Inst{20-16} = ft;
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
llvm-svn: 53146
2008-07-06 03:05:21 +08:00
|
|
|
let Inst{15-0} = imm16;
|
|
|
|
}
|
|
|
|
|
2013-12-20 23:44:08 +08:00
|
|
|
class ADDS_FM<bits<6> funct, bits<5> fmt> : StdArch {
|
2012-12-13 09:07:37 +08:00
|
|
|
bits<5> fd;
|
|
|
|
bits<5> fs;
|
|
|
|
bits<5> ft;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x11;
|
|
|
|
let Inst{25-21} = fmt;
|
|
|
|
let Inst{20-16} = ft;
|
|
|
|
let Inst{15-11} = fs;
|
|
|
|
let Inst{10-6} = fd;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
2012-12-13 09:14:07 +08:00
|
|
|
|
2013-12-20 23:44:08 +08:00
|
|
|
class ABSS_FM<bits<6> funct, bits<5> fmt> : StdArch {
|
2012-12-13 09:14:07 +08:00
|
|
|
bits<5> fd;
|
|
|
|
bits<5> fs;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x11;
|
|
|
|
let Inst{25-21} = fmt;
|
|
|
|
let Inst{20-16} = 0;
|
|
|
|
let Inst{15-11} = fs;
|
|
|
|
let Inst{10-6} = fd;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
2012-12-13 09:16:49 +08:00
|
|
|
|
2013-12-25 18:09:27 +08:00
|
|
|
class MFC1_FM<bits<5> funct> : StdArch {
|
2012-12-13 09:16:49 +08:00
|
|
|
bits<5> rt;
|
|
|
|
bits<5> fs;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x11;
|
|
|
|
let Inst{25-21} = funct;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = fs;
|
|
|
|
let Inst{10-0} = 0;
|
|
|
|
}
|
2012-12-13 09:24:00 +08:00
|
|
|
|
2013-04-25 09:21:25 +08:00
|
|
|
class LW_FM<bits<6> op> : StdArch {
|
2012-12-13 09:24:00 +08:00
|
|
|
bits<5> rt;
|
|
|
|
bits<21> addr;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-21} = addr{20-16};
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-0} = addr{15-0};
|
|
|
|
}
|
2012-12-13 09:27:48 +08:00
|
|
|
|
2013-12-20 23:44:08 +08:00
|
|
|
class MADDS_FM<bits<3> funct, bits<3> fmt> : StdArch {
|
2012-12-13 09:27:48 +08:00
|
|
|
bits<5> fd;
|
|
|
|
bits<5> fr;
|
|
|
|
bits<5> fs;
|
|
|
|
bits<5> ft;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x13;
|
|
|
|
let Inst{25-21} = fr;
|
|
|
|
let Inst{20-16} = ft;
|
|
|
|
let Inst{15-11} = fs;
|
|
|
|
let Inst{10-6} = fd;
|
|
|
|
let Inst{5-3} = funct;
|
|
|
|
let Inst{2-0} = fmt;
|
|
|
|
}
|
2012-12-13 09:30:49 +08:00
|
|
|
|
2013-12-20 23:44:08 +08:00
|
|
|
class LWXC1_FM<bits<6> funct> : StdArch {
|
2012-12-13 09:30:49 +08:00
|
|
|
bits<5> fd;
|
|
|
|
bits<5> base;
|
|
|
|
bits<5> index;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x13;
|
|
|
|
let Inst{25-21} = base;
|
|
|
|
let Inst{20-16} = index;
|
|
|
|
let Inst{15-11} = 0;
|
|
|
|
let Inst{10-6} = fd;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2013-12-20 23:44:08 +08:00
|
|
|
class SWXC1_FM<bits<6> funct> : StdArch {
|
2012-12-13 09:30:49 +08:00
|
|
|
bits<5> fs;
|
|
|
|
bits<5> base;
|
|
|
|
bits<5> index;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x13;
|
|
|
|
let Inst{25-21} = base;
|
|
|
|
let Inst{20-16} = index;
|
|
|
|
let Inst{15-11} = fs;
|
|
|
|
let Inst{10-6} = 0;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
2012-12-13 09:32:36 +08:00
|
|
|
|
2013-12-20 23:44:08 +08:00
|
|
|
class BC1F_FM<bit nd, bit tf> : StdArch {
|
2013-07-27 04:13:47 +08:00
|
|
|
bits<3> fcc;
|
2012-12-13 09:32:36 +08:00
|
|
|
bits<16> offset;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x11;
|
|
|
|
let Inst{25-21} = 0x8;
|
2013-07-27 04:13:47 +08:00
|
|
|
let Inst{20-18} = fcc;
|
2012-12-13 09:32:36 +08:00
|
|
|
let Inst{17} = nd;
|
|
|
|
let Inst{16} = tf;
|
|
|
|
let Inst{15-0} = offset;
|
|
|
|
}
|
2012-12-13 09:34:09 +08:00
|
|
|
|
2013-12-20 23:44:08 +08:00
|
|
|
class CEQS_FM<bits<5> fmt> : StdArch {
|
2012-12-13 09:34:09 +08:00
|
|
|
bits<5> fs;
|
|
|
|
bits<5> ft;
|
|
|
|
bits<4> cond;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x11;
|
|
|
|
let Inst{25-21} = fmt;
|
|
|
|
let Inst{20-16} = ft;
|
|
|
|
let Inst{15-11} = fs;
|
2014-08-18 03:47:47 +08:00
|
|
|
let Inst{10-8} = 0; // cc
|
2012-12-13 09:34:09 +08:00
|
|
|
let Inst{7-4} = 0x3;
|
|
|
|
let Inst{3-0} = cond;
|
|
|
|
}
|
2012-12-13 09:41:15 +08:00
|
|
|
|
2013-07-16 18:07:14 +08:00
|
|
|
class C_COND_FM<bits<5> fmt, bits<4> c> : CEQS_FM<fmt> {
|
|
|
|
let cond = c;
|
|
|
|
}
|
|
|
|
|
2013-12-25 18:09:27 +08:00
|
|
|
class CMov_I_F_FM<bits<6> funct, bits<5> fmt> : StdArch {
|
2012-12-13 09:41:15 +08:00
|
|
|
bits<5> fd;
|
|
|
|
bits<5> fs;
|
|
|
|
bits<5> rt;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x11;
|
|
|
|
let Inst{25-21} = fmt;
|
|
|
|
let Inst{20-16} = rt;
|
|
|
|
let Inst{15-11} = fs;
|
|
|
|
let Inst{10-6} = fd;
|
|
|
|
let Inst{5-0} = funct;
|
|
|
|
}
|
|
|
|
|
2013-09-06 20:41:17 +08:00
|
|
|
class CMov_F_I_FM<bit tf> : StdArch {
|
2012-12-13 09:41:15 +08:00
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rs;
|
2013-07-27 04:51:20 +08:00
|
|
|
bits<3> fcc;
|
2012-12-13 09:41:15 +08:00
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0;
|
|
|
|
let Inst{25-21} = rs;
|
2013-07-27 04:51:20 +08:00
|
|
|
let Inst{20-18} = fcc;
|
2012-12-13 09:41:15 +08:00
|
|
|
let Inst{17} = 0;
|
|
|
|
let Inst{16} = tf;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10-6} = 0;
|
|
|
|
let Inst{5-0} = 1;
|
|
|
|
}
|
|
|
|
|
2013-12-25 18:09:27 +08:00
|
|
|
class CMov_F_F_FM<bits<5> fmt, bit tf> : StdArch {
|
2012-12-13 09:41:15 +08:00
|
|
|
bits<5> fd;
|
|
|
|
bits<5> fs;
|
2013-07-27 04:51:20 +08:00
|
|
|
bits<3> fcc;
|
2012-12-13 09:41:15 +08:00
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x11;
|
|
|
|
let Inst{25-21} = fmt;
|
2013-07-27 04:51:20 +08:00
|
|
|
let Inst{20-18} = fcc;
|
2012-12-13 09:41:15 +08:00
|
|
|
let Inst{17} = 0;
|
|
|
|
let Inst{16} = tf;
|
|
|
|
let Inst{15-11} = fs;
|
|
|
|
let Inst{10-6} = fd;
|
|
|
|
let Inst{5-0} = 0x11;
|
|
|
|
}
|
2014-04-03 21:21:51 +08:00
|
|
|
|
|
|
|
class BARRIER_FM<bits<5> op> : StdArch {
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0; // SPECIAL
|
|
|
|
let Inst{25-21} = 0;
|
|
|
|
let Inst{20-16} = 0; // rt = 0
|
|
|
|
let Inst{15-11} = 0; // rd = 0
|
|
|
|
let Inst{10-6} = op; // Operation
|
|
|
|
let Inst{5-0} = 0; // SLL
|
|
|
|
}
|
2014-05-08 19:51:18 +08:00
|
|
|
|
2014-06-24 21:00:32 +08:00
|
|
|
class SDBBP_FM : StdArch {
|
|
|
|
bits<20> code_;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0b011100; // SPECIAL2
|
|
|
|
let Inst{25-6} = code_;
|
|
|
|
let Inst{5-0} = 0b111111; // SDBBP
|
|
|
|
}
|
|
|
|
|
2014-06-11 23:05:56 +08:00
|
|
|
class JR_HB_FM<bits<6> op> : StdArch{
|
|
|
|
bits<5> rs;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0; // SPECIAL
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-11} = 0;
|
|
|
|
let Inst{10} = 1;
|
|
|
|
let Inst{9-6} = 0;
|
|
|
|
let Inst{5-0} = op;
|
|
|
|
}
|
|
|
|
|
|
|
|
class JALR_HB_FM<bits<6> op> : StdArch {
|
|
|
|
bits<5> rd;
|
|
|
|
bits<5> rs;
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0; // SPECIAL
|
|
|
|
let Inst{25-21} = rs;
|
|
|
|
let Inst{20-16} = 0;
|
|
|
|
let Inst{15-11} = rd;
|
|
|
|
let Inst{10} = 1;
|
|
|
|
let Inst{9-6} = 0;
|
|
|
|
let Inst{5-0} = op;
|
|
|
|
}
|
|
|
|
|
2014-05-08 19:51:18 +08:00
|
|
|
class COP0_TLB_FM<bits<6> op> : StdArch {
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = 0x10; // COP0
|
|
|
|
let Inst{25} = 1; // CO
|
|
|
|
let Inst{24-6} = 0;
|
|
|
|
let Inst{5-0} = op; // Operation
|
|
|
|
}
|
2014-06-13 21:15:59 +08:00
|
|
|
|
|
|
|
class CACHEOP_FM<bits<6> op> : StdArch {
|
|
|
|
bits<21> addr;
|
|
|
|
bits<5> hint;
|
|
|
|
bits<5> base = addr{20-16};
|
|
|
|
bits<16> offset = addr{15-0};
|
|
|
|
|
|
|
|
bits<32> Inst;
|
|
|
|
|
|
|
|
let Inst{31-26} = op;
|
|
|
|
let Inst{25-21} = base;
|
|
|
|
let Inst{20-16} = hint;
|
|
|
|
let Inst{15-0} = offset;
|
|
|
|
}
|