Skip to content

Commit

Permalink
Update concurrentAssertion.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrederikfhf committed Dec 4, 2020
1 parent b9d6dfc commit 3771528
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions assertion/src/main/scala/assertionTiming/concurrentAssertion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ object assertNever {

// Assertion for single thread clock cycle 0
assert(!cond(), message)
dut.clock.step(1)
fork {
dut.clock.step(1)
for (i <- 1 until cycles) {
assert(!cond(), message)
dut.clock.step(1)
Expand All @@ -45,8 +45,8 @@ object assertNeverEvent {

// Assertion for single thread clock cycle 0
assert(!cond(), message)
dut.clock.step(1)
fork {
dut.clock.step(1)
while (!event) {
assert(!cond(), message)
dut.clock.step(1)
Expand All @@ -63,8 +63,8 @@ object assertAlways {

// Assertion for single thread clock cycle 0
assert(cond(), message)
dut.clock.step(1)
fork {
dut.clock.step(1)
for (i <- 1 until cycles) {
assert(cond(), message)
dut.clock.step(1)
Expand All @@ -79,8 +79,8 @@ object assertAlwaysEvent {

// Assertion for single thread clock cycle 0
assert(cond(), message)
dut.clock.step(1)
fork {
dut.clock.step(1)
while (!event) {
assert(cond(), message)
dut.clock.step(1)
Expand All @@ -100,8 +100,8 @@ object assertEventually {
var i = 0

assert(!cond(), message)
dut.clock.step(1)
fork {
dut.clock.step(1)
while (!cond()) {
if (i == cycles) {
assert(false, message)
Expand All @@ -117,7 +117,9 @@ object assertEventually {
object assertEventuallyEvent {
def apply[T <: Module](dut: T, cond: () => Boolean = () => true, event: Boolean = false, message: String = "Error") = {

assert(!cond(), message)
fork {
dut.clock.step(1)
while (!cond()) {
if (event) {
assert(false, message)
Expand All @@ -140,7 +142,9 @@ object assertEventuallyAlways {
var i = 0
var k = 0

assert(!cond(), message)
fork {
dut.clock.step(1)
while (!cond()) {
if (i == cycles) {
assert(false, message)
Expand All @@ -162,8 +166,10 @@ object assertEventuallyAlwaysEvent {
def apply[T <: Module](dut: T, cond: () => Boolean = () => true, event: Boolean = false, message: String = "Error") = {

var i = 1

assert(!cond(), message)
fork {
dut.clock.step(1)

while (!cond()) {
if (event) {
assert(false, message)
Expand Down

0 comments on commit 3771528

Please sign in to comment.