Skip to content

Commit

Permalink
FIFO test update
Browse files Browse the repository at this point in the history
  • Loading branch information
Vict0rAH committed Nov 27, 2020
1 parent 2fbfbd7 commit 5edf081
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
24 changes: 16 additions & 8 deletions assertion/src/main/scala/assertionTiming/concurrentAssertion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}*/
}
}

Expand Down Expand Up @@ -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.
*/
Expand Down
10 changes: 5 additions & 5 deletions assertion/src/test/scala/concurrentAssertionTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {

Expand Down Expand Up @@ -219,7 +219,7 @@ class concurrentAssertionTest extends FlatSpec with ChiselScalatestTester with M
d.join
}
}
}*/
}

// assertEventuallyAlways
it should "test assertEventuallyAlways pass" in {
Expand All @@ -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)
Expand All @@ -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 => {

Expand All @@ -254,5 +254,5 @@ class concurrentAssertionTest extends FlatSpec with ChiselScalatestTester with M
t.join
}
}
}*/
}
}
2 changes: 1 addition & 1 deletion assertion/src/test/scala/fifoConcurrentAssertionTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 5edf081

Please sign in to comment.