diff options
| author | Jim Lawson | 2019-03-18 12:17:33 -0700 |
|---|---|---|
| committer | GitHub | 2019-03-18 12:17:33 -0700 |
| commit | 2c449c5d6e23dcbb60e8c64cab6b6f4ba6ae313f (patch) | |
| tree | 3daffa8eb0f57faf31d3977700be38f5be31e59a /chiselFrontend/src/main/scala/chisel3/core/Binding.scala | |
| parent | cfb2f08db9d9df121a82f138dd71297dbcea66cc (diff) | |
Split #974 into two PRs - scalastyle updates (#1037)
* Update style warnings now that subprojects are aggregated.
Use "scalastyle-test-config.xml" for scalastyle config in tests.
Enable "_" in method names and accept method names ending in "_=".
Re-sync scalastyle-test-config.xml with scalastyle-config.xml
* Remove bogus tests that crept in with git add
* Add missing import.
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core/Binding.scala')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/Binding.scala | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Binding.scala b/chiselFrontend/src/main/scala/chisel3/core/Binding.scala index 4c352bc6..55e6bcf9 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Binding.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Binding.scala @@ -1,3 +1,5 @@ +// See LICENSE for license details. + package chisel3.core import chisel3.internal.ChiselException @@ -23,7 +25,7 @@ object Binding { /** Requires that a node is hardware ("bound") */ object requireIsHardware { - def apply(node: Data, msg: String = "") = { + def apply(node: Data, msg: String = ""): Unit = { node._parent match { // Compatibility layer hack case Some(x: BaseModule) => x._compatAutoWrapPorts case _ => @@ -39,7 +41,7 @@ object requireIsHardware { /** Requires that a node is a chisel type (not hardware, "unbound") */ object requireIsChiselType { - def apply(node: Data, msg: String = "") = if (node.topBindingOpt.isDefined) { + def apply(node: Data, msg: String = ""): Unit = if (node.topBindingOpt.isDefined) { val prefix = if (msg.nonEmpty) s"$msg " else "" throw Binding.ExpectedChiselTypeException(s"$prefix'$node' must be a Chisel type, not hardware") } @@ -60,7 +62,7 @@ object BindingDirection { /** Determine the BindingDirection of an Element given its top binding and resolved direction. */ - def from(binding: TopBinding, direction: ActualDirection) = { + def from(binding: TopBinding, direction: ActualDirection): BindingDirection = { binding match { case PortBinding(_) => direction match { case ActualDirection.Output => Output @@ -82,13 +84,13 @@ sealed trait TopBinding extends Binding // Constrained-ness refers to whether 'bound by Module boundaries' // An unconstrained binding, like a literal, can be read by everyone sealed trait UnconstrainedBinding extends TopBinding { - def location = None + def location: Option[BaseModule] = None } // A constrained binding can only be read/written by specific modules // Location will track where this Module is sealed trait ConstrainedBinding extends TopBinding { def enclosure: BaseModule - def location = Some(enclosure) + def location: Option[BaseModule] = Some(enclosure) } // A binding representing a data that cannot be (re)assigned to. @@ -103,7 +105,7 @@ case class RegBinding(enclosure: RawModule) extends ConstrainedBinding case class WireBinding(enclosure: RawModule) extends ConstrainedBinding case class ChildBinding(parent: Data) extends Binding { - def location = parent.topBinding.location + def location: Option[BaseModule] = 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. |
