Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perlmod / Midas / 3.32 / lib / site_perl / 5.8.0 / Midas / MMU / Niagara.pm
CommitLineData
86530b38
AT
1# ========== Copyright Header Begin ==========================================
2#
3# OpenSPARC T2 Processor File: Niagara.pm
4# Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
5# 4150 Network Circle, Santa Clara, California 95054, U.S.A.
6#
7# * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8#
9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation; version 2 of the License.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21#
22# For the avoidance of doubt, and except that if any non-GPL license
23# choice is available it will apply instead, Sun elects to use only
24# the General Public License version 2 (GPLv2) at this time for any
25# software where a choice of GPL license versions is made
26# available with the language indicating that GPLv2 or any later version
27# may be used, or where a choice of which version of the GPL is applied is
28# otherwise unspecified.
29#
30# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
31# CA 95054 USA or visit www.sun.com if you need additional information or
32# have any questions.
33#
34# ========== Copyright Header End ============================================
35# -*- perl -*-
36
37package Midas::MMU::Niagara;
38use strict;
39
40use Midas::Command;
41use Midas::Error;
42use Midas::Configure;
43use Midas::Globals;
44use Midas::Segment;
45
46use TRELoad 'BitFieldTie';
47
48use base qw(Midas::MMU);
49use fields qw(
50 rasize
51 );
52
53
54
55
56##############################################################################
57
58sub new {
59 my $class = shift;
60 my %args = @_;
61 my $this = fields::new($class);
62 $this->SUPER::new();
63
64 foreach my $key (keys %args) {
65 $this->{$key} = $args{$key};
66 }
67
68 $this->set_defaults();
69
70 $this->{mapattr_type} = 'Midas::MMU::Niagara::SectionAttrs';
71
72 return $this;
73}
74
75##############################################################################
76
77sub set_defaults {
78 my $this = shift;
79
80 $this->{vasize} = 64 unless defined $this->{vasize};
81 $this->{pasize} = 40 unless defined $this->{pasize};
82 $this->{rasize} = 40 unless defined $this->{rasize};
83 $this->{type} = 'niagara' unless defined $this->{type};
84
85
86 $this->SUPER::set_defaults();
87}
88
89##############################################################################
90
91sub mmu_cpp_args {
92 my $this = shift;
93 my $list = ['-DNIAGARA'];
94 push @$list, '-DALLOW_TSB_COL' if $CONFIG{allow_tsb_conflicts};
95 return $list;
96}
97
98##############################################################################
99
100##############################################################################
101##############################################################################
102
103{
104 package Midas::MMU::Niagara::SectionAttrs;
105 use strict;
106
107 use Carp;
108 use Midas::Command;
109 use Midas::Globals;
110 use Midas::Error;
111 use Midas::MMU::SunSectionAttrs;
112 use Midas::MMU::TTEFormat;
113 use BitFieldTie;
114
115
116 use base qw(Midas::MMU::SunHyperAttrs);
117 use fields (qw(),
118 (
119 # Hard-code MMU type because 'use fields' directive needs
120 # to happen at compile-time
121 keys %{ get_union_tte_field_hash('niagara') }
122 )
123 );
124
125 our @Settable = ();
126
127 our %Settable = map { $_ => 1} Midas::MMU::Niagara::SectionAttrs->settable();
128 our %FieldSizes = ();
129
130 ############################################################################
131
132 sub new {
133 my $this = shift;
134 my %args = @_;
135
136 unless (ref $this) {
137 $this = fields::new($this);
138 }
139
140 $this->{settable} = \%Settable;
141 foreach my $key (keys %args) {
142 $this->{$key} = $args{$key};
143 }
144
145 return $this;
146 }
147
148 ############################################################################
149
150 sub set_defaults {
151 my $this = shift;
152
153 $this->SUPER::set_defaults();
154
155 foreach my $field (keys %FieldSizes) {
156 $this->{$field} = 0 unless defined $this->{$field};
157 }
158 }
159
160 #############################################################################
161
162 sub settable {
163 my $this = shift;
164 my @settable = $this->SUPER::settable();
165 push @settable, @Settable;
166 return @settable;
167 }
168
169 #############################################################################
170
171 sub get_field_size_hash {
172 my $this = shift;
173 my $sizes = $this->SUPER::get_field_size_hash();
174
175 foreach my $field (keys %FieldSizes) {
176 $sizes->{$field} = $FieldSizes{$field};
177 }
178
179 return $sizes;
180 }
181
182 ############################################################################
183
184 sub legal_page_bits {
185 my $this = shift;
186 return (0, 1, 3, 5);
187 }
188
189 ###########################################################################
190
191}
192
193##############################################################################
194
195##############################################################################
196
1971;