summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Lawson2016-09-30 12:03:12 -0700
committerGitHub2016-09-30 12:03:12 -0700
commit6edbdf279257d656b5eac38d9de8645a068611bf (patch)
tree8bb5597746002ac98641f394cee4c94e1d154aff /src
parent52820f74cbaa9083fb6384c71a5964c0e92d612a (diff)
parent058711230d2d9976ce35edc2587b17d2d6d58cff (diff)
Merge pull request #304 from ucb-bar/gsdt-adddirmethod
Add Data dir method to Chisel compatibility layer.
Diffstat (limited to 'src')
-rw-r--r--src/main/scala/chisel3/compatibility.scala10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/scala/chisel3/compatibility.scala b/src/main/scala/chisel3/compatibility.scala
index aad15f60..d13fcb06 100644
--- a/src/main/scala/chisel3/compatibility.scala
+++ b/src/main/scala/chisel3/compatibility.scala
@@ -12,6 +12,16 @@ package object Chisel { // scalastyle:ignore package.object.name
object Flipped {
def apply[T<:Data](target: T): T = chisel3.core.Flipped[T](target)
}
+ // TODO: Possibly move the AddDirectionToData class here?
+ implicit class AddDirMethodToData[T<:Data](val target: T) extends AnyVal {
+ def dir: Direction = {
+ target match {
+ case e: Element => e.dir
+ case _ => chisel3.core.Direction.Unspecified
+ }
+ }
+ }
+
type ChiselException = chisel3.internal.ChiselException
type Data = chisel3.core.Data