summaryrefslogtreecommitdiffstats
path: root/include/asm-cris/arch-v32/hwregs/iop/iop_mpu_macros.h
blob: 2ec897ced1667ce308f43fe8c3e09766dce009ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
/* ************************************************************************* */
/* This file is autogenerated by IOPASM Version 1.2                          */
/* DO NOT EDIT THIS FILE - All changes will be lost!                         */
/* ************************************************************************* */



#ifndef __IOP_MPU_MACROS_H__
#define __IOP_MPU_MACROS_H__


/* ************************************************************************* */
/*                           REGISTER DEFINITIONS                            */
/* ************************************************************************* */
#define MPU_R0 (0x0)
#define MPU_R1 (0x1)
#define MPU_R2 (0x2)
#define MPU_R3 (0x3)
#define MPU_R4 (0x4)
#define MPU_R5 (0x5)
#define MPU_R6 (0x6)
#define MPU_R7 (0x7)
#define MPU_R8 (0x8)
#define MPU_R9 (0x9)
#define MPU_R10 (0xa)
#define MPU_R11 (0xb)
#define MPU_R12 (0xc)
#define MPU_R13 (0xd)
#define MPU_R14 (0xe)
#define MPU_R15 (0xf)
#define MPU_PC (0x2)
#define MPU_WSTS (0x3)
#define MPU_JADDR (0x4)
#define MPU_IRP (0x5)
#define MPU_SRP (0x6)
#define MPU_T0 (0x8)
#define MPU_T1 (0x9)
#define MPU_T2 (0xa)
#define MPU_T3 (0xb)
#define MPU_I0 (0x10)
#define MPU_I1 (0x11)
#define MPU_I2 (0x12)
#define MPU_I3 (0x13)
#define MPU_I4 (0x14)
#define MPU_I5 (0x15)
#define MPU_I6 (0x16)
#define MPU_I7 (0x17)
#define MPU_I8 (0x18)
#define MPU_I9 (0x19)
#define MPU_I10 (0x1a)
#define MPU_I11 (0x1b)
#define MPU_I12 (0x1c)
#define MPU_I13 (0x1d)
#define MPU_I14 (0x1e)
#define MPU_I15 (0x1f)
#define MPU_P2 (0x2)
#define MPU_P3 (0x3)
#define MPU_P5 (0x5)
#define MPU_P6 (0x6)
#define MPU_P8 (0x8)
#define MPU_P9 (0x9)
#define MPU_P10 (0xa)
#define MPU_P11 (0xb)
#define MPU_P16 (0x10)
#define MPU_P17 (0x12)
#define MPU_P18 (0x12)
#define MPU_P19 (0x13)
#define MPU_P20 (0x14)
#define MPU_P21 (0x15)
#define MPU_P22 (0x16)
#define MPU_P23 (0x17)
#define MPU_P24 (0x18)
#define MPU_P25 (0x19)
#define MPU_P26 (0x1a)
#define MPU_P27 (0x1b)
#define MPU_P28 (0x1c)
#define MPU_P29 (0x1d)
#define MPU_P30 (0x1e)
#define MPU_P31 (0x1f)
#define MPU_P1 (0x1)
#define MPU_REGA (0x1)



/* ************************************************************************* */
/*                              ADDRESS MACROS                               */
/* ************************************************************************* */
#define MK_DWORD_ADDR(ADDR) (ADDR >> 2)
#define MK_BYTE_ADDR(ADDR) (ADDR)



