Skip to content

Commit

Permalink
[SVSim] Fixed non-firing AssertProperty in SVSim (#4087)
Browse files Browse the repository at this point in the history
(cherry picked from commit d3ab477)
  • Loading branch information
dobios authored and mergify[bot] committed May 23, 2024
1 parent 0400ca7 commit 4026691
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/test/scala/chiselTests/LTLSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import chisel3._
import chisel3.ltl._
import chisel3.testers.BasicTester
import _root_.circt.stage.ChiselStage
import chiselTests.ChiselRunners

import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

import Sequence._

class LTLSpec extends AnyFlatSpec with Matchers {
class LTLSpec extends AnyFlatSpec with Matchers with ChiselRunners {
it should "allow booleans to be used as sequences" in {
val chirrtl = ChiselStage.emitCHIRRTL(new RawModule {
val a = IO(Input(Bool()))
Expand Down Expand Up @@ -336,4 +337,12 @@ class LTLSpec extends AnyFlatSpec with Matchers {
chirrtl should include("connect ltl_concat_4.rhs, ltl_delay_4")
chirrtl should include("connect verif_6.property, ltl_concat_4.out")
}

it should "fail correctly in verilator simulation" in {
assertTesterFails(new BasicTester {
withClockAndReset(clock, reset) {
AssertProperty(0.U === 1.U)
}
})
}
}
1 change: 1 addition & 0 deletions svsim/src/main/scala/verilator/Backend.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ final class Backend(
"-o", s"../$outputBinaryName", // "Name of final executable"
"--top-module", topModuleName, // "Name of top-level input module"
"--Mdir", "verilated-sources", // "Name of output object directory"
"--assert", // Enable assertions
),

commonSettings.libraryExtensions match {
Expand Down

0 comments on commit 4026691

Please sign in to comment.