[RFC] [do-not-merge] Refactor Bits into Separate Files #875
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.
Bits.scala
is currently 1200 lines and a pain to read (it's 1700 with the API documentation of #873!). The initial motivation for this was the good approach of sealing everything in theBits
hierarchy (as bad things happen if you start extendingBits
). However, the need to ram all of the implementations of all sealed children ofBits
into one file isn't necessary and it contributes to the bloat ofBits.scala
.This proposes breaking up the sealed traits in
Bits.scala
into separate files with private traits containing the macro and method implementations of these traits. This would create the following files:Element.scala
Bits.scala
Num.scala
UInt.scala
SInt.scala
FixedPoint.scala
Analog.scala
This PR currently shows an example of how this can be done for
UInt
by breaking it up into:private [core] UIntMacros
private [core] UIntMethods
It may also make sense to breakup the whole hierarchy going back to
Data
into macro and method traits.There is no effect on ScalaDoc by doing this. Methods provided by private traits mixed into public classes will still show up.
As this will have major conflicts with #873, I'll wait to act on any full implementation of this.
Related issue:
Type of change: other enhancement
Impact: no functional change
Development Phase: proposal
Release Notes