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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-binutils/] [binutils-2.19.1/] [cgen/] [cpu/] [m68k.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
; Motorola M68000 family CPU description.  -*- Scheme -*-
2
; Copyright (C) 2000, 2009 Red Hat, Inc.
3
; This file is part of CGEN.
4
; See file COPYING.CGEN for details.
5
 
6
(define-rtl-version 0 8)
7
 
8
; NOTE: this file is still strictly WORK-IN-PROGRESS.
9
 
10
(include "simplify.inc")
11
 
12
(define-arch
13
  (name m68k)
14
  (comment "Motorola M68000 architecture")
15
  (insn-lsb0? #t)
16
  (machs m68k16)
17
  (isas basic)
18
)
19
 
20
(define-isa
21
  (name basic)
22
  (comment "Basic M68K instruction set")
23
  (default-insn-word-bitsize 16)
24
  (default-insn-bitsize 16)
25
  (base-insn-bitsize 16)
26
  (decode-assist (15 14 13 12))
27
)
28
 
29
(define-cpu
30
  (name m68k)
31
  (comment "Motorola M68000 family")
32
  (endian big)
33
  (word-bitsize 32)
34
)
35
 
36
(define-mach
37
  (name m68k16)
38
  (comment "Motorola M68000 (16-bit bus)")
39
  (cpu m68k)
40
  (isas basic)
41
)
42
 
43
(define-model
44
  (name mc68000)
45
  (comment "Motorola MC68000 microprocessor")
46
  (mach m68k16)
47
  (unit u-exec "Execution Unit" ()
48
        1 1 ; issue done
49
        () () () ())
50
)
51
 
52
; Hardware elements.
53
 
54
(dnh h-pc "program counter" (PC PROFILE (ISA basic)) (pc) () () ())
55
 
56
(dsh h-ccr "condition code register" () (register HI))
57
 
58
(define-keyword
59
  (name dr-names)
60
  (enum-prefix H-DR-)
61
  (values (d0 0) (d1 1) (d2 2) (d3 3) (d4 4) (d5 5) (d6 6) (d7 7))
62
)
63
 
64
(define-keyword
65
  (name ar-names)
66
  (enum-prefix H-AR-)
67
  (values (a0 0) (a1 1) (a2 2) (a3 3) (a4 4) (a5 5) (a6 6) (a7 7)
68
          (sp 7))
69
)
70
 
71
(define-hardware
72
  (name h-dr)
73
  (comment "data registers")
74
  (attrs (ISA basic) CACHE-ADDR)
75
  (type register SI (8))
76
  (indices extern-keyword dr-names)
77
)
78
 
79
(define-hardware
80
  (name h-ar)
81
  (comment "address registers")
82
  (attrs (ISA basic) CACHE-ADDR)
83
  (type register SI (8))
84
  (indices extern-keyword ar-names)
85
)
86
 
87
; FIXME: need three shadowed A7 registers here for:
88
;   * User stack pointer (USP)
89
;   * Interrupt stack pointer (ISP)
90
;   * Master stack pointer (MSP).
91
; These can be omitted for now since we intend to only do user mode.
92
; c.f. arm.cpu for tips on how to do this.  ARM shadows some registers
93
; depending on any of its five operating modes.
94
 
95
 
96
; Instruction fields.
97
 
98
(define-pmacro (d68f x-name x-comment x-attrs x-word-offset x-word-length
99
                     x-start x-length x-mode x-encode x-decode)
100
  (define-ifield
101
    (name x-name)
102
    (comment x-comment)
103
    (.splice attrs (.unsplice x-attrs))
104
    (word-offset x-word-offset)
105
    (word-length x-word-length)
106
    (start x-start)
107
    (length x-length)
108
    (mode x-mode)
109
    (encode x-encode)
110
    (decode x-decode)
111
  )
112
)
113
 
114
(define-pmacro (dn68f x-name x-comment x-attrs x-word-offset
115
                      x-word-length x-start x-length)
116
  (d68f x-name x-comment x-attrs x-word-offset x-word-length x-start
117
        x-length UINT #f #f)
118
)
119
 
120
(d68f f-simm8  "signed 8 bit immediate"  () 16 16 7  8  INT #f #f)
121
(d68f f-simm16 "signed 16 bit immediate" () 16 16 15 16 INT #f #f)
122
(d68f f-simm32 "signed 32 bit immediate" () 16 32 31 32 INT #f #f)
123
 
124
(dn68f f-uimm8  "unsigned 8 bit immediate"  () 16 16 7  8)
125
(dn68f f-uimm16 "unsigned 16 bit immediate" () 16 16 15 16)
126
(dn68f f-iumm32 "unsigned 32 bit immediate" () 16 32 31 32)
127
 
128
(dn68f f-imm8-filler "unused part of 8 bit immediate" () 16 16 15 8)
129
 
130
(dn68f f-15-4  "4 bits at bit 15"  () 0 16 15 4)
131
(dn68f f-15-12 "12 bits at bit 15" () 0 16 15 12)
132
(dn68f f-15-13 "13 bits at bit 15" () 0 16 15 13)
133
(dn68f f-15-16 "16 bits at bit 15" () 0 16 15 16)
134
(dn68f f-8-1   "1 bit at bit 8"    () 0 16 8  1)
135
 
136
(dnf f-rx     "register Rx field"              ()   11  3)
137
(dnf f-ry     "register Ry field"              ()    2  3)
138
(dnf f-opmode "operation mode"                 ()    7  5)
139
(dnf f-vector "vector field"                   ()    3  4)
140
 
141
(dnf f-imm8   "immediate constant (8 bits)"    ()    7  8)
142
 
143
; Operands.
144
(dnop rx      "register Rx operand"            () h-uint f-rx)
145
(dnop reg-@2  "general reg number (at bit 2)"  () h-uint f-rx)
146
(dnop reg-@11 "general reg number (at bit 11)" () h-uint f-ry)
147
(dnop ry      "register Ry operand"            () h-uint f-ry)
148
(dnop vector  "trap vector operand"            () h-uint f-vector)
149
(dnop imm8    "immediate constant (8 bits)"    () h-uint f-imm8)
150
 
151
; Instructions.
152
 
153
(dni nop "no operation" ()
154
     "nop"
155
      (+ (f-15-16 #x4E71))
156
      (nop)
157
      ()
158
)
159
 
160
(dni exg-data "exchange data registers" ()
161
     "FIXME"
162
     (+ (f-15-4 #xC) rx (f-8-1 1) (f-opmode 8) ry)
163
     (sequence ((SI temp))
164
               (set temp (reg h-dr rx))
165
               (set (reg h-dr rx) (reg h-dr ry))
166
               (set (reg h-dr ry) temp))
167
     ()
168
)
169
 
170
(dni exg-addr "exchange address registers" ()
171
     "FIXME"
172
     (+ (f-15-4 #xC) rx (f-8-1 1) (f-opmode 9) ry)
173
     (sequence ((SI temp))
174
               (set temp (reg h-ar rx))
175
               (set (reg h-ar rx) (reg h-ar ry))
176
               (set (reg h-ar ry) temp))
177
     ()
178
)
179
 
180
(dni exg-data-addr "exchange data and address register" ()
181
     "FIXME"
182
     (+ (f-15-4 #xC) rx (f-8-1 1) (f-opmode #x11) ry)
183
     (sequence ((SI temp))
184
               (set temp (reg h-dr rx))
185
               (set (reg h-dr rx) (reg h-ar ry))
186
               (set (reg h-ar ry) temp))
187
     ()
188
)
189
 
190
(dni illegal "illegal instruction" ()
191
     "FIXME"
192
     (+ (f-15-16 #x4AFC))
193
     (nop)
194
     ()
195
)
196
 
197
(dni moveq "move quick" ()
198
     "FIXME"
199
     (+ (f-15-4 7) reg-@2 (f-8-1 0) imm8)
200
     ; FIXME: set condition codes.
201
     (sequence ()
202
               (set (reg h-dr reg-@2) (ext SI imm8)))
203
     ()
204
)
205
 
206
(dni reset "reset external devices" ()
207
     "FIXME"
208
     (+ (f-15-16 #x4E70))
209
     (nop)
210
     ()
211
)
212
 
213
(dni rte "return from exception" ()
214
     "FIXME"
215
     (+ (f-15-16 #x4E73))
216
     (nop)
217
     ()
218
)
219
 
220
(dni rtr "return and restore condition codes" ()
221
     "FIXME"
222
     (+ (f-15-16 #x4E77))
223
     (nop)
224
     ()
225
)
226
 
227
(dni rts "return from subroutine" ()
228
     "RTS"
229
     (+ (f-15-16 #x4E75))
230
     (nop)
231
     ()
232
)
233
 
234
(dni trap "trap" ()
235
     "FIXME"
236
     (+ (f-15-12 #x4E4) vector)
237
     (nop)
238
     ()
239
)
240
 
241
(dni trapv "trap on overflow" ()
242
     "FIXME"
243
     (+ (f-15-16 #x4E76))
244
     (nop)
245
     ()
246
)
247
 
248
(dni unlk "unlink" ()
249
     "FIXME"
250
     (+ (f-15-13 #x9CB) reg-@2)
251
     (nop)
252
     ()
253
)

powered by: WebSVN 2.1.0

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