From 89ef4d78e8f44f31df6530a6a4dee20d0ad0399f Mon Sep 17 00:00:00 2001 From: Chick Markley Date: Mon, 13 May 2019 18:08:25 -0700 Subject: RawModule with no reset should be able to use withClock method. (#1065) * RawModule with no reset should be able to use withClock method. - refactor ClockAndReset - now has `clockOpt: Option[Clock]` and `resetOpt: Option[Reset]` constructor params - convenience methods clock and reset tries to deref the option - ClockAndReset.empty is factory method for (None, None) - In Builder - forcedClock does not check resetOpt now - forcedReset does not check clockOpt now - withClock no longer looks at resetOpt - withReset no longer looks at clockOpt - Module starts with empty ClockAndReset * RawModule with no reset should be able to use withClock method. Refactor again based on @ducky64 comments - refactor away ClockAndReset, now builder just has a - currentClock - currentReset - withClock, withRest, withClockAndReset just use these fields directly * RawModule with no reset should be able to use withClock method. - Fixed typo in withReset handler, now picks up new reset --- chiselFrontend/src/main/scala/chisel3/core/RawModule.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'chiselFrontend/src/main/scala/chisel3/core/RawModule.scala') diff --git a/chiselFrontend/src/main/scala/chisel3/core/RawModule.scala b/chiselFrontend/src/main/scala/chisel3/core/RawModule.scala index 397debcb..b224d9a3 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/RawModule.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/RawModule.scala @@ -146,7 +146,8 @@ abstract class MultiIOModule(implicit moduleCompileOptions: CompileOptions) val reset: Reset = IO(Input(Bool())) // Setup ClockAndReset - Builder.currentClockAndReset = Some(ClockAndReset(clock, reset)) + Builder.currentClock = Some(clock) + Builder.currentReset = Some(reset) private[core] override def initializeInParent(parentCompileOptions: CompileOptions): Unit = { implicit val sourceInfo = UnlocatableSourceInfo -- cgit v1.2.3