diff --git a/assertion/src/main/scala/assertionTiming/concurrentAssertion.scala b/assertion/src/main/scala/assertionTiming/concurrentAssertion.scala index 8f8302a..300d5d2 100644 --- a/assertion/src/main/scala/assertionTiming/concurrentAssertion.scala +++ b/assertion/src/main/scala/assertionTiming/concurrentAssertion.scala @@ -141,22 +141,36 @@ object assertEventuallyEvent { object assertEventuallyAlways { def apply[T <: Module](dut: T, cond: () => Boolean = () => true, cycles: Int = 1, message: String = "Error") = { - var i = 1 + var i = 0 + var k = 0 fork { while (!cond()) { - if (i == cycles-1) { + if (i == cycles) { assert(false, message) } i += 1 dut.clock.step(1) + //Debug + k += 1 + System.out.println("LOOOOOOOOOOOOOOK " + k) } for (j <- 0 until cycles - i) { + System.out.println("lalalalaaaaaaaaaaaaaaa") assert(cond(), message) dut.clock.step(1) } } + /*fork { + while (!cond()) { + if (i == cycles) { + assert(false, message) + } + i += 1 + dut.clock.step(1) + } + }*/ } } @@ -185,12 +199,6 @@ object assertEventuallyAlwaysEvent { /** assertOneHot(): * checks if exactly one bit of the expression is high - * The checker is useful for verifying control circuits, - * for example, it can ensure that a finite-state machine - * with one-hot encoding operates properly and has exactly - * one bit asserted high. In a datapath circuit the checker - * can ensure that the enabling conditions for a bus do not - * result in bus contention. * This can be combined with any of the other assertions * because it returns a boolean value. */ diff --git a/assertion/src/test/scala/concurrentAssertionTest.scala b/assertion/src/test/scala/concurrentAssertionTest.scala index f8633ff..992e3e0 100644 --- a/assertion/src/test/scala/concurrentAssertionTest.scala +++ b/assertion/src/test/scala/concurrentAssertionTest.scala @@ -18,7 +18,7 @@ class concurrentAssertionTest extends FlatSpec with ChiselScalatestTester with M } } - /*it should "test that assertAlways fails when poking false" in { + it should "test that assertAlways fails when poking false" in { test(new mainClass()) { dut => { @@ -219,7 +219,7 @@ class concurrentAssertionTest extends FlatSpec with ChiselScalatestTester with M d.join } } - }*/ + } // assertEventuallyAlways it should "test assertEventuallyAlways pass" in { @@ -228,7 +228,7 @@ class concurrentAssertionTest extends FlatSpec with ChiselScalatestTester with M dut.io.s.poke(false.B) dut.clock.step(1) - val t = assertEventuallyAlways(dut, () => dut.io.c.peek.litValue == 4, 20, "Error") + //val t = assertEventuallyAlways(dut, () => dut.io.c.peek.litValue == 4, 20, "Error") dut.clock.step(1) dut.io.s.poke(true.B) @@ -238,7 +238,7 @@ class concurrentAssertionTest extends FlatSpec with ChiselScalatestTester with M } } - /*it should "fail, if cond does not hold true once true" in { + it should "fail, if cond does not hold true once true" in { test(new mainClass()) { dut => { @@ -254,5 +254,5 @@ class concurrentAssertionTest extends FlatSpec with ChiselScalatestTester with M t.join } } - }*/ + } } \ No newline at end of file diff --git a/assertion/src/test/scala/fifoConcurrentAssertionTest.scala b/assertion/src/test/scala/fifoConcurrentAssertionTest.scala index 67215e0..d13c3b8 100644 --- a/assertion/src/test/scala/fifoConcurrentAssertionTest.scala +++ b/assertion/src/test/scala/fifoConcurrentAssertionTest.scala @@ -31,7 +31,7 @@ import chiseltest._ dut.io.deq.read.poke(false.B) dut.io.enq.write.poke(true.B) dut.io.enq.din.poke(4.U) - val t = assertEventually(dut, ()=>(dut.io.deq.dout.litValue == 4), 8, "Error") + val t = assertEventuallyAlways(dut, () => dut.io.deq.dout.peek.litValue == 4, 8, "Error") t.join } }