From 69e8250dd47210cee809c9ae231c1e320d76c084 Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Fri, 29 Mar 2019 15:10:13 -0700 Subject: Ignore empty aggregates elements when binding aggregate direction (#946) Previously, including an empty aggregate in a Bundle would cause a MixedDirectionAggregateException because it has no elements and thus doesn't have a direction * Add SampleElementBinding for Vec sample elements * Add ActualDirection.Empty for bound empty aggregates--- chiselFrontend/src/main/scala/chisel3/core/Binding.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'chiselFrontend/src/main/scala/chisel3/core/Binding.scala') diff --git a/chiselFrontend/src/main/scala/chisel3/core/Binding.scala b/chiselFrontend/src/main/scala/chisel3/core/Binding.scala index 55e6bcf9..37ce3f66 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Binding.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Binding.scala @@ -87,7 +87,7 @@ sealed trait UnconstrainedBinding extends TopBinding { def location: Option[BaseModule] = None } // A constrained binding can only be read/written by specific modules -// Location will track where this Module is +// Location will track where this Module is, and the bound object can be referenced in FIRRTL sealed trait ConstrainedBinding extends TopBinding { def enclosure: BaseModule def location: Option[BaseModule] = Some(enclosure) @@ -107,6 +107,10 @@ case class WireBinding(enclosure: RawModule) extends ConstrainedBinding case class ChildBinding(parent: Data) extends Binding { def location: Option[BaseModule] = parent.topBinding.location } +/** Special binding for Vec.sample_element */ +case class SampleElementBinding[T <: Data](parent: Vec[T]) extends Binding { + def location = parent.topBinding.location +} // A DontCare element has a specific Binding, somewhat like a literal. // It is a source (RHS). It may only be connected/applied to sinks. case class DontCareBinding() extends UnconstrainedBinding -- cgit v1.2.3