summaryrefslogtreecommitdiff
path: root/chiselFrontend/src/main/scala/chisel3/core/Data.scala
diff options
context:
space:
mode:
authorJim Lawson2016-07-20 13:28:15 -0700
committerJim Lawson2016-07-20 13:28:15 -0700
commit28e80311f172ae4d1d477e8bb47ca3719c9a8fc5 (patch)
tree5d7a077498317c5f2412604380acc43c6b1fc371 /chiselFrontend/src/main/scala/chisel3/core/Data.scala
parentf81202b896d30d90075be487895befa009b11733 (diff)
Compile ok.
Need to convert UInt(x) into UInt.Lit(x) or UInt.width(x)
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core/Data.scala')
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/Data.scala13
1 files changed, 12 insertions, 1 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Data.scala b/chiselFrontend/src/main/scala/chisel3/core/Data.scala
index 4cc66cb5..79119114 100644
--- a/chiselFrontend/src/main/scala/chisel3/core/Data.scala
+++ b/chiselFrontend/src/main/scala/chisel3/core/Data.scala
@@ -174,6 +174,13 @@ abstract class Data extends HasId {
*/
@deprecated("Use asBits, which makes the reinterpret cast more explicit and actually returns Bits", "chisel3")
def toBits(): UInt = SeqUtils.do_asUInt(this.flatten)(DeprecatedSourceInfo)
+
+ protected def unBind(): Unit = {
+ //TODO(twigg): Do recursively for better error messages
+ for(elem <- this.allElements) {
+ elem.binding = UnboundBinding(elem.binding.direction)
+ }
+ }
}
object Wire {
@@ -210,7 +217,11 @@ object Clock {
// TODO: Document this.
sealed class Clock extends Element(Width(1)) {
- def cloneType: this.type = Clock().asInstanceOf[this.type]
+ def cloneType: this.type = {
+ val clone = Clock().asInstanceOf[this.type]
+ clone.unBind()
+ clone
+ }
private[chisel3] override def flatten: IndexedSeq[Bits] = IndexedSeq()
private[chisel3] def cloneTypeWidth(width: Width): this.type = cloneType
private[chisel3] def toType = "Clock"