Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Clock Invalidation (backport #2485) #2486

Merged
merged 1 commit into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/main/scala/chisel3/Clock.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ sealed class Clock(private[chisel3] val width: Width = Width(1)) extends Element
this.getClass == that.getClass

override def connect(that: Data)(implicit sourceInfo: SourceInfo, connectCompileOptions: CompileOptions): Unit = that match {
case _: Clock => super.connect(that)(sourceInfo, connectCompileOptions)
case _: Clock | DontCare => super.connect(that)(sourceInfo, connectCompileOptions)
case _ => super.badConnect(that)(sourceInfo)
}

Expand Down
8 changes: 8 additions & 0 deletions src/test/scala/chiselTests/InvalidateAPISpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,12 @@ class InvalidateAPISpec extends ChiselPropSpec with Matchers with BackendCompila
val firrtlOutput = myGenerateFirrtl(new ModuleWithoutDontCare)
firrtlOutput should include("is invalid")
}

property("a clock should be able to be connected to a DontCare") {
class ClockConnectedToDontCare extends Module {
val io = IO(new Bundle { val foo = Output(Clock()) })
io.foo := DontCare
}
myGenerateFirrtl(new ClockConnectedToDontCare) should include("io.foo is invalid")
}
}