-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
rift2Chip_tb.scala
195 lines (145 loc) · 5.07 KB
/
rift2Chip_tb.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
package test
/*
Copyright (c) 2020 - 2024 Wuhan University of Technology <295054118@whut.edu.cn>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import chisel3.stage.ChiselGeneratorAnnotation
import circt.stage.{ChiselStage, FirtoolOption}
import rift2Chip._
import freechips.rocketchip.diplomacy._
class Rift2GoCfg extends Rift2330
class NormalCfg extends Rift2370
object testMain extends App {
// val cfg = new NormalCfg
// val cfg = new Rift2GoCfg
// val cfg = new Rift2350
val cfg = new Rift2330
// circt.stage.ChiselStage.emitSystemVerilogFile(
// gen = LazyModule(new Rift2Chip()(cfg)).module,
// firtoolOpts = Array("--disable-annotation-unknown", "--dedup")
// )
(new circt.stage.ChiselStage).execute(
Array(
"--target-dir", "generated/Main",
"--target", "verilog",
"--split-verilog",
// "--split-verilog",
) ++ args,
Seq(
chisel3.stage.ChiselGeneratorAnnotation( () => {
val soc = LazyModule(new Rift2Chip()(cfg))
soc.module
}),
circt.stage.FirtoolOption("--disable-annotation-unknown"),
circt.stage.FirtoolOption( "--dedup"),
)
)
// val fir = circt.stage.ChiselStage.emitCHIRRTL(
// gen = LazyModule(new Rift2Chip()(cfg)).module,
// args = Array(
// // "--target-dir", "generated/Main",
// // "--target", "verilog",
// // "--split-verilog",
// // "--split-verilog",
// ) ++ args,
// )
// import java.io._
// val writer = new PrintWriter(new File("Rift2Chip.fir" ))
// writer.write(s"$fir")
// writer.close()
}
// object testNoC extends App {
// val cfg = new Rift2330
// (new circt.stage.ChiselStage).execute( Array("--show-registrations", "--full-stacktrace", "--target-dir", "generated/Main") ++ args, Seq(
// ChiselGeneratorAnnotation(() => {
// val soc = LazyModule(new Rift2NoC()(cfg))
// soc.module
// })
// ))
// }
object tapeMain extends App {
// val cfg = new Rift2300
val cfg = new Rift2330
// val cfg = new Rift2350
// val cfg = new Rift2370
(new circt.stage.ChiselStage).execute( Array( "--target-dir", "generated/Main", "-E", "verilog") ++ args, Seq(//, "--gen-mem-verilog", "true"
ChiselGeneratorAnnotation(() => {
val soc = LazyModule(new Rift2Link()(cfg))
soc.module
})
))
(new circt.stage.ChiselStage).execute( Array( "--target-dir", "generated/TapeMain", "-E", "verilog") ++ args, Seq(//, "--gen-mem-verilog", "true"
ChiselGeneratorAnnotation(() => {
val soc = LazyModule(new Rift2LinkA(isFlatten = true)(cfg))
soc.module
})
))
(new circt.stage.ChiselStage).execute( Array( "--target-dir", "generated/TapeSim", "-E", "verilog") ++ args, Seq(
ChiselGeneratorAnnotation(() => {
val soc = LazyModule(new Rift2LinkB()(cfg))
soc.module
})
))
}
object testAll extends App {
val config = Seq(
(new Rift2300, "Rift2300" ),
(new Rift2310, "Rift2310" ),
(new Rift2320, "Rift2320" ),
(new Rift2330, "Rift2330" ),
(new Rift2340, "Rift2340" ),
(new Rift2350, "Rift2350" ),
(new Rift2360, "Rift2360" ),
(new Rift2370, "Rift2370" ),
(new Rift2380, "Rift2380" ),
(new Rift2390, "Rift2390" ),
)
config.map{ cfg =>
println("Compiling " + cfg._2)
// (new circt.stage.ChiselStage).execute( Array( "--target-dir", "generated/Release/"++cfg._2, "-E", "verilog" ) ++ args, Seq(
// ChiselGeneratorAnnotation(() => {
// val soc = LazyModule(new Rift2Chip(isFlatten = true)(cfg._1))
// soc.module
// })
// ))
(new circt.stage.ChiselStage).execute(
Array(
"--target-dir", "generated/Debug/"++cfg._2,
"--target", "verilog",
"--split-verilog",
) ++ args,
Seq(
chisel3.stage.ChiselGeneratorAnnotation( () => {
val soc = LazyModule(new Rift2Chip(isFlatten = false)(cfg._1))
soc.module
}),
circt.stage.FirtoolOption("--disable-annotation-unknown"),
circt.stage.FirtoolOption( "--dedup"),
)
)
}
}
// import rift2Core.backend.fpu._
// object testModule extends App {
// (new chisel3.stage.ChiselStage).execute(args, Seq(
// ChiselGeneratorAnnotation(() => {
// new Reservation_fpu()
// })
// ))
// }
import rift2Core.backend._
object testModule extends App {
(new circt.stage.ChiselStage).execute(args, Seq(
ChiselGeneratorAnnotation(() => {
new SVPWM(4096)
})
))
}