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

Subversion Repositories scarts

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 jlechner
; SCARTS generic 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
;-------------------------------
23
; Instruction Field Definitions
24
;-------------------------------
25
 
26
; Opcode fields
27
(dnf f-opc-4    "4-bit opcode field"                 ()             15  4)
28
(dnf f-opc-5    "5-bit opcode field"                 ()             15  5)
29
(dnf f-opc-6    "6-bit opcode field"                 ()             15  6)
30
(dnf f-opc-7    "7-bit opcode field"                 ()             15  7)
31
(dnf f-opc-8    "8-bit opcode field"                 ()             15  8)
32
(dnf f-opc-12   "12-bit opcode field"                ()             15 12)
33
(dnf f-opc-16   "16-bit opcode field"                ()             15 16)
34
 
35
; Register fields
36
(dnf f-reg-x    "Register field (rX)"                ()              3  4)
37
(dnf f-reg-y    "Register field (rY)"                ()              7  4)
38
 
39
; Immediate fields
40
(df f-uimm-4    "4-bit unsigned immediate field"     ()                       7  4  UINT #f #f)
41
(df f-simm-5    "5-bit signed immediate field"       ()                       8  5   INT #f #f)
42
(df f-uimm-5    "5-bit unsigned immediate field"     ()                       8  5  UINT #f #f)
43
(df f-simm-6    "6-bit signed immediate field"       ()                       9  6   INT #f #f)
44
(df f-simm-7    "7-bit signed immediate field"       ()                      10  7   INT #f #f)
45
(df f-simm-8    "8-bit signed immediate field"       ()                      11  8   INT #f #f)
46
(df f-uimm-8    "8-bit unsigned immediate field"     ()                      11  8  UINT #f #f)
47
(df f-simm-10   "10-bit signed immediate field"      (SIGN-OPT PCREL-ADDR)    9 10   INT #f #f)
48
 
49
;----------------------
50
; Hardware Definitions
51
;----------------------
52
 
53
; Program counter
54
(dsh h-pc "program counter" (PC) (pc))
55
 
56
; Special-purpose registers
57
(dnh h-simm-8    "8-bit signed immediate register"     ()   (immediate (INT 8))    () () ())
58
(dnh h-uimm-8    "8-bit unsigned immediate register"   ()   (immediate (UINT 8))   () () ())
59
(dnh h-simm-10   "10-bit signed immediate register"    ()   (immediate (INT 10))   () () ())
60
 
61
;----------------------
62
; Instruction Operands
63
;----------------------
64
 
65
; Immediate operands
66
(dnop uimm4    "4-bit unsigned immediate operand"   ()   h-uint   f-uimm-4)
67
(dnop simm5    "5-bit signed immediate operand"     ()   h-sint   f-simm-5)
68
(dnop uimm5    "5-bit unsigned immediate operand"   ()   h-uint   f-uimm-5)
69
(dnop simm6    "6-bit signed immediate operand"     ()   h-sint   f-simm-6)
70
(dnop simm7    "7-bit signed immediate operand"     ()   h-sint   f-simm-7)
71
 
72
(define-operand
73
  (name simm8)
74
  (comment "8-bit signed immediate operand")
75
  (type h-simm-8)
76
  (index f-simm-8)
77
  (handlers (parse "simm8"))
78
)
79
 
80
(define-operand
81
  (name uimm8)
82
  (comment "8-bit unsigned immediate operand")
83
  (type h-uimm-8)
84
  (index f-uimm-8)
85
  (handlers (parse "uimm8"))
86
)
87
 
88
(define-operand
89
  (name saddr10-pcrel)
90
  (comment "10-bit signed pc-relative address operand")
91
  (type h-simm-10)
92
  (index f-simm-10)
93
  (handlers (parse "saddr10_pcrel"))
94
)
95
 
96
; Register operands
97
(dnop regX   "register operand rX"   ()   h-gpr   f-reg-x)
98
(dnop regY   "register operand rY"   ()   h-gpr   f-reg-y)
99
 
100
;--------------
101
; Instructions
102
;--------------
103
 
104
; OPC4-REG-SIMM8 instructions
105
(define-pmacro (m-opc4-reg-simm8-insn mnemonic sym comment attributes)
106
  (dni mnemonic comment
107
    attributes
108
    (.str mnemonic " $regX,$simm8")
109
    (+ (.sym OPC4_ sym) simm8 regX)
110
    (nop)
111
    ()
112
  )
113
)
114
 
115
; OPC4-REG_UIMM8 instructions
116
(define-pmacro (m-opc4-reg-uimm8-insn mnemonic sym comment attributes)
117
  (dni mnemonic comment
118
    attributes
119
    (.str mnemonic " $regX,$uimm8")
120
    (+ (.sym OPC4_ sym) uimm8 regX)
121
    (nop)
122
    ()
123
  )
124
)
125
 
126
; OPC5-REG-SIMM7 instructions
127
(define-pmacro (m-opc5-reg-simm7-insn mnemonic sym comment attributes)
128
  (dni mnemonic comment
129
    attributes
130
    (.str mnemonic " $regX,$simm7")
131
    (+ (.sym OPC5_ sym) simm7 regX)
132
    (nop)
133
    ()
134
  )
135
)
136
 
137
; OPC6-REG-SIMM6 instructions
138
(define-pmacro (m-opc6-reg-simm6-insn mnemonic sym comment attributes)
139
  (dni mnemonic comment
140
    attributes
141
    (.str mnemonic " $regX,$simm6")
142
    (+ (.sym OPC6_ sym) simm6 regX)
143
    (nop)
144
    ()
145
  )
146
)
147
 
148
; OPC6-SADDR10-PCREL instructions
149
(define-pmacro (m-opc6-saddr10-pcrel-insn mnemonic sym comment attributes)
150
  (dni mnemonic comment
151
    attributes
152
    (.str mnemonic " ${saddr10-pcrel}")
153
    (+ (.sym OPC6_ sym) saddr10-pcrel)
154
    (nop)
155
    ()
156
  )
157
)
158
 
159
; OPC7-REG-SIMM5 instructions
160
(define-pmacro (m-opc7-reg-simm5-insn mnemonic sym comment attributes)
161
  (dni mnemonic comment
162
    attributes
163
    (.str mnemonic " $regX,$simm5")
164
    (+ (.sym OPC7_ sym) simm5 regX)
165
    (nop)
166
    ()
167
  )
168
)
169
 
170
; OPC7-REG-UIMM5 instructions
171
(define-pmacro (m-opc7-reg-uimm5-insn mnemonic sym comment attributes)
172
  (dni mnemonic comment
173
    attributes
174
    (.str mnemonic " $regX,$uimm5")
175
    (+ (.sym OPC7_ sym) uimm5 regX)
176
    (nop)
177
    ()
178
  )
179
)
180
 
181
; OPC8-REG-UIMM4 instructions
182
(define-pmacro (m-opc8-reg-uimm4-insn mnemonic sym comment attributes)
183
  (dni mnemonic comment
184
    attributes
185
    (.str mnemonic " $regX,$uimm4")
186
    (+ (.sym OPC8_ sym) uimm4 regX)
187
    (nop)
188
    ()
189
  )
190
)
191
 
192
; OPC8-REG-REG instructions
193
(define-pmacro (m-opc8-reg-reg-insn mnemonic sym comment attributes)
194
  (dni mnemonic comment
195
    attributes
196
    (.str mnemonic " $regX,$regY")
197
    (+ (.sym OPC8_ sym) regY regX)
198
    (nop)
199
    ()
200
  )
201
)
202
 
203
; OPC12-REG instructions
204
(define-pmacro (m-opc12-reg-insn mnemonic sym comment attributes)
205
  (dni mnemonic comment
206
    attributes
207
    (.str mnemonic " $regX")
208
    (+ (.sym OPC12_ sym) regX)
209
    (nop)
210
    ()
211
  )
212
)
213
 
214
; OPC16 instructions
215
(define-pmacro (m-opc16-insn mnemonic sym comment attributes)
216
  (dni mnemonic comment
217
    attributes
218
    (.str mnemonic "")
219
    (+ (.sym OPC16_ sym))
220
    (nop)
221
    ()
222
  )
223
)

powered by: WebSVN 2.1.0

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