Skip to content

Commit 68a47bc

Browse files
committed
put checks behind an option
1 parent 98db4f1 commit 68a47bc

File tree

7 files changed

+67
-42
lines changed

7 files changed

+67
-42
lines changed

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,17 @@ object VerifStmtMacrosCompat {
4444
(p.source.file.name, p.line): @nowarn // suppress, there's no clear replacement
4545
}
4646

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")
47+
private[chisel3] def resetToDisableMigrationChecks(label: String)(implicit sourceInfo: SourceInfo) =
48+
if (Builder.emitVerifStatementDisableProperties) {
49+
val disable = Module.disable.value
50+
withDisable(Disable.Never) {
51+
AssertProperty(
52+
prop = ltl.Property.eventually(!disable),
53+
label = Some(s"${label}_never_enabled")
54+
)
55+
CoverProperty(!disable, s"${label}_enabled")
56+
}
5557
}
56-
}
5758

5859
object assert {
5960

core/src/main/scala/chisel3/experimental/hierarchy/core/Definition.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ object Definition extends SourceInfoDoc {
112112
context.useLegacyWidth,
113113
context.includeUtilMetadata,
114114
context.useSRAMBlackbox,
115+
context.emitVerifStatementDisableProperties,
115116
context.warningFilters,
116117
context.sourceRoots,
117118
Some(context.globalNamespace),

core/src/main/scala/chisel3/internal/Builder.scala

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -477,14 +477,15 @@ private[chisel3] class ChiselContext() {
477477
}
478478

479479
private[chisel3] class DynamicContext(
480-
val annotationSeq: AnnotationSeq,
481-
val throwOnFirstError: Boolean,
482-
val useLegacyWidth: Boolean,
483-
val includeUtilMetadata: Boolean,
484-
val useSRAMBlackbox: Boolean,
485-
val warningFilters: Seq[WarningFilter],
486-
val sourceRoots: Seq[File],
487-
val defaultNamespace: Option[Namespace],
480+
val annotationSeq: AnnotationSeq,
481+
val throwOnFirstError: Boolean,
482+
val useLegacyWidth: Boolean,
483+
val includeUtilMetadata: Boolean,
484+
val useSRAMBlackbox: Boolean,
485+
val emitVerifStatementDisableProperties: Boolean,
486+
val warningFilters: Seq[WarningFilter],
487+
val sourceRoots: Seq[File],
488+
val defaultNamespace: Option[Namespace],
488489
// Definitions from other scopes in the same elaboration, use allDefinitions below
489490
val loggerOptions: LoggerOptions,
490491
val definitions: ArrayBuffer[Definition[_]],
@@ -978,6 +979,9 @@ private[chisel3] object Builder extends LazyLogging {
978979

979980
def useSRAMBlackbox: Boolean = dynamicContextVar.value.map(_.useSRAMBlackbox).getOrElse(false)
980981

982+
def emitVerifStatementDisableProperties: Boolean =
983+
dynamicContextVar.value.map(_.emitVerifStatementDisableProperties).getOrElse(false)
984+
981985
// Builds a RenameMap for all Views that do not correspond to a single Data
982986
// These Data give a fake ReferenceTarget for .toTarget and .toReferenceTarget that the returned
983987
// RenameMap can split into the constituent parts

src/main/scala/chisel3/stage/ChiselAnnotations.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,3 +518,17 @@ case object UseSRAMBlackbox extends NoTargetAnnotation with ChiselOption with Ha
518518
)
519519
)
520520
}
521+
522+
case object EmitVerifStatementDisableProperties
523+
extends NoTargetAnnotation
524+
with ChiselOption
525+
with HasShellOptions
526+
with Unserializable {
527+
val options = Seq(
528+
new ShellOption[Unit](
529+
longOption = "emit-verif-statement-disable-properties",
530+
toAnnotationSeq = _ => Seq(EmitVerifStatementDisableProperties),
531+
helpText = "Emit properties to check that Disable for verification statements is eventually toggled"
532+
)
533+
)
534+
}

src/main/scala/chisel3/stage/ChiselOptions.scala

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,30 @@ import chisel3.layer.Layer
88
import java.io.File
99

1010
class ChiselOptions private[stage] (
11-
val printFullStackTrace: Boolean = false,
12-
val throwOnFirstError: Boolean = false,
13-
val outputFile: Option[String] = None,
14-
val chiselCircuit: Option[Circuit] = None,
15-
val sourceRoots: Vector[File] = Vector.empty,
16-
val warningFilters: Vector[WarningFilter] = Vector.empty,
17-
val useLegacyWidth: Boolean = false,
18-
val layerMap: Map[Layer, Layer] = Map.empty,
19-
val includeUtilMetadata: Boolean = false,
20-
val useSRAMBlackbox: Boolean = false) {
11+
val printFullStackTrace: Boolean = false,
12+
val throwOnFirstError: Boolean = false,
13+
val outputFile: Option[String] = None,
14+
val chiselCircuit: Option[Circuit] = None,
15+
val sourceRoots: Vector[File] = Vector.empty,
16+
val warningFilters: Vector[WarningFilter] = Vector.empty,
17+
val useLegacyWidth: Boolean = false,
18+
val layerMap: Map[Layer, Layer] = Map.empty,
19+
val includeUtilMetadata: Boolean = false,
20+
val useSRAMBlackbox: Boolean = false,
21+
val emitVerifStatementDisableProperties: Boolean = false) {
2122

2223
private[stage] def copy(
23-
printFullStackTrace: Boolean = printFullStackTrace,
24-
throwOnFirstError: Boolean = throwOnFirstError,
25-
outputFile: Option[String] = outputFile,
26-
chiselCircuit: Option[Circuit] = chiselCircuit,
27-
sourceRoots: Vector[File] = sourceRoots,
28-
warningFilters: Vector[WarningFilter] = warningFilters,
29-
useLegacyWidth: Boolean = useLegacyWidth,
30-
layerMap: Map[Layer, Layer] = layerMap,
31-
includeUtilMetadata: Boolean = includeUtilMetadata,
32-
useSRAMBlackbox: Boolean = useSRAMBlackbox
24+
printFullStackTrace: Boolean = printFullStackTrace,
25+
throwOnFirstError: Boolean = throwOnFirstError,
26+
outputFile: Option[String] = outputFile,
27+
chiselCircuit: Option[Circuit] = chiselCircuit,
28+
sourceRoots: Vector[File] = sourceRoots,
29+
warningFilters: Vector[WarningFilter] = warningFilters,
30+
useLegacyWidth: Boolean = useLegacyWidth,
31+
layerMap: Map[Layer, Layer] = layerMap,
32+
includeUtilMetadata: Boolean = includeUtilMetadata,
33+
useSRAMBlackbox: Boolean = useSRAMBlackbox,
34+
emitVerifStatementDisableProperties: Boolean = emitVerifStatementDisableProperties
3335
): ChiselOptions = {
3436

3537
new ChiselOptions(
@@ -42,7 +44,8 @@ class ChiselOptions private[stage] (
4244
useLegacyWidth = useLegacyWidth,
4345
layerMap = layerMap,
4446
includeUtilMetadata = includeUtilMetadata,
45-
useSRAMBlackbox = useSRAMBlackbox
47+
useSRAMBlackbox = useSRAMBlackbox,
48+
emitVerifStatementDisableProperties = emitVerifStatementDisableProperties
4649
)
4750

4851
}

src/main/scala/chisel3/stage/package.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ package object stage {
2929
case SourceRootAnnotation(s) => c.copy(sourceRoots = c.sourceRoots :+ s)
3030
case a: WarningConfigurationAnnotation => c.copy(warningFilters = c.warningFilters ++ a.filters)
3131
case a: WarningConfigurationFileAnnotation => c.copy(warningFilters = c.warningFilters ++ a.filters)
32-
case UseLegacyWidthBehavior => c.copy(useLegacyWidth = true)
33-
case RemapLayer(oldLayer, newLayer) => c.copy(layerMap = c.layerMap + ((oldLayer, newLayer)))
34-
case IncludeUtilMetadata => c.copy(includeUtilMetadata = true)
35-
case UseSRAMBlackbox => c.copy(useSRAMBlackbox = true)
32+
case UseLegacyWidthBehavior => c.copy(useLegacyWidth = true)
33+
case RemapLayer(oldLayer, newLayer) => c.copy(layerMap = c.layerMap + ((oldLayer, newLayer)))
34+
case IncludeUtilMetadata => c.copy(includeUtilMetadata = true)
35+
case UseSRAMBlackbox => c.copy(useSRAMBlackbox = true)
36+
case EmitVerifStatementDisableProperties => c.copy(emitVerifStatementDisableProperties = true)
3637
}
3738
}
3839

src/main/scala/chisel3/stage/phases/Elaborate.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class Elaborate extends Phase {
4545
chiselOptions.useLegacyWidth,
4646
chiselOptions.includeUtilMetadata,
4747
chiselOptions.useSRAMBlackbox,
48+
chiselOptions.emitVerifStatementDisableProperties,
4849
chiselOptions.warningFilters,
4950
chiselOptions.sourceRoots,
5051
None,

0 commit comments

Comments
 (0)