1276479Sdim//===----------------------------------------------------------------------===//
2276479Sdim// MicroMIPS Base Classes
3276479Sdim//===----------------------------------------------------------------------===//
4276479Sdim
5276479Sdim//
6276479Sdim// Base class for MicroMips instructions.
7276479Sdim// This class does not depend on the instruction size.
8276479Sdim//
9276479Sdimclass MicroMipsInstBase<dag outs, dag ins, string asmstr, list<dag> pattern,
10276479Sdim                        InstrItinClass itin, Format f> : Instruction
11276479Sdim{
12276479Sdim  let Namespace = "Mips";
13276479Sdim  let DecoderNamespace = "MicroMips";
14276479Sdim
15276479Sdim  let OutOperandList = outs;
16276479Sdim  let InOperandList  = ins;
17276479Sdim
18276479Sdim  let AsmString   = asmstr;
19276479Sdim  let Pattern     = pattern;
20276479Sdim  let Itinerary   = itin;
21276479Sdim
22276479Sdim  let Predicates = [InMicroMips];
23276479Sdim
24276479Sdim  Format Form = f;
25276479Sdim}
26276479Sdim
27276479Sdim//
28276479Sdim// Base class for MicroMIPS 16-bit instructions.
29276479Sdim//
30276479Sdimclass MicroMipsInst16<dag outs, dag ins, string asmstr, list<dag> pattern,
31276479Sdim               InstrItinClass itin, Format f> :
32276479Sdim  MicroMipsInstBase<outs, ins, asmstr, pattern, itin, f>
33276479Sdim{
34276479Sdim  let Size = 2;
35276479Sdim  field bits<16> Inst;
36276479Sdim  field bits<16> SoftFail = 0;
37276479Sdim  bits<6> Opcode = 0x0;
38276479Sdim}
39276479Sdim
40276479Sdim//===----------------------------------------------------------------------===//
41276479Sdim// MicroMIPS 16-bit Instruction Formats
42276479Sdim//===----------------------------------------------------------------------===//
43276479Sdim
44280031Sdimclass ARITH_FM_MM16<bit funct> {
45280031Sdim  bits<3> rd;
46280031Sdim  bits<3> rt;
47280031Sdim  bits<3> rs;
48280031Sdim
49280031Sdim  bits<16> Inst;
50280031Sdim
51280031Sdim  let Inst{15-10} = 0x01;
52280031Sdim  let Inst{9-7}   = rd;
53280031Sdim  let Inst{6-4}   = rt;
54280031Sdim  let Inst{3-1}   = rs;
55280031Sdim  let Inst{0}     = funct;
56280031Sdim}
57280031Sdim
58280031Sdimclass ANDI_FM_MM16<bits<6> funct> {
59280031Sdim  bits<3> rd;
60280031Sdim  bits<3> rs;
61280031Sdim  bits<4> imm;
62280031Sdim
63280031Sdim  bits<16> Inst;
64280031Sdim
65280031Sdim  let Inst{15-10} = funct;
66280031Sdim  let Inst{9-7}   = rd;
67280031Sdim  let Inst{6-4}   = rs;
68280031Sdim  let Inst{3-0}   = imm;
69280031Sdim}
70280031Sdim
71280031Sdimclass LOGIC_FM_MM16<bits<4> funct> {
72280031Sdim  bits<3> rt;
73280031Sdim  bits<3> rs;
74280031Sdim
75280031Sdim  bits<16> Inst;
76280031Sdim
77280031Sdim  let Inst{15-10} = 0x11;
78280031Sdim  let Inst{9-6}   = funct;
79280031Sdim  let Inst{5-3}   = rt;
80280031Sdim  let Inst{2-0}   = rs;
81280031Sdim}
82280031Sdim
83280031Sdimclass SHIFT_FM_MM16<bits<1> funct> {
84280031Sdim  bits<3> rd;
85280031Sdim  bits<3> rt;
86280031Sdim  bits<3> shamt;
87280031Sdim
88280031Sdim  bits<16> Inst;
89280031Sdim
90280031Sdim  let Inst{15-10} = 0x09;
91280031Sdim  let Inst{9-7}   = rd;
92280031Sdim  let Inst{6-4}   = rt;
93280031Sdim  let Inst{3-1}   = shamt;
94280031Sdim  let Inst{0}     = funct;
95280031Sdim}
96280031Sdim
97280031Sdimclass ADDIUR2_FM_MM16 {
98280031Sdim  bits<3> rd;
99280031Sdim  bits<3> rs;
100280031Sdim  bits<3> imm;
101280031Sdim
102280031Sdim  bits<16> Inst;
103280031Sdim
104280031Sdim  let Inst{15-10} = 0x1b;
105280031Sdim  let Inst{9-7}   = rd;
106280031Sdim  let Inst{6-4}   = rs;
107280031Sdim  let Inst{3-1}   = imm;
108280031Sdim  let Inst{0}     = 0;
109280031Sdim}
110280031Sdim
111280031Sdimclass LOAD_STORE_FM_MM16<bits<6> op> {
112280031Sdim  bits<3> rt;
113280031Sdim  bits<7> addr;
114280031Sdim
115280031Sdim  bits<16> Inst;
116280031Sdim
117280031Sdim  let Inst{15-10} = op;
118280031Sdim  let Inst{9-7}   = rt;
119280031Sdim  let Inst{6-4}   = addr{6-4};
120280031Sdim  let Inst{3-0}   = addr{3-0};
121280031Sdim}
122280031Sdim
123280031Sdimclass LOAD_STORE_SP_FM_MM16<bits<6> op> {
124280031Sdim  bits<5> rt;
125280031Sdim  bits<5> offset;
126280031Sdim
127280031Sdim  bits<16> Inst;
128280031Sdim
129280031Sdim  let Inst{15-10} = op;
130280031Sdim  let Inst{9-5}   = rt;
131280031Sdim  let Inst{4-0}   = offset;
132280031Sdim}
133280031Sdim
134288943Sdimclass LOAD_GP_FM_MM16<bits<6> op> {
135288943Sdim  bits<3> rt;
136288943Sdim  bits<7> offset;
137288943Sdim
138288943Sdim  bits<16> Inst;
139288943Sdim
140288943Sdim  let Inst{15-10} = op;
141288943Sdim  let Inst{9-7} = rt;
142288943Sdim  let Inst{6-0} = offset;
143288943Sdim}
144288943Sdim
145280031Sdimclass ADDIUS5_FM_MM16 {
146280031Sdim  bits<5> rd;
147280031Sdim  bits<4> imm;
148280031Sdim
149280031Sdim  bits<16> Inst;
150280031Sdim
151280031Sdim  let Inst{15-10} = 0x13;
152280031Sdim  let Inst{9-5}   = rd;
153280031Sdim  let Inst{4-1}   = imm;
154280031Sdim  let Inst{0}     = 0;
155280031Sdim}
156280031Sdim
157280031Sdimclass ADDIUSP_FM_MM16 {
158280031Sdim  bits<9> imm;
159280031Sdim
160280031Sdim  bits<16> Inst;
161280031Sdim
162280031Sdim  let Inst{15-10} = 0x13;
163280031Sdim  let Inst{9-1}   = imm;
164280031Sdim  let Inst{0}     = 1;
165280031Sdim}
166280031Sdim
167276479Sdimclass MOVE_FM_MM16<bits<6> funct> {
168276479Sdim  bits<5> rs;
169276479Sdim  bits<5> rd;
170276479Sdim
171276479Sdim  bits<16> Inst;
172276479Sdim
173276479Sdim  let Inst{15-10} = funct;
174276479Sdim  let Inst{9-5}   = rd;
175276479Sdim  let Inst{4-0}   = rs;
176276479Sdim}
177276479Sdim
178280031Sdimclass LI_FM_MM16 {
179280031Sdim  bits<3> rd;
180280031Sdim  bits<7> imm;
181280031Sdim
182280031Sdim  bits<16> Inst;
183280031Sdim
184280031Sdim  let Inst{15-10} = 0x3b;
185280031Sdim  let Inst{9-7}   = rd;
186280031Sdim  let Inst{6-0}   = imm;
187280031Sdim}
188280031Sdim
189276479Sdimclass JALR_FM_MM16<bits<5> op> {
190276479Sdim  bits<5> rs;
191276479Sdim
192276479Sdim  bits<16> Inst;
193276479Sdim
194276479Sdim  let Inst{15-10} = 0x11;
195276479Sdim  let Inst{9-5}   = op;
196276479Sdim  let Inst{4-0}   = rs;
197276479Sdim}
198276479Sdim
199276479Sdimclass MFHILO_FM_MM16<bits<5> funct> {
200276479Sdim  bits<5> rd;
201276479Sdim
202276479Sdim  bits<16> Inst;
203276479Sdim
204276479Sdim  let Inst{15-10} = 0x11;
205276479Sdim  let Inst{9-5}   = funct;
206276479Sdim  let Inst{4-0}   = rd;
207276479Sdim}
208276479Sdim
209280031Sdimclass JRADDIUSP_FM_MM16<bits<5> op> {
210280031Sdim  bits<5> rs;
211280031Sdim  bits<5> imm;
212280031Sdim
213280031Sdim  bits<16> Inst;
214280031Sdim
215280031Sdim  let Inst{15-10} = 0x11;
216280031Sdim  let Inst{9-5}   = op;
217280031Sdim  let Inst{4-0}   = imm;
218280031Sdim}
219280031Sdim
220280031Sdimclass ADDIUR1SP_FM_MM16 {
221280031Sdim  bits<3> rd;
222280031Sdim  bits<6> imm;
223280031Sdim
224280031Sdim  bits<16> Inst;
225280031Sdim
226280031Sdim  let Inst{15-10} = 0x1b;
227280031Sdim  let Inst{9-7}   = rd;
228280031Sdim  let Inst{6-1}   = imm;
229280031Sdim  let Inst{0}     = 1;
230280031Sdim}
231280031Sdim
232280031Sdimclass BRKSDBBP16_FM_MM<bits<6> op> {
233280031Sdim  bits<4> code_;
234280031Sdim  bits<16> Inst;
235280031Sdim
236280031Sdim  let Inst{15-10} = 0x11;
237280031Sdim  let Inst{9-4}   = op;
238280031Sdim  let Inst{3-0}   = code_;
239280031Sdim}
240280031Sdim
241280031Sdimclass BEQNEZ_FM_MM16<bits<6> op> {
242280031Sdim  bits<3> rs;
243280031Sdim  bits<7> offset;
244280031Sdim
245280031Sdim  bits<16> Inst;
246280031Sdim
247280031Sdim  let Inst{15-10} = op;
248280031Sdim  let Inst{9-7}   = rs;
249280031Sdim  let Inst{6-0}   = offset;
250280031Sdim}
251280031Sdim
252288943Sdimclass B16_FM {
253288943Sdim  bits<10> offset;
254288943Sdim
255288943Sdim  bits<16> Inst;
256288943Sdim
257288943Sdim  let Inst{15-10} = 0x33;
258288943Sdim  let Inst{9-0}   = offset;
259288943Sdim}
260288943Sdim
261288943Sdimclass MOVEP_FM_MM16 {
262288943Sdim  bits<3> dst_regs;
263288943Sdim  bits<3> rt;
264288943Sdim  bits<3> rs;
265288943Sdim
266288943Sdim  bits<16> Inst;
267288943Sdim
268288943Sdim  let Inst{15-10} = 0x21;
269288943Sdim  let Inst{9-7}   = dst_regs;
270288943Sdim  let Inst{6-4}   = rt;
271288943Sdim  let Inst{3-1}   = rs;
272288943Sdim  let Inst{0}     = 0;
273288943Sdim}
274288943Sdim
275276479Sdim//===----------------------------------------------------------------------===//
276276479Sdim// MicroMIPS 32-bit Instruction Formats
277276479Sdim//===----------------------------------------------------------------------===//
278276479Sdim
279251607Sdimclass MMArch {
280251607Sdim  string Arch = "micromips";
281251607Sdim  list<dag> Pattern = [];
282251607Sdim}
283251607Sdim
284251607Sdimclass ADD_FM_MM<bits<6> op, bits<10> funct> : MMArch {
285251607Sdim  bits<5> rt;
286251607Sdim  bits<5> rs;
287251607Sdim  bits<5> rd;
288251607Sdim
289251607Sdim  bits<32> Inst;
290251607Sdim
291251607Sdim  let Inst{31-26} = op;
292251607Sdim  let Inst{25-21} = rt;
293251607Sdim  let Inst{20-16} = rs;
294251607Sdim  let Inst{15-11} = rd;
295251607Sdim  let Inst{10}    = 0;
296251607Sdim  let Inst{9-0}   = funct;
297251607Sdim}
298251607Sdim
299251607Sdimclass ADDI_FM_MM<bits<6> op> : MMArch {
300251607Sdim  bits<5>  rs;
301251607Sdim  bits<5>  rt;
302251607Sdim  bits<16> imm16;
303251607Sdim
304251607Sdim  bits<32> Inst;
305251607Sdim
306251607Sdim  let Inst{31-26} = op;
307251607Sdim  let Inst{25-21} = rt;
308251607Sdim  let Inst{20-16} = rs;
309251607Sdim  let Inst{15-0}  = imm16;
310251607Sdim}
311251607Sdim
312251607Sdimclass SLTI_FM_MM<bits<6> op> : MMArch {
313251607Sdim  bits<5> rt;
314251607Sdim  bits<5> rs;
315251607Sdim  bits<16> imm16;
316251607Sdim
317251607Sdim  bits<32> Inst;
318251607Sdim
319251607Sdim  let Inst{31-26} = op;
320261991Sdim  let Inst{25-21} = rt;
321261991Sdim  let Inst{20-16} = rs;
322251607Sdim  let Inst{15-0}  = imm16;
323251607Sdim}
324251607Sdim
325251607Sdimclass LUI_FM_MM : MMArch {
326251607Sdim  bits<5> rt;
327251607Sdim  bits<16> imm16;
328251607Sdim
329251607Sdim  bits<32> Inst;
330251607Sdim
331251607Sdim  let Inst{31-26} = 0x10;
332251607Sdim  let Inst{25-21} = 0xd;
333251607Sdim  let Inst{20-16} = rt;
334251607Sdim  let Inst{15-0}  = imm16;
335251607Sdim}
336251607Sdim
337251607Sdimclass MULT_FM_MM<bits<10> funct> : MMArch {
338251607Sdim  bits<5>  rs;
339251607Sdim  bits<5>  rt;
340251607Sdim
341251607Sdim  bits<32> Inst;
342251607Sdim
343251607Sdim  let Inst{31-26} = 0x00;
344251607Sdim  let Inst{25-21} = rt;
345251607Sdim  let Inst{20-16} = rs;
346251607Sdim  let Inst{15-6}  = funct;
347251607Sdim  let Inst{5-0}   = 0x3c;
348251607Sdim}
349251607Sdim
350251607Sdimclass SRA_FM_MM<bits<10> funct, bit rotate> : MMArch {
351251607Sdim  bits<5> rd;
352251607Sdim  bits<5> rt;
353251607Sdim  bits<5> shamt;
354251607Sdim
355251607Sdim  bits<32> Inst;
356251607Sdim
357251607Sdim  let Inst{31-26} = 0;
358251607Sdim  let Inst{25-21} = rd;
359251607Sdim  let Inst{20-16} = rt;
360251607Sdim  let Inst{15-11} = shamt;
361251607Sdim  let Inst{10}    = rotate;
362251607Sdim  let Inst{9-0}   = funct;
363251607Sdim}
364251607Sdim
365251607Sdimclass SRLV_FM_MM<bits<10> funct, bit rotate> : MMArch {
366251607Sdim  bits<5> rd;
367251607Sdim  bits<5> rt;
368251607Sdim  bits<5> rs;
369251607Sdim
370251607Sdim  bits<32> Inst;
371251607Sdim
372251607Sdim  let Inst{31-26} = 0;
373251607Sdim  let Inst{25-21} = rt;
374251607Sdim  let Inst{20-16} = rs;
375251607Sdim  let Inst{15-11} = rd;
376251607Sdim  let Inst{10}    = rotate;
377251607Sdim  let Inst{9-0}   = funct;
378251607Sdim}
379251607Sdim
380251607Sdimclass LW_FM_MM<bits<6> op> : MMArch {
381251607Sdim  bits<5> rt;
382251607Sdim  bits<21> addr;
383251607Sdim
384251607Sdim  bits<32> Inst;
385251607Sdim
386251607Sdim  let Inst{31-26} = op;
387251607Sdim  let Inst{25-21} = rt;
388251607Sdim  let Inst{20-16} = addr{20-16};
389251607Sdim  let Inst{15-0}  = addr{15-0};
390251607Sdim}
391261991Sdim
392296417Sdimclass POOL32C_LHUE_FM_MM<bits<6> op, bits<4> fmt, bits<3> funct> : MMArch {
393296417Sdim  bits<5> rt;
394296417Sdim  bits<21> addr;
395296417Sdim  bits<5> base = addr{20-16};
396296417Sdim  bits<9> offset = addr{8-0};
397296417Sdim
398296417Sdim  bits<32> Inst;
399296417Sdim
400296417Sdim  let Inst{31-26} = op;
401296417Sdim  let Inst{25-21} = rt;
402296417Sdim  let Inst{20-16} = base;
403296417Sdim  let Inst{15-12} = fmt;
404296417Sdim  let Inst{11-9} = funct;
405296417Sdim  let Inst{8-0}  = offset;
406296417Sdim}
407296417Sdim
408261991Sdimclass LWL_FM_MM<bits<4> funct> {
409261991Sdim  bits<5> rt;
410261991Sdim  bits<21> addr;
411261991Sdim
412261991Sdim  bits<32> Inst;
413261991Sdim
414261991Sdim  let Inst{31-26} = 0x18;
415261991Sdim  let Inst{25-21} = rt;
416261991Sdim  let Inst{20-16} = addr{20-16};
417261991Sdim  let Inst{15-12} = funct;
418261991Sdim  let Inst{11-0}  = addr{11-0};
419261991Sdim}
420261991Sdim
421296417Sdimclass POOL32C_STEVA_LDEVA_FM_MM<bits<4> type, bits<3> funct> {
422296417Sdim  bits<5> rt;
423296417Sdim  bits<21> addr;
424296417Sdim  bits<5> base = addr{20-16};
425296417Sdim  bits<9> offset = addr{8-0};
426296417Sdim
427296417Sdim  bits<32> Inst;
428296417Sdim
429296417Sdim  let Inst{31-26} = 0x18;
430296417Sdim  let Inst{25-21} = rt;
431296417Sdim  let Inst{20-16} = base;
432296417Sdim  let Inst{15-12} = type;
433296417Sdim  let Inst{11-9} = funct;
434296417Sdim  let Inst{8-0}  = offset;
435296417Sdim}
436296417Sdim
437261991Sdimclass CMov_F_I_FM_MM<bits<7> func> : MMArch {
438261991Sdim  bits<5> rd;
439261991Sdim  bits<5> rs;
440261991Sdim  bits<3> fcc;
441261991Sdim
442261991Sdim  bits<32> Inst;
443261991Sdim
444261991Sdim  let Inst{31-26} = 0x15;
445261991Sdim  let Inst{25-21} = rd;
446261991Sdim  let Inst{20-16} = rs;
447261991Sdim  let Inst{15-13} = fcc;
448261991Sdim  let Inst{12-6}  = func;
449261991Sdim  let Inst{5-0}   = 0x3b;
450261991Sdim}
451261991Sdim
452261991Sdimclass MTLO_FM_MM<bits<10> funct> : MMArch {
453261991Sdim  bits<5> rs;
454261991Sdim
455261991Sdim  bits<32> Inst;
456261991Sdim
457261991Sdim  let Inst{31-26} = 0x00;
458261991Sdim  let Inst{25-21} = 0x00;
459261991Sdim  let Inst{20-16} = rs;
460261991Sdim  let Inst{15-6}  = funct;
461261991Sdim  let Inst{5-0}   = 0x3c;
462261991Sdim}
463261991Sdim
464261991Sdimclass MFLO_FM_MM<bits<10> funct> : MMArch {
465261991Sdim  bits<5> rd;
466261991Sdim
467261991Sdim  bits<32> Inst;
468261991Sdim
469261991Sdim  let Inst{31-26} = 0x00;
470261991Sdim  let Inst{25-21} = 0x00;
471261991Sdim  let Inst{20-16} = rd;
472261991Sdim  let Inst{15-6}  = funct;
473261991Sdim  let Inst{5-0}   = 0x3c;
474261991Sdim}
475261991Sdim
476261991Sdimclass CLO_FM_MM<bits<10> funct> : MMArch {
477261991Sdim  bits<5> rd;
478261991Sdim  bits<5> rs;
479261991Sdim
480261991Sdim  bits<32> Inst;
481261991Sdim
482261991Sdim  let Inst{31-26} = 0x00;
483261991Sdim  let Inst{25-21} = rd;
484261991Sdim  let Inst{20-16} = rs;
485261991Sdim  let Inst{15-6}  = funct;
486261991Sdim  let Inst{5-0}   = 0x3c;
487261991Sdim}
488261991Sdim
489261991Sdimclass SEB_FM_MM<bits<10> funct> : MMArch {
490261991Sdim  bits<5> rd;
491261991Sdim  bits<5> rt;
492261991Sdim
493261991Sdim  bits<32> Inst;
494261991Sdim
495261991Sdim  let Inst{31-26} = 0x00;
496261991Sdim  let Inst{25-21} = rd;
497261991Sdim  let Inst{20-16} = rt;
498261991Sdim  let Inst{15-6}  = funct;
499261991Sdim  let Inst{5-0}   = 0x3c;
500261991Sdim}
501261991Sdim
502261991Sdimclass EXT_FM_MM<bits<6> funct> : MMArch {
503261991Sdim  bits<5> rt;
504261991Sdim  bits<5> rs;
505261991Sdim  bits<5> pos;
506261991Sdim  bits<5> size;
507261991Sdim
508261991Sdim  bits<32> Inst;
509261991Sdim
510261991Sdim  let Inst{31-26} = 0x00;
511261991Sdim  let Inst{25-21} = rt;
512261991Sdim  let Inst{20-16} = rs;
513261991Sdim  let Inst{15-11} = size;
514261991Sdim  let Inst{10-6}  = pos;
515261991Sdim  let Inst{5-0}   = funct;
516261991Sdim}
517261991Sdim
518261991Sdimclass J_FM_MM<bits<6> op> : MMArch {
519261991Sdim  bits<26> target;
520261991Sdim
521261991Sdim  bits<32> Inst;
522261991Sdim
523261991Sdim  let Inst{31-26} = op;
524261991Sdim  let Inst{25-0}  = target;
525261991Sdim}
526261991Sdim
527261991Sdimclass JR_FM_MM<bits<8> funct> : MMArch {
528261991Sdim  bits<5> rs;
529261991Sdim
530261991Sdim  bits<32> Inst;
531261991Sdim
532261991Sdim  let Inst{31-21} = 0x00;
533261991Sdim  let Inst{20-16} = rs;
534261991Sdim  let Inst{15-14} = 0x0;
535261991Sdim  let Inst{13-6}  = funct;
536261991Sdim  let Inst{5-0}   = 0x3c;
537261991Sdim}
538261991Sdim
539276479Sdimclass JALR_FM_MM<bits<10> funct> {
540261991Sdim  bits<5> rs;
541261991Sdim  bits<5> rd;
542261991Sdim
543261991Sdim  bits<32> Inst;
544261991Sdim
545261991Sdim  let Inst{31-26} = 0x00;
546261991Sdim  let Inst{25-21} = rd;
547261991Sdim  let Inst{20-16} = rs;
548261991Sdim  let Inst{15-6}  = funct;
549261991Sdim  let Inst{5-0}   = 0x3c;
550261991Sdim}
551261991Sdim
552261991Sdimclass BEQ_FM_MM<bits<6> op> : MMArch {
553261991Sdim  bits<5>  rs;
554261991Sdim  bits<5>  rt;
555261991Sdim  bits<16> offset;
556261991Sdim
557261991Sdim  bits<32> Inst;
558261991Sdim
559261991Sdim  let Inst{31-26} = op;
560261991Sdim  let Inst{25-21} = rt;
561261991Sdim  let Inst{20-16} = rs;
562261991Sdim  let Inst{15-0}  = offset;
563261991Sdim}
564261991Sdim
565261991Sdimclass BGEZ_FM_MM<bits<5> funct> : MMArch {
566261991Sdim  bits<5>  rs;
567261991Sdim  bits<16> offset;
568261991Sdim
569261991Sdim  bits<32> Inst;
570261991Sdim
571261991Sdim  let Inst{31-26} = 0x10;
572261991Sdim  let Inst{25-21} = funct;
573261991Sdim  let Inst{20-16} = rs;
574261991Sdim  let Inst{15-0}  = offset;
575261991Sdim}
576261991Sdim
577261991Sdimclass BGEZAL_FM_MM<bits<5> funct> : MMArch {
578261991Sdim  bits<5>  rs;
579261991Sdim  bits<16> offset;
580261991Sdim
581261991Sdim  bits<32> Inst;
582261991Sdim
583261991Sdim  let Inst{31-26} = 0x10;
584261991Sdim  let Inst{25-21} = funct;
585261991Sdim  let Inst{20-16} = rs;
586261991Sdim  let Inst{15-0}  = offset;
587261991Sdim}
588261991Sdim
589276479Sdimclass SYNC_FM_MM : MMArch {
590276479Sdim  bits<5> stype;
591276479Sdim
592276479Sdim  bits<32> Inst;
593276479Sdim
594276479Sdim  let Inst{31-26} = 0x00;
595276479Sdim  let Inst{25-21} = 0x0;
596276479Sdim  let Inst{20-16} = stype;
597276479Sdim  let Inst{15-6}  = 0x1ad;
598276479Sdim  let Inst{5-0}   = 0x3c;
599276479Sdim}
600276479Sdim
601276479Sdimclass BRK_FM_MM : MMArch {
602276479Sdim  bits<10> code_1;
603276479Sdim  bits<10> code_2;
604276479Sdim  bits<32> Inst;
605276479Sdim  let Inst{31-26} = 0x0;
606276479Sdim  let Inst{25-16} = code_1;
607276479Sdim  let Inst{15-6}  = code_2;
608276479Sdim  let Inst{5-0}   = 0x07;
609276479Sdim}
610276479Sdim
611276479Sdimclass SYS_FM_MM : MMArch {
612276479Sdim  bits<10> code_;
613276479Sdim  bits<32> Inst;
614276479Sdim  let Inst{31-26} = 0x0;
615276479Sdim  let Inst{25-16} = code_;
616276479Sdim  let Inst{15-6}  = 0x22d;
617276479Sdim  let Inst{5-0}   = 0x3c;
618276479Sdim}
619276479Sdim
620276479Sdimclass WAIT_FM_MM {
621276479Sdim  bits<10> code_;
622276479Sdim  bits<32> Inst;
623276479Sdim
624276479Sdim  let Inst{31-26} = 0x00;
625276479Sdim  let Inst{25-16} = code_;
626276479Sdim  let Inst{15-6}  = 0x24d;
627276479Sdim  let Inst{5-0}   = 0x3c;
628276479Sdim}
629276479Sdim
630276479Sdimclass ER_FM_MM<bits<10> funct> : MMArch {
631276479Sdim  bits<32> Inst;
632276479Sdim
633276479Sdim  let Inst{31-26} = 0x00;
634276479Sdim  let Inst{25-16} = 0x00;
635276479Sdim  let Inst{15-6}  = funct;
636276479Sdim  let Inst{5-0}   = 0x3c;
637276479Sdim}
638276479Sdim
639276479Sdimclass EI_FM_MM<bits<10> funct> : MMArch {
640276479Sdim  bits<32> Inst;
641276479Sdim  bits<5> rt;
642276479Sdim
643276479Sdim  let Inst{31-26} = 0x00;
644276479Sdim  let Inst{25-21} = 0x00;
645276479Sdim  let Inst{20-16} = rt;
646276479Sdim  let Inst{15-6}  = funct;
647276479Sdim  let Inst{5-0}   = 0x3c;
648276479Sdim}
649276479Sdim
650261991Sdimclass TEQ_FM_MM<bits<6> funct> : MMArch {
651261991Sdim  bits<5> rs;
652261991Sdim  bits<5> rt;
653261991Sdim  bits<4> code_;
654261991Sdim
655261991Sdim  bits<32> Inst;
656261991Sdim
657261991Sdim  let Inst{31-26} = 0x00;
658261991Sdim  let Inst{25-21} = rt;
659261991Sdim  let Inst{20-16} = rs;
660261991Sdim  let Inst{15-12} = code_;
661261991Sdim  let Inst{11-6}  = funct;
662261991Sdim  let Inst{5-0}   = 0x3c;
663261991Sdim}
664261991Sdim
665261991Sdimclass TEQI_FM_MM<bits<5> funct> : MMArch {
666261991Sdim  bits<5> rs;
667261991Sdim  bits<16> imm16;
668261991Sdim
669261991Sdim  bits<32> Inst;
670261991Sdim
671261991Sdim  let Inst{31-26} = 0x10;
672261991Sdim  let Inst{25-21} = funct;
673261991Sdim  let Inst{20-16} = rs;
674261991Sdim  let Inst{15-0}  = imm16;
675261991Sdim}
676276479Sdim
677276479Sdimclass LL_FM_MM<bits<4> funct> {
678276479Sdim  bits<5> rt;
679276479Sdim  bits<21> addr;
680276479Sdim
681276479Sdim  bits<32> Inst;
682276479Sdim
683276479Sdim  let Inst{31-26} = 0x18;
684276479Sdim  let Inst{25-21} = rt;
685276479Sdim  let Inst{20-16} = addr{20-16};
686276479Sdim  let Inst{15-12} = funct;
687276479Sdim  let Inst{11-0}  = addr{11-0};
688276479Sdim}
689276479Sdim
690296417Sdimclass LLE_FM_MM<bits<4> funct> {
691296417Sdim  bits<5> rt;
692296417Sdim  bits<21> addr;
693296417Sdim  bits<5> base = addr{20-16};
694296417Sdim  bits<9> offset = addr{8-0};
695296417Sdim
696296417Sdim  bits<32> Inst;
697296417Sdim
698296417Sdim  let Inst{31-26} = 0x18;
699296417Sdim  let Inst{25-21} = rt;
700296417Sdim  let Inst{20-16} = base;
701296417Sdim  let Inst{15-12} = funct;
702296417Sdim  let Inst{11-9} = 0x6;
703296417Sdim  let Inst{8-0} = offset;
704296417Sdim}
705296417Sdim
706276479Sdimclass ADDS_FM_MM<bits<2> fmt, bits<8> funct> : MMArch {
707276479Sdim  bits<5> ft;
708276479Sdim  bits<5> fs;
709276479Sdim  bits<5> fd;
710276479Sdim
711276479Sdim  bits<32> Inst;
712276479Sdim
713276479Sdim  let Inst{31-26} = 0x15;
714276479Sdim  let Inst{25-21} = ft;
715276479Sdim  let Inst{20-16} = fs;
716276479Sdim  let Inst{15-11} = fd;
717276479Sdim  let Inst{10}    = 0;
718276479Sdim  let Inst{9-8}   = fmt;
719276479Sdim  let Inst{7-0}   = funct;
720276479Sdim
721276479Sdim  list<dag> Pattern = [];
722276479Sdim}
723276479Sdim
724276479Sdimclass LWXC1_FM_MM<bits<9> funct> : MMArch {
725276479Sdim  bits<5> fd;
726276479Sdim  bits<5> base;
727276479Sdim  bits<5> index;
728276479Sdim
729276479Sdim  bits<32> Inst;
730276479Sdim
731276479Sdim  let Inst{31-26} = 0x15;
732276479Sdim  let Inst{25-21} = index;
733276479Sdim  let Inst{20-16} = base;
734276479Sdim  let Inst{15-11} = fd;
735276479Sdim  let Inst{10-9}  = 0x0;
736276479Sdim  let Inst{8-0}   = funct;
737276479Sdim}
738276479Sdim
739276479Sdimclass SWXC1_FM_MM<bits<9> funct> : MMArch {
740276479Sdim  bits<5> fs;
741276479Sdim  bits<5> base;
742276479Sdim  bits<5> index;
743276479Sdim
744276479Sdim  bits<32> Inst;
745276479Sdim
746276479Sdim  let Inst{31-26} = 0x15;
747276479Sdim  let Inst{25-21} = index;
748276479Sdim  let Inst{20-16} = base;
749276479Sdim  let Inst{15-11} = fs;
750276479Sdim  let Inst{10-9}  = 0x0;
751276479Sdim  let Inst{8-0}   = funct;
752276479Sdim}
753276479Sdim
754276479Sdimclass CEQS_FM_MM<bits<2> fmt> : MMArch {
755276479Sdim  bits<5> fs;
756276479Sdim  bits<5> ft;
757276479Sdim  bits<4> cond;
758276479Sdim
759276479Sdim  bits<32> Inst;
760276479Sdim
761276479Sdim  let Inst{31-26} = 0x15;
762276479Sdim  let Inst{25-21} = ft;
763276479Sdim  let Inst{20-16} = fs;
764276479Sdim  let Inst{15-13} = 0x0;  // cc
765276479Sdim  let Inst{12}    = 0;
766276479Sdim  let Inst{11-10} = fmt;
767276479Sdim  let Inst{9-6}   = cond;
768276479Sdim  let Inst{5-0}   = 0x3c;
769276479Sdim}
770276479Sdim
771276479Sdimclass BC1F_FM_MM<bits<5> tf> : MMArch {
772276479Sdim  bits<16> offset;
773276479Sdim
774276479Sdim  bits<32> Inst;
775276479Sdim
776276479Sdim  let Inst{31-26} = 0x10;
777276479Sdim  let Inst{25-21} = tf;
778276479Sdim  let Inst{20-18} = 0x0; // cc
779276479Sdim  let Inst{17-16} = 0x0;
780276479Sdim  let Inst{15-0}  = offset;
781276479Sdim}
782276479Sdim
783276479Sdimclass ROUND_W_FM_MM<bits<1> fmt, bits<8> funct> : MMArch {
784276479Sdim  bits<5> fd;
785276479Sdim  bits<5> fs;
786276479Sdim
787276479Sdim  bits<32> Inst;
788276479Sdim
789276479Sdim  let Inst{31-26} = 0x15;
790276479Sdim  let Inst{25-21} = fd;
791276479Sdim  let Inst{20-16} = fs;
792276479Sdim  let Inst{15}    = 0;
793276479Sdim  let Inst{14}    = fmt;
794276479Sdim  let Inst{13-6}  = funct;
795276479Sdim  let Inst{5-0}   = 0x3b;
796276479Sdim}
797276479Sdim
798276479Sdimclass ABS_FM_MM<bits<2> fmt, bits<7> funct> : MMArch {
799276479Sdim  bits<5> fd;
800276479Sdim  bits<5> fs;
801276479Sdim
802276479Sdim  bits<32> Inst;
803276479Sdim
804276479Sdim  let Inst{31-26} = 0x15;
805276479Sdim  let Inst{25-21} = fd;
806276479Sdim  let Inst{20-16} = fs;
807276479Sdim  let Inst{15}    = 0;
808276479Sdim  let Inst{14-13} = fmt;
809276479Sdim  let Inst{12-6}  = funct;
810276479Sdim  let Inst{5-0}   = 0x3b;
811276479Sdim}
812276479Sdim
813276479Sdimclass CMov_F_F_FM_MM<bits<9> func, bits<2> fmt> : MMArch {
814276479Sdim  bits<5> fd;
815276479Sdim  bits<5> fs;
816276479Sdim
817276479Sdim  bits<32> Inst;
818276479Sdim
819276479Sdim  let Inst{31-26} = 0x15;
820276479Sdim  let Inst{25-21} = fd;
821276479Sdim  let Inst{20-16} = fs;
822276479Sdim  let Inst{15-13} = 0x0; //cc
823276479Sdim  let Inst{12-11} = 0x0;
824276479Sdim  let Inst{10-9}  = fmt;
825276479Sdim  let Inst{8-0}   = func;
826276479Sdim}
827276479Sdim
828276479Sdimclass CMov_I_F_FM_MM<bits<8> funct, bits<2> fmt> : MMArch {
829276479Sdim  bits<5> fd;
830276479Sdim  bits<5> fs;
831276479Sdim  bits<5> rt;
832276479Sdim
833276479Sdim  bits<32> Inst;
834276479Sdim
835276479Sdim  let Inst{31-26} = 0x15;
836276479Sdim  let Inst{25-21} = rt;
837276479Sdim  let Inst{20-16} = fs;
838276479Sdim  let Inst{15-11} = fd;
839276479Sdim  let Inst{9-8}   = fmt;
840276479Sdim  let Inst{7-0}   = funct;
841276479Sdim}
842276479Sdim
843276479Sdimclass MFC1_FM_MM<bits<8> funct> : MMArch {
844276479Sdim  bits<5> rt;
845276479Sdim  bits<5> fs;
846276479Sdim
847276479Sdim  bits<32> Inst;
848276479Sdim
849276479Sdim  let Inst{31-26} = 0x15;
850276479Sdim  let Inst{25-21} = rt;
851276479Sdim  let Inst{20-16} = fs;
852276479Sdim  let Inst{15-14} = 0x0;
853276479Sdim  let Inst{13-6}  = funct;
854276479Sdim  let Inst{5-0}   = 0x3b;
855276479Sdim}
856276479Sdim
857276479Sdimclass MADDS_FM_MM<bits<6> funct>: MMArch {
858276479Sdim  bits<5> ft;
859276479Sdim  bits<5> fs;
860276479Sdim  bits<5> fd;
861276479Sdim  bits<5> fr;
862276479Sdim
863276479Sdim  bits<32> Inst;
864276479Sdim
865276479Sdim  let Inst{31-26} = 0x15;
866276479Sdim  let Inst{25-21} = ft;
867276479Sdim  let Inst{20-16} = fs;
868276479Sdim  let Inst{15-11} = fd;
869276479Sdim  let Inst{10-6}  = fr;
870276479Sdim  let Inst{5-0}   = funct;
871276479Sdim}
872280031Sdim
873280031Sdimclass COMPACT_BRANCH_FM_MM<bits<5> funct> {
874280031Sdim  bits<5>  rs;
875280031Sdim  bits<16> offset;
876280031Sdim
877280031Sdim  bits<32> Inst;
878280031Sdim
879280031Sdim  let Inst{31-26} = 0x10;
880280031Sdim  let Inst{25-21} = funct;
881280031Sdim  let Inst{20-16} = rs;
882280031Sdim  let Inst{15-0}  = offset;
883280031Sdim}
884280031Sdim
885280031Sdimclass COP0_TLB_FM_MM<bits<10> op> : MMArch {
886280031Sdim  bits<32> Inst;
887280031Sdim
888280031Sdim  let Inst{31-26} = 0x0;
889280031Sdim  let Inst{25-16} = 0x0;
890280031Sdim  let Inst{15-6}  = op;
891280031Sdim  let Inst{5-0}   = 0x3c;
892280031Sdim}
893280031Sdim
894280031Sdimclass SDBBP_FM_MM : MMArch {
895280031Sdim  bits<10> code_;
896280031Sdim
897280031Sdim  bits<32> Inst;
898280031Sdim
899280031Sdim  let Inst{31-26} = 0x0;
900280031Sdim  let Inst{25-16} = code_;
901280031Sdim  let Inst{15-6}  = 0x36d;
902280031Sdim  let Inst{5-0}   = 0x3c;
903280031Sdim}
904280031Sdim
905280031Sdimclass RDHWR_FM_MM : MMArch {
906280031Sdim  bits<5> rt;
907280031Sdim  bits<5> rd;
908280031Sdim
909280031Sdim  bits<32> Inst;
910280031Sdim
911280031Sdim  let Inst{31-26} = 0x0;
912280031Sdim  let Inst{25-21} = rt;
913280031Sdim  let Inst{20-16} = rd;
914280031Sdim  let Inst{15-6}  = 0x1ac;
915280031Sdim  let Inst{5-0}   = 0x3c;
916280031Sdim}
917280031Sdim
918280031Sdimclass LWXS_FM_MM<bits<10> funct> {
919280031Sdim  bits<5> rd;
920280031Sdim  bits<5> base;
921280031Sdim  bits<5> index;
922280031Sdim
923280031Sdim  bits<32> Inst;
924280031Sdim
925280031Sdim  let Inst{31-26} = 0x0;
926280031Sdim  let Inst{25-21} = index;
927280031Sdim  let Inst{20-16} = base;
928280031Sdim  let Inst{15-11} = rd;
929280031Sdim  let Inst{10}    = 0;
930280031Sdim  let Inst{9-0}   = funct;
931280031Sdim}
932280031Sdim
933280031Sdimclass LWM_FM_MM<bits<4> funct> : MMArch {
934280031Sdim  bits<5> rt;
935280031Sdim  bits<21> addr;
936280031Sdim
937280031Sdim  bits<32> Inst;
938280031Sdim
939280031Sdim  let Inst{31-26} = 0x8;
940280031Sdim  let Inst{25-21} = rt;
941280031Sdim  let Inst{20-16} = addr{20-16};
942280031Sdim  let Inst{15-12} = funct;
943280031Sdim  let Inst{11-0}  = addr{11-0};
944280031Sdim}
945280031Sdim
946296417Sdimclass LWM_FM_MM16<bits<4> funct> : MMArch, PredicateControl {
947280031Sdim  bits<2> rt;
948280031Sdim  bits<4> addr;
949280031Sdim
950280031Sdim  bits<16> Inst;
951280031Sdim
952280031Sdim  let Inst{15-10} = 0x11;
953280031Sdim  let Inst{9-6}   = funct;
954280031Sdim  let Inst{5-4}   = rt;
955280031Sdim  let Inst{3-0}   = addr;
956280031Sdim}
957280031Sdim
958280031Sdimclass CACHE_PREF_FM_MM<bits<6> op, bits<4> funct> : MMArch {
959280031Sdim  bits<21> addr;
960280031Sdim  bits<5> hint;
961280031Sdim  bits<5> base = addr{20-16};
962280031Sdim  bits<12> offset = addr{11-0};
963280031Sdim
964280031Sdim  bits<32> Inst;
965280031Sdim
966280031Sdim  let Inst{31-26} = op;
967280031Sdim  let Inst{25-21} = hint;
968280031Sdim  let Inst{20-16} = base;
969280031Sdim  let Inst{15-12} = funct;
970280031Sdim  let Inst{11-0}  = offset;
971280031Sdim}
972280031Sdim
973296417Sdimclass CACHE_PREFE_FM_MM<bits<6> op, bits<3> funct> : MMArch {
974296417Sdim  bits<21> addr;
975296417Sdim  bits<5> hint;
976296417Sdim  bits<5> base = addr{20-16};
977296417Sdim  bits<9> offset = addr{8-0};
978296417Sdim
979296417Sdim  bits<32> Inst;
980296417Sdim
981296417Sdim  let Inst{31-26} = op;
982296417Sdim  let Inst{25-21} = hint;
983296417Sdim  let Inst{20-16} = base;
984296417Sdim  let Inst{15-12} = 0xA;
985296417Sdim  let Inst{11-9} = funct;
986296417Sdim  let Inst{8-0}  = offset;
987296417Sdim}
988296417Sdim
989296417Sdimclass POOL32F_PREFX_FM_MM<bits<6> op, bits<9> funct> : MMArch {
990296417Sdim  bits<5> index;
991296417Sdim  bits<5> base;
992296417Sdim  bits<5> hint;
993296417Sdim
994296417Sdim  bits<32> Inst;
995296417Sdim
996296417Sdim  let Inst{31-26} = op;
997296417Sdim  let Inst{25-21} = index;
998296417Sdim  let Inst{20-16} = base;
999296417Sdim  let Inst{15-11} = hint;
1000296417Sdim  let Inst{10-9}  = 0x0;
1001296417Sdim  let Inst{8-0}   = funct;
1002296417Sdim}
1003296417Sdim
1004280031Sdimclass BARRIER_FM_MM<bits<5> op> : MMArch {
1005280031Sdim  bits<32> Inst;
1006280031Sdim
1007280031Sdim  let Inst{31-26} = 0x0;
1008280031Sdim  let Inst{25-21} = 0x0;
1009280031Sdim  let Inst{20-16} = 0x0;
1010280031Sdim  let Inst{15-11} = op;
1011280031Sdim  let Inst{10-6}  = 0x0;
1012280031Sdim  let Inst{5-0}   = 0x0;
1013280031Sdim}
1014288943Sdim
1015288943Sdimclass ADDIUPC_FM_MM {
1016288943Sdim  bits<3> rs;
1017288943Sdim  bits<23> imm;
1018288943Sdim
1019288943Sdim  bits<32> Inst;
1020288943Sdim
1021288943Sdim  let Inst{31-26} = 0x1e;
1022288943Sdim  let Inst{25-23} = rs;
1023288943Sdim  let Inst{22-0} = imm;
1024288943Sdim}
1025