Skip to content

Commit

Permalink
[test] Migrate QueueFlushSpec to ChiselSim
Browse files Browse the repository at this point in the history
Migrate the integration test QueueFlushSpec from ChiselSpec to ChiselSim.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
  • Loading branch information
seldridge committed Feb 24, 2025
1 parent 6c2bc0a commit aab42b2
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions integration-tests/src/test/scala-2/chiselTest/QueueFlushSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ package chiselTests
import org.scalacheck._

import chisel3._
import chisel3.simulator.scalatest.ChiselSim
import chisel3.simulator.stimulus.RunUntilFinished
import chisel3.testers.{BasicTester, TesterDriver}
import chisel3.util._
import chisel3.util.random.LFSR
import org.scalatest.propspec.AnyPropSpec

/** Test elements can be enqueued and dequeued when flush is tied to false
*
Expand Down Expand Up @@ -230,59 +233,59 @@ class DequeueFullQueueEdgecaseTester(

}

class QueueFlushSpec extends ChiselPropSpec {
class QueueFlushSpec extends AnyPropSpec with PropertyUtils with ChiselSim {

property("Queue should have things pass through") {
forAll(vecSizes, safeUIntN(20), Gen.choose(0, 15), Gen.oneOf(true, false)) { (depth, se, tap, isSync) =>
whenever(se._1 >= 1 && depth >= 1 && se._2.nonEmpty) {
assertTesterPasses {
simulate {
new ThingsPassThroughFlushQueueTester(se._2, depth, se._1, tap, isSync)
}
}(RunUntilFinished(1024 * 10))
}
}
}
property("Queue should flush when requested") {
forAll(vecSizes, safeUIntN(20), Gen.choose(0, 15), Gen.oneOf(true, false)) { (depth, se, tap, isSync) =>
whenever(se._1 >= 1 && depth >= 1 && se._2.nonEmpty) {
assertTesterPasses {
simulate {
new QueueGetsFlushedTester(se._2, depth, se._1, tap, isSync)
}
}(RunUntilFinished(1024 * 10))
}
}
}
property("Queue flush when queue is empty") {
forAll(vecSizes, safeUIntN(20), Gen.choose(0, 15), Gen.oneOf(true, false)) { (depth, se, tap, isSync) =>
whenever(se._1 >= 1 && depth >= 1 && se._2.nonEmpty) {
assertTesterPasses {
simulate {
new EmptyFlushEdgecaseTester(se._2, depth, se._1, tap, isSync)
}
}(RunUntilFinished(1024 * 10))
}
}
}
property("Test queue can enqueue during a flush") {
forAll(vecSizes, safeUIntN(20), Gen.choose(0, 15), Gen.oneOf(true, false)) { (depth, se, tap, isSync) =>
whenever(se._1 >= 1 && depth >= 1 && se._2.nonEmpty) {
assertTesterPasses {
simulate {
new EnqueueEmptyFlushEdgecaseTester(se._2, depth, se._1, tap, isSync)
}
}(RunUntilFinished(1024 * 10))
}
}
}
property("Queue flush when queue is full") {
forAll(vecSizes, safeUIntN(20), Gen.choose(0, 15), Gen.oneOf(true, false)) { (depth, se, tap, isSync) =>
whenever(se._1 >= 1 && depth >= 1 && se._2.nonEmpty) {
assertTesterPasses {
simulate {
new FullQueueFlushEdgecaseTester(se._2, depth, se._1, tap, isSync)
}
}(RunUntilFinished(1024 * 10))
}
}
}
property("Queue should be able to dequeue when flush is high") {
forAll(Gen.choose(3, 5), safeUIntN(20), Gen.choose(0, 15), Gen.oneOf(true, false)) { (depth, se, tap, isSync) =>
whenever(se._1 >= 1 && depth >= 1 && se._2.nonEmpty) {
assertTesterPasses(
simulate(
new DequeueFullQueueEdgecaseTester(se._2, depth, se._1, tap, isSync)
)
)(RunUntilFinished(1024 * 10))
}
}
}
Expand Down

0 comments on commit aab42b2

Please sign in to comment.