OSDN Git Service

Regenerate cgen files, update copyright year.
[pf3gnuchains/pf3gnuchains3x.git] / sid / component / cgen-cpu / sh / sh4al-cpu.h
1 /* CPU class elements for sh4al.
2
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
4
5 Copyright (C) 2000-2010 Red Hat, Inc.
6
7 This file is part of the Red Hat simulators.
8
9
10 */
11
12 // This file is included in the middle of the cpu class struct.
13
14 public:
15
16 // CPU state information.
17
18   // Hardware elements.
19   struct {
20   /* Program counter */
21   UDI h_pc;
22   /* General purpose integer registers */
23   DI h_gr[64];
24   /* Status register */
25   SI h_sr;
26   /* Floating point status and control register */
27   SI h_fpscr;
28   /* Single precision floating point registers */
29   SF h_fr[64];
30   /* Current instruction set mode */
31   BI h_ism;
32   } hardware;
33
34   void stream_cgen_hardware (std::ostream &ost) const 
35   {
36     ost << hardware.h_pc << ' ';
37     for (int i = 0; i < 64; i++)
38       ost << hardware.h_gr[i] << ' ';
39     ost << hardware.h_sr << ' ';
40     ost << hardware.h_fpscr << ' ';
41     for (int i = 0; i < 64; i++)
42       ost << hardware.h_fr[i] << ' ';
43     ost << hardware.h_ism << ' ';
44   }
45   void destream_cgen_hardware (std::istream &ist) 
46   {
47     ist >> hardware.h_pc;
48     for (int i = 0; i < 64; i++)
49       ist >> hardware.h_gr[i];
50     ist >> hardware.h_sr;
51     ist >> hardware.h_fpscr;
52     for (int i = 0; i < 64; i++)
53       ist >> hardware.h_fr[i];
54     ist >> hardware.h_ism;
55   }
56   template <typename ST> 
57   void stream_stacks (const ST &st, std::ostream &ost) const
58   {
59     for (int i = 0; i < sh4al::pipe_sz; i++)
60     {
61       ost << st[i].t << ' ';
62       for (int j = 0; j <= st[i].t; j++)
63       {
64         ost << st[i].buf[j].pc << ' ';
65         ost << st[i].buf[j].val << ' ';
66         ost << st[i].buf[j].idx0 << ' ';
67       }
68     }
69   }
70   
71   template <typename ST> 
72   void destream_stacks (ST &st, std::istream &ist)
73   {
74     for (int i = 0; i < sh4al::pipe_sz; i++)
75     {
76       ist >> st[i].t;
77       for (int j = 0; j <= st[i].t; j++)
78       {
79         ist >> st[i].buf[j].pc;
80         ist >> st[i].buf[j].val;
81         ist >> st[i].buf[j].idx0;
82       }
83     }
84   }
85   
86   void stream_cgen_write_stacks (std::ostream &ost, const sh4al::write_stacks &stacks) const 
87   {
88     stream_stacks ( stacks.h_pc_writes, ost);
89     stream_stacks ( stacks.h_pr_writes, ost);
90   }
91   void destream_cgen_write_stacks (std::istream &ist, sh4al::write_stacks &stacks) 
92   {
93     destream_stacks ( stacks.h_pc_writes, ist);
94     destream_stacks ( stacks.h_pr_writes, ist);
95   }
96   // C++ register access function templates
97 #define current_cpu this
98
99   inline UDI h_pc_get () const { return current_cpu->hardware.h_pc; }
100   inline void h_pc_set (UDI newval) { {
101 current_cpu->hardware.h_ism = ANDDI (newval, 1);
102 current_cpu->hardware.h_pc = ANDDI (newval, INVDI (1));
103 }
104  }
105
106   inline DI h_gr_get (UINT regno) const { return ((((regno) == (63))) ? (MAKEDI (0, 0)) : (current_cpu->hardware.h_gr[regno])); }
107   inline void h_gr_set (UINT regno, DI newval) { if (((regno) != (63))) {
108 current_cpu->hardware.h_gr[regno] = newval;
109 } else {
110 ((void) 0); /*nop*/
111 }
112  }
113
114   inline SI h_grc_get (UINT regno) const { return ANDDI (current_cpu->hardware.h_gr[regno], ZEXTSIDI (0xffffffff)); }
115   inline void h_grc_set (UINT regno, SI newval) { current_cpu->hardware.h_gr[regno] = EXTSIDI (newval);
116  }
117
118   inline SI h_sr_get () const { return this->hardware.h_sr; }
119   inline void h_sr_set (SI newval) { this->hardware.h_sr = newval; }
120
121   inline SI h_fpscr_get () const { return this->hardware.h_fpscr; }
122   inline void h_fpscr_set (SI newval) { this->hardware.h_fpscr = newval; }
123
124   inline BI h_frbit_get () const { return ANDSI (SRLSI (current_cpu->hardware.h_fpscr, 21), 1); }
125   inline void h_frbit_set (BI newval) { current_cpu->hardware.h_fpscr = ORSI (ANDSI (current_cpu->hardware.h_fpscr, (~ (((1) << (21))))), SLLSI (newval, 21));
126  }
127
128   inline BI h_szbit_get () const { return ANDSI (SRLSI (current_cpu->hardware.h_fpscr, 20), 1); }
129   inline void h_szbit_set (BI newval) { current_cpu->hardware.h_fpscr = ORSI (ANDSI (current_cpu->hardware.h_fpscr, (~ (((1) << (20))))), SLLSI (newval, 20));
130  }
131
132   inline BI h_prbit_get () const { return ANDSI (SRLSI (current_cpu->hardware.h_fpscr, 19), 1); }
133   inline void h_prbit_set (BI newval) { current_cpu->hardware.h_fpscr = ORSI (ANDSI (current_cpu->hardware.h_fpscr, (~ (((1) << (19))))), SLLSI (newval, 19));
134  }
135
136   inline BI h_sbit_get () const { return ANDSI (SRLSI (current_cpu->hardware.h_sr, 1), 1); }
137   inline void h_sbit_set (BI newval) { current_cpu->hardware.h_sr = ORSI (ANDSI (current_cpu->hardware.h_sr, (~ (2))), SLLSI (newval, 1));
138  }
139
140   inline BI h_mbit_get () const { return ANDSI (SRLSI (current_cpu->hardware.h_sr, 9), 1); }
141   inline void h_mbit_set (BI newval) { current_cpu->hardware.h_sr = ORSI (ANDSI (current_cpu->hardware.h_sr, (~ (((1) << (9))))), SLLSI (newval, 9));
142  }
143
144   inline BI h_qbit_get () const { return ANDSI (SRLSI (current_cpu->hardware.h_sr, 8), 1); }
145   inline void h_qbit_set (BI newval) { current_cpu->hardware.h_sr = ORSI (ANDSI (current_cpu->hardware.h_sr, (~ (((1) << (8))))), SLLSI (newval, 8));
146  }
147
148   inline SF h_fr_get (UINT regno) const { return this->hardware.h_fr[regno]; }
149   inline void h_fr_set (UINT regno, SF newval) { this->hardware.h_fr[regno] = newval; }
150
151   inline SF h_fp_get (UINT regno) const { return current_cpu->hardware.h_fr[regno]; }
152   inline void h_fp_set (UINT regno, SF newval) { current_cpu->hardware.h_fr[regno] = newval;
153  }
154
155   inline SF h_fv_get (UINT regno) const { return current_cpu->hardware.h_fr[regno]; }
156   inline void h_fv_set (UINT regno, SF newval) { current_cpu->hardware.h_fr[regno] = newval;
157  }
158
159   inline DF h_dr_get (UINT regno) const { return SUBWORDDIDF (ORDI (SLLDI (ZEXTSIDI (SUBWORDSFSI (current_cpu->hardware.h_fr[regno])), 32), ZEXTSIDI (SUBWORDSFSI (current_cpu->hardware.h_fr[((regno) + (1))])))); }
160   inline void h_dr_set (UINT regno, DF newval) { {
161 current_cpu->hardware.h_fr[regno] = SUBWORDSISF (SUBWORDDFSI (newval, 0));
162 current_cpu->hardware.h_fr[((regno) + (1))] = SUBWORDSISF (SUBWORDDFSI (newval, 1));
163 }
164  }
165
166   inline BI h_endian_get () const { return current_cpu->sh64_endian (); }
167   inline void h_endian_set (BI newval) { current_cpu->cgen_rtx_error ("cannot alter target byte order mid-program");
168  }
169
170   inline BI h_ism_get () const { return current_cpu->hardware.h_ism; }
171   inline void h_ism_set (BI newval) { current_cpu->cgen_rtx_error ("cannot set ism directly");
172  }
173
174   inline SF h_frc_get (UINT regno) const { return current_cpu->hardware.h_fr[((((16) * (current_cpu->h_frbit_get ()))) + (regno))]; }
175   inline void h_frc_set (UINT regno, SF newval) { current_cpu->hardware.h_fr[((((16) * (current_cpu->h_frbit_get ()))) + (regno))] = newval;
176  }
177
178   inline DF h_drc_get (UINT regno) const { return current_cpu->h_dr_get (((((16) * (current_cpu->h_frbit_get ()))) + (regno))); }
179   inline void h_drc_set (UINT regno, DF newval) { current_cpu->h_dr_set (((((16) * (current_cpu->h_frbit_get ()))) + (regno)), newval);
180  }
181
182   inline SF h_xf_get (UINT regno) const { return current_cpu->hardware.h_fr[((((16) * (NOTBI (current_cpu->h_frbit_get ())))) + (regno))]; }
183   inline void h_xf_set (UINT regno, SF newval) { current_cpu->hardware.h_fr[((((16) * (NOTBI (current_cpu->h_frbit_get ())))) + (regno))] = newval;
184  }
185
186   inline DF h_xd_get (UINT regno) const { return current_cpu->h_dr_get (((((16) * (NOTBI (current_cpu->h_frbit_get ())))) + (regno))); }
187   inline void h_xd_set (UINT regno, DF newval) { current_cpu->h_dr_set (((((16) * (NOTBI (current_cpu->h_frbit_get ())))) + (regno)), newval);
188  }
189
190   inline SF h_fvc_get (UINT regno) const { return current_cpu->hardware.h_fr[((((16) * (current_cpu->h_frbit_get ()))) + (regno))]; }
191   inline void h_fvc_set (UINT regno, SF newval) { current_cpu->hardware.h_fr[((((16) * (current_cpu->h_frbit_get ()))) + (regno))] = newval;
192  }
193
194   inline SI h_gbr_get () const { return SUBWORDDISI (current_cpu->hardware.h_gr[((UINT) 16)], 1); }
195   inline void h_gbr_set (SI newval) { current_cpu->hardware.h_gr[((UINT) 16)] = EXTSIDI (newval);
196  }
197
198   inline SI h_vbr_get () const { return SUBWORDDISI (current_cpu->hardware.h_gr[((UINT) 20)], 1); }
199   inline void h_vbr_set (SI newval) { current_cpu->hardware.h_gr[((UINT) 20)] = EXTSIDI (newval);
200  }
201
202   inline SI h_pr_get () const { return SUBWORDDISI (current_cpu->hardware.h_gr[((UINT) 18)], 1); }
203   inline void h_pr_set (SI newval) { current_cpu->hardware.h_gr[((UINT) 18)] = EXTSIDI (newval);
204  }
205
206   inline SI h_macl_get () const { return SUBWORDDISI (current_cpu->hardware.h_gr[((UINT) 17)], 1); }
207   inline void h_macl_set (SI newval) { current_cpu->hardware.h_gr[((UINT) 17)] = ORDI (SLLDI (ZEXTSIDI (SUBWORDDISI (current_cpu->hardware.h_gr[((UINT) 17)], 0)), 32), ZEXTSIDI (newval));
208  }
209
210   inline SI h_mach_get () const { return SUBWORDDISI (current_cpu->hardware.h_gr[((UINT) 17)], 0); }
211   inline void h_mach_set (SI newval) { current_cpu->hardware.h_gr[((UINT) 17)] = ORDI (SLLDI (ZEXTSIDI (newval), 32), ZEXTSIDI (SUBWORDDISI (current_cpu->hardware.h_gr[((UINT) 17)], 1)));
212  }
213
214   inline BI h_tbit_get () const { return ANDBI (current_cpu->hardware.h_gr[((UINT) 19)], 1); }
215   inline void h_tbit_set (BI newval) { current_cpu->hardware.h_gr[((UINT) 19)] = ORDI (ANDDI (current_cpu->hardware.h_gr[((UINT) 19)], INVDI (1)), ZEXTBIDI (newval));
216  }
217
218 #undef current_cpu
219