-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathVexRiscvWB_small.scala
126 lines (120 loc) · 4.06 KB
/
VexRiscvWB_small.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
package vexriscv.demo
import vexriscv.plugin._
import vexriscv.{VexRiscv, VexRiscvConfig, plugin}
import spinal.core._
import spinal.lib._
object VexRiscvWB_small{
def main(args: Array[String]) {
//val report = SpinalConfig(mode = Verilog).generate{
val report = SpinalConfig(mode = VHDL).generate{
//CPU configuration
val cpuConfig = VexRiscvConfig(
plugins = List(
new IBusSimplePlugin(
resetVector = 0x00010000l,
cmdForkOnSecondStage = false,
cmdForkPersistence = false,
prediction = NONE,
catchAccessFault = false,
compressedGen = true
),
new DBusSimplePlugin(
catchAddressMisaligned = true,
catchAccessFault = false
),
new CsrPlugin(
CsrPluginConfig(
catchIllegalAccess = false,
mvendorid = null,
marchid = null,
mimpid = null,
mhartid = null,
misaExtensionsInit = 66,
misaAccess = CsrAccess.NONE,
mtvecAccess = CsrAccess.READ_WRITE, // required for xtvecModeGen
mtvecInit = 0x00010011l,
mepcAccess = CsrAccess.READ_WRITE, // required to access EPC from software
mscratchGen = false,
mcauseAccess = CsrAccess.READ_ONLY,
mbadaddrAccess = CsrAccess.NONE,
mcycleAccess = CsrAccess.NONE,
minstretAccess = CsrAccess.NONE,
ecallGen = true, // enable
wfiGenAsWait = false,
ucycleAccess = CsrAccess.NONE,
uinstretAccess = CsrAccess.NONE,
xtvecModeGen = true
)
),
new DecoderSimplePlugin(
catchIllegalInstruction = true
),
new RegFilePlugin(
regFileReadyKind = plugin.SYNC,
zeroBoot = false
),
new IntAluPlugin,
new MulPlugin,
new DivPlugin,
new SrcPlugin(
separatedAddSub = false,
executeInsertion = false
),
//new LightShifterPlugin,
new FullBarrelShifterPlugin,
new HazardSimplePlugin(
bypassExecute = true,
bypassMemory = true,
bypassWriteBack = true,
bypassWriteBackBuffer = true,
pessimisticUseSrc = false,
pessimisticWriteRegFile = false,
pessimisticAddressMatch = false
),
new DebugPlugin(
debugClockDomain = ClockDomain.current.clone(reset = Bool().setName("debugReset")),
hardwareBreakpointCount = 16
),
new BranchPlugin(
earlyBranch = false,
catchAddressMisaligned = true
),
new UserInterruptPlugin(
interruptName = "LocalInt0",
code = 16
),
new UserInterruptPlugin(
interruptName = "LocalInt1",
code = 17
),
new UserInterruptPlugin(
interruptName = "LocalInt2",
code = 18
),
new UserInterruptPlugin(
interruptName = "LocalInt3",
code = 19
),
new YamlPlugin("cpu0.yaml")
)
)
//CPU instanciation
val cpu = new VexRiscv(cpuConfig)
//CPU modifications to be an AhbLite3 one
cpu.rework {
for (plugin <- cpuConfig.plugins) plugin match {
case plugin: IBusSimplePlugin => {
plugin.iBus.setAsDirectionLess() //Unset IO properties of iBus
master(plugin.iBus.toWishbone()).setName("iBusWishbone")
}
case plugin: DBusSimplePlugin => {
plugin.dBus.setAsDirectionLess()
master(plugin.dBus.toWishbone()).setName("dBusWishbone")
}
case _ =>
}
}
cpu
}
}
}