OSDN Git Service

1c9feaf27f0e0d60031fc28ab725e60c68279471
[pf3gnuchains/pf3gnuchains3x.git] / sid / component / cgen-cpu / mt / mt-cpu.h
1 /* CPU class elements for mt.
2
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
4
5 Copyright (C) 2000-2009 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   /* special-purpose registers */
21   SI h_spr[16];
22   /* program counter */
23   USI h_pc;
24   } hardware;
25
26   void stream_cgen_hardware (std::ostream &ost) const 
27   {
28     for (int i = 0; i < 16; i++)
29       ost << hardware.h_spr[i] << ' ';
30     ost << hardware.h_pc << ' ';
31   }
32   void destream_cgen_hardware (std::istream &ist) 
33   {
34     for (int i = 0; i < 16; i++)
35       ist >> hardware.h_spr[i];
36     ist >> hardware.h_pc;
37   }
38   template <typename ST> 
39   void stream_stacks (const ST &st, std::ostream &ost) const
40   {
41     for (int i = 0; i < mt::pipe_sz; i++)
42     {
43       ost << st[i].t << ' ';
44       for (int j = 0; j <= st[i].t; j++)
45       {
46         ost << st[i].buf[j].pc << ' ';
47         ost << st[i].buf[j].val << ' ';
48         ost << st[i].buf[j].idx0 << ' ';
49       }
50     }
51   }
52   
53   template <typename ST> 
54   void destream_stacks (ST &st, std::istream &ist)
55   {
56     for (int i = 0; i < mt::pipe_sz; i++)
57     {
58       ist >> st[i].t;
59       for (int j = 0; j <= st[i].t; j++)
60       {
61         ist >> st[i].buf[j].pc;
62         ist >> st[i].buf[j].val;
63         ist >> st[i].buf[j].idx0;
64       }
65     }
66   }
67   
68   void stream_cgen_write_stacks (std::ostream &ost, const mt::write_stacks &stacks) const 
69   {
70     stream_stacks ( stacks.h_spr_writes, ost);
71     stream_stacks ( stacks.h_pc_writes, ost);
72   }
73   void destream_cgen_write_stacks (std::istream &ist, mt::write_stacks &stacks) 
74   {
75     destream_stacks ( stacks.h_spr_writes, ist);
76     destream_stacks ( stacks.h_pc_writes, ist);
77   }
78   // C++ register access function templates
79 #define current_cpu this
80
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; }
83
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; }
86
87 #undef current_cpu
88