diff options
Diffstat (limited to 'core/src')
| -rw-r--r-- | core/src/main/scala/chisel3/CompileOptions.scala | 3 | ||||
| -rw-r--r-- | core/src/main/scala/chisel3/Module.scala | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/core/src/main/scala/chisel3/CompileOptions.scala b/core/src/main/scala/chisel3/CompileOptions.scala index db773d6e..2764b652 100644 --- a/core/src/main/scala/chisel3/CompileOptions.scala +++ b/core/src/main/scala/chisel3/CompileOptions.scala @@ -22,6 +22,9 @@ trait CompileOptions { val explicitInvalidate: Boolean // Should the reset type of Module be a Bool or a Reset val inferModuleReset: Boolean + + /** If marked true, then any Module which consumes `inferModuleReset=false` must also mix in [[RequireSyncReset]] */ + def migrateInferModuleReset: Boolean = false } object CompileOptions { diff --git a/core/src/main/scala/chisel3/Module.scala b/core/src/main/scala/chisel3/Module.scala index 3382cd1b..08286ed5 100644 --- a/core/src/main/scala/chisel3/Module.scala +++ b/core/src/main/scala/chisel3/Module.scala @@ -141,6 +141,15 @@ abstract class Module(implicit moduleCompileOptions: CompileOptions) extends Raw // Top module and compatibility mode use Bool for reset // Note that a Definition elaboration will lack a parent, but still not be a Top module val inferReset = (_parent.isDefined || Builder.inDefinition) && moduleCompileOptions.inferModuleReset + if (moduleCompileOptions.migrateInferModuleReset && !moduleCompileOptions.inferModuleReset) { + this match { + case _: RequireSyncReset => // Good! It's been migrated. + case _ => // Bad! It hasn't been migrated. + Builder.error( + s"$desiredName is not inferring its module reset, but has not been marked `RequireSyncReset`. Please extend this trait." + ) + } + } if (inferReset) Reset() else Bool() } |
