Skip to content

Commit 571c439

Browse files
committed
add static warning and property for reset->disable migration
1 parent 9dc68e3 commit 571c439

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

core/src/main/scala-2/chisel3/VerificationStatementMacros.scala

+16
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import chisel3.layers
1010
import chisel3.util.circt.IfElseFatalIntrinsic
1111
import chisel3.internal.Builder.pushCommand
1212
import chisel3.internal._
13+
import chisel3.ltl._
14+
import chisel3.ltl.Sequence.BoolSequence
1315

1416
import scala.language.experimental.macros
1517
import scala.reflect.macros.blackbox
@@ -42,6 +44,17 @@ object VerifStmtMacrosCompat {
4244
(p.source.file.name, p.line): @nowarn // suppress, there's no clear replacement
4345
}
4446

47+
private[chisel3] def resetToDisableMigrationChecks(label: String)(implicit sourceInfo: SourceInfo) = {
48+
val disable = Module.disable.value
49+
withDisable(Disable.Never) {
50+
AssertProperty(
51+
prop = ltl.Property.eventually(!disable),
52+
label = Some(s"${label}_never_enabled")
53+
)
54+
CoverProperty(!disable, s"${label}_enabled")
55+
}
56+
}
57+
4558
object assert {
4659

4760
/** @group VerifPrintMacros */
@@ -117,6 +130,7 @@ object VerifStmtMacrosCompat {
117130
): chisel3.assert.Assert = {
118131
block(layers.Verification.Assert, skipIfAlreadyInBlock = true, skipIfLayersEnabled = true) {
119132
val id = Builder.forcedUserModule // It should be safe since we push commands anyway.
133+
resetToDisableMigrationChecks("assertion")
120134
IfElseFatalIntrinsic(id, format, "chisel3_builtin", clock, predicate, enable, format.unpackArgs: _*)(sourceInfo)
121135
}
122136
new chisel3.assert.Assert()
@@ -186,6 +200,7 @@ object VerifStmtMacrosCompat {
186200
val id = new chisel3.assume.Assume()
187201
block(layers.Verification.Assume, skipIfAlreadyInBlock = true, skipIfLayersEnabled = true) {
188202
message.foreach(Printable.checkScope(_))
203+
resetToDisableMigrationChecks("assumption")
189204
when(!Module.reset.asBool) {
190205
val formattedMsg = formatFailureMessage("Assumption", line, cond, message)
191206
Builder.pushCommand(Verification(id, Formal.Assume, sourceInfo, Module.clock.ref, cond.ref, formattedMsg))
@@ -230,6 +245,7 @@ object VerifStmtMacrosCompat {
230245
): chisel3.cover.Cover = {
231246
val id = new chisel3.cover.Cover()
232247
block(layers.Verification.Cover, skipIfAlreadyInBlock = true, skipIfLayersEnabled = true) {
248+
resetToDisableMigrationChecks("cover")
233249
when(!Module.reset.asBool) {
234250
Builder.pushCommand(Verification(id, Formal.Cover, sourceInfo, Module.clock.ref, cond.ref, ""))
235251
}

0 commit comments

Comments
 (0)