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

Subversion Repositories scarts

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 jlechner
; Collection of macros to simplify .cpu file writing. -*- 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
; Enums.
7
 
8
; Define a normal enum without using name/value pairs.
9
; This is currently the same as define-full-enum but it needn't remain
10
; that way (it's define-full-enum that would change).
11
 
12
(define-pmacro (define-normal-enum name comment attrs prefix vals)
13
  "Define a normal enum, fixed number of arguments."
14
  (define-full-enum name comment attrs prefix vals)
15
)
16
 
17
; Define a normal insn enum.
18
 
19
(define-pmacro (define-normal-insn-enum name comment attrs prefix fld vals)
20
  "Define a normal instruction opcode enum."
21
  (define-full-insn-enum name comment attrs prefix fld vals)
22
)
23
 
24
; Instruction fields.
25
 
26
; Normally, fields are unsigned and have no encode/decode needs.
27
 
28
(define-pmacro (define-normal-ifield name comment attrs start length)
29
  "Define a normal instruction field."
30
  (define-full-ifield name comment attrs start length UINT #f #f)
31
)
32
 
33
; For those who don't like typing.
34
 
35
(define-pmacro (df name comment attrs start length mode encode decode)
36
  "Shorthand form of normal fields requiring mode, encode/decode."
37
  (define-full-ifield name comment attrs start length mode encode decode)
38
)
39
(define-pmacro dnf
40
  "Shorthand form of define-normal-ifield."
41
  define-normal-ifield
42
)
43
 
44
; Define a normal multi-ifield.
45
 
46
(define-pmacro (define-normal-multi-ifield name comment attrs
47
                 mode subflds insert extract)
48
  "Define a normal multi-part instruction field."
49
  (define-full-multi-ifield name comment attrs mode subflds insert extract)
50
)
51
 
52
; For those who don't like typing.
53
 
54
(define-pmacro dnmf
55
  "Shorthand form of define-normal-multi-ifield."
56
  define-normal-multi-ifield
57
)
58
 
59
; Simple multi-ifields: mode is UINT, default insert/extract support,
60
; default encode/decode support.
61
 
62
(define-pmacro (dsmf name comment attrs subflds)
63
  "Define a simple multi-part instruction field."
64
  (define-full-multi-ifield name comment attrs UINT subflds #f #f)
65
)
66
 
67
; Hardware.
68
 
69
; Simpler version for most hardware elements.
70
; Allow special assembler support specification but no semantic-name,
71
; getter/setter, or layout specs.
72
 
73
(define-pmacro (define-normal-hardware name comment attrs type
74
                 indices values handlers)
75
  "Define a normal hardware element."
76
  (define-full-hardware name comment attrs name type
77
    indices values handlers () () ())
78
)
79
 
80
; For those who don't like typing.
81
 
82
(define-pmacro dnh
83
  "Shorthand form of define-normal-hardware."
84
  define-normal-hardware
85
)
86
 
87
; Simpler version of dnh that leaves out the indices, values, handlers,
88
; getter/setter, and layout specs.
89
; This is useful for 1 bit registers.
90
; ??? While dsh and dnh aren't that distinguishable when perusing a .cpu file,
91
; they both take a fixed number of positional arguments, and dsh is a proper
92
; subset of dnh with all arguments in the same positions, so methinks things
93
; are ok.
94
 
95
(define-pmacro (define-simple-hardware name comment attrs type)
96
  "Define a simple hardware element (usually a scalar register)."
97
  (define-full-hardware name comment attrs name type () () () () () ())
98
)
99
 
100
(define-pmacro dsh
101
  "Shorthand form of define-simple-hardware."
102
  define-simple-hardware
103
)
104
 
105
; Operands.
106
 
107
; Simpler version for most operands.
108
; Allow special assembler support specification but no handlers or
109
; getter/setter specs.
110
 
111
(define-pmacro (define-normal-operand name comment attrs type index)
112
  "Define a normal operand."
113
  (define-full-operand name comment attrs type DFLT index () () ())
114
)
115
 
116
; For those who don't like typing.
117
 
118
(define-pmacro dno
119
  "Shorthand form of define-normal-operand."
120
  define-normal-operand
121
)
122
 
123
; Deprecated, but still in wide use.
124
 
125
(define-pmacro dnop
126
  "Shorthand form of define-normal-operand."
127
  define-normal-operand
128
)
129
 
130
(define-pmacro (dndo x-name x-mode x-args
131
                     x-syntax x-base-ifield x-encoding x-ifield-assertion
132
                     x-getter x-setter)
133
  "Define a normal derived operand."
134
  (define-derived-operand
135
    (name x-name)
136
    (mode x-mode)
137
    (args x-args)
138
    (syntax x-syntax)
139
    (base-ifield x-base-ifield)
140
    (encoding x-encoding)
141
    (ifield-assertion x-ifield-assertion)
142
    (getter x-getter)
143
    (setter x-setter)
144
    )
145
)
146
 
147
; Instructions.
148
 
149
; Define an instruction object, normal version.
150
; At present all fields must be specified.
151
; Fields ifield-assertion is absent.
152
 
153
(define-pmacro (define-normal-insn name comment attrs syntax fmt semantics timing)
154
  "Define a normal instruction."
155
  (define-full-insn name comment attrs syntax fmt () semantics timing)
156
)
157
 
158
; To reduce the amount of typing.
159
; Note that this is the same name as the D'ni in MYST.  Oooohhhh.....
160
; this must be the right way to go. :-)
161
 
162
(define-pmacro dni
163
  "Shorthand form of define-normal-insn."
164
  define-normal-insn
165
)
166
 
167
; Macro instructions.
168
 
169
; Define a macro-insn object, normal version.
170
; This only supports expanding to one real insn.
171
 
172
(define-pmacro (define-normal-macro-insn name comment attrs syntax expansion)
173
  "Define a normal macro instruction."
174
  (define-full-minsn name comment attrs syntax expansion)
175
)
176
 
177
; To reduce the amount of typing.
178
 
179
(define-pmacro dnmi
180
  "Shorthand form of define-normal-macro-insn."
181
  define-normal-macro-insn
182
)
183
 
184
; Modes.
185
; ??? Not currently available for use.
186
;
187
; Define Normal Mode
188
;
189
;(define-pmacro (define-normal-mode name comment attrs bits bytes
190
;                non-mode-c-type printf-type sem-mode ptr-to host?)
191
;  "Define a normal mode.\n"
192
;  (define-full-mode name comment attrs bits bytes
193
;    non-mode-c-type printf-type sem-mode ptr-to host?)
194
;)
195
;
196
; For those who don't like typing.
197
;(define-pmacro dnm
198
;  "Shorthand form of define-normal-mode.\n"
199
;  define-normal-mode
200
;)

powered by: WebSVN 2.1.0

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