1 /* CPU class elements for mt.
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.
20 /* special-purpose registers */
26 void stream_cgen_hardware (std::ostream &ost) const
28 for (int i = 0; i < 16; i++)
29 ost << hardware.h_spr[i] << ' ';
30 ost << hardware.h_pc << ' ';
32 void destream_cgen_hardware (std::istream &ist)
34 for (int i = 0; i < 16; i++)
35 ist >> hardware.h_spr[i];
38 template <typename ST>
39 void stream_stacks (const ST &st, std::ostream &ost) const
41 for (int i = 0; i < mt::pipe_sz; i++)
43 ost << st[i].t << ' ';
44 for (int j = 0; j <= st[i].t; j++)
46 ost << st[i].buf[j].pc << ' ';
47 ost << st[i].buf[j].val << ' ';
48 ost << st[i].buf[j].idx0 << ' ';
53 template <typename ST>
54 void destream_stacks (ST &st, std::istream &ist)
56 for (int i = 0; i < mt::pipe_sz; i++)
59 for (int j = 0; j <= st[i].t; j++)
61 ist >> st[i].buf[j].pc;
62 ist >> st[i].buf[j].val;
63 ist >> st[i].buf[j].idx0;
68 void stream_cgen_write_stacks (std::ostream &ost, const mt::write_stacks &stacks) const
70 stream_stacks ( stacks.h_spr_writes, ost);
71 stream_stacks ( stacks.h_pc_writes, ost);
73 void destream_cgen_write_stacks (std::istream &ist, mt::write_stacks &stacks)
75 destream_stacks ( stacks.h_spr_writes, ist);
76 destream_stacks ( stacks.h_pc_writes, ist);
78 // C++ register access function templates
79 #define current_cpu this
81 inline SI h_spr_get (UINT regno) const { return this->hardware.h_spr[regno]; }
82 inline void h_spr_set (UINT regno, SI newval) { this->hardware.h_spr[regno] = newval; }
84 inline USI h_pc_get () const { return this->hardware.h_pc; }
85 inline void h_pc_set (USI newval) { this->hardware.h_pc = newval; }