diff options
| author | Andrew Waterman | 2016-01-15 14:23:28 -0800 |
|---|---|---|
| committer | Andrew Waterman | 2016-01-15 14:23:28 -0800 |
| commit | 2d7bf7a5fdb5ee722009d4816bb8aa355ead59fc (patch) | |
| tree | 4013e896b6baf627b34b563df3fc9a5b8b93501f /src | |
| parent | 171dd769bebaaeff069ca6dd745d3d1725b36547 (diff) | |
flatten should return Seq[Bits], not Seq[UInt]
Calling toBits inside of flatten makes asInput/asOutput/asDirectionless fail
on SInts. Also, the abstract type Data was already defining it to return
Seq[Bits], so this change didn't really change the API.
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/scala/Chisel/Bits.scala | 6 | ||||
| -rw-r--r-- | src/main/scala/Chisel/Data.scala | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/main/scala/Chisel/Bits.scala b/src/main/scala/Chisel/Bits.scala index e001f864..7505c102 100644 --- a/src/main/scala/Chisel/Bits.scala +++ b/src/main/scala/Chisel/Bits.scala @@ -10,9 +10,7 @@ import firrtl.PrimOp._ /** Element is a leaf data type: it cannot contain other Data objects. Example * uses are for representing primitive data types, like integers and bits. */ -abstract class Element(dirArg: Direction, val width: Width) extends Data(dirArg) { - private[Chisel] def flatten: IndexedSeq[UInt] = IndexedSeq(toBits) -} +abstract class Element(dirArg: Direction, val width: Width) extends Data(dirArg) /** A data type for values represented by a single bitvector. Provides basic * bitwise operations. @@ -25,6 +23,8 @@ sealed abstract class Bits(dirArg: Direction, width: Width, override val litArg: private[Chisel] def fromInt(x: BigInt): this.type + private[Chisel] def flatten: IndexedSeq[Bits] = IndexedSeq(this) + def cloneType: this.type = cloneTypeWidth(width) override def <> (that: Data): Unit = this := that diff --git a/src/main/scala/Chisel/Data.scala b/src/main/scala/Chisel/Data.scala index f9b277e1..c72c7dfc 100644 --- a/src/main/scala/Chisel/Data.scala +++ b/src/main/scala/Chisel/Data.scala @@ -123,7 +123,7 @@ object Clock { // TODO: Document this. sealed class Clock(dirArg: Direction) extends Element(dirArg, Width(1)) { def cloneType: this.type = Clock(dirArg).asInstanceOf[this.type] - private[Chisel] override def flatten: IndexedSeq[UInt] = IndexedSeq() + private[Chisel] override def flatten: IndexedSeq[Bits] = IndexedSeq() private[Chisel] def cloneTypeWidth(width: Width): this.type = cloneType private[Chisel] def toType = "Clock" |
