summaryrefslogtreecommitdiff
path: root/chiselFrontend/src/main/scala/chisel3/core/Data.scala
diff options
context:
space:
mode:
authorRichard Lin2017-08-11 13:05:44 -0700
committerGitHub2017-08-11 13:05:44 -0700
commitc87145bc61a729bb035428d527c5787c174c5256 (patch)
tree99f9dbe4f3fca852a4e890619d5dace0cb3677dd /chiselFrontend/src/main/scala/chisel3/core/Data.scala
parent43e62e7f6b5534b48c3757cfcca51b66ca74753d (diff)
Rename userDir->specifiedDir (#671)
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core/Data.scala')
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/Data.scala58
1 files changed, 29 insertions, 29 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Data.scala b/chiselFrontend/src/main/scala/chisel3/core/Data.scala
index 66f16294..be1fe753 100644
--- a/chiselFrontend/src/main/scala/chisel3/core/Data.scala
+++ b/chiselFrontend/src/main/scala/chisel3/core/Data.scala
@@ -11,22 +11,22 @@ import chisel3.internal.sourceinfo._
/** User-specified directions.
*/
-sealed abstract class UserDirection
-object UserDirection {
+sealed abstract class SpecifiedDirection
+object SpecifiedDirection {
/** Default user direction, also meaning 'not-flipped'
*/
- case object Unspecified extends UserDirection
+ case object Unspecified extends SpecifiedDirection
/** Node and its children are forced as output
*/
- case object Output extends UserDirection
+ case object Output extends SpecifiedDirection
/** Node and its children are forced as inputs
*/
- case object Input extends UserDirection
+ case object Input extends SpecifiedDirection
/** Mainly for containers, children are flipped.
*/
- case object Flip extends UserDirection
+ case object Flip extends SpecifiedDirection
- def flip(dir: UserDirection) = dir match {
+ def flip(dir: SpecifiedDirection) = dir match {
case Unspecified => Flip
case Flip => Unspecified
case Output => Input
@@ -36,12 +36,12 @@ object UserDirection {
/** Returns the effective UserDirection of this node given the parent's effective UserDirection
* and the user-specified UserDirection of this node.
*/
- def fromParent(parentDirection: UserDirection, thisDirection: UserDirection) =
+ def fromParent(parentDirection: SpecifiedDirection, thisDirection: SpecifiedDirection) =
(parentDirection, thisDirection) match {
- case (UserDirection.Output, _) => UserDirection.Output
- case (UserDirection.Input, _) => UserDirection.Input
- case (UserDirection.Unspecified, thisDirection) => thisDirection
- case (UserDirection.Flip, thisDirection) => UserDirection.flip(thisDirection)
+ case (SpecifiedDirection.Output, _) => SpecifiedDirection.Output
+ case (SpecifiedDirection.Input, _) => SpecifiedDirection.Input
+ case (SpecifiedDirection.Unspecified, thisDirection) => thisDirection
+ case (SpecifiedDirection.Flip, thisDirection) => SpecifiedDirection.flip(thisDirection)
}
}
@@ -78,7 +78,7 @@ object debug { // scalastyle:ignore object.name
*/
object DataMirror {
def widthOf(target: Data): Width = target.width
- def userDirectionOf(target: Data): UserDirection = target.userDirection
+ def specifiedDirectionOf(target: Data): SpecifiedDirection = target.specifiedDirection
def directionOf(target: Data): ActualDirection = {
requireIsHardware(target, "node requested directionality on")
target.direction
@@ -147,21 +147,21 @@ private[core] object cloneSupertype {
object Input {
def apply[T<:Data](source: T): T = {
val out = source.cloneType
- out.userDirection = UserDirection.Input
+ out.specifiedDirection = SpecifiedDirection.Input
out
}
}
object Output {
def apply[T<:Data](source: T): T = {
val out = source.cloneType
- out.userDirection = UserDirection.Output
+ out.specifiedDirection = SpecifiedDirection.Output
out
}
}
object Flipped {
def apply[T<:Data](source: T): T = {
val out = source.cloneType
- out.userDirection = UserDirection.flip(source.userDirection)
+ out.specifiedDirection = SpecifiedDirection.flip(source.specifiedDirection)
out
}
}
@@ -183,18 +183,18 @@ abstract class Data extends HasId {
}
// User-specified direction, local at this node only.
- // Note that the actual direction of this node can differ from child and parent userDirection.
- private var _userDirection: UserDirection = UserDirection.Unspecified
- private[chisel3] def userDirection: UserDirection = _userDirection
- private[core] def userDirection_=(direction: UserDirection) = {
- if (_userDirection != UserDirection.Unspecified) {
+ // Note that the actual direction of this node can differ from child and parent specifiedDirection.
+ private var _specifiedDirection: SpecifiedDirection = SpecifiedDirection.Unspecified
+ private[chisel3] def specifiedDirection: SpecifiedDirection = _specifiedDirection
+ private[core] def specifiedDirection_=(direction: SpecifiedDirection) = {
+ if (_specifiedDirection != SpecifiedDirection.Unspecified) {
this match {
// Anything flies in compatibility mode
case t: Record if !t.compileOptions.dontAssumeDirectionality =>
- case _ => throw Binding.RebindingException(s"Attempted reassignment of user direction to $this")
+ case _ => throw Binding.RebindingException(s"Attempted reassignment of user-specified direction to $this")
}
}
- _userDirection = direction
+ _specifiedDirection = direction
}
/** This overwrites a relative UserDirection with an explicit one, and is used to implement
@@ -202,11 +202,11 @@ abstract class Data extends HasId {
* DO NOT USE OUTSIDE THIS PURPOSE. THIS OPERATION IS DANGEROUS!
*/
private[core] def _assignCompatibilityExplicitDirection: Unit = {
- (this, _userDirection) match {
+ (this, _specifiedDirection) match {
case (_: Analog, _) => // nothing to do
- case (_, UserDirection.Unspecified) => _userDirection = UserDirection.Output
- case (_, UserDirection.Flip) => _userDirection = UserDirection.Input
- case (_, UserDirection.Input | UserDirection.Output) => // nothing to do
+ case (_, SpecifiedDirection.Unspecified) => _specifiedDirection = SpecifiedDirection.Output
+ case (_, SpecifiedDirection.Flip) => _specifiedDirection = SpecifiedDirection.Input
+ case (_, SpecifiedDirection.Input | SpecifiedDirection.Output) => // nothing to do
}
}
@@ -236,7 +236,7 @@ abstract class Data extends HasId {
* node is the top-level.
* binding and direction are valid after this call completes.
*/
- private[chisel3] def bind(target: Binding, parentDirection: UserDirection = UserDirection.Unspecified)
+ private[chisel3] def bind(target: Binding, parentDirection: SpecifiedDirection = SpecifiedDirection.Unspecified)
// Both _direction and _resolvedUserDirection are saved versions of computed variables (for
// efficiency, avoid expensive recomputation of frequent operations).
@@ -319,7 +319,7 @@ abstract class Data extends HasId {
def chiselCloneType: this.type = {
val clone = this.cloneType // get a fresh object, without bindings
// Only the top-level direction needs to be fixed up, cloneType should do the rest
- clone.userDirection = userDirection
+ clone.specifiedDirection = specifiedDirection
clone
}
final def := (that: Data)(implicit sourceInfo: SourceInfo, connectionCompileOptions: CompileOptions): Unit = this.connect(that)(sourceInfo, connectionCompileOptions)