diff options
| author | Andrew Waterman | 2016-08-15 22:48:14 -0700 |
|---|---|---|
| committer | GitHub | 2016-08-15 22:48:14 -0700 |
| commit | ddb7278760029be9d960ba8bf2b06ac8a8aac767 (patch) | |
| tree | 1c9e7306c2de99abc233d4dc8fe8640ce82e5cad /chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala | |
| parent | 2a074c828ddd8e6c20fa21d618664d50120f3d7a (diff) | |
Make "def width" a private API; expose isWidthKnown instead (#257)
* Make "def width" a private API; expose isWidthKnown instead
Resolves #256.
Since width was used to determine whether getWidth would succeed, I added
def isWidthKnown: Boolean
but another option would be to expose something like
def widthOption: Option[Int]
...thoughts?
* Document getWidth/isWidthKnown
* Add widthOption for more idiomatic Scala manipulation of widths
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala b/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala index f2774a8d..15643ac8 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala @@ -16,7 +16,7 @@ import chisel3.internal.sourceinfo.{SourceInfo, DeprecatedSourceInfo, VecTransfo */ sealed abstract class Aggregate(dirArg: Direction) extends Data(dirArg) { private[core] def cloneTypeWidth(width: Width): this.type = cloneType - def width: Width = flatten.map(_.width).reduce(_ + _) + private[core] def width: Width = flatten.map(_.width).reduce(_ + _) } object Vec { @@ -373,5 +373,6 @@ class Bundle extends Aggregate(NO_DIR) { } private[core] object Bundle { - val keywords = List("flip", "asInput", "asOutput", "cloneType", "toBits") + val keywords = List("flip", "asInput", "asOutput", "cloneType", "toBits", + "widthOption") } |
