xref: /netbsd-src/external/gpl3/binutils/dist/cpu/or1kcommon.cpu (revision 03f5171a7b36cbd3eb2581be737439f912b7121f)
1a45653d1Smatt; OpenRISC 1000 32-bit CPU hardware description.  -*- Scheme -*-
2*106c59e5Schristos; Copyright 2000-2019 Free Software Foundation, Inc.
3a45653d1Smatt; Contributed for OR32 by Johan Rydberg, jrydberg@opencores.org
4a45653d1Smatt; Modified by Julius Baxter, juliusbaxter@gmail.com
5*106c59e5Schristos; Modified by Andrey Bacherov, avbacherov@opencores.org
6a45653d1Smatt;
7a45653d1Smatt; This program is free software; you can redistribute it and/or modify
8a45653d1Smatt; it under the terms of the GNU General Public License as published by
9a45653d1Smatt; the Free Software Foundation; either version 3 of the License, or
10a45653d1Smatt; (at your option) any later version.
11a45653d1Smatt;
12a45653d1Smatt; This program is distributed in the hope that it will be useful,
13a45653d1Smatt; but WITHOUT ANY WARRANTY; without even the implied warranty of
14a45653d1Smatt; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15a45653d1Smatt; GNU General Public License for more details.
16a45653d1Smatt;
17a45653d1Smatt; You should have received a copy of the GNU General Public License
18a45653d1Smatt; along with this program; if not, see <http://www.gnu.org/licenses/>
19a45653d1Smatt
20a45653d1Smatt; Hardware pieces.
21a45653d1Smatt; These entries list the elements of the raw hardware.
22a45653d1Smatt; They're also used to provide tables and other elements of the assembly
23a45653d1Smatt; language.
24a45653d1Smatt
25a45653d1Smatt(define-hardware
26a45653d1Smatt  (name h-pc)
27a45653d1Smatt  (comment "program counter")
28a45653d1Smatt  (attrs PC (MACH ORBIS-MACHS))
29a45653d1Smatt  (type pc UWI)
30fc4f4269Schristos  (get () (raw-reg h-pc))
31fc4f4269Schristos  (set (newval) (sequence ()
32fc4f4269Schristos                 (set (reg h-sys-ppc) (raw-reg h-pc))
33fc4f4269Schristos                 (set (raw-reg h-pc) newval)
34fc4f4269Schristos                ))
35a45653d1Smatt  )
36a45653d1Smatt
37a45653d1Smatt(define-pmacro REG-INDICES
38a45653d1Smatt  ((r0 0)
39a45653d1Smatt   (r1 1)
40a45653d1Smatt   (r2 2)
41a45653d1Smatt   (r3 3)
42a45653d1Smatt   (r4 4)
43a45653d1Smatt   (r5 5)
44a45653d1Smatt   (r6 6)
45a45653d1Smatt   (r7 7)
46a45653d1Smatt   (r8 8)
47a45653d1Smatt   (r9 9)
48a45653d1Smatt   (r10 10)
49a45653d1Smatt   (r11 11)
50a45653d1Smatt   (r12 12)
51a45653d1Smatt   (r13 13)
52a45653d1Smatt   (r14 14)
53a45653d1Smatt   (r15 15)
54a45653d1Smatt   (r16 16)
55a45653d1Smatt   (r17 17)
56a45653d1Smatt   (r18 18)
57a45653d1Smatt   (r19 19)
58a45653d1Smatt   (r20 20)
59a45653d1Smatt   (r21 21)
60a45653d1Smatt   (r22 22)
61a45653d1Smatt   (r23 23)
62a45653d1Smatt   (r24 24)
63a45653d1Smatt   (r25 25)
64a45653d1Smatt   (r26 26)
65a45653d1Smatt   (r27 27)
66a45653d1Smatt   (r28 28)
67a45653d1Smatt   (r29 29)
68a45653d1Smatt   (r30 30)
69a45653d1Smatt   (r31 31)
70a45653d1Smatt   (lr 9)
71a45653d1Smatt   (sp 1)
72a45653d1Smatt   (fp 2))
73a45653d1Smatt  )
74a45653d1Smatt
75*106c59e5Schristos;
76*106c59e5Schristos; Hardware: [S]pecial [P]urpose [R]egisters
77*106c59e5Schristos;
78a45653d1Smatt(define-hardware
79a45653d1Smatt  (name h-spr) (comment "special purpose registers")
80a45653d1Smatt  (attrs VIRTUAL (MACH ORBIS-MACHS))
81a45653d1Smatt  (type register UWI (#x20000))
82a45653d1Smatt  (get (index) (c-call UWI "@cpu@_h_spr_get_raw" index))
83a45653d1Smatt  (set (index newval) (c-call VOID "@cpu@_h_spr_set_raw" index newval))
84a45653d1Smatt)
85a45653d1Smatt
86a45653d1Smatt(define-pmacro spr-shift 11)
87a45653d1Smatt(define-pmacro (spr-address spr-group spr-index)
88a45653d1Smatt  (or (sll UWI (enum UWI (.sym "SPR-GROUP-" spr-group)) spr-shift)
89a45653d1Smatt      (enum UWI (.sym "SPR-INDEX-" spr-group "-" spr-index))))
90a45653d1Smatt
91*106c59e5Schristos;
92*106c59e5Schristos; Hardware: [G]enepral  [P]urpose [R]egisters
93*106c59e5Schristos;
94a45653d1Smatt(define-hardware
95a45653d1Smatt  (name h-gpr) (comment "general registers")
96a45653d1Smatt  (attrs (MACH ORBIS-MACHS))
97a45653d1Smatt  (type register UWI (32))
98a45653d1Smatt  (indices keyword "" REG-INDICES)
99a45653d1Smatt  (get (index) (reg UWI h-spr (add index (spr-address SYS GPR0))))
100a45653d1Smatt  (set (index newval) (set UWI (reg UWI h-spr (add index (spr-address SYS GPR0))) newval))
101a45653d1Smatt  )
102a45653d1Smatt
103*106c59e5Schristos;
104*106c59e5Schristos; Hardware: virtual registerts for FPU (single precision)
105*106c59e5Schristos;           mapped to GPRs
106*106c59e5Schristos;
107*106c59e5Schristos(define-hardware
108*106c59e5Schristos  (name h-fsr)
109*106c59e5Schristos  (comment "floating point registers (single, virtual)")
110*106c59e5Schristos  (attrs VIRTUAL (MACH ORFPX32-MACHS))
111*106c59e5Schristos  (type register SF (32))
112*106c59e5Schristos  (indices keyword "" REG-INDICES)
113*106c59e5Schristos  (get (index) (subword SF (trunc SI (reg h-gpr index)) 0))
114*106c59e5Schristos  (set (index newval) (set UWI (reg h-gpr index) (zext UWI (subword SI newval 0))))
115*106c59e5Schristos  )
116*106c59e5Schristos
117*106c59e5Schristos;
118*106c59e5Schristos; Register pairs are offset by 2 for registers r16 and above.  This is to
119*106c59e5Schristos; be able to allow registers to be call saved in GCC across function calls.
120*106c59e5Schristos;
121*106c59e5Schristos(define-pmacro (reg-pair-reg-lo index)
122*106c59e5Schristos  (and index (const #x1f))
123*106c59e5Schristos)
124*106c59e5Schristos
125*106c59e5Schristos(define-pmacro (reg-pair-reg-hi index)
126*106c59e5Schristos  (add (and index (const #x1f))
127*106c59e5Schristos       (if (eq (sra index (const 5))
128*106c59e5Schristos	       (const 1))
129*106c59e5Schristos	   (const 2)
130*106c59e5Schristos	   (const 1)
131*106c59e5Schristos	 )
132*106c59e5Schristos    )
133*106c59e5Schristos)
134*106c59e5Schristos
135*106c59e5Schristos;
136*106c59e5Schristos; Hardware: vrtual registers for double precision floating point
137*106c59e5Schristos;           operands on 32-bit machines
138*106c59e5Schristos;           mapped to GPRs
139*106c59e5Schristos;
140*106c59e5Schristos(define-hardware
141*106c59e5Schristos  (name h-fd32r)
142*106c59e5Schristos  (comment "or32 floating point registers (double, virtual)")
143*106c59e5Schristos  (attrs VIRTUAL (MACH ORFPX64A32-MACHS))
144*106c59e5Schristos  (type register DF (32))
145*106c59e5Schristos  (get (index) (join DF SI
146*106c59e5Schristos                        (reg h-gpr (reg-pair-reg-lo index))
147*106c59e5Schristos                        (reg h-gpr (reg-pair-reg-hi index))))
148*106c59e5Schristos  (set (index newval)
149*106c59e5Schristos       (sequence ()
150*106c59e5Schristos                 (set (reg h-gpr (reg-pair-reg-lo index)) (subword SI newval 0))
151*106c59e5Schristos                 (set (reg h-gpr (reg-pair-reg-hi index))
152*106c59e5Schristos                                 (subword SI newval 1))))
153*106c59e5Schristos)
154*106c59e5Schristos
155*106c59e5Schristos;
156*106c59e5Schristos; Hardware: vrtual 64-bit integer registers for conversions
157*106c59e5Schristos;           float64 <-> int64 on 32-bit machines
158*106c59e5Schristos;           mapped to GPRs
159*106c59e5Schristos;
160*106c59e5Schristos(define-hardware
161*106c59e5Schristos  (name h-i64r)
162*106c59e5Schristos  (comment "or32 double word registers (int64, virtual)")
163*106c59e5Schristos  (attrs VIRTUAL (MACH ORFPX64A32-MACHS))
164*106c59e5Schristos  (type register DI (32))
165*106c59e5Schristos  (get (index) (join DI SI
166*106c59e5Schristos                        (reg h-gpr (reg-pair-reg-lo index))
167*106c59e5Schristos                        (reg h-gpr (reg-pair-reg-hi index))))
168*106c59e5Schristos  (set (index newval)
169*106c59e5Schristos       (sequence ()
170*106c59e5Schristos                 (set (reg h-gpr (reg-pair-reg-lo index)) (subword SI newval 0))
171*106c59e5Schristos                 (set (reg h-gpr (reg-pair-reg-hi index))
172*106c59e5Schristos                                 (subword SI newval 1))))
173*106c59e5Schristos)
174*106c59e5Schristos
175*106c59e5Schristos
176a45653d1Smatt(define-normal-enum
177a45653d1Smatt  except-number
178a45653d1Smatt  "Exception numbers"
179a45653d1Smatt  ()
180a45653d1Smatt  EXCEPT-
181a45653d1Smatt  (("NONE"     #x00)
182a45653d1Smatt   ("RESET"    #x01)
183a45653d1Smatt   ("BUSERR"   #x02)
184a45653d1Smatt   ("DPF"      #x03)
185a45653d1Smatt   ("IPF"      #x04)
186a45653d1Smatt   ("TICK"     #x05)
187a45653d1Smatt   ("ALIGN"    #x06)
188a45653d1Smatt   ("ILLEGAL"  #x07)
189a45653d1Smatt   ("INT"      #x08)
190a45653d1Smatt   ("DTLBMISS" #x09)
191a45653d1Smatt   ("ITLBMISS" #x0a)
192a45653d1Smatt   ("RANGE"    #x0b)
193a45653d1Smatt   ("SYSCALL"  #x0c)
194a45653d1Smatt   ("FPE"      #x0d)
195a45653d1Smatt   ("TRAP"     #x0e)
196a45653d1Smatt   )
197a45653d1Smatt  )
198a45653d1Smatt
199a45653d1Smatt(define-pmacro (raise-exception exnum)
200a45653d1Smatt  (c-call VOID "@cpu@_exception" pc exnum))
201a45653d1Smatt
202a45653d1Smatt(define-normal-enum
203a45653d1Smatt  spr-groups
204a45653d1Smatt  "special purpose register groups"
205a45653d1Smatt  ()
206a45653d1Smatt  SPR-GROUP-
207a45653d1Smatt  (("SYS"          #x0)
208a45653d1Smatt   ("DMMU"         #x1)
209a45653d1Smatt   ("IMMU"         #x2)
210a45653d1Smatt   ("DCACHE"       #x3)
211a45653d1Smatt   ("ICACHE"       #x4)
212a45653d1Smatt   ("MAC"          #x5)
213a45653d1Smatt   ("DEBUG"        #x6)
214a45653d1Smatt   ("PERF"         #x7)
215a45653d1Smatt   ("POWER"        #x8)
216a45653d1Smatt   ("PIC"          #x9)
217a45653d1Smatt   ("TICK"         #xa)
218a45653d1Smatt   ("FPU"          #xb)
219a45653d1Smatt   )
220a45653d1Smatt  )
221a45653d1Smatt
222a45653d1Smatt(define-pmacro (spr-reg-info)
223a45653d1Smatt  (.splice
224a45653d1Smatt   (SYS VR       #x000 "version register")
225a45653d1Smatt   (SYS UPR      #x001 "unit present register")
226a45653d1Smatt   (SYS CPUCFGR  #x002 "cpu configuration register")
227a45653d1Smatt   (SYS DMMUCFGR #x003 "Data MMU configuration register")
228a45653d1Smatt   (SYS IMMUCFGR #x004 "Insn MMU configuration register")
229a45653d1Smatt   (SYS DCCFGR   #x005 "Data cache configuration register")
230a45653d1Smatt   (SYS ICCFGR   #x006 "Insn cache configuration register")
231a45653d1Smatt   (SYS DCFGR    #x007 "Debug configuration register")
232a45653d1Smatt   (SYS PCCFGR   #x008 "Performance counters configuration register")
233a45653d1Smatt   (SYS NPC      #x010 "Next program counter")
2347c6f6726Schristos   (SYS SR       #x011 "Supervision Register")
235a45653d1Smatt   (SYS PPC      #x012 "Previous program counter")
236a45653d1Smatt   (SYS FPCSR    #x014 "Floating point control status register")
237a45653d1Smatt   (.unsplice
238a45653d1Smatt    (.map (.pmacro (n) (.splice SYS (.sym "EPCR" n) (.add n #x20) (.str "Exception PC register " n)))
239a45653d1Smatt          (.iota #x10)))
240a45653d1Smatt   (.unsplice
241a45653d1Smatt    (.map (.pmacro (n) (.splice SYS (.sym "EEAR" n) (.add n #x30) (.str "Exception effective address register " n)))
242a45653d1Smatt          (.iota #x10)))
243a45653d1Smatt   (.unsplice
244a45653d1Smatt    (.map (.pmacro (n) (.splice SYS (.sym "ESR" n) (.add n #x40) (.str "Exception supervision register " n)))
245a45653d1Smatt          (.iota #x10)))
246a45653d1Smatt   (.unsplice
247a45653d1Smatt    (.map (.pmacro (n) (.splice SYS (.sym "GPR" n) (.add n #x400) (.str "General purpose register " n)))
248a45653d1Smatt          (.iota #x200)))
249a45653d1Smatt
250a45653d1Smatt   (MAC MACLO    #x001 "Multiply and accumulate result (low)")
251a45653d1Smatt   (MAC MACHI    #x002 "Multiply and accumulate result (high)")
252a45653d1Smatt   (TICK TTMR    #x000 "Tick timer mode register")
253a45653d1Smatt   )
254a45653d1Smatt  )
255a45653d1Smatt
256a45653d1Smatt(define-normal-enum
257a45653d1Smatt  spr-reg-indices
258*106c59e5Schristos  "special purpose register indices"
259a45653d1Smatt  ()
260a45653d1Smatt  SPR-INDEX-
261a45653d1Smatt  (.map (.pmacro (args)
262a45653d1Smatt                 (.apply (.pmacro (group index n comment)
263a45653d1Smatt                                  ((.sym group "-" index) n))
264a45653d1Smatt                         args)
265a45653d1Smatt                 )
266a45653d1Smatt        (spr-reg-info)
267a45653d1Smatt        )
268a45653d1Smatt  )
269a45653d1Smatt
270a45653d1Smatt(define-pmacro (define-h-spr-reg spr-group spr-index n spr-comment)
271a45653d1Smatt  (define-hardware
272a45653d1Smatt    (name (.sym "h-" (.downcase spr-group) "-" (.downcase spr-index)))
273a45653d1Smatt    (comment spr-comment)
274a45653d1Smatt    (attrs VIRTUAL (MACH ORBIS-MACHS))
275a45653d1Smatt    (type register UWI)
276a45653d1Smatt    (get ()       (reg UWI h-spr (spr-address spr-group spr-index)))
277a45653d1Smatt    (set (newval) (set (reg UWI h-spr (spr-address spr-group spr-index)) newval))
278a45653d1Smatt    )
279a45653d1Smatt  )
280a45653d1Smatt(.splice begin (.unsplice (.map (.pmacro (args) (.apply define-h-spr-reg args)) (spr-reg-info))))
281a45653d1Smatt
282a45653d1Smatt(define-pmacro (spr-field-info)
283a45653d1Smatt  ((SYS VR      REV    5  0 "revision field")
284a45653d1Smatt   (SYS VR      CFG   23 16 "configuration template field")
285a45653d1Smatt   (SYS VR      VER   31 24 "version field")
286a45653d1Smatt   (SYS UPR     UP     0  0 "UPR present bit")
287a45653d1Smatt   (SYS UPR     DCP    1  1 "data cache present bit")
288a45653d1Smatt   (SYS UPR     ICP    2  2 "insn cache present bit")
289a45653d1Smatt   (SYS UPR     DMP    3  3 "data MMU present bit")
290a45653d1Smatt   (SYS UPR     MP     4  4 "MAC unit present bit")
291a45653d1Smatt   (SYS UPR     IMP    5  5 "insn MMU present bit")
292a45653d1Smatt   (SYS UPR     DUP    6  6 "debug unit present bit")
293a45653d1Smatt   (SYS UPR     PCUP   7  7 "performance counters unit present bit")
294a45653d1Smatt   (SYS UPR     PICP   8  8 "programmable interrupt controller present bit")
295a45653d1Smatt   (SYS UPR     PMP    9  9 "power management present bit")
296a45653d1Smatt   (SYS UPR     TTP   10 10 "tick timer present bit")
297a45653d1Smatt   (SYS UPR     CUP   31 24 "custom units present field")
298a45653d1Smatt   (SYS CPUCFGR NSGR   3  0 "number of shadow GPR files field")
299a45653d1Smatt   (SYS CPUCFGR CGF    4  4 "custom GPR file bit")
300a45653d1Smatt   (SYS CPUCFGR OB32S  5  5 "ORBIS32 supported bit")
301a45653d1Smatt   (SYS CPUCFGR OB64S  6  6 "ORBIS64 supported bit")
302a45653d1Smatt   (SYS CPUCFGR OF32S  7  7 "ORFPX32 supported bit")
303a45653d1Smatt   (SYS CPUCFGR OF64S  8  8 "ORFPX64 supported bit")
304a45653d1Smatt   (SYS CPUCFGR OV64S  9  9 "ORVDX64 supported bit")
305a45653d1Smatt   (SYS CPUCFGR ND    10 10 "no transfer delay bit")
306a45653d1Smatt   (SYS SR      SM     0  0 "supervisor mode bit")
307a45653d1Smatt   (SYS SR      TEE    1  1 "tick timer exception enabled bit")
308a45653d1Smatt   (SYS SR      IEE    2  2 "interrupt exception enabled bit")
309a45653d1Smatt   (SYS SR      DCE    3  3 "data cache enabled bit")
310a45653d1Smatt   (SYS SR      ICE    4  4 "insn cache enabled bit")
311a45653d1Smatt   (SYS SR      DME    5  5 "data MMU enabled bit")
312a45653d1Smatt   (SYS SR      IME    6  6 "insn MMU enabled bit")
313a45653d1Smatt   (SYS SR      LEE    7  7 "little endian enabled bit")
314a45653d1Smatt   (SYS SR      CE     8  8 "CID enable bit")
315a45653d1Smatt   (SYS SR      F      9  9 "flag bit")
316a45653d1Smatt   (SYS SR      CY    10 10 "carry bit")
317a45653d1Smatt   (SYS SR      OV    11 11 "overflow bit")
318a45653d1Smatt   (SYS SR      OVE   12 12 "overflow exception enabled bit")
319a45653d1Smatt   (SYS SR      DSX   13 13 "delay slot exception bit")
320a45653d1Smatt   (SYS SR      EPH   14 14 "exception prefix high bit")
321a45653d1Smatt   (SYS SR      FO    15 15 "fixed one bit")
322a45653d1Smatt   (SYS SR      SUMRA 16 16 "SPRs user mode read access bit")
323a45653d1Smatt   (SYS SR      CID   31 28 "context ID field")
324a45653d1Smatt   (SYS FPCSR   FPEE   0  0 "floating point exceptions enabled bit")
325a45653d1Smatt   (SYS FPCSR   RM     2  1 "floating point rounding mode field")
326a45653d1Smatt   (SYS FPCSR   OVF    3  3 "floating point overflow flag bit")
327a45653d1Smatt   (SYS FPCSR   UNF    4  4 "floating point underflow bit")
328a45653d1Smatt   (SYS FPCSR   SNF    5  5 "floating point SNAN flag bit")
329a45653d1Smatt   (SYS FPCSR   QNF    6  6 "floating point QNAN flag bit")
330a45653d1Smatt   (SYS FPCSR   ZF     7  7 "floating point zero flag bit")
331a45653d1Smatt   (SYS FPCSR   IXF    8  8 "floating point inexact flag bit")
332a45653d1Smatt   (SYS FPCSR   IVF    9  9 "floating point invalid flag bit")
333a45653d1Smatt   (SYS FPCSR   INF   10 10 "floating point infinity flag bit")
334a45653d1Smatt   (SYS FPCSR   DZF   11 11 "floating point divide by zero flag bit")
335a45653d1Smatt   )
336a45653d1Smatt  )
337a45653d1Smatt
338a45653d1Smatt(define-normal-enum
339a45653d1Smatt  spr-field-msbs
340a45653d1Smatt  "SPR field msb positions"
341a45653d1Smatt  ()
342a45653d1Smatt  SPR-FIELD-MSB-
343a45653d1Smatt  (.map (.pmacro (args)
344a45653d1Smatt                 (.apply (.pmacro (group index field msb lsb comment)
345a45653d1Smatt                                  ((.sym group "-" index "-" field) msb)
346a45653d1Smatt                                  )
347a45653d1Smatt                         args
348a45653d1Smatt                         )
349a45653d1Smatt                 )
350a45653d1Smatt        (spr-field-info)
351a45653d1Smatt        )
352a45653d1Smatt  )
353a45653d1Smatt
354a45653d1Smatt(define-normal-enum
355a45653d1Smatt  spr-field-lsbs
356a45653d1Smatt  "SPR field lsb positions"
357a45653d1Smatt  ()
358a45653d1Smatt  SPR-FIELD-SIZE-
359a45653d1Smatt  (.map (.pmacro (args)
360a45653d1Smatt                 (.apply (.pmacro (group index field msb lsb comment)
361a45653d1Smatt                                  ((.sym group "-" index "-" field) lsb)
362a45653d1Smatt                                  )
363a45653d1Smatt                         args
364a45653d1Smatt                         )
365a45653d1Smatt                 )
366a45653d1Smatt        (spr-field-info)
367a45653d1Smatt        )
368a45653d1Smatt  )
369a45653d1Smatt
370a45653d1Smatt(define-normal-enum
371a45653d1Smatt  spr-field-masks
372a45653d1Smatt  "SPR field masks"
373a45653d1Smatt  ()
374a45653d1Smatt  SPR-FIELD-MASK-
375a45653d1Smatt  (.map (.pmacro (args)
376a45653d1Smatt                 (.apply (.pmacro (group index field msb lsb comment)
377a45653d1Smatt                                  (.splice (.str group "-" index "-" field) (.sll (.inv (.sll (.inv 0) (.add (.sub msb lsb) 1))) lsb))
378a45653d1Smatt                                  )
379a45653d1Smatt                         args
380a45653d1Smatt                         )
381a45653d1Smatt                 )
382a45653d1Smatt        (spr-field-info)
383a45653d1Smatt        )
384a45653d1Smatt  )
385a45653d1Smatt
386a45653d1Smatt(define-pmacro (define-h-spr-field spr-group spr-index spr-field spr-field-msb spr-field-lsb spr-field-comment)
387a45653d1Smatt  (.let ((spr-field-name (.sym "h-" (.downcase spr-group) "-" (.downcase spr-index) "-" (.downcase spr-field)))
388a45653d1Smatt         )
389a45653d1Smatt        (begin
390a45653d1Smatt          (define-hardware
391a45653d1Smatt            (name spr-field-name)
392a45653d1Smatt            (comment spr-field-comment)
393a45653d1Smatt            (attrs VIRTUAL (MACH ORBIS-MACHS))
394a45653d1Smatt            (type register UWI)
395a45653d1Smatt            (get ()      (c-call UWI  "@cpu@_h_spr_field_get_raw" (spr-address spr-group spr-index) spr-field-msb spr-field-lsb))
396a45653d1Smatt            (set (value) (c-call VOID "@cpu@_h_spr_field_set_raw" (spr-address spr-group spr-index) spr-field-msb spr-field-lsb value))
397a45653d1Smatt            )
398a45653d1Smatt          )
399a45653d1Smatt        )
400a45653d1Smatt  )
401a45653d1Smatt(.splice begin (.unsplice (.map (.pmacro (args) (.apply define-h-spr-field args)) (spr-field-info))))
402a45653d1Smatt
403a45653d1Smatt(define-attr
404a45653d1Smatt  (type boolean)
405a45653d1Smatt  (for insn)
406a45653d1Smatt  (name DELAYED-CTI)
407a45653d1Smatt  (comment "delayed control transfer instruction")
408a45653d1Smatt  (values #f #t)
409a45653d1Smatt  (default #f)
410a45653d1Smatt  )
411a45653d1Smatt
412a45653d1Smatt(define-attr
413a45653d1Smatt  (for insn)
414a45653d1Smatt  (type boolean)
415a45653d1Smatt  (name NOT-IN-DELAY-SLOT)
416a45653d1Smatt  (comment "instruction cannot be in delay slot")
417a45653d1Smatt  (values #f #t)
418a45653d1Smatt  (default #f)
419a45653d1Smatt  )
420a45653d1Smatt
421a45653d1Smatt(define-attr
422a45653d1Smatt  (for insn)
423a45653d1Smatt  (type boolean)
424a45653d1Smatt  (name FORCED-CTI)
425a45653d1Smatt  (comment "instruction may forcefully transfer control (e.g., rfe)")
426a45653d1Smatt  )
427