MMU description » History » Version 35
Alexander Kamkin, 02/19/2013 11:40 AM
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 | Each buffer is described using a number parameters: |
||
6 | 27 | Alexander Kamkin | |
7 | 19 | Taya Sergeeva | For instance, this is an example of the buffer below: |
8 | |||
9 | 10 | Alexander Kamkin | <pre> |
10 | 2 | Taya Sergeeva | address PA |
11 | { |
||
12 | width = 40 |
||
13 | } |
||
14 | |||
15 | buffer L1 |
||
16 | { |
||
17 | sets = 4 |
||
18 | lines = 128 |
||
19 | line = (tag:30 data:256) |
||
20 | index(addr:PA) = addr<9**8> |
||
21 | match(addr:PA) = line.tag == addr<39**10> |
||
22 | policy = lru |
||
23 | 10 | Alexander Kamkin | } |
24 | 1 | Taya Sergeeva | </pre> |
25 | |||
26 | |||
27 | _Description of each constructor_ in the buffer example is below: |
||
28 | 19 | Taya Sergeeva | |
29 | h3. ''address'' |
||
30 | |||
31 | <pre> |
||
32 | gives the width of the field occupied in bytes; |
||
33 | ''address'' has a name; ''PA''(Physical Address) in our case; it also can be virtual (VA); |
||
34 | </pre> |
||
35 | |||
36 | 21 | Taya Sergeeva | h3. ''buffer'' |
37 | |||
38 | <pre> |
||
39 | has a name, ''L1'' in pur example; it can have names ''L2'' and ''TLB'' also; |
||
40 | ''buffer'' can be described by different parameters, such sets, lines, index, match, policy, and so on, which number is infixed; |
||
41 | </pre> |
||
42 | 1 | Taya Sergeeva | |
43 | 15 | Taya Sergeeva | h3. ''set'' |
44 | 16 | Taya Sergeeva | |
45 | 15 | Taya Sergeeva | <pre> |
46 | 1 | Taya Sergeeva | is an associativity of a buffer; it returns the number of lines in a one set; |
47 | 15 | Taya Sergeeva | </pre> |
48 | 1 | Taya Sergeeva | |
49 | 15 | Taya Sergeeva | h3. ''lines'' |
50 | 17 | Taya Sergeeva | |
51 | 15 | Taya Sergeeva | <pre> |
52 | 1 | Taya Sergeeva | is the number of lines in a given buffer; |
53 | 15 | Taya Sergeeva | </pre> |
54 | 13 | Taya Sergeeva | |
55 | 15 | Taya Sergeeva | h3. ''line'' |
56 | 17 | Taya Sergeeva | |
57 | 15 | Taya Sergeeva | <pre> |
58 | 1 | Taya Sergeeva | designates the specific line in which the necessary data will be looking for; |
59 | ''line'' includes its own parameters in the braces: ''tag'' and ''data'', each of them has an appropriate width of the fields kept in bytes; |
||
60 | in our example ''line'' has only two parameters, but in general case it can include more; |
||
61 | 15 | Taya Sergeeva | </pre> |
62 | 14 | Taya Sergeeva | |
63 | 15 | Taya Sergeeva | h3. ''index'' |
64 | 17 | Taya Sergeeva | |
65 | 15 | Taya Sergeeva | <pre> |
66 | 1 | 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''; |
67 | 14 | Taya Sergeeva | ''index'' depends on an ''address'', which is ''physical'' (PA) in our case; the type of an address is set in the braces after ''index''; |
68 | 15 | Taya Sergeeva | </pre> |
69 | 1 | Taya Sergeeva | |
70 | 15 | Taya Sergeeva | h3. ''match'' |
71 | 17 | Taya Sergeeva | |
72 | 1 | Taya Sergeeva | <pre> |
73 | 16 | Taya Sergeeva | returns ''true'' or ''false'' depending on if the data required is in the given line or not; |
74 | it returns ''true'' if there is a ''hit'' in the line, and returns ''false'' otherwise; |
||
75 | 14 | Taya Sergeeva | ''match'' description contains the the initial and the final points of the address field in the triangle brackets after ''addr''; |
76 | 1 | Taya Sergeeva | as ''index'' in the round braces ''match'' also has the type of the address used; ''PA'' in our case; |
77 | </pre> |
||
78 | |||
79 | h3. ''policy'' |
||
80 | |||
81 | <pre> |
||
82 | sets a policy which will be applied to our buffer, ''lru'' (Least Recently Used) in our example; |
||
83 | policy also can be ''plru'' (Pseudo LRU) and ''fifo'' (First Input First Out). |
||
84 | </pre> |
||
85 | 25 | Alexander Kamkin | |
86 | h2. Code Structure |
||
87 | |||
88 | 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. |
||
89 | |||
90 | The folders ru.ispras.microtesk.translator.mmu.ir.* contain the inner representation of the MMU hierarchy of one buffer. |
||
91 | |||
92 | MMU translator is in the ru.ispras.microtesk.translator.mmu.translator folder. |
||
93 | 1 | Taya Sergeeva | |
94 | 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. |
||
95 | 26 | Alexander Kamkin | |
96 | After grammar files being generated the file ''BufferExample'' can be loaded to the translator. |