]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/binutils-tumbl.git/blob - opcodes/microblaze-opcm.h
MBTumbl: Implement support for conditional execution
[fpga/lx-cpu1/binutils-tumbl.git] / opcodes / microblaze-opcm.h
1 /* microblaze-opcm.h -- Header used in microblaze-opc.h
2
3    Copyright 2009 Free Software Foundation, Inc.
4
5    This file is part of the GNU opcodes library.
6
7    This library is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3, or (at your option)
10    any later version.
11
12    It is distributed in the hope that it will be useful, but WITHOUT
13    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15    License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this file; see the file COPYING.  If not, write to the
19    Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
20    MA 02110-1301, USA.  */
21  
22
23 #ifndef MICROBLAZE_OPCM
24 #define MICROBLAZE_OPCM
25
26 #ifdef ARCH_mbtumbl
27
28 enum microblaze_instr
29 {
30   add, rsub, addc, rsubc, addk, rsubk, addkc, rsubkc, cmp, cmpu, cmpi,
31   addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul, muli,
32   bsll, bsra, bsrl, bslli, bsrai, bsrli, or, and, xor,
33   andn, sra, src, srl, sext8, sext16, mts, mfs, br, brd, brl,
34   bra, bral, beq, bne, blt, ble, bgt, bge, ori, andi, xori, andni,
35   imm, rts, rti, bri, brli, brai, brali, beqi, bnei, blti, blei, bgti,
36   bgei, lbu, lhu, lw, lwx, sb, sh, sw, swx, lbui, lhui, lwi,
37   sbi, shi, swi, halt, it, itt, ite,
38   invalid_inst
39 };
40
41 #else
42
43 enum microblaze_instr
44 {
45   add, rsub, addc, rsubc, addk, rsubk, addkc, rsubkc, cmp, cmpu,
46   addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul, 
47   mulh, mulhu, mulhsu,
48   idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput,
49   ncget, ncput, muli, bslli, bsrai, bsrli, mului, or, and, xor,
50   andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16, 
51   wic, wdc, wdcclear, wdcflush, mts, mfs, br, brd,
52   brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt,
53   bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
54   imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
55   brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
56   bgtid, bgei, bgeid, lbu, lhu, lw, lwx, sb, sh, sw, swx, lbui, lhui, lwi,
57   sbi, shi, swi, msrset, msrclr, tuqula, fadd, frsub, fmul, fdiv, 
58   fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt, 
59   fint, fsqrt, 
60   tget, tcget, tnget, tncget, tput, tcput, tnput, tncput,
61   eget, ecget, neget, necget, eput, ecput, neput, necput,
62   teget, tecget, tneget, tnecget, teput, tecput, tneput, tnecput,
63   aget, caget, naget, ncaget, aput, caput, naput, ncaput,
64   taget, tcaget, tnaget, tncaget, taput, tcaput, tnaput, tncaput,
65   eaget, ecaget, neaget, necaget, eaput, ecaput, neaput, necaput,
66   teaget, tecaget, tneaget, tnecaget, teaput, tecaput, tneaput, tnecaput,
67   getd, tgetd, cgetd, tcgetd, ngetd, tngetd, ncgetd, tncgetd,
68   putd, tputd, cputd, tcputd, nputd, tnputd, ncputd, tncputd,
69   egetd, tegetd, ecgetd, tecgetd, negetd, tnegetd, necgetd, tnecgetd,
70   eputd, teputd, ecputd, tecputd, neputd, tneputd, necputd, tnecputd,
71   agetd, tagetd, cagetd, tcagetd, nagetd, tnagetd, ncagetd, tncagetd,
72   aputd, taputd, caputd, tcaputd, naputd, tnaputd, ncaputd, tncaputd,
73   eagetd, teagetd, ecagetd, tecagetd, neagetd, tneagetd, necagetd, tnecagetd,
74   eaputd, teaputd, ecaputd, tecaputd, neaputd, tneaputd, necaputd, tnecaputd,
75   invalid_inst
76 };
77
78 #endif
79
80 enum microblaze_instr_type
81 {
82   arithmetic_inst, logical_inst, mult_inst, div_inst, branch_inst,
83   return_inst, immediate_inst, special_inst, memory_load_inst,
84   memory_store_inst, barrel_shift_inst,
85 #ifndef ARCH_mbtumbl
86   anyware_inst,
87 #else
88   halt_inst,
89   pseudo_inst
90 #endif
91 };
92
93 #define INST_WORD_SIZE 4
94
95 /* Gen purpose regs go from 0 to 31.  */
96 /* Mask is reg num - max_reg_num, ie reg_num - 32 in this case.  */
97
98 #define REG_PC_MASK 0x8000
99 #define REG_MSR_MASK 0x8001
100
101 #ifndef ARCH_mbtumbl
102
103 #define REG_EAR_MASK 0x8003
104 #define REG_ESR_MASK 0x8005
105 #define REG_FSR_MASK 0x8007
106 #define REG_BTR_MASK 0x800b
107 #define REG_EDR_MASK 0x800d
108 #define REG_PVR_MASK 0xa000
109
110 #define REG_PID_MASK   0x9000
111 #define REG_ZPR_MASK   0x9001
112 #define REG_TLBX_MASK  0x9002
113 #define REG_TLBLO_MASK 0x9003
114 #define REG_TLBHI_MASK 0x9004
115 #define REG_TLBSX_MASK 0x9005
116
117 #endif
118
119 #define MIN_REGNUM 0
120 #define MAX_REGNUM 31
121
122 #define MIN_PVR_REGNUM 0
123 #define MAX_PVR_REGNUM 15
124
125 #define REG_PC  32 /* PC.  */
126 #define REG_MSR 33 /* Machine status reg.  */
127
128 #ifndef ARCH_mbtumbl
129
130 #define REG_EAR 35 /* Exception reg.  */
131 #define REG_ESR 37 /* Exception reg.  */
132 #define REG_FSR 39 /* FPU Status reg.  */
133 #define REG_BTR 43 /* Branch Target reg.  */
134 #define REG_EDR 45 /* Exception reg.  */
135 #define REG_PVR 40960 /* Program Verification reg.  */
136
137 #define REG_PID   36864 /* MMU: Process ID reg.  */
138 #define REG_ZPR   36865 /* MMU: Zone Protect reg.  */
139 #define REG_TLBX  36866 /* MMU: TLB Index reg.  */
140 #define REG_TLBLO 36867 /* MMU: TLB Low reg.  */
141 #define REG_TLBHI 36868 /* MMU: TLB High reg.  */
142 #define REG_TLBSX 36869 /* MMU: TLB Search Index reg.  */
143
144 #else
145
146 /* Tumbl conditions for it, itt, ite */
147
148 #define COND_ALL 0
149 #define COND_EQ  1
150 #define COND_NE  2
151 #define COND_LT  3
152 #define COND_LE  4
153 #define COND_GT  5
154 #define COND_GE  6
155
156 #define COND_LOW  0
157 #define COND_MASK 0x7
158
159 #define COND_TYPE_MASK 0x18
160 #define COND_TYPE_LOW  3
161
162 #define COND_TYPE_ALL 0
163 #define COND_TYPE_IT  1
164 #define COND_TYPE_ITT 2
165 #define COND_TYPE_ITE 3
166
167 #endif
168
169 /* Alternate names for gen purpose regs.  */
170 #define REG_SP  1 /* stack pointer.  */
171 #define REG_ROSDP 2 /* read-only small data pointer.  */
172 #define REG_RWSDP 13 /* read-write small data pointer.  */
173
174 /* Assembler Register - Used in Delay Slot Optimization.  */
175 #define REG_AS    18
176 #define REG_ZERO  0
177  
178 #define RD_LOW  21 /* Low bit for RD.  */
179 #define RA_LOW  16 /* Low bit for RA.  */
180 #define RB_LOW  11 /* Low bit for RB.  */
181 #define IMM_LOW  0 /* Low bit for immediate.  */
182
183 #define RD_MASK 0x03E00000
184 #define RA_MASK 0x001F0000
185 #define RB_MASK 0x0000F800
186 #define IMM_MASK 0x0000FFFF
187
188 /* Imm mask for barrel shifts.  */
189 #define IMM5_MASK 0x0000001F
190
191 #ifndef ARCH_mbtumbl
192
193 /* FSL imm mask for get, put instructions.  */
194 #define  RFSL_MASK 0x000000F
195
196 /* Imm mask for msrset, msrclr instructions.  */
197 #define  IMM15_MASK 0x00007FFF
198
199 #endif
200
201 #endif /* MICROBLAZE-OPCM */