/* ************************************************************************* */
/*                            INSTRUCTION MACROS                             */
/* ************************************************************************* */
#define MPU_ADD_RRR(S,N,D) (0x4000008C | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADD_RRS(S,N,D) (0x4000048C | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADD_RSR(S,N,D) (0x4000018C | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADD_RSS(S,N,D) (0x4000058C | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADD_SRR(S,N,D) (0x4000028C | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADD_SRS(S,N,D) (0x4000068C | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADD_SSR(S,N,D) (0x4000038C | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADD_SSS(S,N,D) (0x4000078C | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADDQ_RIR(S,N,D) (0x10000000 | ((S & ((1 << 5) - 1)) << 16)\
                                 | ((N & ((1 << 16) - 1)) << 0)\
                                 | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADDQ_IRR(S,N,D) (0x10000000 | ((S & ((1 << 16) - 1)) << 0)\
                                 | ((N & ((1 << 5) - 1)) << 16)\
                                 | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADDX_IRR_INSTR(S,N,D) (0xC000008C | ((N & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADDX_IRR_IMM(S,N,D) (S & 0xFFFFFFFF)

#define MPU_ADDX_RIR_INSTR(S,N,D) (0xC000008C | ((S & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADDX_RIR_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_ADDX_ISR_INSTR(S,N,D) (0xC000028C | ((N & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADDX_ISR_IMM(S,N,D) (S & 0xFFFFFFFF)

#define MPU_ADDX_SIR_INSTR(S,N,D) (0xC000028C | ((S & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADDX_SIR_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_ADDX_IRS_INSTR(S,N,D) (0xC000048C | ((N & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADDX_IRS_IMM(S,N,D) (S & 0xFFFFFFFF)

#define MPU_ADDX_RIS_INSTR(S,N,D) (0xC000048C | ((S & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADDX_RIS_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_ADDX_ISS_INSTR(S,N,D) (0xC000068C | ((N & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADDX_ISS_IMM(S,N,D) (S & 0xFFFFFFFF)

#define MPU_ADDX_SIS_INSTR(S,N,D) (0xC000068C | ((S & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ADDX_SIS_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_AND_RRR(S,N,D) (0x4000008A | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_AND_RRS(S,N,D) (0x4000048A | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_AND_RSR(S,N,D) (0x4000018A | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_AND_RSS(S,N,D) (0x4000058A | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_AND_SRR(S,N,D) (0x4000028A | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_AND_SRS(S,N,D) (0x4000068A | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_AND_SSR(S,N,D) (0x4000038A | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_AND_SSS(S,N,D) (0x4000078A | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ANDQ_RIR(S,N,D) (0x08000000 | ((S & ((1 << 5) - 1)) << 16)\
                                 | ((N & ((1 << 16) - 1)) << 0)\
                                 | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ANDQ_IRR(S,N,D) (0x08000000 | ((S & ((1 << 16) - 1)) << 0)\
                                 | ((N & ((1 << 5) - 1)) << 16)\
                                 | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ANDX_RIR_INSTR(S,N,D) (0xC000008A | ((S & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ANDX_RIR_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_ANDX_IRR_INSTR(S,N,D) (0xC000008A | ((N & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ANDX_IRR_IMM(S,N,D) (S & 0xFFFFFFFF)

#define MPU_ANDX_ISR_INSTR(S,N,D) (0xC000028A | ((N & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ANDX_ISR_IMM(S,N,D) (S & 0xFFFFFFFF)

#define MPU_ANDX_SIR_INSTR(S,N,D) (0xC000028A | ((S & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ANDX_SIR_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_ANDX_IRS_INSTR(S,N,D) (0xC000048A | ((N & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ANDX_IRS_IMM(S,N,D) (S & 0xFFFFFFFF)

#define MPU_ANDX_ISS_INSTR(S,N,D) (0xC000068A | ((N & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ANDX_ISS_IMM(S,N,D) (S & 0xFFFFFFFF)

#define MPU_ANDX_RIS_INSTR(S,N,D) (0xC000048A | ((S & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ANDX_RIS_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_ANDX_SIS_INSTR(S,N,D) (0xC000068A | ((S & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ANDX_SIS_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_BA_I(S) (0x60000000 | ((S & ((1 << 16) - 1)) << 0))

#define MPU_BAR_R(S) (0x62000000 | ((S & ((1 << 5) - 1)) << 11))

#define MPU_BAR_S(S) (0x63000000 | ((S & ((1 << 5) - 1)) << 11))

#define MPU_BBC_RII(S,N,D) (0x78000000 | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 21)\
                                | ((D & ((1 << 16) - 1)) << 0))

#define MPU_BBS_RII(S,N,D) (0x7C000000 | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 21)\
                                | ((D & ((1 << 16) - 1)) << 0))

#define MPU_BNZ_RI(S,D) (0x74400000 | ((S & ((1 << 5) - 1)) << 16)\
                             | ((D & ((1 << 16) - 1)) << 0))

#define MPU_BMI_RI(S,D) (0x7FE00000 | ((S & ((1 << 5) - 1)) << 16)\
                             | ((D & ((1 << 16) - 1)) << 0))

#define MPU_BPL_RI(S,D) (0x7BE00000 | ((S & ((1 << 5) - 1)) << 16)\
                             | ((D & ((1 << 16) - 1)) << 0))

#define MPU_BZ_RI(S,D) (0x74000000 | ((S & ((1 << 5) - 1)) << 16)\
                            | ((D & ((1 << 16) - 1)) << 0))

#define MPU_DI() (0x40000001)

#define MPU_EI() (0x40000003)

#define MPU_HALT() (0x40000002)

#define MPU_JIR_I(S) (0x60200000 | ((S & ((1 << 16) - 1)) << 0))

#define MPU_JIR_R(S) (0x62200000 | ((S & ((1 << 5) - 1)) << 11))

#define MPU_JIR_S(S) (0x63200000 | ((S & ((1 << 5) - 1)) << 11))

#define MPU_JNT() (0x61000000)

#define MPU_JSR_I(S) (0x60400000 | ((S & ((1 << 16) - 1)) << 0))

#define MPU_JSR_R(S) (0x62400000 | ((S & ((1 << 5) - 1)) << 11))

#define MPU_JSR_S(S) (0x63400000 | ((S & ((1 << 5) - 1)) << 11))

#define MPU_LSL_RRR(S,N,D) (0x4000008E | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LSL_RRS(S,N,D) (0x4000048E | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LSL_RSR(S,N,D) (0x4000018E | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LSL_RSS(S,N,D) (0x4000058E | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LSL_SRR(S,N,D) (0x4000028E | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LSL_SRS(S,N,D) (0x4000068E | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LSL_SSR(S,N,D) (0x4000038E | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LSL_SSS(S,N,D) (0x4000078E | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LSLQ_RIR(S,N,D) (0x18000000 | ((S & ((1 << 5) - 1)) << 16)\
                                 | ((N & ((1 << 16) - 1)) << 0)\
                                 | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LSR_RRR(S,N,D) (0x4000008F | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LSR_RRS(S,N,D) (0x4000048F | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LSR_RSR(S,N,D) (0x4000018F | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LSR_RSS(S,N,D) (0x4000058F | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LSR_SRR(S,N,D) (0x4000028F | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LSR_SRS(S,N,D) (0x4000068F | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LSR_SSR(S,N,D) (0x4000038F | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LSR_SSS(S,N,D) (0x4000078F | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LSRQ_RIR(S,N,D) (0x1C000000 | ((S & ((1 << 5) - 1)) << 16)\
                                 | ((N & ((1 << 16) - 1)) << 0)\
                                 | ((D & ((1 << 5) - 1)) << 21))

#define MPU_LW_IR(S,D) (0x64400000 | ((S & ((1 << 16) - 1)) << 0)\
                            | ((D & ((1 << 5) - 1)) << 16))

#define MPU_LW_IS(S,D) (0x64600000 | ((S & ((1 << 16) - 1)) << 0)\
                            | ((D & ((1 << 5) - 1)) << 16))

#define MPU_LW_RR(S,D) (0x66400000 | ((S & ((1 << 5) - 1)) << 11)\
                            | ((D & ((1 << 5) - 1)) << 16))

#define MPU_LW_RS(S,D) (0x66600000 | ((S & ((1 << 5) - 1)) << 11)\
                            | ((D & ((1 << 5) - 1)) << 16))

#define MPU_LW_SR(S,D) (0x67400000 | ((S & ((1 << 5) - 1)) << 11)\
                            | ((D & ((1 << 5) - 1)) << 16))

#define MPU_LW_SS(S,D) (0x67600000 | ((S & ((1 << 5) - 1)) << 11)\
                            | ((D & ((1 << 5) - 1)) << 16))

#define MPU_LW_RIR(S,N,D) (0x66400000 | ((S & ((1 << 5) - 1)) << 11)\
                               | ((N & ((1 << 8) - 1)) << 0)\
                               | ((D & ((1 << 5) - 1)) << 16))

#define MPU_LW_RIS(S,N,D) (0x66600000 | ((S & ((1 << 5) - 1)) << 11)\
                               | ((N & ((1 << 8) - 1)) << 0)\
                               | ((D & ((1 << 5) - 1)) << 16))

#define MPU_LW_SIR(S,N,D) (0x67400000 | ((S & ((1 << 5) - 1)) << 11)\
                               | ((N & ((1 << 8) - 1)) << 0)\
                               | ((D & ((1 << 5) - 1)) << 16))

#define MPU_LW_SIS(S,N,D) (0x67600000 | ((S & ((1 << 5) - 1)) << 11)\
                               | ((N & ((1 << 8) - 1)) << 0)\
                               | ((D & ((1 << 5) - 1)) << 16))

#define MPU_MOVE_RR(S,D) (0x40000081 | ((S & ((1 << 5) - 1)) << 11)\
                              | ((D & ((1 << 5) - 1)) << 21))

#define MPU_MOVE_RS(S,D) (0x40000481 | ((S & ((1 << 5) - 1)) << 11)\
                              | ((D & ((1 << 5) - 1)) << 21))

#define MPU_MOVE_SR(S,D) (0x40000181 | ((S & ((1 << 5) - 1)) << 11)\
                              | ((D & ((1 << 5) - 1)) << 21))

