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