-
Notifications
You must be signed in to change notification settings - Fork 269
Expand file tree
/
Copy pathConfig.scala
More file actions
364 lines (321 loc) · 14.3 KB
/
Copy pathConfig.scala
File metadata and controls
364 lines (321 loc) · 14.3 KB
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
// See LICENSE for license details.
package midas
import java.io.File
import firrtl.stage.TransformManager.TransformDependency
import org.chipsalliance.cde.config.{Config, Field, Parameters}
import freechips.rocketchip.diplomacy.TransferSizes
import core._
import widgets._
import platform._
import firesim.lib.nasti._
case object FPGATopQSFPBitWidth extends Field[Int](256)
case object QSFPStreamBitWidth extends Field[Int](QSFPBridgeStreamConstants.streamWidthBits)
case object FPGATopQSFPBRAMQueueDepth extends Field[Int](256)
case object F1ShimHasQSFPPorts extends Field[Boolean](false)
case object F1ShimHasPCIMPorts extends Field[Boolean](false)
case object MetasimPrintfEnable extends Field[Boolean](false)
// Provides a function to elaborate the top-level platform shim
case object Platform extends Field[(Parameters) => PlatformShim]
// Switches to synthesize prints and assertions
case object SynthAsserts extends Field[Boolean]
case object SynthPrints extends Field[Boolean]
/** When set, [[targetutils.FPGADebugAnnotation]] s (signals labelled with FPGADebug()) are automatically wired out to
* an ILA.
*/
case object EnableAutoILA extends Field[Boolean](false)
/** Sets a per-probe buffer depth on the ILA. A greater value permits capturing a longer waveform, at the expense of
* FPGA reasources. See PG172 ([200~https://docs.xilinx.com/v/u/en-US/pg172-ila) for more info.
*/
case object ILADepthKey extends Field[Int](1024)
/** Sets the number of comparators to be generated per ILA-probe. See PG172
* ([200~https://docs.xilinx.com/v/u/en-US/pg172-ila) for more info.
*/
case object ILAProbeTriggersKey extends Field[Int](2)
// Auto Counter Switches
case object EnableAutoCounter extends Field[Boolean](false)
/** Chooses between the two implementation strategies for Auto Counter.
*
* True: Synthesized Printf Implementation
* - Generates a counter directly in the target module, adds a printf, and annotates it for printf synthesis
* - Pros: cycle-exact event resolution; counters are printed every time the event is asserted
* - Cons: considerably more resource intensive (64-bit values are synthesized in the printf) Biancolin: This seems
* like a waste of bandwidth? Maybe just print the message?
*
* False: Native Bridge Implementation (Default)
* - Wires out each annotated event (Bool) to a dedicated AutoCounter bridge.
* - Pros: More resource efficient;
* - Cons: Coarse event resolution (depends on the sampling frequency set in the bridge)
*/
case object AutoCounterUsePrintfImpl extends Field[Boolean](false)
case object HasDMAChannel extends Field[Boolean]
// Enables multi-cycle RAM model generation (as demonstrated in the ICCAD2019 paper)
case object GenerateMultiCycleRamModels extends Field[Boolean](false)
// Enables multithreading of repeated instances of annotated models
case object EnableModelMultiThreading extends Field[Boolean](false)
// User provided transforms to run before Golden Gate transformations
// These are constructor functions accept a Parameters instance and produce a
// sequence of firrtl Transforms to run
case object TargetTransforms extends Field[Seq[TransformDependency]](Seq())
// User provided transforms to run after Golden Gate transformations
case object HostTransforms extends Field[Seq[TransformDependency]](Seq())
// Directory into which output files are dumped. Set by -td when invoking the Stage
case object OutputDir extends Field[File]
// Provides the absolute paths to firrtl-emitted module in the context of the
// FPGA project before and after linking. If the firrtl-emitted module is the
// top-level, set the path to None.
case object PreLinkCircuitPath extends Field[Option[String]](None)
case object PostLinkCircuitPath extends Field[Option[String]](None)
// Alias WithoutTLMonitors into this package so that it can be used in config strings
class WithoutTLMonitors extends freechips.rocketchip.subsystem.WithoutTLMonitors
class SimConfig
extends Config(new Config((site, _, _) => {
case SynthAsserts => false
case SynthPrints => false
case AXIDebugPrint => false
// TODO remove
case HasDMAChannel => site(CPUManagedAXI4Key).nonEmpty
// Remove once AXI4 port is complete
case MemNastiKey => {
NastiParameters(
addrBits = chisel3.util.log2Ceil(site(HostMemChannelKey).size * site(HostMemNumChannels)),
dataBits = site(HostMemChannelKey).beatBytes * 8,
idBits = 6,
)
}
}) ++ new WithoutTLMonitors)
class F1Config
extends Config(new Config((_, _, _) => {
case Platform => (p: Parameters) => new F1Shim()(p)
case HasDMAChannel => true
case StreamEngineInstantiatorKey => (e: StreamEngineParameters, p: Parameters) => new CPUManagedStreamEngine(p, e)
case CPUManagedAXI4Key =>
Some(
CPUManagedAXI4Params(
addrBits = 64,
dataBits = 512,
// idBits = 6,
idBits = 16,
)
)
case FPGAManagedAXI4Key => None
case CtrlNastiKey => NastiParameters(32, 25, 12)
case HostMemChannelKey =>
HostMemChannelParams(
size = 0x400000000L, // 16 GiB
beatBytes = 8,
idBits = 16,
)
case HostMemNumChannels => 4
case PreLinkCircuitPath => Some("firesim_top")
case PostLinkCircuitPath => Some("WRAPPER_INST/CL/firesim_top")
}) ++ new SimConfig)
class F2Config
extends Config(new Config((_, _, _) => {
case Platform => (p: Parameters) => new F1Shim()(p)
case HasDMAChannel => true
case StreamEngineInstantiatorKey => (e: StreamEngineParameters, p: Parameters) => new CPUManagedStreamEngine(p, e)
case CPUManagedAXI4Key =>
Some(
CPUManagedAXI4Params(
addrBits = 64,
dataBits = 512,
idBits = 16,
)
)
case FPGAManagedAXI4Key => None
case CtrlNastiKey => NastiParameters(32, 32, 12)
case HostMemChannelKey =>
HostMemChannelParams(
size = 0x400000000L, // 16 GiB
beatBytes = 8,
idBits = 16,
)
case HostMemNumChannels => 1
case PreLinkCircuitPath => Some("firesim_top")
case PostLinkCircuitPath => Some("WRAPPER/CL/firesim_top")
}) ++ new SimConfig)
class XilinxAlveoU250Config
extends Config(new Config((_, _, _) => {
case F1ShimHasQSFPPorts => true
case HostMemNumChannels => 1
case PreLinkCircuitPath => Some("firesim_top")
case PostLinkCircuitPath => Some("firesim_top")
}) ++ new F1Config ++ new SimConfig)
class XilinxAlveoU200Config
extends Config(new Config((_, _, _) => {
case HostMemNumChannels => 1
case PreLinkCircuitPath => Some("design_1_i/firesim_wrapper_0/inst/firesim_top")
case PostLinkCircuitPath => Some("design_1_i/firesim_wrapper_0/inst/firesim_top")
}) ++ new XilinxAlveoU250Config)
class XilinxAlveoU280Config extends XilinxAlveoU200Config
class NitefuryConfig
extends Config(new Config((_, _, _) => {
case Platform => (p: Parameters) => new F1Shim()(p)
case HasDMAChannel => true
case StreamEngineInstantiatorKey => (e: StreamEngineParameters, p: Parameters) => new CPUManagedStreamEngine(p, e)
case CPUManagedAXI4Key =>
Some(
CPUManagedAXI4Params(
addrBits = 64,
dataBits = 128,
idBits = 4,
)
)
case FPGAManagedAXI4Key => None
case CtrlNastiKey => NastiParameters(32, 25, 12)
case HostMemChannelKey =>
HostMemChannelParams(
size = 0x40000000L, // 1 GiB
beatBytes = 8,
idBits = 16,
)
case HostMemNumChannels => 1
case PreLinkCircuitPath => Some("firesim_top")
case PostLinkCircuitPath => Some("Top_i/firesim_wrapper_0/inst/firesim_top")
}) ++ new SimConfig)
class XilinxVCU118Config
extends Config(new Config((_, _, _) => {
case Platform => (p: Parameters) => new F1Shim()(p)
case HasDMAChannel => true
case StreamEngineInstantiatorKey => (e: StreamEngineParameters, p: Parameters) => new CPUManagedStreamEngine(p, e)
case CPUManagedAXI4Key =>
Some(
CPUManagedAXI4Params(
addrBits = 64,
dataBits = 512,
idBits = 4,
)
)
case FPGAManagedAXI4Key => None
case CtrlNastiKey => NastiParameters(32, 25, 12)
case HostMemChannelKey =>
HostMemChannelParams(
size = 0x80000000L, // 2 GiB
beatBytes = 8,
idBits = 6,
)
case HostMemNumChannels => 2
case PreLinkCircuitPath => Some("partition/firesim_top")
case PostLinkCircuitPath => Some("partition_wrapper/partition/firesim_top")
}) ++ new SimConfig)
class VitisConfig
extends Config(new Config((_, _, _) => {
case Platform => (p: Parameters) => new VitisShim()(p)
case CPUManagedAXI4Key => None
case FPGAManagedAXI4Key =>
val dataBits = 512
Some(
FPGAManagedAXI4Params(
// This value was chosen arbitrarily. Vitis makes it natural to
// request multiples of 1 GiB, and we may wish to expand this as after some
// performance analysis.
size = 4096 * 1024,
dataBits = dataBits,
// This was chosen to match the AXI4 recommendations and could change.
idBits = 4,
// Don't support narrow reads/writes, and cap at a page per the AXI5 spec
writeTransferSizes = TransferSizes(dataBits / 8, 4096),
readTransferSizes = TransferSizes(dataBits / 8, 4096),
)
)
case StreamEngineInstantiatorKey =>
(e: StreamEngineParameters, p: Parameters) => new FPGAManagedStreamEngine(p, e)
// Notes on width selection for the control bus
// Address: This needs further investigation. 12 may not be sufficient when using many auto counters
// ID: AXI4Lite does not use ID bits. Use one here since Nasti (which
// lacks a native AXI4LITE implementation) can't handle 0-width wires.
case CtrlNastiKey => NastiParameters(32, 12, 1)
case HostMemChannelKey =>
HostMemChannelParams(
size = 0x400000000L, // 16 GiB
beatBytes = 8,
idBits = 16,
)
// This could be as many as four on a U250, but support for the other
// channels requires adding address offsets in the shim (TODO).
case HostMemNumChannels => 1
// We don't need to provide circuit paths because
// 1) The Shim module is the top-level of the kernel
// 2) Implementation constraints are scoped to the kernel level in our vitis flow
case PreLinkCircuitPath => None
case PostLinkCircuitPath => None
}) ++ new SimConfig)
// Turns on all additional synthesizable debug features for checking the
// implementation of the simulator.
class HostDebugFeatures
extends Config((_, _, _) => { case GenerateTokenIrrevocabilityAssertions =>
true
})
class WithPCIMPorts
extends Config((_, _, _) => {
case F1ShimHasPCIMPorts => true
case FPGAStreamEngineInstantiatorKey =>
(e: StreamEngineParameters, p: Parameters) => new FPGAManagedStreamEngine(p, e)
case FPGAManagedAXI4Key =>
Some(
FPGAManagedAXI4Params(
size = BigInt(1) << 64, // 128GB (size of Bar 4)
dataBits = 512, // 512 bits set by FireSim default
idBits = 6, // 6 is a guess; based upon CPUManagedAXI4Params
writeTransferSizes = TransferSizes(512 / 8), // Default for Firesim
readTransferSizes = TransferSizes(512 / 8), // Default for Firesim
interleavedId = Some(0), // Interleaved not currentlky supported therefore 0
)
)
})
class EC2F1Config
extends Config(
new WithPCIMPorts ++
new F1Config
)
class EC2F2Config
extends Config(
new WithPCIMPorts ++
new F2Config
)
case object FireAxeNoCPartitionPass extends Field[Boolean](false)
case object FireAxeQSFPConnections extends Field[Boolean](false)
case object FireAxePCIMConnections extends Field[Boolean](false)
case object FireAxePCISConnections extends Field[Boolean](false)
case object FireAxePreserveTarget extends Field[Boolean](false)
case object FireAxePartitionGlobalInfo extends Field[Option[Seq[Seq[String]]]](None)
case object FireAxePartitionIndex extends Field[Option[Int]](None)
class WithFireAxePreserveTarget
extends Config((_, _, _) => { case midas.FireAxePreserveTarget =>
true
})
class WithFireAxeNoCPart
extends Config((_, _, _) => { case midas.FireAxeNoCPartitionPass =>
true
})
class WithQSFP
extends Config((_, _, _) => {
case midas.FireAxeQSFPConnections => true
case midas.FireAxePCIMConnections => false
case midas.FireAxePCISConnections => false
})
class WithPCIS
extends Config((_, _, _) => {
case midas.FireAxeQSFPConnections => false
case midas.FireAxePCIMConnections => false
case midas.FireAxePCISConnections => true
})
class WithPCIM
extends Config((_, _, _) => {
case midas.FireAxeQSFPConnections => false
case midas.FireAxePCIMConnections => true
case midas.FireAxePCISConnections => false
})
class WithPartitionGlobalInfo(info: Seq[Seq[String]])
extends Config((_, _, _) => { case midas.FireAxePartitionGlobalInfo =>
Some(info)
})
class WithPartitionBase
extends Config((_, _, _) => { case midas.FireAxePartitionIndex =>
None
})
class WithPartitionIndex(index: Int)
extends Config((_, _, _) => { case midas.FireAxePartitionIndex =>
Some(index)
})
class ExactMode extends WithFireAxePreserveTarget