#define MPU_MOVE_SS(S,D) (0x40000581 | ((S & ((1 << 5) - 1)) << 11)\
                              | ((D & ((1 << 5) - 1)) << 21))

#define MPU_MOVEQ_IR(S,D) (0x24000000 | ((S & ((1 << 16) - 1)) << 0)\
                               | ((D & ((1 << 5) - 1)) << 21))

#define MPU_MOVEQ_IS(S,D) (0x2C000000 | ((S & ((1 << 16) - 1)) << 0)\
                               | ((D & ((1 << 5) - 1)) << 21))

#define MPU_MOVEX_IR_INSTR(S,D) (0xC0000081 | ((D & ((1 << 5) - 1)) << 21))

#define MPU_MOVEX_IR_IMM(S,D) (S & 0xFFFFFFFF)

#define MPU_MOVEX_IS_INSTR(S,D) (0xC0000481 | ((D & ((1 << 5) - 1)) << 21))

#define MPU_MOVEX_IS_IMM(S,D) (S & 0xFFFFFFFF)

#define MPU_NOP() (0x40000000)

#define MPU_NOT_RR(S,D) (0x40100081 | ((S & ((1 << 5) - 1)) << 11)\
                             | ((D & ((1 << 5) - 1)) << 21))

#define MPU_NOT_RS(S,D) (0x40100481 | ((S & ((1 << 5) - 1)) << 11)\
                             | ((D & ((1 << 5) - 1)) << 21))

