1 /* CPU class elements for sh2a_nofpu.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright (C) 2000-2009 Red Hat, Inc.
7 This file is part of the Red Hat simulators.
12 // This file is included in the middle of the cpu class struct.
16 // CPU state information.
22 /* General purpose integer registers */
26 /* Floating point status and control register */
28 /* Single precision floating point registers */
30 /* Current instruction set mode */
34 void stream_cgen_hardware (std::ostream &ost) const
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 << ' ';
45 void destream_cgen_hardware (std::istream &ist)
48 for (int i = 0; i < 64; i++)
49 ist >> hardware.h_gr[i];
51 ist >> hardware.h_fpscr;
52 for (int i = 0; i < 64; i++)
53 ist >> hardware.h_fr[i];
54 ist >> hardware.h_ism;
56 template <typename ST>
57 void stream_stacks (const ST &st, std::ostream &ost) const
59 for (int i = 0; i < sh2a_nofpu::pipe_sz; i++)
61 ost << st[i].t << ' ';
62 for (int j = 0; j <= st[i].t; j++)
64 ost << st[i].buf[j].pc << ' ';
65 ost << st[i].buf[j].val << ' ';
66 ost << st[i].buf[j].idx0 << ' ';
71 template <typename ST>
72 void destream_stacks (ST &st, std::istream &ist)
74 for (int i = 0; i < sh2a_nofpu::pipe_sz; i++)
77 for (int j = 0; j <= st[i].t; j++)
79 ist >> st[i].buf[j].pc;
80 ist >> st[i].buf[j].val;
81 ist >> st[i].buf[j].idx0;
86 void stream_cgen_write_stacks (std::ostream &ost, const sh2a_nofpu::write_stacks &stacks) const
88 stream_stacks ( stacks.h_pc_writes, ost);
89 stream_stacks ( stacks.h_pr_writes, ost);
91 void destream_cgen_write_stacks (std::istream &ist, sh2a_nofpu::write_stacks &stacks)
93 destream_stacks ( stacks.h_pc_writes, ist);
94 destream_stacks ( stacks.h_pr_writes, ist);
96 // C++ register access function templates
97 #define current_cpu this
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));
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;
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);
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; }
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; }
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));
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));
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));
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));
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));
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));
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; }
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;
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;
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));
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");
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");
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;
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);
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;
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);
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;
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);
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);
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);
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));
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)));
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));