-
Notifications
You must be signed in to change notification settings - Fork 193
/
rocket.scala
394 lines (341 loc) · 11.5 KB
/
rocket.scala
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
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
package Vivado
import Chisel._
import org.chipsalliance.cde.config.{Config, Parameters}
import freechips.rocketchip.devices.debug.DebugModuleKey
import freechips.rocketchip.diplomacy._
import freechips.rocketchip.subsystem._
import freechips.rocketchip.devices.tilelink._
import freechips.rocketchip.tile.{BuildRoCC, OpcodeSet}
import freechips.rocketchip.util.DontTouch
import freechips.rocketchip.system._
class RocketSystem(implicit p: Parameters) extends RocketSubsystem
with HasAsyncExtInterrupts
with CanHaveMasterAXI4MemPort
with CanHaveMasterAXI4MMIOPort
with CanHaveSlaveAXI4Port
{
val bootROM = p(BootROMLocated(location)).map { BootROM.attach(_, this, CBUS) }
override lazy val module = new RocketSystemModuleImp(this)
}
class RocketSystemModuleImp[+L <: RocketSystem](_outer: L) extends RocketSubsystemModuleImp(_outer)
with HasRTCModuleImp
with HasExtInterruptsModuleImp
with DontTouch
class WithGemmini(mesh_size: Int, bus_bits: Int) extends Config((site, here, up) => {
case BuildRoCC => up(BuildRoCC) ++ Seq(
(p: Parameters) => {
implicit val q = p
implicit val v = implicitly[ValName]
LazyModule(new gemmini.Gemmini(gemmini.GemminiConfigs.defaultConfig.copy(
meshRows = mesh_size, meshColumns = mesh_size, dma_buswidth = bus_bits)))
}
)
case SystemBusKey => up(SystemBusKey).copy(beatBytes = bus_bits/8)
})
class WithDebugProgBuf(prog_buf_words: Int, imp_break: Boolean) extends Config((site, here, up) => {
case DebugModuleKey => up(DebugModuleKey, site).map(_.copy(nProgramBufferWords = prog_buf_words, hasImplicitEbreak = imp_break))
})
/*----------------- 32-bit RocketChip ---------------*/
/* Note: Linux not supported yet on 32-bit cores */
/* 32-bit config, max memory 2GB */
class Rocket32BaseConfig extends Config(
new WithBootROMFile("workspace/bootrom.img") ++
new WithExtMemSize(0x80000000L) ++
new WithNExtTopInterrupts(8) ++
new WithDTS("freechips,rocketchip-vivado", Nil) ++
new WithDebugSBA ++
new WithEdgeDataBits(64) ++
new WithCoherentBusTopology ++
new WithoutTLMonitors ++
new BaseConfig)
class Rocket32s1 extends Config(
new WithNBreakpoints(8) ++
new WithNSmallCores(1) ++
new WithRV32 ++
new Rocket32BaseConfig)
class Rocket32s2 extends Config(
new WithNBreakpoints(8) ++
new WithNSmallCores(2) ++
new WithRV32 ++
new Rocket32BaseConfig)
/* With exposed JTAG port */
class Rocket32s2j extends Config(
new WithNBreakpoints(8) ++
new WithJtagDTM ++
new WithNSmallCores(2) ++
new WithRV32 ++
new Rocket32BaseConfig)
class Rocket32s4 extends Config(
new WithNBreakpoints(8) ++
new WithNSmallCores(4) ++
new WithRV32 ++
new Rocket32BaseConfig)
class Rocket32s8 extends Config(
new WithNBreakpoints(8) ++
new WithNSmallCores(8) ++
new WithRV32 ++
new Rocket32BaseConfig)
class Rocket32s16 extends Config(
new WithNBreakpoints(8) ++
new WithNSmallCores(16) ++
new WithRV32 ++
new Rocket32BaseConfig)
/*----------------- 64-bit RocketChip ---------------*/
/*
* WithExtMemSize(0x380000000L) = 14GB (16GB minus 2GB for IO) is max supported by the base config.
* Actual memory size depends on the target board.
* The Makefile changes the size to correct value during build.
* It also sets right core clock frequency.
*/
class RocketBaseConfig extends Config(
new WithBootROMFile("workspace/bootrom.img") ++
new WithExtMemSize(0x380000000L) ++
new WithNExtTopInterrupts(8) ++
new WithDTS("freechips,rocketchip-vivado", Nil) ++
new WithDebugSBA ++
new WithEdgeDataBits(64) ++
new WithCoherentBusTopology ++
new WithoutTLMonitors ++
new BaseConfig)
class RocketWideBusConfig extends Config(
new WithBootROMFile("workspace/bootrom.img") ++
new WithExtMemSize(0x380000000L) ++
new WithNExtTopInterrupts(8) ++
new WithDTS("freechips,rocketchip-vivado", Nil) ++
new WithDebugSBA ++
new WithEdgeDataBits(256) ++
new WithCoherentBusTopology ++
new WithoutTLMonitors ++
new BaseConfig)
class Rocket64b1 extends Config(
new WithNBreakpoints(8) ++
new WithNBigCores(1) ++
new RocketBaseConfig)
class Rocket64b2 extends Config(
new WithNBreakpoints(8) ++
new WithNBigCores(2) ++
new RocketBaseConfig)
/* With exposed BSCAN port - the name must end with 'e' */
/* With up to 256GB memory */
/* Note: lower 2GB are used for memory mapped IO, so max usable RAM size is 254GB */
class Rocket64b2e extends Config(
new WithNBreakpoints(8) ++
new WithNBigCores(2) ++
new WithExtMemSize(0x3f80000000L) ++
new RocketBaseConfig)
/* With up to 256GB memory */
/* Note: lower 2GB are used for memory mapped IO, so max usable RAM size is 254GB */
class Rocket64b2m extends Config(
new WithNBreakpoints(8) ++
new WithNBigCores(2) ++
new WithExtMemSize(0x3f80000000L) ++
new RocketBaseConfig)
/* With up to 256GB memory, 2 memory channels, L2 cache and wide memory bus */
class Rocket64b2m2 extends Config(
new WithNBreakpoints(8) ++
new WithNBigCores(2) ++
new WithExtMemSize(0x3f80000000L) ++
new WithNMemoryChannels(2) ++
new WithNBanks(4) ++
new WithInclusiveCache ++
new RocketWideBusConfig)
/* With up to 256GB memory, 4 memory channels, L2 cache and wide memory bus */
class Rocket64b4m4 extends Config(
new WithNBreakpoints(8) ++
new WithNBigCores(4) ++
new WithExtMemSize(0x3f80000000L) ++
new WithNMemoryChannels(4) ++
new WithNBanks(8) ++
new WithInclusiveCache ++
new RocketWideBusConfig)
/* With exposed JTAG port */
class Rocket64b2j extends Config(
new WithNBreakpoints(8) ++
new WithJtagDTM ++
new WithNBigCores(2) ++
new RocketBaseConfig)
/* Smaller debug module */
class Rocket64b2d1 extends Config(
new WithNBreakpoints(1) ++
new WithNBigCores(2) ++
new WithDebugProgBuf(1, true) ++
new RocketBaseConfig)
/* Smaller debug module */
class Rocket64b2d2 extends Config(
new WithNBreakpoints(2) ++
new WithNBigCores(2) ++
new WithDebugProgBuf(2, true) ++
new RocketBaseConfig)
/* Smaller debug module */
class Rocket64b2d3 extends Config(
new WithNBreakpoints(3) ++
new WithNBigCores(2) ++
new WithDebugProgBuf(2, false) ++
new RocketBaseConfig)
/* With 512KB level 2 cache */
/* Note: adding L2 cache reduces max CPU clock frequency */
class Rocket64b2l2 extends Config(
new WithInclusiveCache ++
new WithNBreakpoints(8) ++
new WithNBigCores(2) ++
new RocketBaseConfig)
/* With Gemmini 4x4 and 2 small cores */
/* Note: small core has no MMU and cannot boot mainstream Linux */
class Rocket64s2gem4 extends Config(
new WithGemmini(4, 64) ++
new WithInclusiveCache ++
new WithNBreakpoints(8) ++
new WithNSmallCores(2) ++
new RocketBaseConfig)
/* With Gemmini 4x4 and 2 medium cores */
/* Note: cannot get medium core to boot Linux: Oops - illegal instruction */
class Rocket64m2gem4 extends Config(
new WithGemmini(4, 64) ++
new WithInclusiveCache ++
new WithNBreakpoints(8) ++
new WithNMedCores(2) ++
new RocketBaseConfig)
/* With Gemmini 4x4 */
class Rocket64b1gem4 extends Config(
new WithGemmini(4, 64) ++
new WithInclusiveCache ++
new WithNBreakpoints(8) ++
new WithNBigCores(1) ++
new RocketBaseConfig)
/* With Gemmini 8x8 */
class Rocket64b1gem8 extends Config(
new WithGemmini(8, 64) ++
new WithInclusiveCache ++
new WithNBreakpoints(8) ++
new WithNBigCores(1) ++
new RocketBaseConfig)
/* With Gemmini 16x16 */
class Rocket64b1gem16 extends Config(
new WithGemmini(16, 64) ++
new WithInclusiveCache ++
new WithNBreakpoints(8) ++
new WithNBigCores(1) ++
new RocketBaseConfig)
/* With Gemmini 4x4, 2 big cores */
class Rocket64b2gem4 extends Config(
new WithGemmini(4, 64) ++
new WithInclusiveCache ++
new WithNBreakpoints(8) ++
new WithNBigCores(2) ++
new RocketBaseConfig)
/* With Gemmini 8x8, 2 big cores */
class Rocket64b2gem8 extends Config(
new WithGemmini(8, 64) ++
new WithInclusiveCache ++
new WithNBreakpoints(8) ++
new WithNBigCores(2) ++
new RocketBaseConfig)
/* With Gemmini 16x16, 2 big cores */
class Rocket64b2gem16 extends Config(
new WithGemmini(16, 64) ++
new WithInclusiveCache ++
new WithNBreakpoints(8) ++
new WithNBigCores(2) ++
new RocketBaseConfig)
class Rocket64b4 extends Config(
new WithNBreakpoints(8) ++
new WithNBigCores(4) ++
new RocketBaseConfig)
/* With level 2 cache and wide memory bus */
class Rocket64b4l2w extends Config(
new WithInclusiveCache ++
new WithNBreakpoints(8) ++
new WithNBigCores(4) ++
new RocketWideBusConfig)
class Rocket64b8 extends Config(
new WithNBreakpoints(8) ++
new WithNBigCores(8) ++
new RocketBaseConfig)
class Rocket64b16m extends Config(
new WithNBreakpoints(4) ++
new WithNBigCores(16) ++
new WithExtMemSize(0x3f80000000L) ++
new RocketBaseConfig)
class Rocket64b24m extends Config(
new WithNBreakpoints(4) ++
new WithNBigCores(24) ++
new WithExtMemSize(0x3f80000000L) ++
new RocketBaseConfig)
class Rocket64b32m extends Config(
new WithNBreakpoints(4) ++
new WithNBigCores(32) ++
new WithExtMemSize(0x3f80000000L) ++
new RocketBaseConfig)
/* Without slave port - for use in HDL simulation */
class Rocket64b2s extends Config(
new WithNBigCores(2) ++
new WithBootROMFile("workspace/bootrom.img") ++
new WithExtMemSize(0x40000000) ++
new WithNExtTopInterrupts(8) ++
new WithEdgeDataBits(64) ++
new WithCoherentBusTopology ++
new WithoutTLMonitors ++
new WithNoSlavePort ++
new BaseConfig)
/*----------------- Sonic BOOM ---------------*/
class Rocket64w1 extends Config(
new WithNBreakpoints(8) ++
new boom.common.WithNSmallBooms(1) ++
new RocketBaseConfig)
class Rocket64x1 extends Config(
new WithInclusiveCache ++
new WithNBreakpoints(8) ++
new boom.common.WithNMediumBooms(1) ++
new RocketWideBusConfig)
/* Note: multi-core BOOM appears unstable */
class Rocket64x2 extends Config(
new WithInclusiveCache ++
new WithNBreakpoints(8) ++
new boom.common.WithNMediumBooms(2) ++
new RocketWideBusConfig)
class Rocket64x4 extends Config(
new WithInclusiveCache ++
new WithNBreakpoints(8) ++
new boom.common.WithNMediumBooms(4) ++
new RocketWideBusConfig)
class Rocket64x8 extends Config(
new WithInclusiveCache ++
new WithNBreakpoints(4) ++
new boom.common.WithNMediumBooms(8) ++
new RocketWideBusConfig)
class Rocket64x12 extends Config(
new WithInclusiveCache ++
new WithNBreakpoints(4) ++
new boom.common.WithNMediumBooms(12) ++
new RocketWideBusConfig)
/* With up to 256GB memory, 4 memory channels */
/* Note: lower 2GB are used for memory mapped IO, so max usable RAM size is 254GB */
class Rocket64x12m4 extends Config(
new WithNBreakpoints(4) ++
new boom.common.WithNMediumBooms(12) ++
new WithExtMemSize(0x3f80000000L) ++
new WithNMemoryChannels(4) ++
new WithNBanks(8) ++
new WithInclusiveCache ++
new RocketWideBusConfig)
/* Note: 3-way BOOM appears unstable */
class Rocket64y1 extends Config(
new WithInclusiveCache ++
new WithNBreakpoints(8) ++
new boom.common.WithNLargeBooms(1) ++
new RocketWideBusConfig)
/* Note: 4-way BOOM appears unstable */
class Rocket64z1 extends Config(
new WithInclusiveCache ++
new WithNBreakpoints(8) ++
new boom.common.WithNMegaBooms(1) ++
new RocketWideBusConfig)
/* With up to 256GB memory */
/* Note: lower 2GB are used for memory mapped IO, so max usable RAM size is 254GB */
/* Note: 4-way BOOM appears unstable */
class Rocket64z2m extends Config(
new WithInclusiveCache ++
new WithNBreakpoints(8) ++
new boom.common.WithNMegaBooms(2) ++
new WithExtMemSize(0x3f80000000L) ++
new RocketWideBusConfig)