#define MPU_NOT_SR(S,D) (0x40100181 | ((S & ((1 << 5) - 1)) << 11)\
                             | ((D & ((1 << 5) - 1)) << 21))

#define MPU_NOT_SS(S,D) (0x40100581 | ((S & ((1 << 5) - 1)) << 11)\
                             | ((D & ((1 << 5) - 1)) << 21))

#define MPU_OR_RRR(S,N,D) (0x4000008B | ((S & ((1 << 5) - 1)) << 16)\
                               | ((N & ((1 << 5) - 1)) << 11)\
                               | ((D & ((1 << 5) - 1)) << 21))

#define MPU_OR_RRS(S,N,D) (0x4000048B | ((S & ((1 << 5) - 1)) << 16)\
                               | ((N & ((1 << 5) - 1)) << 11)\
                               | ((D & ((1 << 5) - 1)) << 21))

#define MPU_OR_RSR(S,N,D) (0x4000018B | ((S & ((1 << 5) - 1)) << 16)\
                               | ((N & ((1 << 5) - 1)) << 11)\
                               | ((D & ((1 << 5) - 1)) << 21))

#define MPU_OR_RSS(S,N,D) (0x4000058B | ((S & ((1 << 5) - 1)) << 16)\
                               | ((N & ((1 << 5) - 1)) << 11)\
                               | ((D & ((1 << 5) - 1)) << 21))

