Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | # ========== Copyright Header Begin ========================================== |
2 | # | |
3 | # OpenSPARC T2 Processor File: Pfe_Model.py | |
4 | # Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
5 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
6 | # | |
7 | # The above named program is free software; you can redistribute it and/or | |
8 | # modify it under the terms of the GNU General Public | |
9 | # License version 2 as published by the Free Software Foundation. | |
10 | # | |
11 | # The above named program is distributed in the hope that it will be | |
12 | # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | # General Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU General Public | |
17 | # License along with this work; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | # | |
20 | # ========== Copyright Header End ============================================ | |
21 | ||
22 | from Pfe_SymbolTbl import * | |
23 | ||
24 | class uCore: | |
25 | def __init__(self): | |
26 | self.s = [] | |
27 | ||
28 | def __populate__(self): | |
29 | for i,s in enumerate(self.s): | |
30 | self.__dict__['s' + str(i)] = s | |
31 | ||
32 | def __repr__(self): | |
33 | return "<uCore instance>" | |
34 | ||
35 | ||
36 | class Core: | |
37 | def __init__(self): | |
38 | self.u = [] | |
39 | self.s = [] | |
40 | ||
41 | def __populate__(self): | |
42 | for i,u in enumerate(self.u): | |
43 | u.__populate__() | |
44 | self.__dict__['u' + str(i)] = u | |
45 | self.s += u.s | |
46 | for i,s in enumerate(self.s): | |
47 | self.__dict__['s' + str(i)] = s | |
48 | ||
49 | def __repr__(self): | |
50 | return "<Core instance>" | |
51 | ||
52 | ||
53 | class Cpu: | |
54 | def __init__(self): | |
55 | self.c = [] | |
56 | self.u = [] | |
57 | self.s = [] | |
58 | ||
59 | def __populate__(self): | |
60 | for i,c in enumerate(self.c): | |
61 | c.__populate__() | |
62 | self.__dict__['c'+str(i)] = c | |
63 | self.u += c.u | |
64 | self.s += c.s | |
65 | for i,u in enumerate(self.u): | |
66 | self.__dict__['u' + str(i)] = u | |
67 | for i,s in enumerate(self.s): | |
68 | self.__dict__['s' + str(i)] = s | |
69 | ||
70 | def __repr__(self): | |
71 | return "<Cpu instance>" | |
72 | ||
73 | ||
74 | class Model: | |
75 | def __init__(self): | |
76 | self.sym = Pfe_SymbolTbl() | |
77 | self.mem = None | |
78 | self.p = [] | |
79 | self.c = [] | |
80 | self.u = [] | |
81 | self.s = [] | |
82 | ||
83 | def __populate__(self): | |
84 | for p in self.p: | |
85 | p.__populate__() | |
86 | self.c += p.c | |
87 | self.u += p.u | |
88 | self.s += p.s | |
89 | for i,c in enumerate(self.c): | |
90 | self.__dict__['c' + str(i)] = c | |
91 | for i,u in enumerate(self.u): | |
92 | self.__dict__['u' + str(i)] = u | |
93 | for i,s in enumerate(self.s): | |
94 | self.__dict__['s' + str(i)] = s | |
95 | ||
96 | def __create_cpu__(self,count): | |
97 | """ | |
98 | create_cpu() creates n cpu instances of the specific product. | |
99 | If the product does not support creating n instances of the cpu | |
100 | then the method returns False | |
101 | """ | |
102 | return False | |
103 | ||
104 | def __repr__(self): | |
105 | return "<Model instance>" | |
106 | ||
107 | ||
108 |