diff options
| author | Richard Lin | 2017-05-03 15:13:09 -0700 |
|---|---|---|
| committer | GitHub | 2017-05-03 15:13:09 -0700 |
| commit | 7d085287640e76fa10903e4be9ffdd1cfed8acdb (patch) | |
| tree | e14d2d6c3700ed462cf29ee56db2d981ad6c76ee /src/test/scala/chiselTests | |
| parent | 989fbd5de53606cac85a9e6944c1f255f4cf04c9 (diff) | |
Clear clock and reset scope for RawModule (#607)
Diffstat (limited to 'src/test/scala/chiselTests')
| -rw-r--r-- | src/test/scala/chiselTests/RawModuleSpec.scala | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/test/scala/chiselTests/RawModuleSpec.scala b/src/test/scala/chiselTests/RawModuleSpec.scala index 180a1c04..b864a669 100644 --- a/src/test/scala/chiselTests/RawModuleSpec.scala +++ b/src/test/scala/chiselTests/RawModuleSpec.scala @@ -28,12 +28,12 @@ class PlusOneModule extends Module { io.out := io.in + 1.asUInt } -class RawModuleWithImpliitModule extends RawModule { +class RawModuleWithImplicitModule extends RawModule { val in = IO(Input(UInt(32.W))) val out = IO(Output(UInt(32.W))) val clk = IO(Input(Clock())) val rst = IO(Input(Bool())) - + withClockAndReset(clk, rst) { val plusModule = Module(new PlusOneModule) plusModule.io.in := in @@ -42,7 +42,7 @@ class RawModuleWithImpliitModule extends RawModule { } class ImplicitModuleInRawModuleTester extends BasicTester { - val plusModule = Module(new RawModuleWithImpliitModule) + val plusModule = Module(new RawModuleWithImplicitModule) plusModule.clk := clock plusModule.rst := reset plusModule.in := 42.U @@ -50,16 +50,38 @@ class ImplicitModuleInRawModuleTester extends BasicTester { stop() } +class RawModuleWithDirectImplicitModule extends RawModule { + val plusModule = Module(new PlusOneModule) +} + +class ImplicitModuleDirectlyInRawModuleTester extends BasicTester { + val plusModule = Module(new RawModuleWithDirectImplicitModule) + stop() +} + class RawModuleSpec extends ChiselFlatSpec { "RawModule" should "elaborate" in { - elaborate { new RawModuleWithImpliitModule } + elaborate { new RawModuleWithImplicitModule } } - + "RawModule" should "work" in { assertTesterPasses({ new RawModuleTester }) } - + "ImplicitModule in a withClock block in a RawModule" should "work" in { assertTesterPasses({ new ImplicitModuleInRawModuleTester }) } -}
\ No newline at end of file + + + "ImplicitModule directly in a RawModule" should "fail" in { + intercept[chisel3.internal.ChiselException] { + elaborate { new RawModuleWithDirectImplicitModule } + } + } + + "ImplicitModule directly in a RawModule in an ImplicitModule" should "fail" in { + intercept[chisel3.internal.ChiselException] { + elaborate { new ImplicitModuleDirectlyInRawModuleTester } + } + } +} |