#define MPU_OR_SRR(S,N,D) (0x4000028B | ((S & ((1 << 5) - 1)) << 16)\
                               | ((N & ((1 << 5) - 1)) << 11)\
                               | ((D & ((1 << 5) - 1)) << 21))

#define MPU_OR_SRS(S,N,D) (0x4000068B | ((S & ((1 << 5) - 1)) << 16)\
                               | ((N & ((1 << 5) - 1)) << 11)\
                               | ((D & ((1 << 5) - 1)) << 21))

#define MPU_OR_SSR(S,N,D) (0x4000038B | ((S & ((1 << 5) - 1)) << 16)\
                               | ((N & ((1 << 5) - 1)) << 11)\
                               | ((D & ((1 << 5) - 1)) << 21))

#define MPU_OR_SSS(S,N,D) (0x4000078B | ((S & ((1 << 5) - 1)) << 16)\
                               | ((N & ((1 << 5) - 1)) << 11)\
                               | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ORQ_RIR(S,N,D) (0x0C000000 | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 16) - 1)) << 0)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ORQ_IRR(S,N,D) (0x0C000000 | ((S & ((1 << 16) - 1)) << 0)\
                                | ((N & ((1 << 5) - 1)) << 16)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ORX_RIR_INSTR(S,N,D) (0xC000008B | ((S & ((1 << 5) - 1)) << 16)\
                                      | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ORX_RIR_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_ORX_IRR_INSTR(S,N,D) (0xC000008B | ((N & ((1 << 5) - 1)) << 16)\
                                      | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ORX_IRR_IMM(S,N,D) (S & 0xFFFFFFFF)

#define MPU_ORX_SIR_INSTR(S,N,D) (0xC000028B | ((S & ((1 << 5) - 1)) << 16)\
                                      | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ORX_SIR_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_ORX_ISR_INSTR(S,N,D) (0xC000028B | ((N & ((1 << 5) - 1)) << 16)\
                                      | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ORX_ISR_IMM(S,N,D) (S & 0xFFFFFFFF)

#define MPU_ORX_RIS_INSTR(S,N,D) (0xC000048B | ((S & ((1 << 5) - 1)) << 16)\
                                      | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ORX_RIS_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_ORX_IRS_INSTR(S,N,D) (0xC000048B | ((N & ((1 << 5) - 1)) << 16)\
                                      | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ORX_IRS_IMM(S,N,D) (S & 0xFFFFFFFF)

#define MPU_ORX_SIS_INSTR(S,N,D) (0xC000068B | ((S & ((1 << 5) - 1)) << 16)\
                                      | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ORX_SIS_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_ORX_ISS_INSTR(S,N,D) (0xC000068B | ((N & ((1 << 5) - 1)) << 16)\
                                      | ((D & ((1 << 5) - 1)) << 21))

#define MPU_ORX_ISS_IMM(S,N,D) (S & 0xFFFFFFFF)

#define MPU_RET() (0x63003000)

#define MPU_RETI() (0x63602800)

#define MPU_RR_IR(S,D) (0x50000000 | ((S & ((1 << 11) - 1)) << 0)\
                            | ((D & ((1 << 5) - 1)) << 21))

#define MPU_RR_SR(S,D) (0x50008000 | ((S & ((1 << 5) - 1)) << 16)\
                            | ((D & ((1 << 5) - 1)) << 21))

#define MPU_RW_RI(S,D) (0x56000000 | ((S & ((1 << 5) - 1)) << 11)\
                            | ((D & ((1 << 11) - 1)) << 0))

#define MPU_RW_RS(S,D) (0x57000000 | ((S & ((1 << 5) - 1)) << 11)\
                            | ((D & ((1 << 5) - 1)) << 16))

#define MPU_RWQ_II(S,D) (0x58000000 | ((S & ((1 << 16) - 1)) << 11)\
                             | ((D & ((1 << 11) - 1)) << 0))

