Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SVSim] Fixed non-firing AssertProperty in SVSim (backport #4087) #4089

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading