1 1.1 christos ; Collection of macros, for GNU Binutils .cpu files. -*- Scheme -*- 2 1.1 christos ; 3 1.1 christos ; Copyright 2000, 2007, 2009 Free Software Foundation, Inc. 4 1.1 christos ; 5 1.1 christos ; Contributed by Red Hat Inc. 6 1.1 christos ; 7 1.1 christos ; This file is part of the GNU Binutils. 8 1.1 christos ; 9 1.1 christos ; This program is free software; you can redistribute it and/or modify 10 1.1 christos ; it under the terms of the GNU General Public License as published by 11 1.1 christos ; the Free Software Foundation; either version 3 of the License, or 12 1.1 christos ; (at your option) any later version. 13 1.1 christos ; 14 1.1 christos ; This program is distributed in the hope that it will be useful, 15 1.1 christos ; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 1.1 christos ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 1.1 christos ; GNU General Public License for more details. 18 1.1 christos ; 19 1.1 christos ; You should have received a copy of the GNU General Public License 20 1.1 christos ; along with this program; if not, write to the Free Software 21 1.1 christos ; Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 22 1.1 christos ; MA 02110-1301, USA. 23 1.1 christos 24 1.1 christos ; Enums. 26 1.1 christos 27 1.1 christos ; Define a normal enum without using name/value pairs. 28 1.1 christos ; This is currently the same as define-full-enum but it needn't remain 29 1.1 christos ; that way (it's define-full-enum that would change). 30 1.1 christos 31 1.1 christos (define-pmacro (define-normal-enum name comment attrs prefix vals) 32 1.1 christos "Define a normal enum, fixed number of arguments." 33 1.1 christos (define-full-enum name comment attrs prefix vals) 34 1.1 christos ) 35 1.1 christos 36 1.1 christos ; Define a normal insn enum. 37 1.1 christos 38 1.1 christos (define-pmacro (define-normal-insn-enum name comment attrs prefix fld vals) 39 1.1 christos "Define a normal instruction opcode enum." 40 1.1 christos (define-full-insn-enum name comment attrs prefix fld vals) 41 1.1 christos ) 42 1.1 christos 43 1.1 christos ; Instruction fields. 45 1.1 christos 46 1.1 christos ; Normally, fields are unsigned and have no encode/decode needs. 47 1.1 christos 48 1.1 christos (define-pmacro (define-normal-ifield name comment attrs start length) 49 1.1 christos "Define a normal instruction field." 50 1.1 christos (define-full-ifield name comment attrs start length UINT #f #f) 51 1.1 christos ) 52 1.1 christos 53 1.1 christos ; For those who don't like typing. 54 1.1 christos 55 1.1 christos (define-pmacro (df name comment attrs start length mode encode decode) 56 1.1 christos "Shorthand form of normal fields requiring mode, encode/decode." 57 1.1 christos (define-full-ifield name comment attrs start length mode encode decode) 58 1.1 christos ) 59 1.1 christos (define-pmacro dnf 60 1.1 christos "Shorthand form of define-normal-ifield." 61 1.1 christos define-normal-ifield 62 1.1 christos ) 63 1.1 christos 64 1.1 christos ; Define a normal multi-ifield. 65 1.1 christos 66 1.1 christos (define-pmacro (define-normal-multi-ifield name comment attrs 67 1.1 christos mode subflds insert extract) 68 1.1 christos "Define a normal multi-part instruction field." 69 1.1 christos (define-full-multi-ifield name comment attrs mode subflds insert extract) 70 1.1 christos ) 71 1.1 christos 72 1.1 christos ; For those who don't like typing. 73 1.1 christos 74 1.1 christos (define-pmacro dnmf 75 1.1 christos "Shorthand form of define-normal-multi-ifield." 76 1.1 christos define-normal-multi-ifield 77 1.1 christos ) 78 1.1 christos 79 1.1 christos ; Simple multi-ifields: mode is UINT, default insert/extract support, 80 1.1 christos ; default encode/decode support. 81 1.1 christos 82 1.1 christos (define-pmacro (dsmf name comment attrs subflds) 83 1.1 christos "Define a simple multi-part instruction field." 84 1.1 christos (define-full-multi-ifield name comment attrs UINT subflds #f #f) 85 1.1 christos ) 86 1.1 christos 87 1.1 christos ; Hardware. 89 1.1 christos 90 1.1 christos ; Simpler version for most hardware elements. 91 1.1 christos ; Allow special assembler support specification but no semantic-name, 92 1.1 christos ; getter/setter, or layout specs. 93 1.1 christos 94 1.1 christos (define-pmacro (define-normal-hardware name comment attrs type 95 1.1 christos indices values handlers) 96 1.1 christos "Define a normal hardware element." 97 1.1 christos (define-full-hardware name comment attrs name type 98 1.1 christos indices values handlers () () ()) 99 1.1 christos ) 100 1.1 christos 101 1.1 christos ; For those who don't like typing. 102 1.1 christos 103 1.1 christos (define-pmacro dnh 104 1.1 christos "Shorthand form of define-normal-hardware." 105 1.1 christos define-normal-hardware 106 1.1 christos ) 107 1.1 christos 108 1.1 christos ; Simpler version of dnh that leaves out the indices, values, handlers, 109 1.1 christos ; getter/setter, and layout specs. 110 1.1 christos ; This is useful for 1 bit registers. 111 1.1 christos ; ??? While dsh and dnh aren't that distinguishable when perusing a .cpu file, 112 1.1 christos ; they both take a fixed number of positional arguments, and dsh is a proper 113 1.1 christos ; subset of dnh with all arguments in the same positions, so methinks things 114 1.1 christos ; are ok. 115 1.1 christos 116 1.1 christos (define-pmacro (define-simple-hardware name comment attrs type) 117 1.1 christos "Define a simple hardware element (usually a scalar register)." 118 1.1 christos (define-full-hardware name comment attrs name type () () () () () ()) 119 1.1 christos ) 120 1.1 christos 121 1.1 christos (define-pmacro dsh 122 1.1 christos "Shorthand form of define-simple-hardware." 123 1.1 christos define-simple-hardware 124 1.1 christos ) 125 1.1 christos 126 1.1 christos ; Operands. 128 1.1 christos 129 1.1 christos ; Simpler version for most operands. 130 1.1 christos ; Allow special assembler support specification but no handlers or 131 1.1 christos ; getter/setter specs. 132 1.1 christos 133 1.1 christos (define-pmacro (define-normal-operand name comment attrs type index) 134 1.1 christos "Define a normal operand." 135 1.1 christos (define-full-operand name comment attrs type DFLT index () () ()) 136 1.1 christos ) 137 1.1 christos 138 1.1 christos ; For those who don't like typing. 139 1.1 christos 140 1.1 christos (define-pmacro dno 141 1.1 christos "Shorthand form of define-normal-operand." 142 1.1 christos define-normal-operand 143 1.1 christos ) 144 1.1 christos 145 1.1 christos ; Deprecated, but still in wide use. 146 1.1 christos 147 1.1 christos (define-pmacro dnop 148 1.1 christos "Shorthand form of define-normal-operand." 149 1.1 christos define-normal-operand 150 1.1 christos ) 151 1.1 christos 152 1.1 christos (define-pmacro (dndo x-name x-mode x-args 153 1.1 christos x-syntax x-base-ifield x-encoding x-ifield-assertion 154 1.1 christos x-getter x-setter) 155 1.1 christos "Define a normal derived operand." 156 1.1 christos (define-derived-operand 157 1.1 christos (name x-name) 158 1.1 christos (mode x-mode) 159 1.1 christos (args x-args) 160 1.1 christos (syntax x-syntax) 161 1.1 christos (base-ifield x-base-ifield) 162 1.1 christos (encoding x-encoding) 163 1.1 christos (ifield-assertion x-ifield-assertion) 164 1.1 christos (getter x-getter) 165 1.1 christos (setter x-setter) 166 1.1 christos ) 167 1.1 christos ) 168 1.1 christos 169 1.1 christos ; Instructions. 171 1.1 christos 172 1.1 christos ; Define an instruction object, normal version. 173 1.1 christos ; At present all fields must be specified. 174 1.1 christos ; Fields ifield-assertion is absent. 175 1.1 christos 176 1.1 christos (define-pmacro (define-normal-insn name comment attrs syntax fmt semantics timing) 177 1.1 christos "Define a normal instruction." 178 1.1 christos (define-full-insn name comment attrs syntax fmt () semantics timing) 179 1.1 christos ) 180 1.1 christos 181 1.1 christos ; To reduce the amount of typing. 182 1.1 christos ; Note that this is the same name as the D'ni in MYST. Oooohhhh..... 183 1.1 christos ; this must be the right way to go. :-) 184 1.1 christos 185 1.1 christos (define-pmacro dni 186 1.1 christos "Shorthand form of define-normal-insn." 187 1.1 christos define-normal-insn 188 1.1 christos ) 189 1.1 christos 190 1.1 christos ; Macro instructions. 192 1.1 christos 193 1.1 christos ; Define a macro-insn object, normal version. 194 1.1 christos ; This only supports expanding to one real insn. 195 1.1 christos 196 1.1 christos (define-pmacro (define-normal-macro-insn name comment attrs syntax expansion) 197 1.1 christos "Define a normal macro instruction." 198 1.1 christos (define-full-minsn name comment attrs syntax expansion) 199 1.1 christos ) 200 1.1 christos 201 1.1 christos ; To reduce the amount of typing. 202 1.1 christos 203 1.1 christos (define-pmacro dnmi 204 1.1 christos "Shorthand form of define-normal-macro-insn." 205 1.1 christos define-normal-macro-insn 206 1.1 christos ) 207 1.1 christos 208 1.1 christos ; Modes. 210 1.1 christos ; ??? Not currently available for use. 211 1.1 christos ; 212 1.1 christos ; Define Normal Mode 213 1.1 christos ; 214 1.1 christos ;(define-pmacro (define-normal-mode name comment attrs bits bytes 215 1.1 christos ; non-mode-c-type printf-type sem-mode ptr-to host?) 216 1.1 christos ; "Define a normal mode.\n" 217 1.1 christos ; (define-full-mode name comment attrs bits bytes 218 1.1 christos ; non-mode-c-type printf-type sem-mode ptr-to host?) 219 ;) 220 ; 221 ; For those who don't like typing. 222 ;(define-pmacro dnm 223 ; "Shorthand form of define-normal-mode.\n" 224 ; define-normal-mode 225 ;) 226