#define MPU_RWQ_IS(S,D) (0x55000000 | ((S & ((1 << 16) - 1)) << 0)\
                             | ((D & ((1 << 5) - 1)) << 16))

#define MPU_RWX_II_INSTR(S,D) (0xD4000000 | ((D & ((1 << 11) - 1)) << 0))

#define MPU_RWX_II_IMM(S,D) (S & 0xFFFFFFFF)

#define MPU_RWX_IS_INSTR(S,D) (0xD5000000 | ((D & ((1 << 5) - 1)) << 16))

#define MPU_RWX_IS_IMM(S,D) (S & 0xFFFFFFFF)

#define MPU_SUB_RRR(S,N,D) (0x4000008D | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_SUB_RRS(S,N,D) (0x4000048D | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_SUB_RSR(S,N,D) (0x4000018D | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_SUB_RSS(S,N,D) (0x4000058D | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_SUB_SRR(S,N,D) (0x4000028D | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_SUB_SRS(S,N,D) (0x4000068D | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_SUB_SSR(S,N,D) (0x4000038D | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_SUB_SSS(S,N,D) (0x4000078D | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_SUBQ_RIR(S,N,D) (0x14000000 | ((S & ((1 << 5) - 1)) << 16)\
                                 | ((N & ((1 << 16) - 1)) << 0)\
                                 | ((D & ((1 << 5) - 1)) << 21))

#define MPU_SUBX_RIR_INSTR(S,N,D) (0xC000008D | ((S & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_SUBX_RIR_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_SUBX_SIR_INSTR(S,N,D) (0xC000028D | ((S & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_SUBX_SIR_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_SUBX_RIS_INSTR(S,N,D) (0xC000048D | ((S & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_SUBX_RIS_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_SUBX_SIS_INSTR(S,N,D) (0xC000068D | ((S & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_SUBX_SIS_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_SW_RI(S,D) (0x64000000 | ((S & ((1 << 5) - 1)) << 16)\
                            | ((D & ((1 << 16) - 1)) << 0))

#define MPU_SW_SI(S,D) (0x64200000 | ((S & ((1 << 5) - 1)) << 16)\
                            | ((D & ((1 << 16) - 1)) << 0))

#define MPU_SW_RR(S,D) (0x66000000 | ((S & ((1 << 5) - 1)) << 16)\
                            | ((D & ((1 << 5) - 1)) << 11))

#define MPU_SW_SR(S,D) (0x66200000 | ((S & ((1 << 5) - 1)) << 16)\
                            | ((D & ((1 << 5) - 1)) << 11))

#define MPU_SW_RS(S,D) (0x67000000 | ((S & ((1 << 5) - 1)) << 16)\
                            | ((D & ((1 << 5) - 1)) << 11))

#define MPU_SW_SS(S,D) (0x67200000 | ((S & ((1 << 5) - 1)) << 16)\
                            | ((D & ((1 << 5) - 1)) << 11))

#define MPU_SW_RIR(S,N,D) (0x66000000 | ((S & ((1 << 5) - 1)) << 16)\
                               | ((N & ((1 << 8) - 1)) << 0)\
                               | ((D & ((1 << 5) - 1)) << 11))

#define MPU_SW_SIR(S,N,D) (0x66200000 | ((S & ((1 << 5) - 1)) << 16)\
                               | ((N & ((1 << 8) - 1)) << 0)\
                               | ((D & ((1 << 5) - 1)) << 11))

#define MPU_SW_RIS(S,N,D) (0x67000000 | ((S & ((1 << 5) - 1)) << 16)\
                               | ((N & ((1 << 8) - 1)) << 0)\
                               | ((D & ((1 << 5) - 1)) << 11))

#define MPU_SW_SIS(S,N,D) (0x67200000 | ((S & ((1 << 5) - 1)) << 16)\
                               | ((N & ((1 << 8) - 1)) << 0)\
                               | ((D & ((1 << 5) - 1)) << 11))

#define MPU_SWX_II_INSTR(S,D) (0xE4000000 | ((D & ((1 << 16) - 1)) << 0))

