Skip to content

Commit

Permalink
Update concurrentAssertion
Browse files Browse the repository at this point in the history
  • Loading branch information
Vict0rAH committed Nov 21, 2020
1 parent f7c6461 commit 9c6531b
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions assertion/src/main/scala/assertionTiming/concurrentAssertion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import chisel3._
object assertNever {
def apply[T <: Module](dut: T, cond: () => Boolean, message: String, cycles: Int) = {

// Assertion for single thread clock cycle 0
assert(cond(), message)
fork {
for (i <- 0 until cycles) {
assert(!cond(), message)
Expand All @@ -44,8 +46,10 @@ object assertNever {
object assertAlways {
def apply[T <: Module](dut: T, cond: () => Boolean, message: String, cycles: Int) = {

// Assertion for single thread clock cycle 0
assert(cond(), message)
fork {
for (i <- 0 until cycles) {
for (i <- 1 until cycles) {
assert(cond(), message)
dut.clock.step(1)
}
Expand All @@ -63,7 +67,10 @@ object assertAlways {
object assertEventually {
def apply[T <: Module](dut: T, cond: () => Boolean, message: String, cycles: Int) = {

var i = 0
var i = 1
// Assertion for single thread clock cycle 0
assert(cond(), message)

fork {
/*for (i <- 0 until cycles) {
if (cond()) {
Expand Down Expand Up @@ -95,7 +102,10 @@ object assertEventually {
object assertEventuallyAlways {
def apply[T <: Module](dut: T, cond: () => Boolean, message: String, cycles: Int) = {

var i = 0
var i = 1
// Assertion for single thread clock cycle 0
assert(cond(), message)

/*for (i <- 0 until cycles) {
if (cond()) {
break
Expand Down Expand Up @@ -129,8 +139,10 @@ object assertEventuallyAlways {
object assertOneHot {
def apply(cond: UInt, message: String, cycles: Int) {

// Assertion for single thread clock cycle 0
assert(cond(), message)
for (i <- 0 until cycles) {
assert(cond == 1.U << cond/2.U)
assert(cond())
}
}
}

0 comments on commit 9c6531b

Please sign in to comment.