summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/aop/InjectionSpec.scala
diff options
context:
space:
mode:
authorJack Koenig2022-01-10 10:39:52 -0800
committerJack Koenig2022-01-10 15:53:55 -0800
commit3131c0daad41dea78bede4517669e376c41a325a (patch)
tree55baed78a6a01f80ff3952a08233ca553a19964f /src/test/scala/chiselTests/aop/InjectionSpec.scala
parentdd36f97a82746cec0b25b94651581fe799e24579 (diff)
Apply scalafmt
Command: sbt scalafmtAll
Diffstat (limited to 'src/test/scala/chiselTests/aop/InjectionSpec.scala')
-rw-r--r--src/test/scala/chiselTests/aop/InjectionSpec.scala63
1 files changed, 36 insertions, 27 deletions
diff --git a/src/test/scala/chiselTests/aop/InjectionSpec.scala b/src/test/scala/chiselTests/aop/InjectionSpec.scala
index a28501a5..9b29b0ba 100644
--- a/src/test/scala/chiselTests/aop/InjectionSpec.scala
+++ b/src/test/scala/chiselTests/aop/InjectionSpec.scala
@@ -38,12 +38,15 @@ object InjectionHierarchy {
val in = Input(Bool())
})
//scalastyle:off regex
- setInline("SubmoduleC.v", s"""
- |module SubmoduleC(
- | input io_in
- |);
- |endmodule
- """.stripMargin)
+ setInline(
+ "SubmoduleC.v",
+ s"""
+ |module SubmoduleC(
+ | input io_in
+ |);
+ |endmodule
+ """.stripMargin
+ )
}
class AspectTester(results: Seq[Int]) extends BasicTester {
@@ -63,26 +66,26 @@ object InjectionHierarchy {
class InjectionSpec extends ChiselFlatSpec with Utils {
import InjectionHierarchy._
val correctValueAspect = InjectingAspect(
- {dut: AspectTester => Seq(dut)},
- {dut: AspectTester =>
- for(i <- 0 until dut.values.length) {
+ { dut: AspectTester => Seq(dut) },
+ { dut: AspectTester =>
+ for (i <- 0 until dut.values.length) {
dut.values(i) := i.U
}
}
)
val wrongValueAspect = InjectingAspect(
- {dut: AspectTester => Seq(dut)},
- {dut: AspectTester =>
- for(i <- 0 until dut.values.length) {
+ { dut: AspectTester => Seq(dut) },
+ { dut: AspectTester =>
+ for (i <- 0 until dut.values.length) {
dut.values(i) := (i + 1).U
}
}
)
val manipulateSubmoduleAspect = InjectingAspect(
- {dut: SubmoduleManipulationTester => Seq(dut)},
- {dut: SubmoduleManipulationTester =>
+ { dut: SubmoduleManipulationTester => Seq(dut) },
+ { dut: SubmoduleManipulationTester =>
val moduleSubmoduleB = Module(new SubmoduleB)
moduleSubmoduleB.io.in := dut.moduleSubmoduleA.io.out
//if we're here then we've elaborated correctly
@@ -91,8 +94,8 @@ class InjectionSpec extends ChiselFlatSpec with Utils {
)
val duplicateSubmoduleAspect = InjectingAspect(
- {dut: SubmoduleManipulationTester => Seq(dut)},
- {_: SubmoduleManipulationTester =>
+ { dut: SubmoduleManipulationTester => Seq(dut) },
+ { _: SubmoduleManipulationTester =>
// By creating a second SubmoduleA, the module names would conflict unless they were uniquified
val moduleSubmoduleA2 = Module(new SubmoduleA)
//if we're here then we've elaborated correctly
@@ -101,8 +104,8 @@ class InjectionSpec extends ChiselFlatSpec with Utils {
)
val addingExternalModules = InjectingAspect(
- {dut: SubmoduleManipulationTester => Seq(dut)},
- {_: SubmoduleManipulationTester =>
+ { dut: SubmoduleManipulationTester => Seq(dut) },
+ { _: SubmoduleManipulationTester =>
// By creating a second SubmoduleA, the module names would conflict unless they were uniquified
val moduleSubmoduleC = Module(new SubmoduleC)
//if we're here then we've elaborated correctly
@@ -123,30 +126,36 @@ class InjectionSpec extends ChiselFlatSpec with Utils {
)
"Test" should "pass if inserted the correct values" in {
- assertTesterPasses{ new AspectTester(Seq(0, 1, 2)) }
+ assertTesterPasses { new AspectTester(Seq(0, 1, 2)) }
}
"Test" should "fail if inserted the wrong values" in {
- assertTesterFails{ new AspectTester(Seq(9, 9, 9)) }
+ assertTesterFails { new AspectTester(Seq(9, 9, 9)) }
}
"Test" should "pass if pass wrong values, but correct with aspect" in {
- assertTesterPasses({ new AspectTester(Seq(9, 9, 9))} , Nil, Seq(correctValueAspect) ++ TesterDriver.verilatorOnly)
+ assertTesterPasses({ new AspectTester(Seq(9, 9, 9)) }, Nil, Seq(correctValueAspect) ++ TesterDriver.verilatorOnly)
}
"Test" should "pass if pass wrong values, then wrong aspect, then correct aspect" in {
assertTesterPasses(
- new AspectTester(Seq(9, 9, 9)), Nil, Seq(wrongValueAspect, correctValueAspect) ++ TesterDriver.verilatorOnly
+ new AspectTester(Seq(9, 9, 9)),
+ Nil,
+ Seq(wrongValueAspect, correctValueAspect) ++ TesterDriver.verilatorOnly
)
}
"Test" should "fail if pass wrong values, then correct aspect, then wrong aspect" in {
- assertTesterFails({ new AspectTester(Seq(9, 9, 9))} , Nil, Seq(correctValueAspect, wrongValueAspect))
+ assertTesterFails({ new AspectTester(Seq(9, 9, 9)) }, Nil, Seq(correctValueAspect, wrongValueAspect))
}
"Test" should "pass if the submodules in SubmoduleManipulationTester can be manipulated by manipulateSubmoduleAspect" in {
- assertTesterPasses({ new SubmoduleManipulationTester} , Nil, Seq(manipulateSubmoduleAspect) ++ TesterDriver.verilatorOnly)
+ assertTesterPasses(
+ { new SubmoduleManipulationTester },
+ Nil,
+ Seq(manipulateSubmoduleAspect) ++ TesterDriver.verilatorOnly
+ )
}
"Module name collisions when adding a new module" should "be resolved" in {
assertTesterPasses(
- { new SubmoduleManipulationTester},
+ { new SubmoduleManipulationTester },
Nil,
Seq(duplicateSubmoduleAspect) ++ TesterDriver.verilatorOnly
)
@@ -154,7 +163,7 @@ class InjectionSpec extends ChiselFlatSpec with Utils {
"Adding external modules" should "work" in {
assertTesterPasses(
- { new SubmoduleManipulationTester},
+ { new SubmoduleManipulationTester },
Nil,
Seq(addingExternalModules) ++ TesterDriver.verilatorOnly
)
@@ -162,7 +171,7 @@ class InjectionSpec extends ChiselFlatSpec with Utils {
"Injection into multiple submodules of the same class" should "work" in {
assertTesterPasses(
- {new MultiModuleInjectionTester},
+ { new MultiModuleInjectionTester },
Nil,
Seq(multiModuleInjectionAspect) ++ TesterDriver.verilatorOnly
)