1//===-- MicroMipsInstrFormats.td - microMIPS Inst Formats -*- tablegen -*--===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This files descributes the formats of the microMIPS instruction set.
11//
12//===----------------------------------------------------------------------===//
13
14//===----------------------------------------------------------------------===//
15// MicroMIPS Base Classes
16//===----------------------------------------------------------------------===//
17
18//
19// Base class for MicroMips instructions.
20// This class does not depend on the instruction size.
21//
22class MicroMipsInstBase<dag outs, dag ins, string asmstr, list<dag> pattern,
23                        InstrItinClass itin, Format f> : Instruction,
24                        PredicateControl {
25  let Namespace = "Mips";
26  let DecoderNamespace = "MicroMips";
27
28  let OutOperandList = outs;
29  let InOperandList  = ins;
30
31  let AsmString   = asmstr;
32  let Pattern     = pattern;
33  let Itinerary   = itin;
34
35  let EncodingPredicates = [InMicroMips];
36
37  Format Form = f;
38}
39
40//
41// Base class for MicroMIPS 16-bit instructions.
42//
43class MicroMipsInst16<dag outs, dag ins, string asmstr, list<dag> pattern,
44               InstrItinClass itin, Format f> :
45  MicroMipsInstBase<outs, ins, asmstr, pattern, itin, f>
46{
47  let Size = 2;
48  field bits<16> Inst;
49  field bits<16> SoftFail = 0;
50  bits<6> Opcode = 0x0;
51}
52
53//===----------------------------------------------------------------------===//
54// MicroMIPS 16-bit Instruction Formats
55//===----------------------------------------------------------------------===//
56
57class ARITH_FM_MM16<bit funct> {
58  bits<3> rd;
59  bits<3> rt;
60  bits<3> rs;
61
62  bits<16> Inst;
63
64  let Inst{15-10} = 0x01;
65  let Inst{9-7}   = rd;
66  let Inst{6-4}   = rt;
67  let Inst{3-1}   = rs;
68  let Inst{0}     = funct;
69}
70
71class ANDI_FM_MM16<bits<6> funct> {
72  bits<3> rd;
73  bits<3> rs;
74  bits<4> imm;
75
76  bits<16> Inst;
77
78  let Inst{15-10} = funct;
79  let Inst{9-7}   = rd;
80  let Inst{6-4}   = rs;
81  let Inst{3-0}   = imm;
82}
83
84class LOGIC_FM_MM16<bits<4> funct> {
85  bits<3> rt;
86  bits<3> rs;
87
88  bits<16> Inst;
89
90  let Inst{15-10} = 0x11;
91  let Inst{9-6}   = funct;
92  let Inst{5-3}   = rt;
93  let Inst{2-0}   = rs;
94}
95
96class SHIFT_FM_MM16<bits<1> funct> {
97  bits<3> rd;
98  bits<3> rt;
99  bits<3> shamt;
100
101  bits<16> Inst;
102
103  let Inst{15-10} = 0x09;
104  let Inst{9-7}   = rd;
105  let Inst{6-4}   = rt;
106  let Inst{3-1}   = shamt;
107  let Inst{0}     = funct;
108}
109
110class ADDIUR2_FM_MM16 {
111  bits<3> rd;
112  bits<3> rs;
113  bits<3> imm;
114
115  bits<16> Inst;
116
117  let Inst{15-10} = 0x1b;
118  let Inst{9-7}   = rd;
119  let Inst{6-4}   = rs;
120  let Inst{3-1}   = imm;
121  let Inst{0}     = 0;
122}
123
124class LOAD_STORE_FM_MM16<bits<6> op> {
125  bits<3> rt;
126  bits<7> addr;
127
128  bits<16> Inst;
129
130  let Inst{15-10} = op;
131  let Inst{9-7}   = rt;
132  let Inst{6-4}   = addr{6-4};
133  let Inst{3-0}   = addr{3-0};
134}
135
136class LOAD_STORE_SP_FM_MM16<bits<6> op> {
137  bits<5> rt;
138  bits<5> offset;
139
140  bits<16> Inst;
141
142  let Inst{15-10} = op;
143  let Inst{9-5}   = rt;
144  let Inst{4-0}   = offset;
145}
146
147class LOAD_GP_FM_MM16<bits<6> op> {
148  bits<3> rt;
149  bits<7> offset;
150
151  bits<16> Inst;
152
153  let Inst{15-10} = op;
154  let Inst{9-7} = rt;
155  let Inst{6-0} = offset;
156}
157
158class ADDIUS5_FM_MM16 {
159  bits<5> rd;
160  bits<4> imm;
161
162  bits<16> Inst;
163
164  let Inst{15-10} = 0x13;
165  let Inst{9-5}   = rd;
166  let Inst{4-1}   = imm;
167  let Inst{0}     = 0;
168}
169
170class ADDIUSP_FM_MM16 {
171  bits<9> imm;
172
173  bits<16> Inst;
174
175  let Inst{15-10} = 0x13;
176  let Inst{9-1}   = imm;
177  let Inst{0}     = 1;
178}
179
180class MOVE_FM_MM16<bits<6> funct> {
181  bits<5> rs;
182  bits<5> rd;
183
184  bits<16> Inst;
185
186  let Inst{15-10} = funct;
187  let Inst{9-5}   = rd;
188  let Inst{4-0}   = rs;
189}
190
191class LI_FM_MM16 {
192  bits<3> rd;
193  bits<7> imm;
194
195  bits<16> Inst;
196
197  let Inst{15-10} = 0x3b;
198  let Inst{9-7}   = rd;
199  let Inst{6-0}   = imm;
200}
201
202class JALR_FM_MM16<bits<5> op> {
203  bits<5> rs;
204
205  bits<16> Inst;
206
207  let Inst{15-10} = 0x11;
208  let Inst{9-5}   = op;
209  let Inst{4-0}   = rs;
210}
211
212class MFHILO_FM_MM16<bits<5> funct> {
213  bits<5> rd;
214
215  bits<16> Inst;
216
217  let Inst{15-10} = 0x11;
218  let Inst{9-5}   = funct;
219  let Inst{4-0}   = rd;
220}
221
222class JRADDIUSP_FM_MM16<bits<5> op> {
223  bits<5> rs;
224  bits<5> imm;
225
226  bits<16> Inst;
227
228  let Inst{15-10} = 0x11;
229  let Inst{9-5}   = op;
230  let Inst{4-0}   = imm;
231}
232
233class ADDIUR1SP_FM_MM16 {
234  bits<3> rd;
235  bits<6> imm;
236
237  bits<16> Inst;
238
239  let Inst{15-10} = 0x1b;
240  let Inst{9-7}   = rd;
241  let Inst{6-1}   = imm;
242  let Inst{0}     = 1;
243}
244
245class BRKSDBBP16_FM_MM<bits<6> op> {
246  bits<4> code_;
247  bits<16> Inst;
248
249  let Inst{15-10} = 0x11;
250  let Inst{9-4}   = op;
251  let Inst{3-0}   = code_;
252}
253
254class BEQNEZ_FM_MM16<bits<6> op> {
255  bits<3> rs;
256  bits<7> offset;
257
258  bits<16> Inst;
259
260  let Inst{15-10} = op;
261  let Inst{9-7}   = rs;
262  let Inst{6-0}   = offset;
263}
264
265class B16_FM {
266  bits<10> offset;
267
268  bits<16> Inst;
269
270  let Inst{15-10} = 0x33;
271  let Inst{9-0}   = offset;
272}
273
274class MOVEP_FM_MM16 {
275  bits<3> dst_regs;
276  bits<3> rt;
277  bits<3> rs;
278
279  bits<16> Inst;
280
281  let Inst{15-10} = 0x21;
282  let Inst{9-7}   = dst_regs;
283  let Inst{6-4}   = rt;
284  let Inst{3-1}   = rs;
285  let Inst{0}     = 0;
286}
287
288//===----------------------------------------------------------------------===//
289// MicroMIPS 32-bit Instruction Formats
290//===----------------------------------------------------------------------===//
291
292class MMArch {
293  string Arch = "micromips";
294}
295
296class ADD_FM_MM<bits<6> op, bits<10> funct> : MMArch {
297  bits<5> rt;
298  bits<5> rs;
299  bits<5> rd;
300
301  bits<32> Inst;
302
303  let Inst{31-26} = op;
304  let Inst{25-21} = rt;
305  let Inst{20-16} = rs;
306  let Inst{15-11} = rd;
307  let Inst{10}    = 0;
308  let Inst{9-0}   = funct;
309}
310
311class ADDI_FM_MM<bits<6> op> : MMArch {
312  bits<5>  rs;
313  bits<5>  rt;
314  bits<16> imm16;
315
316  bits<32> Inst;
317
318  let Inst{31-26} = op;
319  let Inst{25-21} = rt;
320  let Inst{20-16} = rs;
321  let Inst{15-0}  = imm16;
322}
323
324class SLTI_FM_MM<bits<6> op> : MMArch {
325  bits<5> rt;
326  bits<5> rs;
327  bits<16> imm16;
328
329  bits<32> Inst;
330
331  let Inst{31-26} = op;
332  let Inst{25-21} = rt;
333  let Inst{20-16} = rs;
334  let Inst{15-0}  = imm16;
335}
336
337class LUI_FM_MM : MMArch {
338  bits<5> rt;
339  bits<16> imm16;
340
341  bits<32> Inst;
342
343  let Inst{31-26} = 0x10;
344  let Inst{25-21} = 0xd;
345  let Inst{20-16} = rt;
346  let Inst{15-0}  = imm16;
347}
348
349class MULT_FM_MM<bits<10> funct> : MMArch {
350  bits<5>  rs;
351  bits<5>  rt;
352
353  bits<32> Inst;
354
355  let Inst{31-26} = 0x00;
356  let Inst{25-21} = rt;
357  let Inst{20-16} = rs;
358  let Inst{15-6}  = funct;
359  let Inst{5-0}   = 0x3c;
360}
361
362class SRA_FM_MM<bits<10> funct, bit rotate> : MMArch {
363  bits<5> rd;
364  bits<5> rt;
365  bits<5> shamt;
366
367  bits<32> Inst;
368
369  let Inst{31-26} = 0;
370  let Inst{25-21} = rd;
371  let Inst{20-16} = rt;
372  let Inst{15-11} = shamt;
373  let Inst{10}    = rotate;
374  let Inst{9-0}   = funct;
375}
376
377class SRLV_FM_MM<bits<10> funct, bit rotate> : MMArch {
378  bits<5> rd;
379  bits<5> rt;
380  bits<5> rs;
381
382  bits<32> Inst;
383
384  let Inst{31-26} = 0;
385  let Inst{25-21} = rt;
386  let Inst{20-16} = rs;
387  let Inst{15-11} = rd;
388  let Inst{10}    = rotate;
389  let Inst{9-0}   = funct;
390}
391
392class LW_FM_MM<bits<6> op> : MMArch {
393  bits<5> rt;
394  bits<21> addr;
395  bits<5> base = addr{20-16};
396  bits<16> offset = addr{15-0};
397
398  bits<32> Inst;
399
400  let Inst{31-26} = op;
401  let Inst{25-21} = rt;
402  let Inst{20-16} = base;
403  let Inst{15-0}  = offset;
404}
405
406class POOL32C_LHUE_FM_MM<bits<6> op, bits<4> fmt, bits<3> funct> : MMArch {
407  bits<5> rt;
408  bits<21> addr;
409  bits<5> base = addr{20-16};
410  bits<9> offset = addr{8-0};
411
412  bits<32> Inst;
413
414  let Inst{31-26} = op;
415  let Inst{25-21} = rt;
416  let Inst{20-16} = base;
417  let Inst{15-12} = fmt;
418  let Inst{11-9} = funct;
419  let Inst{8-0}  = offset;
420}
421
422class LWL_FM_MM<bits<4> funct> : MMArch {
423  bits<5> rt;
424  bits<21> addr;
425
426  bits<32> Inst;
427
428  let Inst{31-26} = 0x18;
429  let Inst{25-21} = rt;
430  let Inst{20-16} = addr{20-16};
431  let Inst{15-12} = funct;
432  let Inst{11-0}  = addr{11-0};
433}
434
435class POOL32C_STEVA_LDEVA_FM_MM<bits<4> type, bits<3> funct> : MMArch {
436  bits<5> rt;
437  bits<21> addr;
438  bits<5> base = addr{20-16};
439  bits<9> offset = addr{8-0};
440
441  bits<32> Inst;
442
443  let Inst{31-26} = 0x18;
444  let Inst{25-21} = rt;
445  let Inst{20-16} = base;
446  let Inst{15-12} = type;
447  let Inst{11-9} = funct;
448  let Inst{8-0}  = offset;
449}
450
451class CMov_F_I_FM_MM<bits<7> func> : MMArch {
452  bits<5> rd;
453  bits<5> rs;
454  bits<3> fcc;
455
456  bits<32> Inst;
457
458  let Inst{31-26} = 0x15;
459  let Inst{25-21} = rd;
460  let Inst{20-16} = rs;
461  let Inst{15-13} = fcc;
462  let Inst{12-6}  = func;
463  let Inst{5-0}   = 0x3b;
464}
465
466class MTLO_FM_MM<bits<10> funct> : MMArch {
467  bits<5> rs;
468
469  bits<32> Inst;
470
471  let Inst{31-26} = 0x00;
472  let Inst{25-21} = 0x00;
473  let Inst{20-16} = rs;
474  let Inst{15-6}  = funct;
475  let Inst{5-0}   = 0x3c;
476}
477
478class MFLO_FM_MM<bits<10> funct> : MMArch {
479  bits<5> rd;
480
481  bits<32> Inst;
482
483  let Inst{31-26} = 0x00;
484  let Inst{25-21} = 0x00;
485  let Inst{20-16} = rd;
486  let Inst{15-6}  = funct;
487  let Inst{5-0}   = 0x3c;
488}
489
490class CLO_FM_MM<bits<10> funct> : MMArch {
491  bits<5> rd;
492  bits<5> rs;
493
494  bits<32> Inst;
495
496  let Inst{31-26} = 0x00;
497  let Inst{25-21} = rd;
498  let Inst{20-16} = rs;
499  let Inst{15-6}  = funct;
500  let Inst{5-0}   = 0x3c;
501}
502
503class SEB_FM_MM<bits<10> funct> : MMArch {
504  bits<5> rd;
505  bits<5> rt;
506
507  bits<32> Inst;
508
509  let Inst{31-26} = 0x00;
510  let Inst{25-21} = rd;
511  let Inst{20-16} = rt;
512  let Inst{15-6}  = funct;
513  let Inst{5-0}   = 0x3c;
514}
515
516class EXT_FM_MM<bits<6> funct> : MMArch {
517  bits<5> rt;
518  bits<5> rs;
519  bits<5> pos;
520  bits<5> size;
521
522  bits<32> Inst;
523
524  let Inst{31-26} = 0x00;
525  let Inst{25-21} = rt;
526  let Inst{20-16} = rs;
527  let Inst{15-11} = size;
528  let Inst{10-6}  = pos;
529  let Inst{5-0}   = funct;
530}
531
532class J_FM_MM<bits<6> op> : MMArch {
533  bits<26> target;
534
535  bits<32> Inst;
536
537  let Inst{31-26} = op;
538  let Inst{25-0}  = target;
539}
540
541class JR_FM_MM<bits<8> funct> : MMArch {
542  bits<5> rs;
543
544  bits<32> Inst;
545
546  let Inst{31-21} = 0x00;
547  let Inst{20-16} = rs;
548  let Inst{15-14} = 0x0;
549  let Inst{13-6}  = funct;
550  let Inst{5-0}   = 0x3c;
551}
552
553class JALR_FM_MM<bits<10> funct> {
554  bits<5> rs;
555  bits<5> rd;
556
557  bits<32> Inst;
558
559  let Inst{31-26} = 0x00;
560  let Inst{25-21} = rd;
561  let Inst{20-16} = rs;
562  let Inst{15-6}  = funct;
563  let Inst{5-0}   = 0x3c;
564}
565
566class BEQ_FM_MM<bits<6> op> : MMArch {
567  bits<5>  rs;
568  bits<5>  rt;
569  bits<16> offset;
570
571  bits<32> Inst;
572
573  let Inst{31-26} = op;
574  let Inst{25-21} = rt;
575  let Inst{20-16} = rs;
576  let Inst{15-0}  = offset;
577}
578
579class BGEZ_FM_MM<bits<5> funct> : MMArch {
580  bits<5>  rs;
581  bits<16> offset;
582
583  bits<32> Inst;
584
585  let Inst{31-26} = 0x10;
586  let Inst{25-21} = funct;
587  let Inst{20-16} = rs;
588  let Inst{15-0}  = offset;
589}
590
591class BGEZAL_FM_MM<bits<5> funct> : MMArch {
592  bits<5>  rs;
593  bits<16> offset;
594
595  bits<32> Inst;
596
597  let Inst{31-26} = 0x10;
598  let Inst{25-21} = funct;
599  let Inst{20-16} = rs;
600  let Inst{15-0}  = offset;
601}
602
603class SYNC_FM_MM : MMArch {
604  bits<5> stype;
605
606  bits<32> Inst;
607
608  let Inst{31-26} = 0x00;
609  let Inst{25-21} = 0x0;
610  let Inst{20-16} = stype;
611  let Inst{15-6}  = 0x1ad;
612  let Inst{5-0}   = 0x3c;
613}
614
615class SYNCI_FM_MM : MMArch {
616  bits<21> addr;
617  bits<5> rs = addr{20-16};
618  bits<16> offset = addr{15-0};
619  bits<32> Inst;
620
621  let Inst{31-26} = 0b010000;
622  let Inst{25-21} = 0b10000;
623  let Inst{20-16} = rs;
624  let Inst{15-0}  = offset;
625}
626
627class BRK_FM_MM : MMArch {
628  bits<10> code_1;
629  bits<10> code_2;
630  bits<32> Inst;
631  let Inst{31-26} = 0x0;
632  let Inst{25-16} = code_1;
633  let Inst{15-6}  = code_2;
634  let Inst{5-0}   = 0x07;
635}
636
637class SYS_FM_MM : MMArch {
638  bits<10> code_;
639  bits<32> Inst;
640  let Inst{31-26} = 0x0;
641  let Inst{25-16} = code_;
642  let Inst{15-6}  = 0x22d;
643  let Inst{5-0}   = 0x3c;
644}
645
646class WAIT_FM_MM : MMArch {
647  bits<10> code_;
648  bits<32> Inst;
649
650  let Inst{31-26} = 0x00;
651  let Inst{25-16} = code_;
652  let Inst{15-6}  = 0x24d;
653  let Inst{5-0}   = 0x3c;
654}
655
656class ER_FM_MM<bits<10> funct> : MMArch {
657  bits<32> Inst;
658
659  let Inst{31-26} = 0x00;
660  let Inst{25-16} = 0x00;
661  let Inst{15-6}  = funct;
662  let Inst{5-0}   = 0x3c;
663}
664
665class EI_FM_MM<bits<10> funct> : MMArch {
666  bits<32> Inst;
667  bits<5> rt;
668
669  let Inst{31-26} = 0x00;
670  let Inst{25-21} = 0x00;
671  let Inst{20-16} = rt;
672  let Inst{15-6}  = funct;
673  let Inst{5-0}   = 0x3c;
674}
675
676class TEQ_FM_MM<bits<6> funct> : MMArch {
677  bits<5> rs;
678  bits<5> rt;
679  bits<4> code_;
680
681  bits<32> Inst;
682
683  let Inst{31-26} = 0x00;
684  let Inst{25-21} = rt;
685  let Inst{20-16} = rs;
686  let Inst{15-12} = code_;
687  let Inst{11-6}  = funct;
688  let Inst{5-0}   = 0x3c;
689}
690
691class TEQI_FM_MM<bits<5> funct> : MMArch {
692  bits<5> rs;
693  bits<16> imm16;
694
695  bits<32> Inst;
696
697  let Inst{31-26} = 0x10;
698  let Inst{25-21} = funct;
699  let Inst{20-16} = rs;
700  let Inst{15-0}  = imm16;
701}
702
703class LL_FM_MM<bits<4> funct> : MMArch {
704  bits<5> rt;
705  bits<21> addr;
706
707  bits<32> Inst;
708
709  let Inst{31-26} = 0x18;
710  let Inst{25-21} = rt;
711  let Inst{20-16} = addr{20-16};
712  let Inst{15-12} = funct;
713  let Inst{11-0}  = addr{11-0};
714}
715
716class LLE_FM_MM<bits<4> funct> : MMArch {
717  bits<5> rt;
718  bits<21> addr;
719  bits<5> base = addr{20-16};
720  bits<9> offset = addr{8-0};
721
722  bits<32> Inst;
723
724  let Inst{31-26} = 0x18;
725  let Inst{25-21} = rt;
726  let Inst{20-16} = base;
727  let Inst{15-12} = funct;
728  let Inst{11-9} = 0x6;
729  let Inst{8-0} = offset;
730}
731
732class ADDS_FM_MM<bits<2> fmt, bits<8> funct> : MMArch {
733  bits<5> ft;
734  bits<5> fs;
735  bits<5> fd;
736
737  bits<32> Inst;
738
739  let Inst{31-26} = 0x15;
740  let Inst{25-21} = ft;
741  let Inst{20-16} = fs;
742  let Inst{15-11} = fd;
743  let Inst{10}    = 0;
744  let Inst{9-8}   = fmt;
745  let Inst{7-0}   = funct;
746
747}
748
749class LWXC1_FM_MM<bits<9> funct> : MMArch {
750  bits<5> fd;
751  bits<5> base;
752  bits<5> index;
753
754  bits<32> Inst;
755
756  let Inst{31-26} = 0x15;
757  let Inst{25-21} = index;
758  let Inst{20-16} = base;
759  let Inst{15-11} = fd;
760  let Inst{10-9}  = 0x0;
761  let Inst{8-0}   = funct;
762}
763
764class SWXC1_FM_MM<bits<9> funct> : MMArch {
765  bits<5> fs;
766  bits<5> base;
767  bits<5> index;
768
769  bits<32> Inst;
770
771  let Inst{31-26} = 0x15;
772  let Inst{25-21} = index;
773  let Inst{20-16} = base;
774  let Inst{15-11} = fs;
775  let Inst{10-9}  = 0x0;
776  let Inst{8-0}   = funct;
777}
778
779class CEQS_FM_MM<bits<2> fmt> : MMArch {
780  bits<5> fs;
781  bits<5> ft;
782  bits<3> fcc;
783  bits<4> cond;
784
785  bits<32> Inst;
786
787  let Inst{31-26} = 0x15;
788  let Inst{25-21} = ft;
789  let Inst{20-16} = fs;
790  let Inst{15-13} = fcc;
791  let Inst{12}    = 0;
792  let Inst{11-10} = fmt;
793  let Inst{9-6}   = cond;
794  let Inst{5-0}   = 0x3c;
795}
796
797class C_COND_FM_MM<bits <2> fmt, bits<4> c> : CEQS_FM_MM<fmt> {
798  let cond = c;
799}
800
801class BC1F_FM_MM<bits<5> tf> : MMArch {
802  bits<3> fcc;
803  bits<16> offset;
804
805  bits<32> Inst;
806
807  let Inst{31-26} = 0x10;
808  let Inst{25-21} = tf;
809  let Inst{20-18} = fcc; // cc
810  let Inst{17-16} = 0x0;
811  let Inst{15-0}  = offset;
812}
813
814class ROUND_W_FM_MM<bits<1> fmt, bits<8> funct> : MMArch {
815  bits<5> fd;
816  bits<5> fs;
817
818  bits<32> Inst;
819
820  let Inst{31-26} = 0x15;
821  let Inst{25-21} = fd;
822  let Inst{20-16} = fs;
823  let Inst{15}    = 0;
824  let Inst{14}    = fmt;
825  let Inst{13-6}  = funct;
826  let Inst{5-0}   = 0x3b;
827}
828
829class ABS_FM_MM<bits<2> fmt, bits<7> funct> : MMArch {
830  bits<5> fd;
831  bits<5> fs;
832
833  bits<32> Inst;
834
835  let Inst{31-26} = 0x15;
836  let Inst{25-21} = fd;
837  let Inst{20-16} = fs;
838  let Inst{15}    = 0;
839  let Inst{14-13} = fmt;
840  let Inst{12-6}  = funct;
841  let Inst{5-0}   = 0x3b;
842}
843
844class CMov_F_F_FM_MM<bits<9> func, bits<2> fmt> : MMArch {
845  bits<5> fd;
846  bits<5> fs;
847  bits<3> fcc;
848  bits<32> Inst;
849
850  let Inst{31-26} = 0x15;
851  let Inst{25-21} = fd;
852  let Inst{20-16} = fs;
853  let Inst{15-13} = fcc; //cc
854  let Inst{12-11} = 0x0;
855  let Inst{10-9}  = fmt;
856  let Inst{8-0}   = func;
857}
858
859class CMov_I_F_FM_MM<bits<8> funct, bits<2> fmt> : MMArch {
860  bits<5> fd;
861  bits<5> fs;
862  bits<5> rt;
863
864  bits<32> Inst;
865
866  let Inst{31-26} = 0x15;
867  let Inst{25-21} = rt;
868  let Inst{20-16} = fs;
869  let Inst{15-11} = fd;
870  let Inst{9-8}   = fmt;
871  let Inst{7-0}   = funct;
872}
873
874class MFC1_FM_MM<bits<8> funct> : MMArch {
875  bits<5> rt;
876  bits<5> fs;
877
878  bits<32> Inst;
879
880  let Inst{31-26} = 0x15;
881  let Inst{25-21} = rt;
882  let Inst{20-16} = fs;
883  let Inst{15-14} = 0x0;
884  let Inst{13-6}  = funct;
885  let Inst{5-0}   = 0x3b;
886}
887
888class MADDS_FM_MM<bits<6> funct>: MMArch {
889  bits<5> ft;
890  bits<5> fs;
891  bits<5> fd;
892  bits<5> fr;
893
894  bits<32> Inst;
895
896  let Inst{31-26} = 0x15;
897  let Inst{25-21} = ft;
898  let Inst{20-16} = fs;
899  let Inst{15-11} = fd;
900  let Inst{10-6}  = fr;
901  let Inst{5-0}   = funct;
902}
903
904class COMPACT_BRANCH_FM_MM<bits<5> funct> {
905  bits<5>  rs;
906  bits<16> offset;
907
908  bits<32> Inst;
909
910  let Inst{31-26} = 0x10;
911  let Inst{25-21} = funct;
912  let Inst{20-16} = rs;
913  let Inst{15-0}  = offset;
914}
915
916class COP0_TLB_FM_MM<bits<10> op> : MMArch {
917  bits<32> Inst;
918
919  let Inst{31-26} = 0x0;
920  let Inst{25-16} = 0x0;
921  let Inst{15-6}  = op;
922  let Inst{5-0}   = 0x3c;
923}
924
925class SDBBP_FM_MM : MMArch {
926  bits<10> code_;
927
928  bits<32> Inst;
929
930  let Inst{31-26} = 0x0;
931  let Inst{25-16} = code_;
932  let Inst{15-6}  = 0x36d;
933  let Inst{5-0}   = 0x3c;
934}
935
936class SIGRIE_FM_MM : MMArch {
937  bits<16> code_;
938
939  bits<32> Inst;
940
941  let Inst{31-26} = 0x0;
942  let Inst{25-22} = 0x0;
943  let Inst{21-6} = code_;
944  let Inst{5-0} = 0b111111;
945}
946
947class RDHWR_FM_MM : MMArch {
948  bits<5> rt;
949  bits<5> rd;
950
951  bits<32> Inst;
952
953  let Inst{31-26} = 0x0;
954  let Inst{25-21} = rt;
955  let Inst{20-16} = rd;
956  let Inst{15-6}  = 0x1ac;
957  let Inst{5-0}   = 0x3c;
958}
959
960class LWXS_FM_MM<bits<10> funct> {
961  bits<5> rd;
962  bits<5> base;
963  bits<5> index;
964
965  bits<32> Inst;
966
967  let Inst{31-26} = 0x0;
968  let Inst{25-21} = index;
969  let Inst{20-16} = base;
970  let Inst{15-11} = rd;
971  let Inst{10}    = 0;
972  let Inst{9-0}   = funct;
973}
974
975class LWM_FM_MM<bits<4> funct> : MMArch {
976  bits<5> rt;
977  bits<21> addr;
978
979  bits<32> Inst;
980
981  let Inst{31-26} = 0x8;
982  let Inst{25-21} = rt;
983  let Inst{20-16} = addr{20-16};
984  let Inst{15-12} = funct;
985  let Inst{11-0}  = addr{11-0};
986}
987
988class LWM_FM_MM16<bits<4> funct> : MMArch {
989  bits<2> rt;
990  bits<4> addr;
991
992  bits<16> Inst;
993
994  let Inst{15-10} = 0x11;
995  let Inst{9-6}   = funct;
996  let Inst{5-4}   = rt;
997  let Inst{3-0}   = addr;
998}
999
1000class CACHE_PREF_FM_MM<bits<6> op, bits<4> funct> : MMArch {
1001  bits<21> addr;
1002  bits<5> hint;
1003  bits<5> base = addr{20-16};
1004  bits<12> offset = addr{11-0};
1005
1006  bits<32> Inst;
1007
1008  let Inst{31-26} = op;
1009  let Inst{25-21} = hint;
1010  let Inst{20-16} = base;
1011  let Inst{15-12} = funct;
1012  let Inst{11-0}  = offset;
1013}
1014
1015class CACHE_PREFE_FM_MM<bits<6> op, bits<3> funct> : MMArch {
1016  bits<21> addr;
1017  bits<5> hint;
1018  bits<5> base = addr{20-16};
1019  bits<9> offset = addr{8-0};
1020
1021  bits<32> Inst;
1022
1023  let Inst{31-26} = op;
1024  let Inst{25-21} = hint;
1025  let Inst{20-16} = base;
1026  let Inst{15-12} = 0xA;
1027  let Inst{11-9} = funct;
1028  let Inst{8-0}  = offset;
1029}
1030
1031class POOL32F_PREFX_FM_MM<bits<6> op, bits<9> funct> : MMArch {
1032  bits<5> index;
1033  bits<5> base;
1034  bits<5> hint;
1035
1036  bits<32> Inst;
1037
1038  let Inst{31-26} = op;
1039  let Inst{25-21} = index;
1040  let Inst{20-16} = base;
1041  let Inst{15-11} = hint;
1042  let Inst{10-9}  = 0x0;
1043  let Inst{8-0}   = funct;
1044}
1045
1046class BARRIER_FM_MM<bits<5> op> : MMArch {
1047  bits<32> Inst;
1048
1049  let Inst{31-26} = 0x0;
1050  let Inst{25-21} = 0x0;
1051  let Inst{20-16} = 0x0;
1052  let Inst{15-11} = op;
1053  let Inst{10-6}  = 0x0;
1054  let Inst{5-0}   = 0x0;
1055}
1056
1057class ADDIUPC_FM_MM {
1058  bits<3> rs;
1059  bits<23> imm;
1060
1061  bits<32> Inst;
1062
1063  let Inst{31-26} = 0x1e;
1064  let Inst{25-23} = rs;
1065  let Inst{22-0} = imm;
1066}
1067
1068class POOL32A_CFTC2_FM_MM<bits<10> funct> : MMArch {
1069  bits<5> rt;
1070  bits<5> impl;
1071
1072  bits<32> Inst;
1073
1074  let Inst{31-26} = 0b000000;
1075  let Inst{25-21} = rt;
1076  let Inst{20-16} = impl;
1077  let Inst{15-6}  = funct;
1078  let Inst{5-0}   = 0b111100;
1079}
1080
1081class POOL32A_TLBINV_FM_MM<bits<10> funct> : MMArch {
1082  bits<32> Inst;
1083
1084  let Inst{31-26} = 0x0;
1085  let Inst{25-16} = 0x0;
1086  let Inst{15-6}  = funct;
1087  let Inst{5-0}   = 0b111100;
1088}
1089
1090class POOL32A_MFTC0_FM_MM<bits<5> funct, bits<6> opcode> : MMArch {
1091  bits<5> rt;
1092  bits<5> rs;
1093  bits<3> sel;
1094
1095  bits<32> Inst;
1096
1097  let Inst{31-26} = 0b000000;
1098  let Inst{25-21} = rt;
1099  let Inst{20-16} = rs;
1100  let Inst{15-14} = 0;
1101  let Inst{13-11} = sel;
1102  let Inst{10-6}  = funct;
1103  let Inst{5-0}   = opcode;
1104}
1105
1106class POOL32A_HYPCALL_FM_MM : MMArch {
1107  bits<32> Inst;
1108
1109  bits<10> code_;
1110
1111  let Inst{31-26} = 0x0;
1112  let Inst{25-16} = code_;
1113  let Inst{15-6}  = 0b1100001101;
1114  let Inst{5-0}   = 0b111100;
1115}
1116