]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/ppc/idecode_fields.h
Initial creation of sourceware repository
[thirdparty/binutils-gdb.git] / sim / ppc / idecode_fields.h
1 /* This file is part of the program psim.
2
3 Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 */
20
21
22 /* Instruction field macros:
23
24 The macro's below greatly simplify the process of translating the
25 pseudo code found in the PowerPC manual into C.
26
27 In addition to the below, more will be found in the gen program's
28 cache table */
29
30
31 /* map some statements and variables directly across */
32
33 #define is_64bit_implementation (WITH_TARGET_WORD_BITSIZE == 64)
34 #define is_64bit_mode IS_64BIT_MODE(processor)
35
36 #define NIA nia
37 #define CIA cia
38
39
40 /* reservation */
41
42 #define RESERVE cpu_reservation(processor)->valid
43 #define RESERVE_ADDR cpu_reservation(processor)->addr
44 #define RESERVE_DATA cpu_reservation(processor)->data
45
46 #define real_addr(EA, IS_READ) vm_real_data_addr(cpu_data_map(processor), \
47 EA, \
48 IS_READ, \
49 processor, \
50 cia)
51
52
53 /* depending on mode return a 32 or 64bit number */
54
55 #define IEA(X) (is_64bit_mode \
56 ? (X) \
57 : MASKED((X), 32, 63))
58
59 /* Expand argument to current architecture size */
60
61 #define EXTS(X) EXTS_##X
62
63
64 /* Gen translates text of the form A{XX:YY} into A_XX_YY_ the macro's
65 below define such translated text into real expressions */
66
67 /* the spr field as it normally is used */
68
69 #define SPR_5_9_ (SPR & 0x1f)
70 #define SPR_0_4_ (SPR >> 5)
71 #define SPR_0_ ((SPR & BIT10(0)) != 0)
72
73 #define tbr_5_9_ (tbr & 0x1f)
74 #define tbr_0_4_ (tbr >> 5)
75
76
77 #define TB cpu_get_time_base(processor)
78
79
80 /* various registers with important masks */
81
82 #define LR_0b00 (LR & ~3)
83 #define CTR_0b00 (CTR & ~3)
84
85 #define CR_BI_ ((CR & BIT32_BI) != 0)
86 #define CR_BA_ ((CR & BIT32_BA) != 0)
87 #define CR_BB_ ((CR & BIT32_BB) != 0)
88
89
90 /* extended extracted fields */
91
92 #define TO_0_ ((TO & BIT5(0)) != 0)
93 #define TO_1_ ((TO & BIT5(1)) != 0)
94 #define TO_2_ ((TO & BIT5(2)) != 0)
95 #define TO_3_ ((TO & BIT5(3)) != 0)
96 #define TO_4_ ((TO & BIT5(4)) != 0)
97
98 #define BO_0_ ((BO & BIT5(0)) != 0)
99 #define BO_1_ ((BO & BIT5(1)) != 0)
100 #define BO_2_ ((BO & BIT5(2)) != 0)
101 #define BO_3_ ((BO & BIT5(3)) != 0)
102 #define BO_4_ ((BO & BIT5(4)) != 0)
103
104 #define GOTO(dest) goto XCONCAT4(label__,dest,__,MY_PREFIX)
105 #define LABEL(dest) XCONCAT4(label__,dest,__,MY_PREFIX)