OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-binutils/] [binutils-2.19.1/] [cpu/] [scarts_32.cpu] - Blame information for rev 7

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 jlechner
; SCARTS (32-bit architecture variant) architecture description.  -*- Scheme -*-
2
; Copyright 2000, 2001 Free Software Foundation, Inc.
3
; Contributed by Martin Walter 
4
;
5
; This file is part of the GNU Binutils.
6
;
7
; This program is free software; you can redistribute it and/or modify
8
; it under the terms of the GNU General Public License as published by
9
; the Free Software Foundation; either version 2 of the License, or
10
; (at your option) any later version.
11
;
12
; This program is distributed in the hope that it will be useful,
13
; but WITHOUT ANY WARRANTY; without even the implied warranty of
14
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
; GNU General Public License for more details.
16
;
17
; You should have received a copy of the GNU General Public License
18
; along with this program; if not, write to the Free Software
19
; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
;
21
 
22
(include "simplify.inc")
23
 
24
;---------------------------
25
; Architectural Definitions
26
;---------------------------
27
 
28
(define-arch
29
  (name scarts_32)
30
  (comment "SCARTS (32-bit architecture variant) architecture")
31
  (default-alignment aligned)
32
  (insn-lsb0? #t)
33
  (machs scarts_32)
34
  (isas scarts_32)
35
)
36
 
37
; Instruction set parameters
38
(define-isa
39
  (name scarts_32)
40
  (comment "SCARTS (32-bit architecture variant) instruction set architecture")
41
 
42
  ; Instructions are always 16 bits wide.
43
  (default-insn-word-bitsize 16)
44
  (default-insn-bitsize 16)
45
  (base-insn-bitsize 16)
46
)
47
 
48
; CPU familiy definitions
49
(define-cpu
50
  ; CPU names must be distinct from the architecture name and machine names.
51
  ; The "b" suffix stands for "base" and is the convention.
52
  ; The "f" suffix stands for "family" and is the convention.
53
  (name scarts_32bf)
54
  (comment "SCARTS (32-bit architecture variant) CPU base family")
55
  (endian little)
56
  (word-bitsize 32)
57
)
58
 
59
; CPU variant (machine) definitions
60
(define-mach
61
  (name scarts_32)
62
  (comment "SCARTS (32-bit architecture variant) machine")
63
  (cpu scarts_32bf)
64
  (bfd-name "scarts_32")
65
  (isas scarts_32)
66
)
67
 
68
; CPU variant (machine) model definitions
69
(define-model
70
  (name scarts_32gm)
71
  (comment "SCARTS (32-bit architecture variant) generic model")
72
  (mach scarts_32)
73
  (unit u-exec "Execution Unit" () 1 1 () () () ())
74
)
75
 
76
;----------------------
77
; Hardware Definitions
78
;----------------------
79
 
80
; General-purpose registers
81
(define-keyword
82
  (name gpr-names)
83
  (print-name h-gpr)
84
  (prefix "")
85
  (values (r0 0) (r1 1) (r2 2) (r3 3) (r4 4) (r5 5) (r6 6) (r7 7)
86
          (r8 8) (r9 9) (r10 10) (r11 11) (r12 12) (r13 13) (r14 14) (r15 15)
87
          (rts 14) (rte 15))
88
)
89
 
90
(dnh h-gpr "general-purpose registers"
91
  (CACHE-ADDR)
92
  (register SI (16))
93
  (extern-keyword gpr-names)
94
  () ()
95
)
96
 
97
(include "scarts.cpu")
98
 
99
;--------------------------
100
; Instruction Enumerations
101
;--------------------------
102
 
103
(define-normal-insn-enum insn-opc-4 "4-bit opcode enum" () OPC4_ f-opc-4
104
  ((LDLI #x0) (LDHI #x1) (LDLIU #x2))
105
)
106
 
107
(define-normal-insn-enum insn-opc-5 "5-bit opcode enum" () OPC5_ f-opc-5
108
  ((CMPI_EQ #x17) (CMPI_LT #x6) (CMPI_GT #x7))
109
)
110
 
111
(define-normal-insn-enum insn-opc-6 "6-bit opcode enum" () OPC6_ f-opc-6
112
  ((LDFPW #x18) (LDFPX #x19) (LDFPY #x1A) (LDFPZ #x1B)
113
   (STFPW #x1C) (STFPX #x1D) (STFPY #x1E) (STFPZ #x1F)
114
   (ADDI #x2A) (ADDI_CT #x26) (ADDI_CF #x22)
115
   (JMPI #x2B) (JMPI_CT #x27) (JMPI_CF #x23))
116
)
117
 
118
(define-normal-insn-enum insn-opc-7 "7-bit opcode enum" () OPC7_ f-opc-7
119
  ((LDFPW_INC #x20) (LDFPX_INC #x22) (LDFPY_INC #x24) (LDFPZ_INC #x26)
120
   (STFPW_INC #x28) (STFPX_INC #x2A) (STFPY_INC #x2C) (STFPZ_INC #x2E)
121
   (LDFPW_DEC #x21) (LDFPX_DEC #x23) (LDFPY_DEC #x25) (LDFPZ_DEC #x27)
122
   (STFPW_DEC #x29) (STFPX_DEC #x2B) (STFPY_DEC #x2D) (STFPZ_DEC #x2F)
123
   (BTEST #x5B)
124
   (BSET #x52) (BSET_CT #x4A) (BSET_CF #x42)
125
   (BCLR #x53) (BCLR_CT #x4B) (BCLR_CF #x43)
126
   (LDVEC #x7D) (STVEC #x7E))
127
)
128
 
129
(define-normal-insn-enum insn-opc-8 "8-bit opcode enum" () OPC8_ f-opc-8
130
  ((CMP_EQ #xB0) (CMP_LT #xB1) (CMP_GT #xB2)
131
   (CMPU_LT #xB3) (CMPU_GT #xB4)
132
   (SL #xA0) (SL_CT #x90) (SL_CF #x80)
133
   (SLI #xA1) (SLI_CT #x91) (SLI_CF #x81)
134
   (SR #xA2) (SR_CT #x92) (SR_CF #x82)
135
   (SRI #xA3) (SRI_CT #x93) (SRI_CF #x83)
136
   (SRA #xE8) (SRA_CT #xD8) (SRA_CF #xC8)
137
   (SRAI #xE9) (SRAI_CT #xD9) (SRAI_CF #xC9)
138
   (MOV #xE0) (MOV_CT #xD0) (MOV_CF #xC0)
139
   (ADD #xE1) (ADD_CT #xD1) (ADD_CF #xC1)
140
   (ADDC #xE2) (ADDC_CT #xD2) (ADDC_CF #xC2)
141
   (SUB #xE3) (SUB_CT #xD3) (SUB_CF #xC3)
142
   (SUBC #xE4) (SUBC_CT #xD4) (SUBC_CF #xC4)
143
   (AND #xE5) (AND_CT #xD5) (AND_CF #xC5)
144
   (OR #xE6) (OR_CT #xD6) (OR_CF #xC6)
145
   (EOR #xE7) (EOR_CT #xD7) (EOR_CF #xC7)
146
   (LDW #xF0) (LDH #xF1) (LDHU #xF2) (LDB #xF3) (LDBU #xF4)
147
   (STW #xF5) (STH #xF6) (STB #xF7)
148
   (TRAP #xEB) (TRAP_CT #xDB) (TRAP_CF #xCB))
149
)
150
 
151
(define-normal-insn-enum insn-opc-12 "12-bit opcode enum" () OPC12_ f-opc-12
152
  ((RRC #xEA0) (RRC_CT #xDA0) (RRC_CF #xCA0)
153
   (NOT #xEC0) (NOT_CT #xDC0) (NOT_CF #xCC0)
154
   (NEG #xED0) (NEG_CT #xDD0) (NEG_CF #xCD0)
155
   (JSR #xEE0) (JSR_CT #xDE0) (JSR_CF #xCE0)
156
   (JMP #xEF0) (JMP_CT #xDF0) (JMP_CF #xCF0))
157
)
158
 
159
(define-normal-insn-enum insn-opc-16 "16-bit opcode enum" () OPC16_ f-opc-16
160
  ((RTS #xF80E) (RTE #xF90F)
161
   (NOP #xFE00) (ILLOP #xFFFF))
162
)
163
 
164
;---------------------------------
165
; Arithmetic Logical Instructions
166
;---------------------------------
167
 
168
(m-opc5-reg-simm7-insn   cmpi_eq   CMPI_EQ   "Compare equal immediate"          ())
169
(m-opc5-reg-simm7-insn   cmpi_lt   CMPI_LT   "Compare less than immediate"      ())
170
(m-opc5-reg-simm7-insn   cmpi_gt   CMPI_GT   "Compare greater than immediate"   ())
171
 
172
(m-opc6-reg-simm6-insn   addi      ADDI      "Add immediate"                      ())
173
(m-opc6-reg-simm6-insn   addi_ct   ADDI_CT   "Add immediate if cond-flag true"    ())
174
(m-opc6-reg-simm6-insn   addi_cf   ADDI_CF   "Add immediate if cond-flag false"   ())
175
 
176
(m-opc8-reg-uimm4-insn   sli       SLI       "Shift left immediate"                                  ())
177
(m-opc8-reg-uimm4-insn   sli_ct    SLI_CT    "Shift left immediate if cond-flag true"                ())
178
(m-opc8-reg-uimm4-insn   sli_cf    SLI_CF    "Shift left immediate if cond-flag false"               ())
179
(m-opc8-reg-uimm4-insn   sri       SRI       "Shift right immediate"                                 ())
180
(m-opc8-reg-uimm4-insn   sri_ct    SRI_CT    "Shift right immediate if cond-flag true"               ())
181
(m-opc8-reg-uimm4-insn   sri_cf    SRI_CF    "Shift right immediate if cond-flag false"              ())
182
(m-opc8-reg-uimm4-insn   srai      SRAI      "Shift right arithmetic immediate"                      ())
183
(m-opc8-reg-uimm4-insn   srai_ct   SRAI_CT   "Shift right arithmetic immediate if cond-flag true"    ())
184
(m-opc8-reg-uimm4-insn   srai_cf   SRAI_CF   "Shift right arithmetic immediate if cond-flag false"   ())
185
 
186
(m-opc8-reg-reg-insn   cmp_eq    CMP_EQ     "Compare equal"                                     ())
187
(m-opc8-reg-reg-insn   cmp_lt    CMP_LT     "Compare less than"                                 ())
188
(m-opc8-reg-reg-insn   cmp_gt    CMP_GT     "Compare greater than"                              ())
189
(m-opc8-reg-reg-insn   cmpu_lt   CMPU_LT    "Compare less than unsigned"                        ())
190
(m-opc8-reg-reg-insn   cmpu_gt   CMPU_GT    "Compare greater than unsigned"                     ())
191
(m-opc8-reg-reg-insn   sl        SL         "Shift left"                                        ())
192
(m-opc8-reg-reg-insn   sl_ct     SL_CT      "Shift left if cond-flag true"                      ())
193
(m-opc8-reg-reg-insn   sl_cf     SL_CF      "Shift left if cond-flag false"                     ())
194
(m-opc8-reg-reg-insn   sr        SR         "Shift right"                                       ())
195
(m-opc8-reg-reg-insn   sr_ct     SR_CT      "Shift right if cond-flag true"                     ())
196
(m-opc8-reg-reg-insn   sr_cf     SR_CF      "Shift right if cond-flag false"                    ())
197
(m-opc8-reg-reg-insn   sra       SRA        "Shift right arithmetic"                            ())
198
(m-opc8-reg-reg-insn   sra_ct    SRA_CT     "Shift right arithmetic if cond-flag true"          ())
199
(m-opc8-reg-reg-insn   sra_cf    SRA_CF     "Shift right arithmetic if cond-flag false"         ())
200
(m-opc8-reg-reg-insn   add       ADD        "Add"                                               ())
201
(m-opc8-reg-reg-insn   add_ct    ADD_CT     "Add if cond-flag true"                             ())
202
(m-opc8-reg-reg-insn   add_cf    ADD_CF     "Add if cond-flag false"                            ())
203
(m-opc8-reg-reg-insn   addc      ADDC       "Add with carry"                                    ())
204
(m-opc8-reg-reg-insn   addc_ct   ADDC_CT    "Add with carry if cond-flag true"                  ())
205
(m-opc8-reg-reg-insn   addc_cf   ADDC_CF    "Add with carry if cond-flag false"                 ())
206
(m-opc8-reg-reg-insn   sub       SUB        "Subtract"                                          ())
207
(m-opc8-reg-reg-insn   sub_ct    SUB_CT     "Subtract if cond-flag true"                        ())
208
(m-opc8-reg-reg-insn   sub_cf    SUB_CF     "Subtract if cond-flag false"                       ())
209
(m-opc8-reg-reg-insn   subc      SUBC       "Subtract with carry"                               ())
210
(m-opc8-reg-reg-insn   subc_ct   SUBC_CT    "Subtract with carry if cond-flag true"             ())
211
(m-opc8-reg-reg-insn   subc_cf   SUBC_CF    "Subtract with carry if cond-flag false"            ())
212
(m-opc8-reg-reg-insn   and       AND        "Bitwise logical and"                               ())
213
(m-opc8-reg-reg-insn   and_ct    AND_CT     "Bitwise logical and if cond-flag true"             ())
214
(m-opc8-reg-reg-insn   and_cf    AND_CF     "Bitwise logical and if cond-flag false"            ())
215
(m-opc8-reg-reg-insn   or        OR         "Bitwise logical or"                                ())
216
(m-opc8-reg-reg-insn   or_ct     OR_CT      "Bitwise logical or if cond-flag true"              ())
217
(m-opc8-reg-reg-insn   or_cf     OR_CF      "Bitwise logical or if cond-flag false"             ())
218
(m-opc8-reg-reg-insn   eor       EOR        "Bitwise logical exclusive or"                      ())
219
(m-opc8-reg-reg-insn   eor_ct    EOR_CT     "Bitwise logical exclusive or if cond-flag true"    ())
220
(m-opc8-reg-reg-insn   eor_cf    EOR_CF     "Bitwise logical exclusive or if cond-flag false"   ())
221
 
222
(m-opc12-reg-insn   rrc      RRC      "Rotate right with carry"                      ())
223
(m-opc12-reg-insn   rrc_ct   RRC_CT   "Rotate right with carry if cond-flag true"    ())
224
(m-opc12-reg-insn   rrc_cf   RRC_CF   "Rotate right with carry if cond-flag false"   ())
225
(m-opc12-reg-insn   not      NOT      "Bitwise logical not"                          ())
226
(m-opc12-reg-insn   not_ct   NOT_CT   "Bitwise logical not if cond-flag true"        ())
227
(m-opc12-reg-insn   not_cf   NOT_CF   "Bitwise logical not if cond-flag false"       ())
228
(m-opc12-reg-insn   neg      NEG      "Negative"                                     ())
229
(m-opc12-reg-insn   neg_ct   NEG_CT   "Negative if cond-flag true"                   ())
230
(m-opc12-reg-insn   neg_cf   NEG_CF   "Negative if cond-flag false"                  ())
231
 
232
;-------------------------------
233
; Control Transfer Instructions
234
;-------------------------------
235
 
236
(m-opc6-saddr10-pcrel-insn   jmpi      JMPI      "Jump immediate"                      (UNCOND-CTI))
237
(m-opc6-saddr10-pcrel-insn   jmpi_ct   JMPI_CT   "Jump immediate if cond-flag true"    (COND-CTI))
238
(m-opc6-saddr10-pcrel-insn   jmpi_cf   JMPI_CF   "Jump immediate if cond-flag false"   (COND-CTI))
239
 
240
(m-opc12-reg-insn   jsr      JSR      "Jump to subroutine"                      (UNCOND-CTI))
241
(m-opc12-reg-insn   jsr_ct   JSR_CT   "Jump to subroutine if cond-flag true"    (COND-CTI))
242
(m-opc12-reg-insn   jsr_cf   JSR_CF   "Jump to subroutine if cond-flag false"   (COND-CTI))
243
(m-opc12-reg-insn   jmp      JMP      "Jump"                                    (UNCOND-CTI))
244
(m-opc12-reg-insn   jmp_ct   JMP_CT   "Jump if cond-flag true"                  (COND-CTI))
245
(m-opc12-reg-insn   jmp_cf   JMP_CF   "Jump if cond-flag false"                 (COND-CTI))
246
 
247
;-----------------------------
248
; Load and Store Instructions
249
;-----------------------------
250
 
251
(m-opc4-reg-simm8-insn   ldli    LDLI    "Load low byte immediate"                          ())
252
(m-opc4-reg-simm8-insn   ldhi    LDHI    "Load high byte immediate"                         ())
253
(m-opc4-reg-uimm8-insn   ldliu   LDLIU   "Load low byte immediate without sign extension"   ())
254
 
255
(m-opc6-reg-simm6-insn   ldfpw   LDFPW   "Load (half)word with frame pointer W"    ())
256
(m-opc6-reg-simm6-insn   ldfpx   LDFPX   "Load (half)word with frame pointer X"    ())
257
(m-opc6-reg-simm6-insn   ldfpy   LDFPY   "Load (half)word with frame pointer Y"    ())
258
(m-opc6-reg-simm6-insn   ldfpz   LDFPZ   "Load (half)word with frame pointer Z"    ())
259
(m-opc6-reg-simm6-insn   stfpw   STFPW   "Store (half)word with frame pointer W"   ())
260
(m-opc6-reg-simm6-insn   stfpx   STFPX   "Store (half)word with frame pointer X"   ())
261
(m-opc6-reg-simm6-insn   stfpy   STFPY   "Store (half)word with frame pointer Y"   ())
262
(m-opc6-reg-simm6-insn   stfpz   STFPZ   "Store (half)word with frame pointer Z"   ())
263
 
264
(m-opc7-reg-simm5-insn   ldfpw_inc   LDFPW_INC   "Load (half)word with frame pointer W and increment W"    ())
265
(m-opc7-reg-simm5-insn   ldfpx_inc   LDFPX_INC   "Load (half)word with frame pointer X and increment X"    ())
266
(m-opc7-reg-simm5-insn   ldfpy_inc   LDFPY_INC   "Load (half)word with frame pointer Y and increment Y"    ())
267
(m-opc7-reg-simm5-insn   ldfpz_inc   LDFPZ_INC   "Load (half)word with frame pointer Z and increment Z"    ())
268
(m-opc7-reg-simm5-insn   ldfpw_dec   LDFPW_DEC   "Load (half)word with frame pointer W and decrement W"    ())
269
(m-opc7-reg-simm5-insn   ldfpx_dec   LDFPX_DEC   "Load (half)word with frame pointer X and decrement X"    ())
270
(m-opc7-reg-simm5-insn   ldfpy_dec   LDFPY_DEC   "Load (half)word with frame pointer Y and decrement Y"    ())
271
(m-opc7-reg-simm5-insn   ldfpz_dec   LDFPZ_DEC   "Load (half)word with frame pointer Z and decrement Z"    ())
272
(m-opc7-reg-simm5-insn   stfpw_inc   STFPW_INC   "Store (half)word with frame pointer W and increment W"   ())
273
(m-opc7-reg-simm5-insn   stfpx_inc   STFPX_INC   "Store (half)word with frame pointer X and increment X"   ())
274
(m-opc7-reg-simm5-insn   stfpy_inc   STFPY_INC   "Store (half)word with frame pointer Y and increment Y"   ())
275
(m-opc7-reg-simm5-insn   stfpz_inc   STFPZ_INC   "Store (half)word with frame pointer Z and increment Z"   ())
276
(m-opc7-reg-simm5-insn   stfpw_dec   STFPW_DEC   "Store (half)word with frame pointer W and decrement W"   ())
277
(m-opc7-reg-simm5-insn   stfpx_dec   STFPX_DEC   "Store (half)word with frame pointer X and decrement X"   ())
278
(m-opc7-reg-simm5-insn   stfpy_dec   STFPY_DEC   "Store (half)word with frame pointer Y and decrement Y"   ())
279
(m-opc7-reg-simm5-insn   stfpz_dec   STFPZ_DEC   "Store (half)word with frame pointer Z and decrement Z"   ())
280
 
281
(m-opc8-reg-reg-insn   ldw    LDW    "Load word"                ())
282
(m-opc8-reg-reg-insn   ldh    LDH    "Load halfword"            ())
283
(m-opc8-reg-reg-insn   ldhu   LDHU   "Load halfword unsigned"   ())
284
(m-opc8-reg-reg-insn   ldb    LDB    "Load byte"                ())
285
(m-opc8-reg-reg-insn   ldbu   LDBU   "Load byte unsigned"       ())
286
(m-opc8-reg-reg-insn   stw    STW    "Store word"               ())
287
(m-opc8-reg-reg-insn   sth    STH    "Store halfword"           ())
288
(m-opc8-reg-reg-insn   stb    STB    "Store byte"               ())
289
 
290
;-------------------
291
; Misc Instructions
292
;-------------------
293
 
294
(m-opc7-reg-simm5-insn   ldvec      LDVEC      "Load vector"                    ())
295
(m-opc7-reg-simm5-insn   stvec      STVEC      "Store vector"                   ())
296
(m-opc7-reg-uimm5-insn   btest      BTEST      "Bit test"                       ())
297
(m-opc7-reg-uimm5-insn   bset       BSET       "Bit set"                        ())
298
(m-opc7-reg-uimm5-insn   bset_ct    BSET_CT    "Bit set if cond-flag true"      ())
299
(m-opc7-reg-uimm5-insn   bset_cf    BSET_CF    "Bit set if cond-flag false"     ())
300
(m-opc7-reg-uimm5-insn   bclr       BCLR       "Bit clear"                      ())
301
(m-opc7-reg-uimm5-insn   bclr_ct    BCLR_CT    "Bit clear if cond-flag true"    ())
302
(m-opc7-reg-uimm5-insn   bclr_cf    BCLR_CF    "Bit clear if cond-flag false"   ())
303
 
304
(m-opc8-reg-uimm4-insn   trap       TRAP       "Trap"                           ())
305
(m-opc8-reg-uimm4-insn   trap_ct    TRAP_CT    "Trap if cond-flag true"         ())
306
(m-opc8-reg-uimm4-insn   trap_cf    TRAP_CF    "Trap if cond-flag false"        ())
307
 
308
(m-opc8-reg-reg-insn   mov      MOV      "Move"                      ())
309
(m-opc8-reg-reg-insn   mov_ct   MOV_CT   "Move if cond-flag true"    ())
310
(m-opc8-reg-reg-insn   mov_cf   MOV_CF   "Move if cond-flag false"   ())
311
 
312
(m-opc16-insn   rts     RTS     "Return from subroutine"   ())
313
(m-opc16-insn   rte     RTE     "Return from exception"    ())
314
(m-opc16-insn   nop     NOP     "No operation"             ())
315
(m-opc16-insn   illop   ILLOP   "Illegal operation"        ())

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.