From fafd984a923591841917cd4c3a1f4c823dc485b4 Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Tue, 8 Oct 2019 07:23:52 -0700 Subject: Fix direction of dynamic index in complex Vec (#1196) Dynamically indexing a Vec of Flipped bidirectional Bundles would get the wrong directions on the elements of the Bundles Fixes #1192--- chiselFrontend/src/main/scala/chisel3/Aggregate.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'chiselFrontend') diff --git a/chiselFrontend/src/main/scala/chisel3/Aggregate.scala b/chiselFrontend/src/main/scala/chisel3/Aggregate.scala index 4640cb0f..ba9afd5b 100644 --- a/chiselFrontend/src/main/scala/chisel3/Aggregate.scala +++ b/chiselFrontend/src/main/scala/chisel3/Aggregate.scala @@ -156,7 +156,9 @@ sealed class Vec[T <: Data] private[chisel3] (gen: => T, val length: Int) child.bind(ChildBinding(this), resolvedDirection) } - direction = sample_element.direction + // Since all children are the same, we can just use the sample_element rather than all children + // .get is safe because None means mixed directions, we only pass 1 so that's not possible + direction = ActualDirection.fromChildren(Set(sample_element.direction), resolvedDirection).get } // Note: the constructor takes a gen() function instead of a Seq to enforce -- cgit v1.2.3