forked from bminor/binutils-gdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxc16x.cpu
3146 lines (2910 loc) · 94 KB
/
xc16x.cpu
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
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; Infineon XC16X CPU description. -*- Scheme -*-
;
; Copyright 2006, 2007, 2009 Free Software Foundation, Inc.
;
; Contributed by KPIT Cummins Infosystems Ltd.; developed under contract
; from Infineon Systems, GMBH , Germany.
;
; This file is part of the GNU Binutils.
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
; 02110-1301, USA.
(define-rtl-version 0 8)
(include "simplify.inc")
; define-arch appears first
(define-arch
(name xc16x) ; name of cpu family
(comment "Infineon XC16X")
(default-alignment aligned)
(insn-lsb0? #t)
(machs xc16x)
(isas xc16x)
)
; Attributes.
; An attribute to describe which pipeline an insn runs in generally OS.
(define-attr
(for insn)
(type enum)
(name PIPE)
(comment "parallel execution pipeline selection")
(values NONE OS)
)
; Instruction set parameters.
(define-isa
(name xc16x)
(default-insn-bitsize 32)
(base-insn-bitsize 32)
(default-insn-word-bitsize 16)
(decode-assist (15 14 13 12))
; The XC16X fetches 1 insn at a time.
(liw-insns 1)
(parallel-insns 1)
)
; Cpu family definitions.
(define-cpu
; cpu names must be distinct from the architecture name and machine names.
; The "b" suffix stands for "base" and is the convention.
; The "f" suffix stands for "family" and is the convention.
(name xc16xbf)
(comment "Infineon XC16X base family")
(endian little)
(insn-chunk-bitsize 32)
(word-bitsize 16)
(parallel-insns 1)
)
(define-mach
(name xc16x)
(comment "Infineon XC16X cpu")
(cpu xc16xbf)
)
; Model descriptions.
(define-model
(name xc16x) (comment "XC16X") (attrs)
(mach xc16x)
(pipeline p-mem "" () ((prefetch) (fetch) (decode) (address) (memory) (execute) (writeback)))
; `state' is a list of variables for recording model state
(state
; bit mask of h-gr registers, =1 means value being loaded from memory
(h-gr UINT)
)
(unit u-exec "Execution Unit" ()
1 1 ; issue done
() ; state
((dr INT -1) (sr INT -1)) ; inputs
((dr INT -1)) ; outputs
() ; profile action (default)
)
(unit u-cmp "Compare Unit" ()
1 1 ; issue done
() ; state
((src1 INT -1) (src2 INT -1)) ; inputs
() ; outputs
() ; profile action (default)
)
(unit u-cti "Jump & Call Unit" ()
1 1 ; issue done
() ; state
((condbit) (sr INT -1)) ; inputs
((pc)) ; outputs
() ; profile action (default)
)
(unit u-mov "Data Movement Unit" ()
1 1 ; issue done
() ;state
((dr INT -1) (sr INT -1)) ; inputs
((dr INT -1)) ; output
() ; profile action (default)
)
)
; Instruction fields.
;
; Attributes:
; PCREL-ADDR: pc relative value (for reloc and disassembly purposes)
; ABS-ADDR: absolute address (for reloc and disassembly purposes)
; RELOC: there is a relocation associated with this field (experiment)
(define-attr
(for ifield operand)
(type boolean)
(name RELOC)
(comment "there is a reloc associated with this field (experiment)")
)
(dnf f-op1 "op1" () 7 4)
(dnf f-op2 "op2" () 3 4)
(dnf f-condcode "condcode" () 7 4) ;condition code required in other jmps and calls
(dnf f-icondcode "indrct condcode" () 15 4) ;condition code required in other jmpi and calli
(dnf f-rcond "relative-cond" () 7 4) ;condition code required in JMPR
(dnf f-qcond "qbit" () 7 4) ;used in enum of bset/bclear macro
(dnf f-extccode "extended condcode" () 15 5) ;condition code required in other jmpa and calla
(dnf f-r0 "r0" () 9 2) ;required where 2 bit register used(only R0-R3)
(dnf f-r1 "r1" () 15 4)
(dnf f-r2 "r2" () 11 4)
(dnf f-r3 "r3" () 12 4)
(dnf f-r4 "r4" () 11 4)
(dnf f-uimm2 "uimm2" () 13 2) ;used for immediate data,eg in ADD,MOV insns
(dnf f-uimm3 "uimm3" () 10 3) ;used for immediate data,eg in ADD,SUB insns
(dnf f-uimm4 "uimm4" () 15 4) ;used for immediate data,eg in MOV insns
(dnf f-uimm7 "uimm7" (PCREL-ADDR RELOC) 15 7) ;used in TRAP
(dnf f-uimm8 "uimm8" () 23 8) ;used in immediate byte data,eg in ADDB,MOVB insns
(dnf f-uimm16 "uimm16" () 31 16) ;used for immediate word data
(dnf f-memory "memory" () 31 16) ; used for memory operands
(dnf f-memgr8 "memory" () 31 16) ; memory location of gr
(dnf f-rel8 "rel8" (PCREL-ADDR RELOC) 15 8) ;used in JMPR,CALLR
(dnf f-relhi8 "relhi8" (PCREL-ADDR RELOC) 23 8) ;used in JB,JBC,JNB,JNBS
(dnf f-reg8 "reg8" () 15 8) ;required where 8bit gp register used
(dnf f-regmem8 "regmem8" () 15 8) ;required where 8bit register used
(dnf f-regoff8 "regoff8" () 15 8) ;required for offset calc
(dnf f-reghi8 "reghi8" () 23 8) ;required where 8bit register number used
(dnf f-regb8 "regb8" () 15 8) ;required for byte registers RL0,RH0, till RL8,RH8
(dnf f-seg8 "seg8" () 15 8) ;used as segment number in JMPS,CALLS
(dnf f-segnum8 "segnum8" () 23 8) ;used in EXTS,EXTSR
(dnf f-mask8 "mask8" () 23 8) ;used as mask in BFLDH,BFLDL insns
(dnf f-pagenum "page num" () 25 10);used in EXTP,EXTPR
(dnf f-datahi8 "datahi8" () 31 8) ;used for filling with const data
(dnf f-data8 "data8" () 23 8) ;used for filling with const data
(dnf f-offset16 "address offset16" (ABS-ADDR RELOC) 31 16) ;used in JMPS,JMPA,CALLA,CALLS
(dnf f-op-bit1 "gap of 1 bit" () 11 1) ;used for filling with const data
(dnf f-op-bit2 "gap of 2 bits" () 11 2) ;used for filling with const data
(dnf f-op-bit4 "gap of 4 bits" () 11 4) ;used for filling with const data
(dnf f-op-bit3 "gap of 3 bits" () 10 3) ;used in CALLA, JMPA
(dnf f-op-2bit "gap of 2 bits" () 10 2) ;used in CALLA
(dnf f-op-bitone "gap of 1 bit " () 10 1) ;used in JMPA
(dnf f-op-onebit "gap of 1 bit " () 9 1) ;used in JMPA
(dnf f-op-1bit "gap of 1 bit " () 8 1) ;used in JMPA, CALLA
(dnf f-op-lbit4 "gap of 4 bits" () 15 4) ;used for filling with const data
(dnf f-op-lbit2 "gap of 2 bits" () 15 2) ;used for filling with const data
(dnf f-op-bit8 "gap of 8 bits" () 31 8) ;used for filling with const data
(dnf f-op-bit16 "gap of 16 bits" () 31 16) ;used for filling with const data
(dnf f-qbit "qbit" () 7 4) ;used in bit field of bset/bclear
(dnf f-qlobit "qlobit" () 31 4) ;used for filling with const data
(dnf f-qhibit "qhibit" () 27 4) ;used for filling with const data
(dnf f-qlobit2 "qlobit2" () 27 2) ;used for filling with const data
(dnf f-pof "upof16" () 31 16) ; used for memory operands
; Enums.
; insn-op1: bits 0-3
(define-normal-insn-enum insn-op1 "insn format enums" () OP1_ f-op1
("0" "1" "2" "3" "4" "5" "6" "7"
"8" "9" "10" "11" "12" "13" "14" "15")
)
; insn-op2: bits 4-7
(define-normal-insn-enum insn-op2 "op2 enums" () OP2_ f-op2
("0" "1" "2" "3" "4" "5" "6" "7"
"8" "9" "10" "11" "12" "13" "14" "15")
)
;/*for bclr/bset*/
; insn-rcond: bits 0-3
(define-normal-insn-enum insn-qcond "bit set/clear enums" () QBIT_ f-qcond
(("0" 0) ("1" 1) ("2" 2) ("3" 3) ("4" 4) ("5" 5) ("6" 6) ("7" 7) ("8" 8) ("9" 9) ("10" 10)
("11" 11) ("12" 12) ("13" 13) ("14" 14) ("15" 15))
)
;/************/
; insn-rcond: bits 0-3
(define-normal-insn-enum insn-rcond "relative jump condition code op2 enums" () COND_ f-rcond
(("UC" 0) ("NET" 1) ("Z" 2) ("NE_NZ" 3) ("V" 4) ("NV" 5) ("N" 6) ("NN" 7)
("C" 8) ("NC" 9) ("SGT" 10) ("SLE" 11) ("SLT" 12) ("SGE" 13) ("UGT" 14) ("ULE" 15)
("EQ" 2) ("NE" 3) ("ULT" 8) ("UGE" 9))
)
; Hardware pieces.
; These entries list the elements of the raw hardware.
; They're also used to provide tables and other elements of the assembly
; language.
(dnh h-pc "program counter" (PC) (pc) () () ())
(define-keyword
(name gr-names)
(enum-prefix H-GR-)
(values (r0 0) (r1 1) (r2 2) (r3 3) (r4 4) (r5 5) (r6 6) (r7 7)
(r8 8) (r9 9) (r10 10) (r11 11) (r12 12) (r13 13) (r14 14) (r15 15))
)
(define-hardware
(name h-gr)
(comment "general registers")
(attrs PROFILE CACHE-ADDR)
(type register HI (16))
(indices extern-keyword gr-names)
)
;; HACK: Various semantics refer to h-cr.
;; This is here to keep things working.
(define-hardware
(name h-cr)
(comment "cr registers")
(attrs PROFILE CACHE-ADDR)
(type register HI (16))
(indices extern-keyword gr-names)
)
(define-keyword
(name ext-names)
(enum-prefix H-EXT-)
(values (0x1 0) (0x2 1) (0x3 2) (0x4 3)
("1" 0) ("2" 1) ("3" 2) ("4" 3))
)
(define-hardware
(name h-ext)
(comment "ext values")
(attrs PROFILE CACHE-ADDR)
(type register HI (8))
(indices extern-keyword ext-names)
)
(define-keyword
(name psw-names)
(enum-prefix H-PSW-)
(values ("IEN" 136) ("r0.11" 240) ("r1.11" 241) ("r2.11" 242) ("r3.11" 243) ("r4.11" 244)
("r5.11" 245) ("r6.11" 246) ("r7.11" 247) ("r8.11" 248)
("r9.11" 249) ("r10.11" 250) ("r11.11" 251) ("r12.11" 252)
("r13.11" 253) ("r14.11" 254) ("r15.11" 255))
)
(define-hardware
(name h-psw)
(comment "ext values")
(attrs PROFILE CACHE-ADDR)
(type register HI (1))
(indices extern-keyword psw-names)
)
(define-keyword
(name grb-names)
(enum-prefix H-GRB-)
(values (rl0 0) (rh0 1) (rl1 2) (rh1 3) (rl2 4) (rh2 5) (rl3 6) (rh3 7)
(rl4 8) (rh4 9) (rl5 10) (rh5 11) (rl6 12) (rh6 13) (rl7 14) (rh7 15))
)
(define-hardware
(name h-grb)
(comment "general registers")
(attrs PROFILE CACHE-ADDR)
(type register QI (16))
(indices extern-keyword grb-names)
)
(define-keyword
(name conditioncode-names)
(enum-prefix H-CC-)
(values (cc_UC 0) (cc_NET 1) (cc_Z 2) (cc_EQ 2) (cc_NZ 3) (cc_NE 3) (cc_V 4) (cc_NV 5) (cc_N 6) (cc_NN 7) (cc_ULT 8) (cc_UGE 9)
(cc_C 8) (cc_NC 9) (cc_SGT 10) (cc_SLE 11) (cc_SLT 12) (cc_SGE 13) (cc_UGT 14)
(cc_ULE 15))
)
(define-hardware
(name h-cc)
(comment "condition codes")
(attrs PROFILE CACHE-ADDR)
(type register QI (16))
(indices extern-keyword conditioncode-names)
)
(define-keyword
(name extconditioncode-names)
(enum-prefix H-ECC-)
(values(cc_UC 0) (cc_NET 2) (cc_Z 4) (cc_EQ 4) (cc_NZ 6) (cc_NE 6) (cc_V 8) (cc_NV 10) (cc_N 12) (cc_NN 14) (cc_ULT 16) (cc_UGE 18) (cc_C 16) (cc_NC 18) (cc_SGT 20)
(cc_SLE 22) (cc_SLT 24) (cc_SGE 26) (cc_UGT 28) (cc_ULE 30) (cc_nusr0 1)
(cc_nusr1 3) (cc_usr0 5) (cc_usr1 7))
)
(define-hardware
(name h-ecc)
(comment "extended condition codes")
(attrs PROFILE CACHE-ADDR)
(type register QI (4))
(indices extern-keyword extconditioncode-names)
)
(define-keyword
(name grb8-names)
(enum-prefix H-GRB8-)
(values (dpp0 0) (dpp1 1) (dpp2 2) (dpp3 3)
(psw 136) (cp 8) (mdl 7) (mdh 6)
(mdc 135) (sp 9) (csp 4) (vecseg 137)
(stkov 10) (stkun 11) (cpucon1 12) (cpucon2 13)
(zeros 142) (ones 143) (spseg 134) (tfr 214)
(rl0 240) (rh0 241) (rl1 242) (rh1 243) (rl2 244) (rh2 245) (rl3 246) (rh3 247)
(rl4 248) (rh4 249) (rl5 250) (rh5 251) (rl6 252) (rh6 253) (rl7 254) (rh7 255))
)
(define-hardware
(name h-grb8)
(comment "general byte registers")
(attrs PROFILE CACHE-ADDR)
(type register QI (36))
(indices extern-keyword grb8-names)
)
(define-keyword
(name r8-names)
(enum-prefix H-R8-)
(values (dpp0 0) (dpp1 1) (dpp2 2) (dpp3 3)
(psw 136) (cp 8) (mdl 7) (mdh 6)
(mdc 135) (sp 9) (csp 4) (vecseg 137)
(stkov 10) (stkun 11) (cpucon1 12) (cpucon2 13)
(zeros 142) (ones 143) (spseg 134) (tfr 214)
(r0 240) (r1 241) (r2 242) (r3 243) (r4 244) (r5 245) (r6 246) (r7 247)
(r8 248) (r9 249) (r10 250) (r11 251) (r12 252) (r13 253) (r14 254) (r15 255))
)
(define-hardware
(name h-r8)
(comment "registers")
(attrs PROFILE CACHE-ADDR)
(type register HI (36))
(indices extern-keyword r8-names)
)
(define-keyword
(name regmem8-names)
(enum-prefix H-REGMEM8-)
(values (dpp0 0) (dpp1 1) (dpp2 2) (dpp3 3)
(psw 136) (cp 8) (mdl 7) (mdh 6)
(mdc 135) (sp 9) (csp 4) (vecseg 137)
(stkov 10) (stkun 11) (cpucon1 12) (cpucon2 13)
(zeros 142) (ones 143) (spseg 134) (tfr 214)
(r0 240) (r1 241) (r2 242) (r3 243) (r4 244) (r5 245) (r6 246) (r7 247)
(r8 248) (r9 249) (r10 250) (r11 251) (r12 252) (r13 253) (r14 254) (r15 255))
)
(define-hardware
(name h-regmem8)
(comment "registers")
(attrs )
(type register HI (16))
(indices extern-keyword regmem8-names)
)
(define-keyword
(name regdiv8-names)
(enum-prefix H-REGDIV8-)
(values (r0 0) (r1 17) (r2 34) (r3 51) (r4 68) (r5 85) (r6 102) (r7 119)
(r8 136) (r9 153) (r10 170) (r11 187) (r12 204) (r13 221) (r14 238) (r15 255))
)
(define-hardware
(name h-regdiv8)
(comment "division insn registers")
(attrs PROFILE CACHE-ADDR)
(type register HI (16))
(indices extern-keyword regdiv8-names)
)
(define-keyword
(name reg0-name)
(enum-prefix H-REG0-)
(values (0x1 1) (0x2 2) (0x3 3) (0x4 4) (0x5 5) (0x6 6) (0x7 7) (0x8 8) (0x9 9) (0xa 10) (0xb 11)
(0xc 12) (0xd 13) (0xe 14) (0xf 15)
("1" 1) ("2" 2) ("3" 3) ("4" 4) ("5" 5) ("6" 6) ("7" 7) ("8" 8) ("9" 9) ("10" 10) ("11" 11)
("12" 12) ("13" 13) ("14" 14) ("15" 15))
)
(define-hardware
(name h-r0)
(comment "for 4-bit data excuding 0")
(attrs PROFILE CACHE-ADDR)
(type register HI (30))
(indices extern-keyword reg0-name)
)
(define-keyword
(name reg0-name1)
(enum-prefix H-REG01-)
(values (0x1 1) (0x2 2) (0x3 3) (0x4 4) (0x5 5) (0x6 6) (0x7 7)
("1" 1) ("2" 2) ("3" 3) ("4" 4) ("5" 5) ("6" 6) ("7" 7))
)
(define-hardware
(name h-r01)
(comment "for 4-bit data excuding 0")
(attrs PROFILE CACHE-ADDR)
(type register HI (14))
(indices extern-keyword reg0-name1)
)
(define-keyword
(name regbmem8-names)
(enum-prefix H-REGBMEM8-)
(values (dpp0 0) (dpp1 1) (dpp2 2) (dpp3 3)
(psw 136) (cp 8) (mdl 7) (mdh 6)
(mdc 135) (sp 9) (csp 4) (vecseg 137)
(stkov 10) (stkun 11) (cpucon1 12) (cpucon2 13)
(zeros 142) (ones 143) (spseg 134) (tfr 214)
(rl0 240) (rh0 241) (rl1 242) (rh1 243) (rl2 244) (rh2 245) (rl3 246) (rh3 247)
(rl4 248) (rh4 249) (rl5 250) (rh5 251) (rl6 252) (rh6 253) (rl7 254) (rh7 255))
)
(define-hardware
(name h-regbmem8)
(comment "registers")
(attrs PROFILE CACHE-ADDR)
(type register HI (36))
(indices extern-keyword regbmem8-names)
)
(define-keyword
(name memgr8-names)
(enum-prefix H-MEMGR8-)
(values (dpp0 65024) (dpp1 65026) (dpp2 65028) (dpp3 65030)
(psw 65296) (cp 65040) (mdl 65038) (mdh 65036)
(mdc 65294) (sp 65042) (csp 65032) (vecseg 65298)
(stkov 65044) (stkun 65046) (cpucon1 65048) (cpucon2 65050)
(zeros 65308) (ones 65310) (spseg 65292) (tfr 65452) )
)
(define-hardware
(name h-memgr8)
(comment "memory location of registers")
(attrs )
(type register HI (20))
(indices extern-keyword memgr8-names)
)
(dsh h-cond "condition bit" () (register BI)) ;any bit from PSW while comparison
; This bit is part of the PSW register
(dsh h-cbit "carry bit" () (register BI))
(dsh h-sgtdis "segmentation enable bit" () (register BI)) ;0 means segmentation enabled
;Instruction operands
; -- layer between the assembler and the raw hardware description
; -- the main means of manipulating instruction fields in the semantic code
; XC16X specific operand attributes:
(define-attr
(for operand)
(type boolean)
(name HASH-PREFIX)
(comment "immediates have an optional '#' prefix")
)
(define-attr
(for operand)
(type boolean)
(name DOT-PREFIX)
(comment "bit addr have an optional '.' prefix")
)
(define-attr
(for operand)
(type boolean)
(name POF-PREFIX)
(comment "page offset ")
)
(define-attr
(for operand)
(type boolean)
(name PAG-PREFIX)
(comment "page ")
)
(define-attr
(for operand)
(type boolean)
(name SOF-PREFIX)
(comment "segment offset selection")
)
(define-attr
(for operand)
(type boolean)
(name SEG-PREFIX)
(comment "segment")
)
;; Define an operand that takes a set of handlers.
;; dowh: define-operand-with-handlers
(define-pmacro (dowh x-name x-comment x-attrs x-type x-index x-handlers)
(define-operand (name x-name) (comment x-comment)
(.splice attrs (.unsplice x-attrs))
(type x-type) (index x-index)
(.splice handlers (.unsplice x-handlers)))
)
(dnop sr "source register" () h-gr f-r2)
(dnop dr "destination register" () h-gr f-r1)
(dnop dri "destination register" () h-gr f-r4)
(dnop srb "source register" () h-grb f-r2)
(dnop drb "destination register" () h-grb f-r1)
(dnop sr2 "2 bit source register" () h-gr f-r0)
(dnop src1 "source register 1" () h-gr f-r1)
(dnop src2 "source register 2" () h-gr f-r2)
(dnop srdiv "source register 2" () h-regdiv8 f-reg8)
(dnop RegNam "PSW bits" () h-psw f-reg8)
(dnop uimm2 "2 bit unsigned number" (HASH-PREFIX) h-ext f-uimm2)
(dnop uimm3 "3 bit unsigned number" (HASH-PREFIX) h-r01 f-uimm3)
(dnop uimm4 "4 bit unsigned number" (HASH-PREFIX) h-uint f-uimm4)
(dnop uimm7 "7 bit trap number" (HASH-PREFIX) h-uint f-uimm7)
(dnop uimm8 "8 bit unsigned immediate" (HASH-PREFIX) h-uint f-uimm8)
(dnop uimm16 "16 bit unsigned immediate" (HASH-PREFIX) h-uint f-uimm16)
(dowh upof16 "16 bit unsigned immediate" (POF-PREFIX) h-addr f-memory ((print "with_pof_prefix")))
(dnop reg8 "8 bit word register number" () h-r8 f-reg8)
(dnop regmem8 "8 bit word register number" () h-regmem8 f-regmem8)
(dnop regbmem8 "8 bit byte register number" () h-regbmem8 f-regmem8)
(dnop regoff8 "8 bit word register number" () h-r8 f-regoff8)
(dnop reghi8 "8 bit word register number" () h-r8 f-reghi8)
(dnop regb8 "8 bit byte register number" () h-grb8 f-regb8)
(dnop genreg "8 bit word register number" () h-r8 f-regb8)
(dnop seg "8 bit segment number" () h-uint f-seg8)
(dnop seghi8 "8 bit hi segment number" () h-uint f-segnum8)
(dnop caddr "16 bit address offset" () h-addr f-offset16)
(dnop rel "8 bit signed relative offset" () h-sint f-rel8)
(dnop relhi "hi 8 bit signed relative offset" () h-sint f-relhi8)
(dnop condbit "condition bit" (SEM-ONLY) h-cond f-nil)
(dnop bit1 "gap of 1 bit" () h-uint f-op-bit1)
(dnop bit2 "gap of 2 bits" () h-uint f-op-bit2)
(dnop bit4 "gap of 4 bits" () h-uint f-op-bit4)
(dnop lbit4 "gap of 4 bits" () h-uint f-op-lbit4)
(dnop lbit2 "gap of 2 bits" () h-uint f-op-lbit2)
(dnop bit8 "gap of 8 bits" () h-uint f-op-bit8)
(dnop u4 "gap of 4 bits" () h-r0 f-uimm4)
(dnop bitone "field of 1 bit" () h-uint f-op-onebit)
(dnop bit01 "field of 1 bit" () h-uint f-op-1bit)
(dnop cond "condition code" () h-cc f-condcode)
(dnop icond "indirect condition code" () h-cc f-icondcode)
(dnop extcond "extended condition code" () h-ecc f-extccode)
(dnop memory "16 bit memory" () h-addr f-memory)
(dnop memgr8 "16 bit memory" () h-memgr8 f-memgr8)
(dnop cbit "carry bit" (SEM-ONLY) h-cbit f-nil)
(dowh qbit "bit addr" (DOT-PREFIX) h-uint f-qbit ((print "with_dot_prefix")))
(dowh qlobit "bit addr" (DOT-PREFIX) h-uint f-qlobit ((print "with_dot_prefix")))
(dowh qhibit "bit addr" (DOT-PREFIX) h-uint f-qhibit ((print "with_dot_prefix")))
(dnop mask8 "8 bit mask" (HASH-PREFIX) h-uint f-mask8)
(dnop masklo8 "8 bit mask" (HASH-PREFIX) h-uint f-datahi8)
(dnop pagenum "10 bit page number" (HASH-PREFIX) h-uint f-pagenum)
(dnop data8 "8 bit data" (HASH-PREFIX) h-uint f-data8)
(dnop datahi8 "8 bit data" (HASH-PREFIX) h-uint f-datahi8)
(dnop sgtdisbit "segmentation enable bit" (SEM-ONLY) h-sgtdis f-nil)
(dowh upag16 "16 bit unsigned immediate" (PAG-PREFIX) h-uint f-uimm16 ((print "with_pag_prefix")))
(dnop useg8 "8 bit segment " (SEG-PREFIX) h-uint f-seg8)
(dnop useg16 "16 bit address offset" (SEG-PREFIX) h-uint f-offset16)
(dnop usof16 "16 bit address offset" (SOF-PREFIX) h-uint f-offset16)
; define hash operator
(define-operand (name hash) (comment "# prefix") (attrs)
(type h-sint)
(index f-nil)
(handlers (parse "hash") (print "hash"))
)
; define dot operator
(define-operand (name dot) (comment ". prefix") (attrs)
(type h-sint)
(index f-nil)
(handlers (parse "dot") (print "dot"))
)
; define pof operator
(define-operand (name pof) (comment "pof: prefix") (attrs)
(type h-sint)
(index f-nil)
(handlers (parse "pof") (print "pof"))
)
; define pag operator
(define-operand (name pag) (comment "pag: prefix") (attrs)
(type h-sint)
(index f-nil)
(handlers (parse "pag") (print "pag"))
)
; define sof operator
(define-operand (name sof) (comment "sof: prefix") (attrs)
(type h-sint)
(index f-nil)
(handlers (parse "sof") (print "sof"))
)
; define seg operator
(define-operand (name segm) (comment "seg: prefix") (attrs)
(type h-sint)
(index f-nil)
(handlers (parse "seg") (print "seg"))
)
; IDOC attribute for instruction documentation.
(define-attr
(for insn)
(type enum)
(name IDOC)
(comment "insn kind for documentation")
(attrs META)
(values
(MOVE - () "Data Movement")
(ALU - () "Arithmatic & logical")
(CMP - () "Compare")
(JMP - () "Jump & Call")
(MISC - () "Miscellaneous")
(SYSC - () "System control")
)
)
; Include the instruction set descriptions from their respective
; source files.
;Arithmatic insns
;******************************************************************
;add/sub register and immediate
(define-pmacro (arithmetic16 name insn insn1 opc1 opc2 op1 op2 mode dir)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",$"dir"$"op2)
(+ opc1 opc2 op1 op2)
(set mode op1 (insn1 mode op1 (mem HI op2)))
()
)
)
(arithmetic16 addrpof add add OP1_0 OP2_2 reg8 upof16 HI "pof")
(arithmetic16 subrpof sub sub OP1_2 OP2_2 reg8 upof16 HI "pof")
(arithmetic16 addbrpof addb add OP1_0 OP2_3 regb8 upof16 QI "pof")
(arithmetic16 subbrpof subb sub OP1_2 OP2_3 regb8 upof16 QI "pof")
(arithmetic16 addrpag add add OP1_0 OP2_2 reg8 upag16 HI "pag")
(arithmetic16 subrpag sub sub OP1_2 OP2_2 reg8 upag16 HI "pag")
(arithmetic16 addbrpag addb add OP1_0 OP2_3 regb8 upag16 QI "pag")
(arithmetic16 subbrpag subb sub OP1_2 OP2_3 regb8 upag16 QI "pag")
;add/sub register and immediate
(define-pmacro (arithmetic17 name insn insn1 opc1 opc2 op1 op2 mode dir)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",$"dir"$"op2)
(+ opc1 opc2 op1 op2)
(set mode op1 (insn1 mode op1 (mem HI op2) cbit))
()
)
)
(arithmetic17 addcrpof addc addc OP1_1 OP2_2 reg8 upof16 HI "pof")
(arithmetic17 subcrpof subc subc OP1_3 OP2_2 reg8 upof16 HI "pof")
(arithmetic17 addcbrpof addcb addc OP1_1 OP2_3 regb8 upof16 QI "pof")
(arithmetic17 subcbrpof subcb subc OP1_3 OP2_3 regb8 upof16 QI "pof")
(arithmetic17 addcrpag addc addc OP1_1 OP2_2 reg8 upag16 HI "pag")
(arithmetic17 subcrpag subc subc OP1_3 OP2_2 reg8 upag16 HI "pag")
(arithmetic17 addcbrpag addcb addc OP1_1 OP2_3 regb8 upag16 QI "pag")
(arithmetic17 subcbrpag subcb subc OP1_3 OP2_3 regb8 upag16 QI "pag")
;add/sub register and immediate
(define-pmacro (arithmetic18 name insn insn1 opc1 opc2 op1 op2 mode dir)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"dir"$"op1 ",$"op2)
(+ opc1 opc2 op2 op1)
(set (mem HI op1) (insn1 (mem HI op1) op2 ))
()
)
)
(arithmetic18 addrpofr add add OP1_0 OP2_4 upof16 reg8 HI "pof")
(arithmetic18 subrpofr sub sub OP1_2 OP2_4 upof16 reg8 HI "pof")
(arithmetic18 addbrpofr addb add OP1_0 OP2_5 upof16 regb8 QI "pof")
(arithmetic18 subbrpofr subb sub OP1_2 OP2_5 upof16 regb8 QI "pof")
;add/sub register and immediate
(define-pmacro (arithmetic19 name insn insn1 opc1 opc2 op1 op2 mode dir)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"dir"$"op1 ",$"op2)
(+ opc1 opc2 op2 op1)
(set (mem HI op1) (insn1 mode (mem HI op1) op2 cbit))
()
)
)
(arithmetic19 addcrpofr addc addc OP1_1 OP2_4 upof16 reg8 HI "pof")
(arithmetic19 subcrpofr subc subc OP1_3 OP2_4 upof16 reg8 HI "pof")
(arithmetic19 addcbrpofr addcb addc OP1_1 OP2_5 upof16 regb8 QI "pof")
(arithmetic19 subcbrpofr subcb subc OP1_3 OP2_5 upof16 regb8 QI "pof")
;add/sub register and immediate
(define-pmacro (arithmetic20 name insn insn1 opc1 opc2 op1 op2 mode dir)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",$hash$"dir"$"op2)
(+ opc1 opc2 op1 op2)
(set mode op1 (insn1 mode op1 op2))
()
)
)
(arithmetic20 addrhpof add add OP1_0 OP2_6 reg8 uimm16 HI "pof")
(arithmetic20 subrhpof sub sub OP1_2 OP2_6 reg8 uimm16 HI "pof")
(arithmetic20 addbrhpof add add OP1_0 OP2_6 reg8 uimm16 HI "pag")
(arithmetic20 subbrhpof sub sub OP1_2 OP2_6 reg8 uimm16 HI "pag")
;add/sub register and immediate
(define-pmacro (arithmetic21 name insn insn1 opc1 opc2 op1 op2 mode dir)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",$hash$"dir"$"op2)
(+ opc1 opc2 op1 (f-op-bit1 0) op2)
(set mode op1 (insn1 mode op1 op2))
()
)
)
(arithmetic21 addrhpof3 add add OP1_0 OP2_8 dr uimm3 HI "pof")
(arithmetic21 subrhpof3 sub sub OP1_2 OP2_8 dr uimm3 HI "pof")
(arithmetic21 addbrhpag3 addb add OP1_0 OP2_9 drb uimm3 QI "pag")
(arithmetic21 subbrhpag3 subb sub OP1_2 OP2_9 drb uimm3 QI "pag")
(arithmetic21 addrhpag3 add add OP1_0 OP2_8 dr uimm3 HI "pag")
(arithmetic21 subrhpag3 sub sub OP1_2 OP2_8 dr uimm3 HI "pag")
(arithmetic21 addbrhpof3 addb add OP1_0 OP2_9 drb uimm3 QI "pof")
(arithmetic21 subbrhpof3 subb sub OP1_2 OP2_9 drb uimm3 QI "pof")
;add/sub register and immediate
(define-pmacro (arithmetic22 name insn insn1 opc1 opc2 op1 op2 mode dir)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",$hash$"dir"$"op2)
(+ opc1 opc2 op1 op2 (f-op-bit8 0))
(set mode op1 (insn1 mode op1 op2))
()
)
)
(arithmetic22 addrbhpof addb add OP1_0 OP2_7 regb8 uimm8 QI "pof")
(arithmetic22 subrbhpof subb sub OP1_2 OP2_7 regb8 uimm8 QI "pof")
(arithmetic22 addbrhpag addb add OP1_0 OP2_7 regb8 uimm8 QI "pag")
(arithmetic22 subbrhpag subb sub OP1_2 OP2_7 regb8 uimm8 QI "pag")
;add/sub register and immediate
(define-pmacro (arithmetic23 name insn insn1 opc1 opc2 op1 op2 mode dir)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",$hash$"dir"$"op2)
(+ opc1 opc2 op1 op2)
(set mode op1 (insn1 mode op1 op2 cbit))
()
)
)
(arithmetic23 addcrhpof addc addc OP1_1 OP2_6 reg8 uimm16 HI "pof")
(arithmetic23 subcrhpof subc subc OP1_3 OP2_6 reg8 uimm16 HI "pof")
(arithmetic23 addcbrhpof addc addc OP1_1 OP2_6 reg8 uimm16 HI "pag")
(arithmetic23 subcbrhpof subc subc OP1_3 OP2_6 reg8 uimm16 HI "pag")
;add/sub register and immediate
(define-pmacro (arithmetic24 name insn insn1 opc1 opc2 op1 op2 mode dir)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",$hash$"dir"$"op2)
(+ opc1 opc2 op1 (f-op-bit1 0) op2)
(set mode op1 (insn1 mode op1 op2 cbit))
()
)
)
(arithmetic24 addcrhpof3 addc addc OP1_1 OP2_8 dr uimm3 HI "pof")
(arithmetic24 subcrhpof3 subc subc OP1_3 OP2_8 dr uimm3 HI "pof")
(arithmetic24 addcbrhpag3 addcb addc OP1_1 OP2_9 drb uimm3 QI "pag")
(arithmetic24 subcbrhpag3 subcb subc OP1_3 OP2_9 drb uimm3 QI "pag")
(arithmetic24 addcrhpag3 addc addc OP1_1 OP2_8 dr uimm3 HI "pag")
(arithmetic24 subcrhpag3 subc subc OP1_3 OP2_8 dr uimm3 HI "pag")
(arithmetic24 addcbrhpof3 addcb addc OP1_1 OP2_9 drb uimm3 QI "pof")
(arithmetic24 subcbrhpof3 subcb subc OP1_3 OP2_9 drb uimm3 QI "pof")
;add/sub register and immediate
(define-pmacro (arithmetic25 name insn insn1 opc1 opc2 op1 op2 mode dir)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",$hash$"dir"$"op2)
(+ opc1 opc2 op1 op2 (f-op-bit8 0))
(set mode op1 (insn1 mode op1 op2 cbit))
()
)
)
(arithmetic25 addcrbhpof addcb addc OP1_1 OP2_7 regb8 uimm8 QI "pof")
(arithmetic25 subcrbhpof subcb subc OP1_3 OP2_7 regb8 uimm8 QI "pof")
(arithmetic25 addcbrhpag addcb addc OP1_1 OP2_7 regb8 uimm8 QI "pag")
(arithmetic25 subcbrhpag subcb subc OP1_3 OP2_7 regb8 uimm8 QI "pag")
;add/sub register and immediate
(define-pmacro (arithmetic10 name insn insn1 opc1 opc2 op1 op2 mode)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",$hash$"op2)
(+ opc1 opc2 op1 (f-op-bit1 0) op2)
(set mode op1 (insn1 mode op1 op2))
()
)
)
(arithmetic10 addri add add OP1_0 OP2_8 dr uimm3 HI)
(arithmetic10 subri sub sub OP1_2 OP2_8 dr uimm3 HI)
(arithmetic10 addbri addb add OP1_0 OP2_9 drb uimm3 QI)
(arithmetic10 subbri subb sub OP1_2 OP2_9 drb uimm3 QI)
;add/sub register and immediate
(define-pmacro (arithmetic11 name insn insn1 opc1 opc2 op1 op2 mode)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",$hash$"op2)
(+ opc1 opc2 op1 op2)
(set mode op1 (insn1 mode op1 op2))
()
)
)
(arithmetic11 addrim add add OP1_0 OP2_6 reg8 uimm16 HI)
(arithmetic11 subrim sub sub OP1_2 OP2_6 reg8 uimm16 HI)
;add/sub register and immediate
(define-pmacro (arithmetic12 name insn insn1 opc1 opc2 op1 op2 mode)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",$hash$"op2)
(+ opc1 opc2 op1 op2 (f-op-bit8 0))
(set mode op1 (insn1 mode op1 op2))
()
)
)
(arithmetic12 addbrim addb add OP1_0 OP2_7 regb8 uimm8 QI)
(arithmetic12 subbrim subb sub OP1_2 OP2_7 regb8 uimm8 QI)
;add/sub register and immediate with carry
(define-pmacro (arithmetic13 name insn insn1 opc1 opc2 op1 op2 mode)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",$hash$"op2)
(+ opc1 opc2 op1 (f-op-bit1 0) op2)
(set mode op1 (insn1 mode op1 op2 cbit))
()
)
)
(arithmetic13 addcri addc addc OP1_1 OP2_8 dr uimm3 HI)
(arithmetic13 subcri subc subc OP1_3 OP2_8 dr uimm3 HI)
(arithmetic13 addcbri addcb addc OP1_1 OP2_9 drb uimm3 QI)
(arithmetic13 subcbri subcb subc OP1_3 OP2_9 drb uimm3 QI)
;add/sub register and immediate with carry
(define-pmacro (arithmetic14 name insn insn1 opc1 opc2 op1 op2 mode)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",$hash$"op2)
(+ opc1 opc2 op1 op2)
(set mode op1 (insn1 mode op1 op2 cbit))
()
)
)
(arithmetic14 addcrim addc addc OP1_1 OP2_6 reg8 uimm16 HI)
(arithmetic14 subcrim subc subc OP1_3 OP2_6 reg8 uimm16 HI)
;add/sub register and immediate with carry
(define-pmacro (arithmetic15 name insn insn1 opc1 opc2 op1 op2 mode)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",$hash$"op2)
(+ opc1 opc2 op1 op2 (f-op-bit8 0))
(set mode op1 (insn1 mode op1 op2 cbit))
()
)
)
(arithmetic15 addcbrim addcb addc OP1_1 OP2_7 regb8 uimm8 QI)
(arithmetic15 subcbrim subcb subc OP1_3 OP2_7 regb8 uimm8 QI)
;add/sub registers
(define-pmacro (arithmetic name insn insn1 opc1 opc2 op1 op2 mode)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",$"op2)
(+ opc1 opc2 op1 op2)
(set mode op1 (insn1 mode op1 op2))
()
)
)
(arithmetic addr add add OP1_0 OP2_0 dr sr HI)
(arithmetic subr sub sub OP1_2 OP2_0 dr sr HI)
(arithmetic addbr addb add OP1_0 OP2_1 drb srb QI)
(arithmetic subbr subb sub OP1_2 OP2_1 drb srb QI)
;add/sub register and indirect memory
(define-pmacro (arithmetic1 name insn insn1 opc1 opc2 op1 op2 mode)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",[$"op2"]")
(+ opc1 opc2 op1 (f-op-bit2 2) op2)
(set mode op1 (insn1 mode op1 (mem HI op2)))
()
)
)
(arithmetic1 add2 add add OP1_0 OP2_8 dr sr2 HI)
(arithmetic1 sub2 sub sub OP1_2 OP2_8 dr sr2 HI)
(arithmetic1 addb2 addb add OP1_0 OP2_9 drb sr2 QI)
(arithmetic1 subb2 subb sub OP1_2 OP2_9 drb sr2 QI)
;add/sub register and indirect memory post increment
(define-pmacro (arithmetic2 name insn insn1 opc1 opc2 op1 op2 mode)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",[$"op2"+]")
(+ opc1 opc2 op1 (f-op-bit2 3) op2)
(sequence ()
(set mode op1 (insn1 mode op1 (mem HI op2)))
(set HI op2 (add HI op2 (const 2)))
)
()
)
)
(arithmetic2 add2i add add OP1_0 OP2_8 dr sr2 HI)
(arithmetic2 sub2i sub sub OP1_2 OP2_8 dr sr2 HI)
(arithmetic2 addb2i addb add OP1_0 OP2_9 drb sr2 QI)
(arithmetic2 subb2i subb sub OP1_2 OP2_9 drb sr2 QI)
;add/sub registers with carry
(define-pmacro (arithmetic3 name insn insn1 opc1 opc2 op1 op2 mode)
(dni name
(.str name "arithmetic" )
((PIPE OS) (IDOC ALU))
(.str insn " $"op1 ",$"op2)
(+ opc1 opc2 op1 op2)
(set mode op1 (insn1 mode op1 op2 cbit))
()
)
)
(arithmetic3 addcr addc addc OP1_1 OP2_0 dr sr HI)
(arithmetic3 subcr subc subc OP1_3 OP2_0 dr sr HI)
(arithmetic3 addbcr addcb addc OP1_1 OP2_1 drb srb QI)
(arithmetic3 subbcr subcb subc OP1_3 OP2_1 drb srb QI)
;add/sub register and indirect memory
(define-pmacro (arithmetic4 name insn insn1 opc1 opc2 op1 op2 mode)
(dni name
(.str name "arithmetic" )