Support indexing 1-entry Seqs
It's a zero-width wire special case. Closes #706.
This commit is contained in:
parent
2e23d46631
commit
ee6702e5e0
@ -11,7 +11,9 @@ package object util {
|
|||||||
|
|
||||||
implicit class SeqToAugmentedSeq[T <: Data](val x: Seq[T]) extends AnyVal {
|
implicit class SeqToAugmentedSeq[T <: Data](val x: Seq[T]) extends AnyVal {
|
||||||
def apply(idx: UInt): T = {
|
def apply(idx: UInt): T = {
|
||||||
if (!isPow2(x.size)) {
|
if (x.size == 1) {
|
||||||
|
x.head
|
||||||
|
} else if (!isPow2(x.size)) {
|
||||||
// For non-power-of-2 seqs, reflect elements to simplify decoder
|
// For non-power-of-2 seqs, reflect elements to simplify decoder
|
||||||
(x ++ x.takeRight(x.size & -x.size)).toSeq(idx)
|
(x ++ x.takeRight(x.size & -x.size)).toSeq(idx)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user