XSTester.scala (39c59369af6e7d78fa72e13aae3735f1a6e98f5c) XSTester.scala (8891a219bbc84f568e1d134854d8d5ed86d6d560)
1package xiangshan
2
3import chisel3._
1package xiangshan
2
3import chisel3._
4import chipsalliance.rocketchip.config.Config
4import org.chipsalliance.cde.config.Config
5import chiseltest._
6import chiseltest.{VerilatorBackendAnnotation, WriteVcdAnnotation}
7import chiseltest.simulator.{VerilatorCFlags, VerilatorFlags}
8import firrtl.AnnotationSeq
9import firrtl.stage.RunFirrtlTransformAnnotation
10import org.scalatest.flatspec._
11import org.scalatest.matchers.should._
5import chiseltest._
6import chiseltest.{VerilatorBackendAnnotation, WriteVcdAnnotation}
7import chiseltest.simulator.{VerilatorCFlags, VerilatorFlags}
8import firrtl.AnnotationSeq
9import firrtl.stage.RunFirrtlTransformAnnotation
10import org.scalatest.flatspec._
11import org.scalatest.matchers.should._
12
12import top.{ArgParser, DefaultConfig}
13import top.{ArgParser, DefaultConfig}
13import xiangshan.backend.regfile.IntPregParams
14
15abstract class XSTester extends AnyFlatSpec with ChiselScalatestTester with Matchers with HasTestAnnos {
16 behavior of "XiangShan Module"
17 val defaultConfig = (new DefaultConfig)
18 implicit val config = defaultConfig.alterPartial({
19 // Get XSCoreParams and pass it to the "small module"
20 case XSCoreParamsKey => defaultConfig(XSTileKey).head.copy(
21 // Example of how to change params
14
15abstract class XSTester extends AnyFlatSpec with ChiselScalatestTester with Matchers with HasTestAnnos {
16 behavior of "XiangShan Module"
17 val defaultConfig = (new DefaultConfig)
18 implicit val config = defaultConfig.alterPartial({
19 // Get XSCoreParams and pass it to the "small module"
20 case XSCoreParamsKey => defaultConfig(XSTileKey).head.copy(
21 // Example of how to change params
22 intPreg = IntPregParams(
23 numEntries = 64,
24 numRead = Some(14),
25 numWrite = Some(8),
26 ),
22 IssQueSize = 12
27 )
28 })
29}
30
31trait HasTestAnnos {
32 var testAnnos: AnnotationSeq = Seq()
33}
34
35trait DumpVCD { this: HasTestAnnos =>
36 testAnnos = testAnnos :+ WriteVcdAnnotation
37}
38
39trait UseVerilatorBackend { this: HasTestAnnos =>
40 testAnnos = testAnnos ++ Seq(VerilatorBackendAnnotation)
41}
23 )
24 })
25}
26
27trait HasTestAnnos {
28 var testAnnos: AnnotationSeq = Seq()
29}
30
31trait DumpVCD { this: HasTestAnnos =>
32 testAnnos = testAnnos :+ WriteVcdAnnotation
33}
34
35trait UseVerilatorBackend { this: HasTestAnnos =>
36 testAnnos = testAnnos ++ Seq(VerilatorBackendAnnotation)
37}