diff options
| author | ducky | 2017-02-01 14:19:15 -0800 |
|---|---|---|
| committer | Richard Lin | 2017-02-07 16:15:04 -0800 |
| commit | ad20406f301e04075e051147092cf9c12a6a6ca8 (patch) | |
| tree | 0f994597218b5f59ac742a73f426b2aeb13103b0 | |
| parent | 6aa4c649c850a01f642c50ff222bd633aca7fe4b (diff) | |
Add macro for compile options materialize to prevent its use in chisel core
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/CompileOptions.scala | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/CompileOptions.scala b/chiselFrontend/src/main/scala/chisel3/core/CompileOptions.scala index 4aa3ad33..f512bf26 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/CompileOptions.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/CompileOptions.scala @@ -3,6 +3,7 @@ package chisel3.core import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context trait CompileOptions { // Should Record connections require a strict match of fields. @@ -26,7 +27,13 @@ trait CompileOptions { object CompileOptions { // Provides a low priority Strict default. Can be overridden by importing the NotStrict option. - implicit def materialize: CompileOptions = chisel3.core.ExplicitCompileOptions.Strict + // Implemented as a macro to prevent this from being used inside chisel core. + implicit def materialize: CompileOptions = macro materialize_impl + + def materialize_impl(c: Context): c.Tree = { + import c.universe._ + q"_root_.chisel3.core.ExplicitCompileOptions.Strict" + } } object ExplicitCompileOptions { |
