summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3
diff options
context:
space:
mode:
authorRichard Lin2018-02-02 23:30:56 -0800
committerGitHub2018-02-02 23:30:56 -0800
commit1bfca502c69a26edca86d716a1ca9d24e6789e59 (patch)
treea5c035ee45c3cd66e2d9b63c74aca75575f78f83 /src/main/scala/chisel3
parent639617ea42c777b8dd1f4300d42784e45f294d76 (diff)
Autoclonetype will clone args that are of type data (#768)
Diffstat (limited to 'src/main/scala/chisel3')
-rw-r--r--src/main/scala/chisel3/util/Arbiter.scala4
-rw-r--r--src/main/scala/chisel3/util/Decoupled.scala10
2 files changed, 6 insertions, 8 deletions
diff --git a/src/main/scala/chisel3/util/Arbiter.scala b/src/main/scala/chisel3/util/Arbiter.scala
index ba257b41..623dd619 100644
--- a/src/main/scala/chisel3/util/Arbiter.scala
+++ b/src/main/scala/chisel3/util/Arbiter.scala
@@ -14,7 +14,9 @@ import chisel3.internal.naming.chiselName // can't use chisel3_ version because
* @param gen data type
* @param n number of inputs
*/
-class ArbiterIO[T <: Data](gen: T, n: Int) extends Bundle {
+class ArbiterIO[T <: Data](private val gen: T, val n: Int) extends Bundle {
+ // See github.com/freechipsproject/chisel3/issues/765 for why gen is a private val and proposed replacement APIs.
+
val in = Flipped(Vec(n, Decoupled(gen)))
val out = Decoupled(gen)
val chosen = Output(UInt(log2Ceil(n).W))
diff --git a/src/main/scala/chisel3/util/Decoupled.scala b/src/main/scala/chisel3/util/Decoupled.scala
index bcd65a1b..d2419325 100644
--- a/src/main/scala/chisel3/util/Decoupled.scala
+++ b/src/main/scala/chisel3/util/Decoupled.scala
@@ -101,9 +101,6 @@ object Decoupled
irr.ready := d.ready
d
}
-// override def cloneType: this.type = {
-// DeqIO(gen).asInstanceOf[this.type]
-// }
}
/** A concrete subclass of ReadyValidIO that promises to not change
@@ -154,8 +151,9 @@ object DeqIO {
* @param gen The type of data to queue
* @param entries The max number of entries in the queue.
*/
-class QueueIO[T <: Data](gen: T, entries: Int) extends Bundle
-{
+class QueueIO[T <: Data](private val gen: T, val entries: Int) extends Bundle
+{ // See github.com/freechipsproject/chisel3/issues/765 for why gen is a private val and proposed replacement APIs.
+
/* These may look inverted, because the names (enq/deq) are from the perspective of the client,
* but internally, the queue implementation itself sits on the other side
* of the interface so uses the flipped instance.
@@ -166,8 +164,6 @@ class QueueIO[T <: Data](gen: T, entries: Int) extends Bundle
val deq = Flipped(DeqIO(gen))
/** The current amount of data in the queue */
val count = Output(UInt(log2Ceil(entries + 1).W))
-
- override def cloneType = new QueueIO(gen, entries).asInstanceOf[this.type]
}
/** A hardware module implementing a Queue