Trait

chiseltest

ChiselUtestTester

Related Doc: package chiseltest

Permalink

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

    Permalink
    Definition Classes
    TestSuite

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addDefaultTargetDir(defaultDir: String, annotationSeq: AnnotationSeq): AnnotationSeq

    Permalink

    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

    Permalink
    Definition Classes
    Any
  6. val batchedFailures: ArrayBuffer[Exception]

    Permalink
    Attributes
    protected
    Definition Classes
    TestEnvInterface
  7. def checkpoint(): Unit

    Permalink

    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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def getExpectDetailedTrace(trace: Seq[StackTraceElement], inFile: String): String

    Permalink
    Attributes
    protected
    Definition Classes
    TestEnvInterface
  14. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  20. def testCircuit[T <: MultiIOModule](dutGen: ⇒ T, annotationSeq: AnnotationSeq = Seq.empty)(testFn: (T) ⇒ Unit)(implicit testPath: TestPath): Unit

    Permalink

    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

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

    Permalink

    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
  22. def testerFail(msg: String): Unit

    Permalink

    Logs a tester failure at this point.

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

    Definition Classes
    TestEnvInterface
  23. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  24. val topFileName: Option[String]

    Permalink
    Definition Classes
    ChiselUtestTesterTestEnvInterface
  25. def utestAfterAll(): Unit

    Permalink
    Definition Classes
    Executor
  26. def utestAfterEach(path: Seq[String]): Unit

    Permalink
    Definition Classes
    Executor
  27. def utestBeforeEach(path: Seq[String]): Unit

    Permalink
    Definition Classes
    Executor
  28. def utestFormatter: Formatter

    Permalink
    Definition Classes
    ChiselUtestTester → TestSuite
  29. def utestWrap(path: Seq[String], runBody: ⇒ Future[Any])(implicit ec: ExecutionContext): Future[Any]

    Permalink
    Definition Classes
    Executor
  30. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. macro def apply(expr: Unit): Tests

    Permalink
    Definition Classes
    TestSuite
    Annotations
    @deprecated
    Deprecated

    Use utest.Tests{...} instead

Inherited from TestEnvInterface

Inherited from TestSuite

Inherited from Executor

Inherited from AnyRef

Inherited from Any

Ungrouped