-
Notifications
You must be signed in to change notification settings - Fork 700
/
Copy pathConfigs.scala
94 lines (78 loc) · 3.45 KB
/
Configs.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
package chipyard.fpga.zcu102
import sys.process._
import org.chipsalliance.cde.config.{Config, Parameters}
import freechips.rocketchip.subsystem.{SystemBusKey, ExtMem}
import freechips.rocketchip.devices.debug.{JTAG}
import freechips.rocketchip.devices.tilelink.{BootROMLocated}
import freechips.rocketchip.resources.{DTSTimebase}
import sifive.blocks.devices.spi.{PeripherySPIKey, SPIParams}
import sifive.blocks.devices.uart.{PeripheryUARTKey, UARTParams}
import sifive.fpgashells.shell.xilinx.{ZCU102ShellPMOD, ZCU102DDRSize}
import testchipip.serdes.{SerialTLKey}
import chipyard._
import chipyard.harness._
class WithDefaultPeripherals extends Config((site, here, up) => {
case PeripheryUARTKey => List(UARTParams(address = BigInt(0x64000000L)))
case PeripherySPIKey => List(SPIParams(rAddress = BigInt(0x64001000L)))
case ZCU102ShellPMOD => "SDIO"
})
class WithSystemModifications extends Config((site, here, up) => {
case DTSTimebase => BigInt((1e6).toLong)
case BootROMLocated(x) => up(BootROMLocated(x), site).map { p =>
val freqMHz = (site(SystemBusKey).dtsFrequency.get / (1000 * 1000)).toLong
val make = s"make -C fpga/src/main/resources/zcu102/sdboot PBUS_CLK=${freqMHz} bin"
require (make.! == 0, "Failed to build bootrom")
p.copy(hang = 0x10000, contentFileName = s"./fpga/src/main/resources/zcu102/sdboot/build/sdboot.bin")
}
case ExtMem => up(ExtMem, site).map(x => x.copy(master = x.master.copy(size = site(ZCU102DDRSize))))
case SerialTLKey => Nil
})
// DOC include start: AbstractZCU102 and Rocket
class WithZCU102Tweaks extends Config(
// clocking
new chipyard.harness.WithAllClocksFromHarnessClockInstantiator ++
new chipyard.clocking.WithPassthroughClockGenerator ++
new chipyard.config.WithUniformBusFrequencies(100) ++
new WithFPGAFrequency(100) ++ // default 100MHz freq
// harness binders
new WithUART ++
new WithSPISDCard ++
new WithDDRMem ++
new WithJTAG ++
// io binders
new chipyard.iobinders.WithUARTTSIPunchthrough ++ // Is it correctly?
new chipyard.iobinders.WithSPIIOPunchthrough ++ // Is it correctly?
// other configuration
new WithDefaultPeripherals ++
new chipyard.config.WithTLBackingMemory ++
new WithSystemModifications ++
// new chipyard.config.WithNoDebug ++
new freechips.rocketchip.subsystem.WithoutTLMonitors ++
new freechips.rocketchip.subsystem.WithNMemoryChannels(1)
)
class RocketZCU102Config extends Config(
new WithFPGAFrequency(25) ++
new WithZCU102Tweaks ++
new chipyard.RocketConfig)
// DOC include end: AbstractZCU102 and Rocket
class RocketZCU102ConfigWithHyp extends Config(
new freechips.rocketchip.system.HypervisorConfig ++ // Would like to support H-ext
new WithFPGAFrequency(25) ++
new WithZCU102Tweaks ++
new chipyard.RocketConfig)
class BoomZCU102Config extends Config(
new WithFPGAFrequency(50) ++
new WithZCU102Tweaks ++
new chipyard.MegaBoomV3Config)
class WithFPGAFrequency(fMHz: Double) extends Config(
new chipyard.harness.WithHarnessBinderClockFreqMHz(fMHz) ++
new chipyard.config.WithSystemBusFrequency(fMHz) ++
new chipyard.config.WithPeripheryBusFrequency(fMHz) ++
new chipyard.config.WithControlBusFrequency(fMHz) ++
new chipyard.config.WithFrontBusFrequency(fMHz) ++
new chipyard.config.WithMemoryBusFrequency(fMHz)
)
class WithFPGAFreq25MHz extends WithFPGAFrequency(25)
class WithFPGAFreq50MHz extends WithFPGAFrequency(50)
class WithFPGAFreq75MHz extends WithFPGAFrequency(75)
class WithFPGAFreq100MHz extends WithFPGAFrequency(100)