mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-12 15:05:06 +00:00
0e68771536
A brief description about PIC16: =============================== PIC16 is an 8-bit microcontroller with only one 8-bit register which is the accumulator. All arithmetic/load/store operations are 8-bit only. The architecture has two address spaces: program and data. The program memory is divided into 2K pages and the data memory is divided into banks of 128 byte, with only 80 usable bytes, resulting in an non-contiguous data memory. It supports direct data memory access (by specifying the address as part of the instruction) and indirect data and program memory access (in an unorthodox fashion which utilize a 16 bit pointer register). Two classes of registers exist: (8-bit class which is only one accumulator) (16-bit class, which contains one or more 16 bit pointer(s)) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51027 91177308-0d34-0410-b5e6-96231b3b80d8
113 lines
3.1 KiB
TableGen
113 lines
3.1 KiB
TableGen
//===- PIC16RegisterInfo.td - PIC16 Register defs ------------*- tblgen -*-===//
|
|
//
|
|
// 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
|
|
class PIC16Inst<dag outs, dag ins, string asmstr, list<dag> pattern>
|
|
: Instruction
|
|
{
|
|
field bits<14> Inst;
|
|
|
|
let Namespace = "PIC16";
|
|
|
|
dag OutOperandList = outs;
|
|
dag InOperandList = ins;
|
|
|
|
let AsmString = asmstr;
|
|
let Pattern = pattern;
|
|
}
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Byte Oriented instruction class in PIC16 : <|opcode|d|f|>
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
class ByteFormat<bits<6> op, dag outs, dag ins, string asmstr,
|
|
list<dag> pattern>
|
|
:PIC16Inst<outs, ins, asmstr, pattern>
|
|
{
|
|
bits<1> d;
|
|
bits<7> f;
|
|
|
|
let Inst{13-8} = op;
|
|
|
|
let Inst{7} = d;
|
|
let Inst{6-0} = f;
|
|
}
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Bit Oriented instruction class in PIC16 : <|opcode|b|f|>
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
class BitFormat<bits<4> op, dag outs, dag ins, string asmstr, list<dag> pattern>
|
|
: PIC16Inst<outs, ins, asmstr, pattern>
|
|
{
|
|
bits<3> b;
|
|
bits<7> f;
|
|
|
|
let Inst{13-10} = op;
|
|
|
|
let Inst{9-7} = b;
|
|
let Inst{6-0} = f;
|
|
}
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Literal Format instruction class in PIC16 : <|opcode|k|>
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
class LiteralFormat<bits<6> op, dag outs, dag ins, string asmstr,
|
|
list<dag> pattern>
|
|
: PIC16Inst<outs, ins, asmstr, pattern>
|
|
{
|
|
bits<8> k;
|
|
|
|
|
|
let Inst{13-8} = op;
|
|
|
|
let Inst{7-0} = k;
|
|
}
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Control Format instruction class in PIC16 : <|opcode|k|>
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
class ControlFormat<bits<3> op, dag outs, dag ins, string asmstr,
|
|
list<dag> pattern>
|
|
:PIC16Inst<outs, ins, asmstr, pattern>
|
|
{
|
|
bits<11> k;
|
|
|
|
|
|
let Inst{13-11} = op;
|
|
|
|
let Inst{10-0} = k;
|
|
}
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Pseudo instruction class in PIC16
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
class Pseudo<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>:
|
|
PIC16Inst<outs, ins, asmstr, pattern>
|
|
{
|
|
let Inst{13-6} = op;
|
|
}
|