2008-11-19 11:00:54 +00:00
|
|
|
//===- PIC16InstrFormats.td - PIC16 Instruction Formats-------*- tblgen -*-===//
|
2008-05-13 09:02:57 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Describe PIC16 instructions format
|
|
|
|
//
|
|
|
|
// All the possible PIC16 fields are:
|
|
|
|
//
|
|
|
|
// opcode - operation code.
|
|
|
|
// f - 7-bit register file address.
|
|
|
|
// d - 1-bit direction specifier
|
|
|
|
// k - 8/11 bit literals
|
|
|
|
// b - 3 bits bit num specifier
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// Generic PIC16 Format
|
2008-11-19 11:00:54 +00:00
|
|
|
// PIC16 Instructions are 14-bit wide.
|
|
|
|
|
|
|
|
// FIXME: Add Cooper Specific Formats if any.
|
|
|
|
|
2008-05-13 09:02:57 +00:00
|
|
|
class PIC16Inst<dag outs, dag ins, string asmstr, list<dag> pattern>
|
2008-11-19 11:00:54 +00:00
|
|
|
: Instruction {
|
2008-05-13 09:02:57 +00:00
|
|
|
field bits<14> Inst;
|
|
|
|
|
|
|
|
let Namespace = "PIC16";
|
|
|
|
dag OutOperandList = outs;
|
2008-05-14 11:31:39 +00:00
|
|
|
dag InOperandList = ins;
|
|
|
|
let AsmString = asmstr;
|
|
|
|
let Pattern = pattern;
|
2008-05-13 09:02:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Byte Oriented instruction class in PIC16 : <|opcode|d|f|>
|
2008-11-19 11:00:54 +00:00
|
|
|
// opcode = 6 bits.
|
|
|
|
// d = direction = 1 bit.
|
|
|
|
// f = file register address = 7 bits.
|
2008-05-13 09:02:57 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
class ByteFormat<bits<6> opcode, dag outs, dag ins, string asmstr,
|
|
|
|
list<dag> pattern>
|
|
|
|
:PIC16Inst<outs, ins, asmstr, pattern> {
|
2008-05-13 09:02:57 +00:00
|
|
|
bits<1> d;
|
|
|
|
bits<7> f;
|
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
let Inst{13-8} = opcode;
|
2008-05-13 09:02:57 +00:00
|
|
|
|
|
|
|
let Inst{7} = d;
|
|
|
|
let Inst{6-0} = f;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Bit Oriented instruction class in PIC16 : <|opcode|b|f|>
|
2008-11-19 11:00:54 +00:00
|
|
|
// opcode = 4 bits.
|
|
|
|
// b = bit specifier = 3 bits.
|
|
|
|
// f = file register address = 7 bits.
|
2008-05-13 09:02:57 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
class BitFormat<bits<4> opcode, dag outs, dag ins, string asmstr,
|
|
|
|
list<dag> pattern>
|
|
|
|
: PIC16Inst<outs, ins, asmstr, pattern> {
|
2008-05-13 09:02:57 +00:00
|
|
|
bits<3> b;
|
|
|
|
bits<7> f;
|
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
let Inst{13-10} = opcode;
|
2008-05-13 09:02:57 +00:00
|
|
|
|
|
|
|
let Inst{9-7} = b;
|
|
|
|
let Inst{6-0} = f;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Literal Format instruction class in PIC16 : <|opcode|k|>
|
2008-11-19 11:00:54 +00:00
|
|
|
// opcode = 6 bits
|
|
|
|
// k = literal = 8 bits
|
2008-05-13 09:02:57 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
class LiteralFormat<bits<6> opcode, dag outs, dag ins, string asmstr,
|
2008-05-14 11:31:39 +00:00
|
|
|
list<dag> pattern>
|
2008-11-19 11:00:54 +00:00
|
|
|
: PIC16Inst<outs, ins, asmstr, pattern> {
|
2008-05-13 09:02:57 +00:00
|
|
|
bits<8> k;
|
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
let Inst{13-8} = opcode;
|
2008-05-13 09:02:57 +00:00
|
|
|
|
|
|
|
let Inst{7-0} = k;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Control Format instruction class in PIC16 : <|opcode|k|>
|
2008-11-19 11:00:54 +00:00
|
|
|
// opcode = 3 bits.
|
|
|
|
// k = jump address = 11 bits.
|
2008-05-13 09:02:57 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
class ControlFormat<bits<3> opcode, dag outs, dag ins, string asmstr,
|
2008-05-14 11:31:39 +00:00
|
|
|
list<dag> pattern>
|
2008-11-19 11:00:54 +00:00
|
|
|
: PIC16Inst<outs, ins, asmstr, pattern> {
|
2008-05-13 09:02:57 +00:00
|
|
|
bits<11> k;
|
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
let Inst{13-11} = opcode;
|
2008-05-13 09:02:57 +00:00
|
|
|
|
|
|
|
let Inst{10-0} = k;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Pseudo instruction class in PIC16
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
class Pseudo<dag outs, dag ins, string asmstr, list<dag> pattern>
|
|
|
|
: PIC16Inst<outs, ins, asmstr, pattern> {
|
|
|
|
let Inst{13-6} = 0;
|
2008-05-13 09:02:57 +00:00
|
|
|
}
|