MMU description » History » Version 90
Alexander Kamkin, 12/02/2014 10:10 AM
1 | 24 | Alexander Kamkin | h1. MMU Description |
---|---|---|---|
2 | 1 | Taya Sergeeva | |
3 | 66 | Alexander Kamkin | _~By Alexander Kamkin and Taya Sergeeva~_ |
4 | 62 | Alexander Kamkin | |
5 | 63 | Alexander Kamkin | {{toc}} |
6 | |||
7 | 35 | Alexander Kamkin | A _memory management unit_ (_MMU_) is known to be one of the most complex and error-prone components of a modern microprocessor. MicroTESK has a special subsystem, called _MMU subsystem_, intended for (1) specifying memory devices and (2) deriving testing knowledge from such specifications. The subsystem provides unified facilities for describing memory buffers (like _L1_ and _L2 caches_, _translation look-aside buffers_ (_TLBs_), etc.) as well as a means for connecting several buffers into a memory hierarchy. |
8 | 1 | Taya Sergeeva | |
9 | 72 | Alexander Kamkin | h2. Grammar |
10 | 66 | Alexander Kamkin | |
11 | <pre> |
||
12 | startRule |
||
13 | : bufferOrAddress* |
||
14 | ; |
||
15 | |||
16 | bufferOrAddress |
||
17 | : address |
||
18 | | buffer |
||
19 | ; |
||
20 | </pre> |
||
21 | |||
22 | 89 | Alexander Kamkin | The expression syntax is derived from nML/Sim-nML (see _MicroTESK Language Reference_). |
23 | |||
24 | 1 | Taya Sergeeva | h2. Address Description |
25 | 56 | Taya Sergeeva | |
26 | 1 | Taya Sergeeva | A buffer is accessed by an _address_, which is typically a _bit vector_ of a fixed length (width). Different buffers are allowed to have a common address space (e.g., L1 and L2 are usually both addressed by physical addresses). However, in general case, each buffer has its own domain. |
27 | |||
28 | 76 | Alexander Kamkin | An address space is described using a keyword @address@. The description can specify two parameters: @width@ (obligatory) and @format@ (optional). |
29 | 1 | Taya Sergeeva | |
30 | 75 | Alexander Kamkin | h3. Grammar |
31 | 69 | Alexander Kamkin | |
32 | <pre> |
||
33 | address |
||
34 | 90 | Alexander Kamkin | : ''address'' ID |
35 | (addressParameter)* |
||
36 | 69 | Alexander Kamkin | ; |
37 | |||
38 | addressParameter |
||
39 | : width |
||
40 | | format |
||
41 | ; |
||
42 | </pre> |
||
43 | |||
44 | 79 | Alexander Kamkin | h3. Address Width (width) |
45 | 1 | Taya Sergeeva | |
46 | 84 | Alexander Kamkin | The @width@ parameter specifies the address _width_. The parameter is obligatory; its value should be non-negative (zero-length addresses are permitted). |
47 | 1 | Taya Sergeeva | |
48 | 69 | Alexander Kamkin | h4. Grammar |
49 | |||
50 | <pre> |
||
51 | width |
||
52 | : ''width'' ''='' expr |
||
53 | ; |
||
54 | </pre> |
||
55 | |||
56 | 79 | Alexander Kamkin | h3. Address Format (format) |
57 | 68 | Alexander Kamkin | |
58 | 84 | Alexander Kamkin | The @format@ parameter specifies the address _format_ (a number of named fields). The parameter is optional. By default, the address is unstructured (no fields are specified). |
59 | 1 | Taya Sergeeva | |
60 | 86 | Alexander Kamkin | A field has three attributes: a _name_, a _width_ and, optionally, an _initial value_. |
61 | 83 | Alexander Kamkin | |
62 | 69 | Alexander Kamkin | h4. Grammar |
63 | |||
64 | <pre> |
||
65 | format |
||
66 | : ''format'' ''='' ''('' |
||
67 | field ('','' field)* |
||
68 | '')'' |
||
69 | ; |
||
70 | |||
71 | field |
||
72 | : ID '':'' expr (''='' expr)? |
||
73 | ; |
||
74 | </pre> |
||
75 | |||
76 | 72 | Alexander Kamkin | h2. Examples |
77 | 1 | Taya Sergeeva | |
78 | <pre> |
||
79 | 66 | Alexander Kamkin | // The singleton. |
80 | 90 | Alexander Kamkin | address Void |
81 | 1 | Taya Sergeeva | // The address width is zero (this is admissible for single-item buffers). |
82 | 90 | Alexander Kamkin | width = 0 |
83 | 66 | Alexander Kamkin | </pre> |
84 | |||
85 | 1 | Taya Sergeeva | <pre> |
86 | 88 | Alexander Kamkin | // An unstructured 64-bit virtual addresses (VA). |
87 | 90 | Alexander Kamkin | address VA |
88 | 84 | Alexander Kamkin | // The address width. |
89 | 90 | Alexander Kamkin | width = 64 |
90 | 1 | Taya Sergeeva | </pre> |
91 | |||
92 | 66 | Alexander Kamkin | <pre> |
93 | // A stuctured 40-bit physical addresses (PA). |
||
94 | 90 | Alexander Kamkin | address PA |
95 | 1 | Taya Sergeeva | // The address width. |
96 | 90 | Alexander Kamkin | width = 40 |
97 | 84 | Alexander Kamkin | // The address format: (<39..36>, TAG=<35..12>, INDEX=<11..5>, LOCAL=<4..0>). |
98 | format = ( |
||
99 | TAG : 24, // The tag (the <35..12> address bits). |
||
100 | 1 | Taya Sergeeva | INDEX : 7, // The set index (the <11..5> address bits). |
101 | LOCAL : 5, // The byte position (the <0..4> address bits). |
||
102 | 90 | Alexander Kamkin | ) |
103 | 84 | Alexander Kamkin | </pre> |
104 | 2 | Taya Sergeeva | |
105 | 1 | Taya Sergeeva | h2. Buffer Description |
106 | 76 | Alexander Kamkin | |
107 | 1 | Taya Sergeeva | A buffer is described using a keyword @buffer@. The description specifies a set of parameters, including @ways@, @sets@, @format@, @index@, @match@ and @policy@. All of the parameters except @index@ (if @sets = 1@) and @policy@ are obligatory. |
108 | 75 | Alexander Kamkin | |
109 | h3. Grammar |
||
110 | 1 | Taya Sergeeva | |
111 | 75 | Alexander Kamkin | <pre> |
112 | 83 | Alexander Kamkin | buffer |
113 | 90 | Alexander Kamkin | : ''buffer'' bufferTypeID ''('' addressTypeID addressArgID '')'' |
114 | (bufferParameter)* |
||
115 | 75 | Alexander Kamkin | ; |
116 | |||
117 | bufferParameter |
||
118 | : ways |
||
119 | | sets |
||
120 | | format |
||
121 | | index |
||
122 | | match |
||
123 | | policy |
||
124 | ; |
||
125 | 1 | Taya Sergeeva | </pre> |
126 | |||
127 | 78 | Alexander Kamkin | h3. Buffer Associativity (ways) |
128 | |||
129 | 84 | Alexander Kamkin | The @ways@ parameter specifies the buffer _associativity_ (the number of lines in a set). The parameter is obligatory; its value should be positive. |
130 | 78 | Alexander Kamkin | |
131 | 1 | Taya Sergeeva | h4. Grammar |
132 | 80 | Alexander Kamkin | |
133 | <pre> |
||
134 | ways |
||
135 | : ''ways'' ''='' expr |
||
136 | 1 | Taya Sergeeva | ; |
137 | </pre> |
||
138 | |||
139 | 80 | Alexander Kamkin | h3. Buffer Length (sets) |
140 | 83 | Alexander Kamkin | |
141 | 84 | Alexander Kamkin | The @sets@ parameter specifies the buffer _length_ (the number of sets a cache). The parameter is obligatory; its value should be positive. |
142 | 78 | Alexander Kamkin | |
143 | 1 | Taya Sergeeva | h4. Grammar |
144 | 80 | Alexander Kamkin | |
145 | <pre> |
||
146 | sets |
||
147 | 1 | Taya Sergeeva | : ''sets'' ''='' expr |
148 | 80 | Alexander Kamkin | ; |
149 | </pre> |
||
150 | 1 | Taya Sergeeva | |
151 | h3. Buffer Line Format (format) |
||
152 | |||
153 | 84 | Alexander Kamkin | The @format@ parameter specifies the buffer _line format_ (a number of named fields). The parameter is optional. By default, the buffer line is unstructured (no fields are specified). |
154 | 82 | Alexander Kamkin | |
155 | 83 | Alexander Kamkin | A field has three attributes: a name, a width and, optionally, an initial value. |
156 | 82 | Alexander Kamkin | |
157 | h4. Grammar |
||
158 | |||
159 | <pre> |
||
160 | 83 | Alexander Kamkin | format |
161 | 1 | Taya Sergeeva | : ''format'' ''='' ''('' field ('','' field)* '')'' |
162 | 82 | Alexander Kamkin | ; |
163 | 1 | Taya Sergeeva | |
164 | field |
||
165 | : fieldID '':'' expr (''='' expr)? |
||
166 | ; |
||
167 | </pre> |
||
168 | |||
169 | h3. Buffer Index Function (index) |
||
170 | 83 | Alexander Kamkin | |
171 | 84 | Alexander Kamkin | The @index@ parameter specifies the _address-to-index function_, which maps an address into the set index. The function may be omitted if the number of sets is @1@. |
172 | 1 | Taya Sergeeva | |
173 | h4. Grammar |
||
174 | |||
175 | 83 | Alexander Kamkin | <pre> |
176 | 1 | Taya Sergeeva | index |
177 | 90 | Alexander Kamkin | : ''index'' ''='' expr |
178 | 83 | Alexander Kamkin | ; |
179 | </pre> |
||
180 | 1 | Taya Sergeeva | |
181 | h3. Buffer Match Predicate (match) |
||
182 | 83 | Alexander Kamkin | |
183 | 84 | Alexander Kamkin | The @match@ parameter specifies the _address-line match predicate_, which checks if an address matches a line. The parameter is obligatory. |
184 | 83 | Alexander Kamkin | |
185 | h4. Grammar |
||
186 | 1 | Taya Sergeeva | |
187 | 83 | Alexander Kamkin | <pre> |
188 | index |
||
189 | 90 | Alexander Kamkin | : ''match'' ''='' expr |
190 | 1 | Taya Sergeeva | ; |
191 | </pre> |
||
192 | 83 | Alexander Kamkin | |
193 | 1 | Taya Sergeeva | h3. Buffer Data Replacement Policy (policy) |
194 | |||
195 | 57 | Taya Sergeeva | The @policy@ parameters specifies the _data replacement_ (_eviction_) _policy_. The parameter is optional. The list of supported policies includes: @RANDOM@, @FIFO@, @PLRU@ and @LRU@. |
196 | 84 | Alexander Kamkin | |
197 | 1 | Taya Sergeeva | h4. Grammar |
198 | |||
199 | <pre> |
||
200 | policy |
||
201 | : ''policy'' ''='' policyID |
||
202 | 54 | Taya Sergeeva | ; |
203 | </pre> |
||
204 | |||
205 | 1 | Taya Sergeeva | h3. Examples |
206 | |||
207 | 84 | Alexander Kamkin | <pre> |
208 | 90 | Alexander Kamkin | // A 4-way set associative cache (L1) addressed by physical addresses (PA). |
209 | buffer L1(PA addr) |
||
210 | 84 | Alexander Kamkin | // The cache associativity. |
211 | 90 | Alexander Kamkin | ways = 4 |
212 | 84 | Alexander Kamkin | // The number of sets. |
213 | 90 | Alexander Kamkin | sets = 128 |
214 | 1 | Taya Sergeeva | // The line format. |
215 | 85 | Alexander Kamkin | format = ( |
216 | V : 1 = 0, // The validity flag (by default, the line is invalid). |
||
217 | TAG : 24, // The tag (the <35..12> address bits). |
||
218 | 84 | Alexander Kamkin | DATA : 256 // The data (4 double words). |
219 | 90 | Alexander Kamkin | ) |
220 | // The address-to-index function (example: using address fields). |
||
221 | index = addr.INDEX |
||
222 | // The address-line predicate (example: using address bits). |
||
223 | match = addr<35..12> == TAG |
||
224 | // The data replacement policy (example: using predefined policy LRU - Least Recently Used). |
||
225 | policy = LRU |
||
226 | 1 | Taya Sergeeva | </pre> |