forked from Hoernchen/Epiphany
-
Notifications
You must be signed in to change notification settings - Fork 2
/
EpiphanySchedule.td
143 lines (131 loc) · 6.52 KB
/
EpiphanySchedule.td
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
//===- EpiphanySchedule.td - Epiphany Scheduling Definitions -*- tablegen -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Epiphany pipeline is shown below
// +---------+------+------------------------+----------------------------------------------------------------------+
// | STEP NO | STEP | NAME | ACTION |
// |---------|------|------------------------|----------------------------------------------------------------------|
// | 1 | FE | Fetch Address | Fetch addr sent to instr memory |
// | 2 | IM | Instruction Mem Access | Instr returns from core mem |
// | 3 | DE | Decode | Decode instr |
// | 4 | RA | Reg Access | Read operands from regs |
// | 5 | E1 | Execution | Load/store address calc Reg read for store Status flag set Branching |
// | 6 | E2 | Execution | Load complete |
// | 7 | E3 | Execution | FP result written in trunc mode |
// | 8 | E4 | Execution | FP result in round-to-near mode |
// +---------+------+------------------------+----------------------------------------------------------------------+
//
// Epiphany can dual-issue when FPU/IALU2 is used.
// In addition, it might be a good idea to group stores and loads to widen them.
//
//===----------------------------------------------------------------------===//
// Functional units across Epiphany chips sets
//===----------------------------------------------------------------------===//
// IALU units
def FE : FuncUnit;
def IM : FuncUnit;
def DE : FuncUnit;
def RA : FuncUnit;
def E1 : FuncUnit;
def E2 : FuncUnit;
def E3 : FuncUnit;
def E4 : FuncUnit;
// IALU2/FPU units
def FE_2 : FuncUnit;
def IM_2 : FuncUnit;
def DE_2 : FuncUnit;
def RA_2 : FuncUnit;
def E1_2 : FuncUnit;
def E2_2 : FuncUnit;
def E3_2 : FuncUnit;
def E4_2 : FuncUnit;
// LoadStore grouping bypass
def LoadStoreBypass : Bypass;
// IALU2 bypass
def IaluBypass : Bypass;
//===----------------------------------------------------------------------===//
// Instruction Itinerary classes used for Epiphany (p58, epiphany_arch_ref.pdf)
//===----------------------------------------------------------------------===//
def IaluItin : InstrItinClass;
def Ialu2Itin : InstrItinClass;
def FpuItin : InstrItinClass;
def LoadItin : InstrItinClass;
def StoreItin : InstrItinClass;
def ControlItin : InstrItinClass;
def BranchItin : InstrItinClass;
def EpiphanyGenericItineraries : ProcessorItineraries<[FE, IM, DE, RA, E1, E2, E3, E4, FE_2, IM_2, DE_2, RA_2, E1_2, E2_2, E3_2, E4_2], [], [
// IALU instructions take steps FE-E1, 1 cycle per step
// Read on cycle 3, result at cycle 4 (after issue)
InstrItinData<IaluItin , [InstrStage<1, [FE]>,
InstrStage<1, [IM]>,
InstrStage<1, [DE]>,
InstrStage<1, [RA]>,
InstrStage<1, [E1]>],
[4, 3]>,
// IALU2 instructions take steps FE-E1, 1 cycle per step
// Read on cycle 3, result at cycle 4 (after issue)
InstrItinData<Ialu2Itin , [InstrStage<1, [FE]>,
InstrStage<1, [IM]>,
InstrStage<1, [DE]>,
InstrStage<1, [RA]>,
InstrStage<1, [E1]>],
[4, 3]>,
// FPU instructions take steps FE-E4, 1 cycle per step
// Read on cycle 3, result at cycle 7 (after issue)
InstrItinData<FpuItin , [InstrStage<1, [FE]>,
InstrStage<1, [IM]>,
InstrStage<1, [DE]>,
InstrStage<1, [RA]>,
InstrStage<1, [E1]>,
InstrStage<1, [E2]>,
InstrStage<1, [E3]>,
InstrStage<1, [E4]>],
[7, 3]>,
// LOAD instructions take steps FE-E2, 1 cycle per step
// Read on cycle 3, result at cycle 6 (after issue)
InstrItinData<LoadItin , [InstrStage<1, [FE]>,
InstrStage<1, [IM]>,
InstrStage<1, [DE]>,
InstrStage<1, [RA]>,
InstrStage<1, [E1]>,
InstrStage<1, [E2]>],
[6, 3]>,
// STORE instructions take steps FE-E1, 1 cycle per step
// Read on cycle 3, result at cycle 4 (after issue)
InstrItinData<StoreItin , [InstrStage<1, [FE]>,
InstrStage<1, [IM]>,
InstrStage<1, [DE]>,
InstrStage<1, [RA]>,
InstrStage<1, [E1]>],
[4, 3]>,
// CONTROL instructions take steps FE-E1, 1 cycle per step
// Read on cycle 3, result at cycle 4 (after issue)
InstrItinData<ControlItin , [InstrStage<1, [FE]>,
InstrStage<1, [IM]>,
InstrStage<1, [DE]>,
InstrStage<1, [RA]>,
InstrStage<1, [E1]>],
[4, 3]>,
// BRANCH instructions take steps FE-E1, 1 cycle per step plus 3 cycle fixed penalty in worst case
// Read on cycle 3, result at cycle 4 (after issue)
InstrItinData<BranchItin , [InstrStage<1, [FE]>,
InstrStage<1, [IM]>,
InstrStage<1, [DE]>,
InstrStage<1, [RA]>,
InstrStage<4, [E1]>],
[4, 3]>
]>;
def EpiphanyModel : SchedMachineModel {
let IssueWidth = 1; // At max we can dual-issue, but let's keep 1 for now
let Itineraries = EpiphanyGenericItineraries;
let LoadLatency = 2;
let CompleteModel = 0;
let MispredictPenalty = 0;
let PostRAScheduler = 1;
}