Skip to content

Commit

Permalink
Revert "Use macro to materialize CompileOptions in Chisel._ (#1257)" (#…
Browse files Browse the repository at this point in the history
…1269)

This reverts commit 5a0f066.
  • Loading branch information
jackkoenig authored Dec 6, 2019
1 parent 39f6c69 commit b192eed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 31 deletions.
21 changes: 3 additions & 18 deletions src/main/scala/chisel3/compatibility.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@ package object Chisel { // scalastyle:ignore package.object.name number.of.t
import chisel3.internal.firrtl.Width

import scala.language.experimental.macros
import scala.reflect.macros.blackbox.Context
import scala.annotation.{StaticAnnotation, compileTimeOnly}
import scala.annotation.StaticAnnotation
import scala.annotation.compileTimeOnly
import scala.language.implicitConversions


/** Default NotStrict CompileOptions for compatibility code
*
* No longer implicit, materialization macro below provides a low-priority default
*/
val defaultCompileOptions = chisel3.ExplicitCompileOptions.NotStrict
implicit val defaultCompileOptions = chisel3.ExplicitCompileOptions.NotStrict

abstract class Direction
case object INPUT extends Direction
Expand Down Expand Up @@ -589,16 +584,6 @@ package object Chisel { // scalastyle:ignore package.object.name number.of.t
val Pipe = chisel3.util.Pipe
type Pipe[T <: Data] = chisel3.util.Pipe[T]

/** Provides a low priority NotStrict default. Can be overridden by providing a custom implicit
* val in lexical scope (ie. imported)
* Implemented as a macro to provide a low-priority default
*/
implicit def materializeCompileOptions: CompileOptions = macro materializeCompileOptions_impl

def materializeCompileOptions_impl(c: Context): c.Tree = {
import c.universe._
q"_root_.chisel3.ExplicitCompileOptions.NotStrict"
}

/** Package for experimental features, which may have their API changed, be removed, etc.
*
Expand Down
13 changes: 0 additions & 13 deletions src/test/scala/chiselTests/CompatibilitySpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,6 @@ class CompatibiltySpec extends ChiselFlatSpec with GeneratorDrivenPropertyChecks
}
elaborate { new Dummy }
}

it should "be able to provide custom CompileOptions" in {
implicit val CustomCompileOptions = chisel3.ExplicitCompileOptions.NotStrict.copy(inferModuleReset = true)
// Top-level Module always uses Bool so needs to be an inner Module
elaborate(new Module {
val io = IO(new Bundle {})
val inst = Module(new Module {
val io = IO(new Bundle {})
assert(reset.isInstanceOf[chisel3.ResetType])
})
})
}

// Verify we can elaborate a design expressed in Chisel2
class Chisel2CompatibleRisc extends Module {
val io = new Bundle {
Expand Down

0 comments on commit b192eed

Please sign in to comment.