From 85fe90d5b7ed4e1101b0b3959a1d362eb93915ac Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Fri, 29 Nov 2019 14:55:01 -0800 Subject: Compat compile options macro (#1253) * Use macro to materialize CompileOptions in Chisel._ This switches from using an implicit val that required awkward suppression (as illustrated in CompileOptionsSpec) to allowing overriding in the same way as done in "import chisel3._" via the creation of an implicit val in lexical scope. * Deprecate Chisel.defaultCompileOptions --- src/test/scala/chiselTests/CompatibilitySpec.scala | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/test') diff --git a/src/test/scala/chiselTests/CompatibilitySpec.scala b/src/test/scala/chiselTests/CompatibilitySpec.scala index d2b39c49..b0f22774 100644 --- a/src/test/scala/chiselTests/CompatibilitySpec.scala +++ b/src/test/scala/chiselTests/CompatibilitySpec.scala @@ -118,6 +118,19 @@ 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 { -- cgit v1.2.3