-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Attach TLError LogicalTreeNodes to subsystem LogicalTreeNode #2410
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
595e0e9
Create OMErrorDevice.scala
mwachs5 0e08326
TLError: implement HasLogicalTreeNode
albertchen-sifive 8ad2f8a
OMErrorDevice: remove specifications
mwachs5 f5db4b4
Add Object model for Zero device
mwachs5 86ba877
TLZero: add OM calls
mwachs5 bf52274
Merge pull request #2411 from chipsalliance/attach-TLError-logicalTre…
albertchen-sifive ba744ca
BaseSubsystem: move LogicalTree add out of lazy val
albertchen-sifive 5b6f37c
BaseSubsystem: add TLZero LogicalTreeNodes
albertchen-sifive 1910582
CanHaveBuiltInDevices: move attach fn to object
albertchen-sifive 042c8af
update OM names and descriptions
albertchen-sifive File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/scala/diplomaticobjectmodel/model/OMErrorDevice.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// See LICENSE.SiFive for license details. | ||
|
||
package freechips.rocketchip.diplomaticobjectmodel.model | ||
|
||
|
||
case class OMErrorDevice( | ||
memoryRegions: Seq[OMMemoryRegion], | ||
interrupts: Seq[OMInterrupt], | ||
_types: Seq[String] = Seq("OMErrorDevice", "OMDevice", "OMComponent", "OMCompoundType") | ||
) extends OMDevice |
10 changes: 10 additions & 0 deletions
10
src/main/scala/diplomaticobjectmodel/model/OMZeroDevice.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// See LICENSE.SiFive for license details. | ||
|
||
package freechips.rocketchip.diplomaticobjectmodel.model | ||
|
||
|
||
case class OMZeroDevice( | ||
memoryRegions: Seq[OMMemoryRegion], | ||
interrupts: Seq[OMInterrupt], | ||
_types: Seq[String] = Seq("OMZeroDevice", "OMDevice", "OMComponent", "OMCompoundType") | ||
) extends OMDevice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This more of a question for me to learn more about Scala than about whether this is the right or wrong thing to do.
Since this is only used in one place, in an anonymous class instance, what's the practical difference between defining this as a sealed trait + anonymous class instance vs. defining a (final) case class and assigning the members normally? I think I can appreciate this technique being used for non-sealed traits, but the fact that this is sealed is interesting to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I the main difference I care about vs a final case class is that the case class generates a bunch of methods and extends stuff that I don't think are appropriate/useful. like case class extends
serializable
whichTLError
andTLZero
definitely are not and it generates stuff like unapply that I don't want exposed because that API will probably be broken.sealed is for similar reasons. to prevent anyone else from creating
BuiltInDevices
outside ofattachBuiltInDevices
and just narrow down the API surface area.just my personal preference, maybe I'm being a too cautious or this isn't the right approach? open to changing this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I think it's a good idea to limit API surface area. I was mostly wondering
sealed trait
vsfinal case class
and notsealed trait
vs(not sealed) trait
. I hadn't thought of the extra methods and traits that case classes provide as being extra stuff that consumers could possibly depend on that would become later liabilities, but now that you point it out, I agree, especially because this data structure is, at the moment, an arbitrary bundle of "stuff", and we may want to reserve the right to change this in the future.