Packages

t

chiseltest

ChiselUtestTester

trait ChiselUtestTester extends TestSuite with TestEnvInterface

Using utest as test framework

// define test spec in trait
trait HasTestChipSpec {
  import chisel3.tester._
  def testChipSpec(dut: TestChip): Unit = { c =>
    // body of the unit test, c is a reference
    c.io.input.poke(1.U)
    c.io.output.expect(2.U)
  }
}

object SomeCircuitSpecTester extends ChiselUtestTester with HasSomeCircuitSpec {
  // define test by Tests macro
  val tests: Tests = Tests {
    // invoke test with test(""){}
    test("comments or name to a test"){
      // test function runs here
      testCircuit(new SomeCircuit, Seq(WriteVcdAnnotation))(SomeCircuitSpec)
    }
  }
}
Linear Supertypes
TestEnvInterface, TestSuite, Executor, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ChiselUtestTester
  2. TestEnvInterface
  3. TestSuite
  4. Executor
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def tests: Tests
    Definition Classes
    TestSuite

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addDefaultTargetDir(defaultDir: String, annotationSeq: AnnotationSeq): AnnotationSeq

    Will add a TargetDirAnnotation with defaultDir with "test_run_dir" path prefix to the annotations if there is not a TargetDirAnnotation already present

    Will add a TargetDirAnnotation with defaultDir with "test_run_dir" path prefix to the annotations if there is not a TargetDirAnnotation already present

    defaultDir

    a default directory

    annotationSeq

    annotations to add it to, unless one is already there

    Definition Classes
    TestEnvInterface
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. val batchedFailures: ArrayBuffer[Exception]
    Attributes
    protected
    Definition Classes
    TestEnvInterface
  7. def checkpoint(): Unit

    If there are any failures, reports them and end the test now.

    If there are any failures, reports them and end the test now.

    Definition Classes
    TestEnvInterface
  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @HotSpotIntrinsicCandidate()
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  12. def getExpectDetailedTrace(trace: Seq[StackTraceElement], inFile: String): String
    Attributes
    protected
    Definition Classes
    TestEnvInterface
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  18. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  19. def testCircuit[T <: MultiIOModule](dutGen: ⇒ T, annotationSeq: AnnotationSeq = Seq.empty)(testFn: (T) ⇒ Unit)(implicit testPath: TestPath): Unit

    Since utest.test collides with chisel3.tester.RawTester.test, it is renamed to testCircuit, Here is a example to constructs a unit test harness for the Chisel Module PlusOne generated as dutGen.

    Since utest.test collides with chisel3.tester.RawTester.test, it is renamed to testCircuit, Here is a example to constructs a unit test harness for the Chisel Module PlusOne generated as dutGen.

    testCircuit(new PlusOne) { c =>
      // body of the unit test, c is a a reference
      c.io.input.poke(1.U)
      c.io.output.expect(2.U)
    }

    If you need to add your own AnnotationSeq to this test, you can add it as second parameter.

    For example:

    // WriteVcdAnnotation will ask backend export VCD file
    testCircuit(new PlusOne, Seq(WriteVcdAnnotation)) { c =>
      // body of the unit test, c is a a reference
      c.io.input.poke(1.U)
      c.io.output.expect(2.U)
    }
    T

    The DUT type, must be a subclass of MultiIOModule

    dutGen

    A generator of a Chisel Module

    Note

    This API is experimental and forward compatibility is not yet guaranteed

  20. def testerExpect(expected: Any, actual: Any, signal: String, msg: Option[String]): Unit

    Expect a specific value on a wire, calling testerFail if the expectation isn't met.

    Expect a specific value on a wire, calling testerFail if the expectation isn't met. Failures queued until the next checkpoint.

    Definition Classes
    TestEnvInterface
  21. def testerFail(msg: String): Unit

    Logs a tester failure at this point.

    Logs a tester failure at this point. Failures queued until the next checkpoint.

    Definition Classes
    TestEnvInterface
  22. def toString(): String
    Definition Classes
    AnyRef → Any
  23. val topFileName: Option[String]
    Definition Classes
    ChiselUtestTesterTestEnvInterface
  24. def utestAfterAll(): Unit
    Definition Classes
    Executor
  25. def utestAfterEach(path: Seq[String]): Unit
    Definition Classes
    Executor
  26. def utestBeforeEach(path: Seq[String]): Unit
    Definition Classes
    Executor
  27. def utestFormatter: Formatter
    Definition Classes
    ChiselUtestTester → TestSuite
  28. def utestWrap(path: Seq[String], runBody: ⇒ Future[Any])(implicit ec: ExecutionContext): Future[Any]
    Definition Classes
    Executor
  29. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  31. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. macro def apply(expr: Unit): Tests
    Definition Classes
    TestSuite
    Annotations
    @deprecated
    Deprecated

    Use utest.Tests{...} instead

  2. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from TestEnvInterface

Inherited from TestSuite

Inherited from Executor

Inherited from AnyRef

Inherited from Any

Ungrouped