diff options
| author | Richard Lin | 2016-09-29 15:37:44 -0700 |
|---|---|---|
| committer | GitHub | 2016-09-29 15:37:44 -0700 |
| commit | 3368a032d7c8ef1022bd9330ef4c4931367ba46b (patch) | |
| tree | 242e9c5d1c5e63bb73bb3cb2c11d056a9e3bbcb9 /chiselFrontend/src/main/scala/chisel3/core/CompileOptions.scala | |
| parent | 12a651513541d6c96e3b709b424d5d3384179076 (diff) | |
| parent | 96fb6a5e2c781b20470d02eac186b1b129c20bdf (diff) | |
Merge pull request #302 from ucb-bar/gsdt-renamecompileoptions
Massive rename of CompileOptions.
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core/CompileOptions.scala')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/CompileOptions.scala | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/CompileOptions.scala b/chiselFrontend/src/main/scala/chisel3/core/CompileOptions.scala new file mode 100644 index 00000000..0e66a241 --- /dev/null +++ b/chiselFrontend/src/main/scala/chisel3/core/CompileOptions.scala @@ -0,0 +1,48 @@ +// See LICENSE for license details. + +package chisel3.core + +import scala.language.experimental.macros + +trait CompileOptions { + // Should Bundle 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). + val declaredTypeMustBeUnbound: Boolean + // Module IOs should be wrapped in an IO() to define their bindings before the reset of the module is defined. + val requireIOWrap: Boolean + // 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. + val dontAssumeDirectionality: Boolean +} + +object CompileOptions { + // Provides a low priority Strict default. Can be overridden by importing the NotStrict option. + implicit def materialize: CompileOptions = chisel3.core.ExplicitCompileOptions.Strict +} + +object ExplicitCompileOptions { + // Collection of "not strict" connection compile options. + // These provide compatibility with existing code. + // import chisel3.core.ExplicitCompileOptions.NotStrict + implicit object NotStrict extends CompileOptions { + val connectFieldsMustMatch = false + val declaredTypeMustBeUnbound = false + val requireIOWrap = false + val dontTryConnectionsSwapped = false + val dontAssumeDirectionality = false + } + + // Collection of "strict" connection compile options, preferred for new code. + // import chisel3.core.ExplicitCompileOptions.Strict + implicit object Strict extends CompileOptions { + val connectFieldsMustMatch = true + val declaredTypeMustBeUnbound = true + val requireIOWrap = true + val dontTryConnectionsSwapped = true + val dontAssumeDirectionality = true + } +} |
