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) } } }
- Alphabetic
- By Inheritance
- ChiselUtestTester
- TestEnvInterface
- TestSuite
- Executor
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
tests: Tests
- Definition Classes
- TestSuite
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
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
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
val
batchedFailures: ArrayBuffer[Exception]
- Attributes
- protected
- Definition Classes
- TestEnvInterface
-
def
bigintToHex(x: BigInt): String
- Attributes
- protected
- Definition Classes
- TestEnvInterface
-
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
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getExpectDetailedTrace(trace: Seq[StackTraceElement], inFile: String): String
- Attributes
- protected
- Definition Classes
- TestEnvInterface
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
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
-
def
testerExpect(expected: BigInt, actual: BigInt, signal: String, msg: Option[String], decode: Option[(BigInt) ⇒ 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
-
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
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
val
topFileName: Option[String]
- Definition Classes
- ChiselUtestTester → TestEnvInterface
-
def
utestAfterAll(): Unit
- Definition Classes
- Executor
-
def
utestAfterEach(path: Seq[String]): Unit
- Definition Classes
- Executor
-
def
utestBeforeEach(path: Seq[String]): Unit
- Definition Classes
- Executor
-
def
utestFormatter: Formatter
- Definition Classes
- ChiselUtestTester → TestSuite
-
def
utestWrap(path: Seq[String], runBody: ⇒ Future[Any])(implicit ec: ExecutionContext): Future[Any]
- Definition Classes
- Executor
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
Deprecated Value Members
-
macro
def
apply(expr: Unit): Tests
- Definition Classes
- TestSuite
- Annotations
- @deprecated
- Deprecated
Use
utest.Tests{...}
instead