summaryrefslogtreecommitdiffstats
path: root/chapters/pipelining_notes.org
blob: 01ff6685ec9c284773877195b18f6e413321d2af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
A1  x18 = x6 + -1 (int)
R1  x16 = int32[x4 + x18 * 4 + 0]
M1  x8 = x16 * x1
R2  x12 = int32[x3 + x6 * 4 + 0]
R3  x13 = int32[x2 + x6 * 4 + 0]
M2  x7 = x12 * x13
A2  x11 = x8 + x7 + 0 (int)
W1  int32[x4 + x6 * 4 + 0] = x11
A3  x6 = x6 + 1 (int)

| N%3 | N%2 | N | Add1 | Add2 | Add3 | Mult1 | Mult2 | Mem1 | Mem2 | Mem3 |
|-----+-----+---+------+------+------+-------+-------+------+------+------|
|   0 |   0 | 0 | A1   |      |      |       |       |      | R2   | R3   |
|   1 |   1 | 1 |      |      |      |       |       | R1   |      |      |
|   2 |   0 | 2 |      |      |      |       | M2    |      |      |      |
|   0 |   1 | 3 |      |      |      | M1    |       |      |      |      |
|   1 |   0 | 4 |      | A2   |      |       |       |      |      |      |
|   2 |   1 | 5 |      |      | A3   |       |       | W1   |      |      |

| N | Add1 | Add2   | Add3   | Mult1  | Mult2 | Mem1   | Mem2 | Mem3 |
|---+------+--------+--------+--------+-------+--------+------+------|
| 0 | n:A1 |        |        | n-1:M1 |       |        | n:R2 | n:R3 |
| 1 |      | n-1:A2 |        |        |       | n:R1   |      |      |
| 2 |      |        | n-1:A3 |        | n:M2  | n-1:W1 |      |      |

| Instr | Stage | Code                                                           |
|-------+-------+----------------------------------------------------------------|
|     0 |     0 | ~x18 = x6 - 1~, ~x12 = int32[x3+x6*4]~, ~x13 = int32[x3+x6*4]~ |
|       |     1 | ~x8 = x16 * x1~                                                |
|     1 |     0 | ~x16 = int32[x4+x18*4]~                                        |
|       |     1 | ~x11 = x8 + x7~                                                |
|     2 |     0 | ~x7 = x12 * x13~                                               |
|       |     1 | ~x6 = x6 + 1~, ~int32[x4+x6*4] = x11~                          |

| N%3 | N%2 | N | Add1 | Add2 | Add3 | Mult1 | Mult2 | Mem1 | Mem2 | Mem3 |
|-----+-----+---+------+------+------+-------+-------+------+------+------|
|   0 |   0 | 0 | A1   |      |      |       |       |      | R2   | R3   |
|   1 |   1 | 1 |      |      |      |       |       | R1   |      |      |
|   2 |   0 | 2 |      |      |      |       | M2    |      |      |      |
|   0 |   1 | 3 |      |      |      | M1    |       |      |      |      |
|   1 |   0 | 4 |      | A2   |      |       |       |      |      |      |
|   2 |   1 | 5 |      |      |      |       |       |      |      |      |
|   0 |   0 | 6 |      |      | A3   |       |       | W1   |      |      |

| N | Add1 | Add2   | Add3   | Mult1  | Mult2  | Mem1   | Mem2 | Mem3 |
|---+------+--------+--------+--------+--------+--------+------+------|
| 0 | n:A1 | n-2:A2 | n-3:A3 |        | n-1:M2 | n-3:W1 | n:R2 | n:R3 |
| 1 |      |        |        | n-1:M1 |        | n:R1   |      |      |

| Instr | Stage | Code                                                              |
|-------+-------+-------------------------------------------------------------------|
|     0 |     0 | ~x18 = x6 - 1~, ~x13 = int32[x4+x18*4+0]~, ~x12 = int32[x3+x6*4]~ |
|       |     1 | ~x7 = x12 * x13~                                                  |
|       |     2 | ~x11 = x8 + x7~                                                   |
|       |     3 | ~x6 = x6 + 1~, ~int32[x4+x6*4] = x11~                             |
|     1 |     0 | ~x16 = int32[x4+x18*4]~                                           |
|       |     1 | ~x8 = x16 * x1~                                                   |


#+begin_src
x18[0] = x6[0] - 1
|| x13[0] = int32[x4[0]+x18[0]*4+0]
|| x12[0] = int32[x3[0]+x6[0]*4]
|| x7[1] = x12[1] * x13[1]
|| x11[2] = x8[2] + x7[2]
|| int32[x4[3]+x6[3]*4] = x11[3]
|| x6[3] = x6[3] + 1

x16[0] = int32[x4+x18*4]
|| x8[1] = x16[1] * x1[1]

x18>>
x16>>
x12>>
x13>>
x7>>
x8>>
x11>>
#+end_src