From a689c7c0dd336fe0b9db6171786993b190a700f8 Mon Sep 17 00:00:00 2001 From: mergify[bot] Date: Wed, 8 Jun 2022 20:09:45 +0000 Subject: Added migration for inferModuleReset (#2571) (#2573) Co-authored-by: Jack Koenig (cherry picked from commit 3c6c044b6bdee850ad9ba375324abaf3813c557d) Co-authored-by: Adam Izraelevitz --- core/src/main/scala/chisel3/CompileOptions.scala | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core/src/main/scala/chisel3/CompileOptions.scala') 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 { -- cgit v1.2.3 From 94aeeb1a5c2fe38777a9004ba36f8b353e96b292 Mon Sep 17 00:00:00 2001 From: mergify[bot] Date: Fri, 8 Jul 2022 23:44:45 +0000 Subject: CompileOptions: add and use emitStrictConnects (#2622) (#2623) (cherry picked from commit 11e8cc60d6268301cff352b8a1d7c4d672b5be11) Co-authored-by: Megan Wachs --- core/src/main/scala/chisel3/CompileOptions.scala | 35 +++++++++++++++++------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'core/src/main/scala/chisel3/CompileOptions.scala') diff --git a/core/src/main/scala/chisel3/CompileOptions.scala b/core/src/main/scala/chisel3/CompileOptions.scala index 2764b652..d7d30306 100644 --- a/core/src/main/scala/chisel3/CompileOptions.scala +++ b/core/src/main/scala/chisel3/CompileOptions.scala @@ -6,25 +6,37 @@ import scala.language.experimental.macros import scala.reflect.macros.blackbox.Context trait CompileOptions { - // Should Record connections require a strict match of fields. - // If true and the same fields aren't present in both source and sink, a MissingFieldException, - // MissingLeftFieldException, or MissingRightFieldException will be thrown. + + /** Should Record connections require a strict match of fields. + * + * If true and the same fields aren't present in both source and sink, a MissingFieldException, + * MissingLeftFieldException, or MissingRightFieldException will be thrown. + */ val connectFieldsMustMatch: Boolean - // When creating an object that takes a type argument, the argument must be unbound (a pure type). + + /** When creating an object that takes a type argument, the argument must be unbound (a pure type). */ val declaredTypeMustBeUnbound: Boolean - // If a connection operator fails, don't try the connection with the operands (source and sink) reversed. + + /** If a connection operator fails, don't try the connection with the operands (source and sink) reversed. */ val dontTryConnectionsSwapped: Boolean - // If connection directionality is not explicit, do not use heuristics to attempt to determine it. + + /** If connection directionality is not explicit, do not use heuristics to attempt to determine it. */ val dontAssumeDirectionality: Boolean - // Check that referenced Data have actually been declared. + + /** Check that referenced Data have actually been declared. */ val checkSynthesizable: Boolean - // Require explicit assignment of DontCare to generate "x is invalid" + + /** Require explicit assignment of DontCare to generate "x is invalid" */ val explicitInvalidate: Boolean - // Should the reset type of Module be a Bool or a Reset + + /** 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 + + /** Should connects emit as firrtl <= instead of <- */ + def emitStrictConnects: Boolean = true } object CompileOptions { @@ -39,6 +51,7 @@ object CompileOptions { } object ExplicitCompileOptions { + case class CompileOptionsClass( // Should Record connections require a strict match of fields. // If true and the same fields aren't present in both source and sink, a MissingFieldException, @@ -68,7 +81,9 @@ object ExplicitCompileOptions { checkSynthesizable = false, explicitInvalidate = false, inferModuleReset = false - ) + ) { + override def emitStrictConnects = false + } // Collection of "strict" connection compile options, preferred for new code. implicit val Strict = new CompileOptionsClass( -- cgit v1.2.3 From 80035d2a7b94faf9bfef962f83f9257f57419a35 Mon Sep 17 00:00:00 2001 From: Megan Wachs Date: Thu, 14 Jul 2022 08:30:13 -0700 Subject: 3.5x: Make explicit copy constructors for ExplicitCompileOptions (#2629) * Add copy constructors for compile options * Add tests for the copy constructors Co-authored-by: Jiuyang Liu --- core/src/main/scala/chisel3/CompileOptions.scala | 48 +++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'core/src/main/scala/chisel3/CompileOptions.scala') diff --git a/core/src/main/scala/chisel3/CompileOptions.scala b/core/src/main/scala/chisel3/CompileOptions.scala index d7d30306..aca00d1f 100644 --- a/core/src/main/scala/chisel3/CompileOptions.scala +++ b/core/src/main/scala/chisel3/CompileOptions.scala @@ -82,7 +82,28 @@ object ExplicitCompileOptions { explicitInvalidate = false, inferModuleReset = false ) { + override def migrateInferModuleReset = false override def emitStrictConnects = false + override def copy( + connectFieldsMustMatch: Boolean = false, + declaredTypeMustBeUnbound: Boolean = false, + dontTryConnectionsSwapped: Boolean = false, + dontAssumeDirectionality: Boolean = false, + checkSynthesizable: Boolean = false, + explicitInvalidate: Boolean = false, + inferModuleReset: Boolean = false + ) = new CompileOptionsClass( + connectFieldsMustMatch, + declaredTypeMustBeUnbound, + dontTryConnectionsSwapped, + dontAssumeDirectionality, + checkSynthesizable, + explicitInvalidate, + inferModuleReset + ) { + override def migrateInferModuleReset = false + override def emitStrictConnects = false + } } // Collection of "strict" connection compile options, preferred for new code. @@ -94,5 +115,30 @@ object ExplicitCompileOptions { checkSynthesizable = true, explicitInvalidate = true, inferModuleReset = true - ) + ) { + + override def migrateInferModuleReset = false + override def emitStrictConnects = true + + override def copy( + connectFieldsMustMatch: Boolean = true, + declaredTypeMustBeUnbound: Boolean = true, + dontTryConnectionsSwapped: Boolean = true, + dontAssumeDirectionality: Boolean = true, + checkSynthesizable: Boolean = true, + explicitInvalidate: Boolean = true, + inferModuleReset: Boolean = true + ) = new CompileOptionsClass( + connectFieldsMustMatch, + declaredTypeMustBeUnbound, + dontTryConnectionsSwapped, + dontAssumeDirectionality, + checkSynthesizable, + explicitInvalidate, + inferModuleReset + ) { + override def migrateInferModuleReset = false + override def emitStrictConnects = true + } + } } -- cgit v1.2.3