summaryrefslogtreecommitdiff
path: root/chiselFrontend/src/main/scala/chisel3/core
diff options
context:
space:
mode:
authorducky2017-02-01 14:19:15 -0800
committerRichard Lin2017-02-07 16:15:04 -0800
commitad20406f301e04075e051147092cf9c12a6a6ca8 (patch)
tree0f994597218b5f59ac742a73f426b2aeb13103b0 /chiselFrontend/src/main/scala/chisel3/core
parent6aa4c649c850a01f642c50ff222bd633aca7fe4b (diff)
Add macro for compile options materialize to prevent its use in chisel core
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core')
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/CompileOptions.scala9
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 {