#define MPU_SWX_II_IMM(S,D) (S & 0xFFFFFFFF)

#define MPU_SWX_IR_INSTR(S,D) (0xE6000000 | ((D & ((1 << 5) - 1)) << 11))

#define MPU_SWX_IR_IMM(S,D) (S & 0xFFFFFFFF)

#define MPU_SWX_IS_INSTR(S,D) (0xE7000000 | ((D & ((1 << 5) - 1)) << 11))

#define MPU_SWX_IS_IMM(S,D) (S & 0xFFFFFFFF)

#define MPU_SWX_IIR_INSTR(S,N,D) (0xE6000000 | ((N & ((1 << 8) - 1)) << 0)\
                                      | ((D & ((1 << 5) - 1)) << 11))

#define MPU_SWX_IIR_IMM(S,N,D) (S & 0xFFFFFFFF)

#define MPU_SWX_IIS_INSTR(S,N,D) (0xE7000000 | ((N & ((1 << 8) - 1)) << 0)\
                                      | ((D & ((1 << 5) - 1)) << 11))

#define MPU_SWX_IIS_IMM(S,N,D) (S & 0xFFFFFFFF)

#define MPU_XOR_RRR(S,N,D) (0x40000089 | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XOR_RRS(S,N,D) (0x40000489 | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XOR_RSR(S,N,D) (0x40000189 | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XOR_RSS(S,N,D) (0x40000589 | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XOR_SRR(S,N,D) (0x40000289 | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XOR_SRS(S,N,D) (0x40000689 | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XOR_SSR(S,N,D) (0x40000389 | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XOR_SSS(S,N,D) (0x40000789 | ((S & ((1 << 5) - 1)) << 16)\
                                | ((N & ((1 << 5) - 1)) << 11)\
                                | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XOR_RR(S,D) (0x40000088 | ((S & ((1 << 5) - 1)) << 11)\
                             | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XOR_RS(S,D) (0x40000488 | ((S & ((1 << 5) - 1)) << 11)\
                             | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XOR_SR(S,D) (0x40000188 | ((S & ((1 << 5) - 1)) << 11)\
                             | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XOR_SS(S,D) (0x40000588 | ((S & ((1 << 5) - 1)) << 11)\
                             | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XORQ_RIR(S,N,D) (0x04000000 | ((S & ((1 << 5) - 1)) << 16)\
                                 | ((N & ((1 << 16) - 1)) << 0)\
                                 | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XORQ_IRR(S,N,D) (0x04000000 | ((S & ((1 << 16) - 1)) << 0)\
                                 | ((N & ((1 << 5) - 1)) << 16)\
                                 | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XORX_RIR_INSTR(S,N,D) (0xC0000089 | ((S & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XORX_RIR_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_XORX_IRR_INSTR(S,N,D) (0xC0000089 | ((N & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XORX_IRR_IMM(S,N,D) (S & 0xFFFFFFFF)

#define MPU_XORX_SIR_INSTR(S,N,D) (0xC0000289 | ((S & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XORX_SIR_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_XORX_ISR_INSTR(S,N,D) (0xC0000289 | ((N & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XORX_ISR_IMM(S,N,D) (S & 0xFFFFFFFF)

#define MPU_XORX_RIS_INSTR(S,N,D) (0xC0000489 | ((S & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XORX_RIS_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_XORX_IRS_INSTR(S,N,D) (0xC0000489 | ((N & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XORX_IRS_IMM(S,N,D) (S & 0xFFFFFFFF)

#define MPU_XORX_SIS_INSTR(S,N,D) (0xC0000689 | ((S & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XORX_SIS_IMM(S,N,D) (N & 0xFFFFFFFF)

#define MPU_XORX_ISS_INSTR(S,N,D) (0xC0000689 | ((N & ((1 << 5) - 1)) << 16)\
                                       | ((D & ((1 << 5) - 1)) << 21))

#define MPU_XORX_ISS_IMM(S,N,D) (S & 0xFFFFFFFF)


#endif /* end of __IOP_MPU_MACROS_H__ */
/* End of iop_mpu_macros.h */