Project

General

Profile

MMU description » History » Version 53

Taya Sergeeva, 02/22/2013 12:44 PM

1 24 Alexander Kamkin
h1. MMU Description
2 1 Taya Sergeeva
3 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.
4 34 Alexander Kamkin
5 38 Alexander Kamkin
h2. Address Description
6
7 40 Alexander Kamkin
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.
8
9 43 Alexander Kamkin
An address space is described using a construct *address*. A couple of examples are given below.
10 38 Alexander Kamkin
11 1 Taya Sergeeva
<pre>
12 42 Alexander Kamkin
address Void { width = 0  }
13 45 Alexander Kamkin
</pre>
14 46 Alexander Kamkin
15 45 Alexander Kamkin
<pre>
16 41 Alexander Kamkin
address PA   { width = 40 }
17 38 Alexander Kamkin
</pre>
18
19 44 Alexander Kamkin
The code above defines two address spaces: (1) a single-element space @Void@ and (2) a space @PA@ consisting of 40-bit addresses (_PA_ usually stands for _physical address_).
20 10 Alexander Kamkin
21 2 Taya Sergeeva
h2. Buffer Description
22
23 48 Taya Sergeeva
Buffer can be described by different parameters, such as the associativity, the number of sets, the tag computing function, the index computing function, the structure of data unit, the controlling bits, the strategies of data changing when ''miss'' occurs, and so on. 
24
25
For instance, there is an example of the buffer below:
26 2 Taya Sergeeva
27
<pre>
28
buffer L1 
29
{
30 53 Taya Sergeeva
	sets = 4;
31
	lines = 128;
32
	line = (tag:30, data:256);
33
	index(addr:PA) = addr<9..8>;
34
	match(addr:PA) = line.tag == addr<39..10>;
35
	policy = lru;
36 10 Alexander Kamkin
}
37 1 Taya Sergeeva
</pre>
38
39
40
_Description of each constructor_ in the buffer example is below:
41 19 Taya Sergeeva
42 49 Taya Sergeeva
h3. address 
43 19 Taya Sergeeva
44
<pre>
45
  gives the width of the field occupied in bytes;
46 52 Taya Sergeeva
  _address_ has a name; ''PA''(Physical Address) in our case; it also can be virtual (VA);
47 19 Taya Sergeeva
</pre>
48
49 49 Taya Sergeeva
h3. buffer
50 21 Taya Sergeeva
51
<pre>
52 52 Taya Sergeeva
  has a name, ''L1'' in pur example; it can have names ''L2'' and ''TLB'' also;
53
  _buffer_ can be described by different parameters, such _sets_, _lines_, _index_, _match_, _policy_, and so on, which number is infixed;
54 21 Taya Sergeeva
</pre>
55 1 Taya Sergeeva
56 51 Taya Sergeeva
h3.  sets 
57 16 Taya Sergeeva
58 15 Taya Sergeeva
<pre>
59 1 Taya Sergeeva
  is an associativity of a buffer; it returns the number of lines in a one set;
60 15 Taya Sergeeva
</pre>
61 1 Taya Sergeeva
62 49 Taya Sergeeva
h3.  lines
63 17 Taya Sergeeva
64 15 Taya Sergeeva
<pre>
65 1 Taya Sergeeva
  is the number of lines in a given buffer;
66 15 Taya Sergeeva
</pre>
67 13 Taya Sergeeva
68 49 Taya Sergeeva
h3.  line
69 17 Taya Sergeeva
70 15 Taya Sergeeva
<pre>
71 1 Taya Sergeeva
  designates the specific line in which the necessary data will be looking for; 
72 52 Taya Sergeeva
  _line_ includes its own parameters in the braces: _tag_ and _data_, each of them has an appropriate width of the fields kept in bytes;
73
  in our example _line_ has only two parameters, but in general case it can include more;
74 15 Taya Sergeeva
</pre>
75 14 Taya Sergeeva
76 49 Taya Sergeeva
h3.  index
77 17 Taya Sergeeva
78 15 Taya Sergeeva
<pre>
79 52 Taya Sergeeva
   returns the initial and the final points of the field kept in bytes; they are marked in a three-cornered brackets, after _addr_;
80
  _index_ depends on an _address_, which is ''physical'' (PA) in our case; the type of an address is set in the braces after _index_; 
81 15 Taya Sergeeva
</pre>
82 1 Taya Sergeeva
83 49 Taya Sergeeva
h3.  match 
84 17 Taya Sergeeva
85 1 Taya Sergeeva
<pre>
86 52 Taya Sergeeva
  returns ''true'' or ''false'' depending on if the data required is in the given line or not; 
87
  it returns ''true'' if there is a ''hit'' in the line, and returns ''false'' otherwise;
88
  _match_ description contains the the initial and the final points of the address field in the triangle brackets after _addr_; 
89
  as _index_ in the round braces _match_ also has the type of the address used; ''PA'' in our case;
90 1 Taya Sergeeva
</pre>
91
92 49 Taya Sergeeva
h3.  policy
93 1 Taya Sergeeva
94
<pre>
95 52 Taya Sergeeva
  sets a policy which will be applied to our buffer, ''lru'' (Least Recently Used) in our example;
96
  policy also can be ''plru'' (Pseudo LRU) and ''fifo'' (First Input First Out).
97 1 Taya Sergeeva
</pre>
98 25 Alexander Kamkin
99
h2. Code Structure
100
101
The MMU grammar is in ru.ispras.microtesk.translator.mmu.grammar folder. It contains Lexer, Parser and TreeWalker files. These files can be compiled by build.xml file (microtesk++/build.xml). The files generated (MMULexer.java, MMUParser.java, MMUTreeWalker.java) are in microtesk++.gen.ru.ispras.microtesk.translator.mmu.grammar folder. 
102
103
The folders ru.ispras.microtesk.translator.mmu.ir.* contain the inner representation of the MMU hierarchy of one buffer.  
104
105
MMU translator is in the ru.ispras.microtesk.translator.mmu.translator folder. 
106 1 Taya Sergeeva
107
Files in ru.ispras.microtesk.model.api.mmu folder contain different policies of cache. Folder ru.ispras.microtesk.model.api.mmu.buffer contains the model of MMU - the files which describe Buffer, Set, Line, Address expressions.  
108 26 Alexander Kamkin
109
After grammar files being generated the file ''BufferExample'' can be loaded to the translator.