add AVec, which automatically infers element type
should consider modifying Vec as such
This commit is contained in:
parent
2b26082132
commit
55082e45c4
@ -11,6 +11,15 @@ object Util
|
|||||||
implicit def wcToUFix(c: WideCounter): UFix = c.value
|
implicit def wcToUFix(c: WideCounter): UFix = c.value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
object AVec
|
||||||
|
{
|
||||||
|
def apply[T <: Data](elts: Seq[T]): Vec[T] = {
|
||||||
|
require(elts.tail.forall(elts.head.getClass == _.getClass))
|
||||||
|
Vec(elts) { elts.head.clone }
|
||||||
|
}
|
||||||
|
def apply[T <: Data](elt0: T, elts: T*): Vec[T] = apply(elt0 :: elts.toList)
|
||||||
|
}
|
||||||
|
|
||||||
// a counter that clock gates most of its MSBs using the LSB carry-out
|
// a counter that clock gates most of its MSBs using the LSB carry-out
|
||||||
case class WideCounter(width: Int, inc: Bool = Bool(true))
|
case class WideCounter(width: Int, inc: Bool = Bool(true))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user