Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / Midas_samy / MMU / Ultra2.pm
CommitLineData
86530b38
AT
1# -*- perl -*-
2
3package Midas::MMU::Ultra2;
4use strict;
5
6use Midas::Command;
7use Midas::Error;
8use Midas::Configure;
9use Midas::Globals;
10use Midas::Segment;
11
12use TRELoad 'BitFieldTie';
13
14use base qw(Midas::MMU);
15use fields qw(
16 );
17
18
19
20
21##############################################################################
22
23sub new {
24 my $class = shift;
25 my %args = @_;
26 my $this = fields::new($class);
27 $this->SUPER::new();
28
29 foreach my $key (keys %args) {
30 $this->{$key} = $args{$key};
31 }
32
33 $this->set_defaults();
34
35 $this->{mapattr_type} = 'Midas::MMU::Ultra2::SectionAttrs';
36
37 return $this;
38}
39
40##############################################################################
41
42sub set_defaults {
43 my $this = shift;
44
45 $this->{vasize} = 64 unless defined $this->{vasize};
46 $this->{pasize} = 41 unless defined $this->{pasize};
47 $this->{type} = 'ultra2' unless defined $this->{type};
48
49 $this->SUPER::set_defaults();
50}
51
52##############################################################################
53
54sub mmu_cpp_args {
55 my $this = shift;
56 my $list = ['-DULTRA2'];
57 push @$list, '-DALLOW_TSB_COL' if $CONFIG{allow_tsb_conflicts};
58 return $list;
59}
60
61##############################################################################
62
63##############################################################################
64##############################################################################
65
66{
67 package Midas::MMU::Ultra2::SectionAttrs;
68 use strict;
69
70 use Carp;
71 use Midas::Command;
72 use Midas::Globals;
73 use Midas::Error;
74 use Midas::MMU::SunSectionAttrs;
75 use Midas::MMU::TTEFormat;
76 use BitFieldTie;
77
78
79 use base qw(Midas::MMU::SunSectionAttrs);
80 use fields (qw( ),
81 (
82 # Hard-code MMU type because 'use fields' directive needs
83 # to happen at compile-time
84 keys %{ get_union_tte_field_hash('ultra2') }
85 )
86 );
87
88 #tte_g is same as tte_rsvd1 for sun4u
89
90 our @Settable = qw();
91
92 our %Settable = map { $_ => 1} Midas::MMU::Ultra2::SectionAttrs->settable();
93 our %FieldSizes = ();
94
95 ############################################################################
96
97 sub new {
98 my $this = shift;
99 my %args = @_;
100
101 unless (ref $this) {
102 $this = fields::new($this);
103 }
104
105 $this->{settable} = \%Settable;
106 foreach my $key (keys %args) {
107 $this->{$key} = $args{$key};
108 }
109
110 return $this;
111 }
112
113 ############################################################################
114
115 sub set_defaults {
116 my $this = shift;
117
118 $this->SUPER::set_defaults();
119
120 foreach my $field (keys %FieldSizes) {
121 $this->{$field} = 0 unless defined $this->{$field};
122 }
123 }
124
125 #############################################################################
126
127 sub settable {
128 my $this = shift;
129 my @settable = $this->SUPER::settable();
130 push @settable, @Settable;
131 return @settable;
132 }
133
134 #############################################################################
135
136 sub get_field_size_hash {
137 my $this = shift;
138 my $sizes = $this->SUPER::get_field_size_hash();
139
140 foreach my $field (keys %FieldSizes) {
141 $sizes->{$field} = $FieldSizes{$field};
142 }
143
144 return $sizes;
145 }
146
147 ############################################################################
148
149 sub legal_page_bits {
150 my $this = shift;
151 return (0, 1, 2, 3);
152 }
153
154 ############################################################################
155
156 sub get_data_addr_bits {
157 my $this = shift;
158 return (40, 13);
159 }
160
161 ###########################################################################
162
163}
164
165##############################################################################
166
167##############################################################################
168
1691;