summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/RawModuleSpec.scala
diff options
context:
space:
mode:
authorAditya Naik2023-11-23 03:11:56 -0800
committerAditya Naik2023-11-23 03:11:56 -0800
commitaf415532cf160e63e971ceb301833b8433c18a50 (patch)
tree1fef70139846f57298c8e24a590490a74249f7dd /src/test/scala/chiselTests/RawModuleSpec.scala
parent8200c0cdf1d471453946d5ae24bc99757b2ef02d (diff)
cleanup
Diffstat (limited to 'src/test/scala/chiselTests/RawModuleSpec.scala')
-rw-r--r--src/test/scala/chiselTests/RawModuleSpec.scala90
1 files changed, 0 insertions, 90 deletions
diff --git a/src/test/scala/chiselTests/RawModuleSpec.scala b/src/test/scala/chiselTests/RawModuleSpec.scala
deleted file mode 100644
index 95687e82..00000000
--- a/src/test/scala/chiselTests/RawModuleSpec.scala
+++ /dev/null
@@ -1,90 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-
-package chiselTests
-
-import chisel3._
-import chisel3.stage.ChiselStage
-import chisel3.testers.BasicTester
-
-class UnclockedPlusOne extends RawModule {
- val in = IO(Input(UInt(32.W)))
- val out = IO(Output(UInt(32.W)))
-
- out := in + 1.asUInt
-}
-
-class RawModuleTester extends BasicTester {
- val plusModule = Module(new UnclockedPlusOne)
- plusModule.in := 42.U
- assert(plusModule.out === 43.U)
- stop()
-}
-
-class PlusOneModule extends Module {
- val io = IO(new Bundle {
- val in = Input(UInt(32.W))
- val out = Output(UInt(32.W))
- })
- io.out := io.in + 1.asUInt
-}
-
-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
- out := plusModule.io.out
- }
-}
-
-class ImplicitModuleInRawModuleTester extends BasicTester {
- val plusModule = Module(new RawModuleWithImplicitModule)
- plusModule.clk := clock
- plusModule.rst := reset
- plusModule.in := 42.U
- assert(plusModule.out === 43.U)
- stop()
-}
-
-class RawModuleWithDirectImplicitModule extends RawModule {
- val plusModule = Module(new PlusOneModule)
-}
-
-class ImplicitModuleDirectlyInRawModuleTester extends BasicTester {
- val plusModule = Module(new RawModuleWithDirectImplicitModule)
- stop()
-}
-
-class RawModuleSpec extends ChiselFlatSpec with Utils {
- "RawModule" should "elaborate" in {
- ChiselStage.elaborate { new RawModuleWithImplicitModule }
- }
-
- "RawModule" should "work" in {
- assertTesterPasses({ new RawModuleTester })
- }
-
- "ImplicitModule in a withClock block in a RawModule" should "work" in {
- assertTesterPasses({ new ImplicitModuleInRawModuleTester })
- }
-
- "ImplicitModule directly in a RawModule" should "fail" in {
- intercept[chisel3.internal.ChiselException] {
- extractCause[ChiselException] {
- ChiselStage.elaborate { new RawModuleWithDirectImplicitModule }
- }
- }
- }
-
- "ImplicitModule directly in a RawModule in an ImplicitModule" should "fail" in {
- intercept[chisel3.internal.ChiselException] {
- extractCause[ChiselException] {
- ChiselStage.elaborate { new ImplicitModuleDirectlyInRawModuleTester }
- }
- }
- }
-}