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

Make isView safe outside of Builder context (backport #4228) #4231

Merged
merged 1 commit into from
Jun 28, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ package object dataview {
}

// Safe for all Data
private[chisel3] def isView(d: Data): Boolean = d._parent.contains(ViewParent)
private[chisel3] def isView(d: Data): Boolean = d._parent.exists(_ == ViewParent)

/** Turn any [[Element]] that could be a View into a concrete Element
*
Expand Down
5 changes: 5 additions & 0 deletions src/test/scala/chiselTests/UIntOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ class UIntLitZeroWidthTester extends BasicTester {

class UIntOpsSpec extends ChiselPropSpec with Matchers with Utils {

// This is intentionally a val outside of any ScalaTest constructs to check that it is legal
// to create a literal outside of a Chisel context and *before* any Chisel contexts have been created
// in this thread.
val five = 5.U

property("Bools can be created from 1 bit UInts") {
ChiselStage.emitCHIRRTL(new GoodBoolConversion)
}
Expand Down
Loading