aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/Utils.scala
diff options
context:
space:
mode:
authorJack2016-05-10 01:23:10 -0700
committerJack Koenig2016-06-10 16:33:08 -0700
commit58d9f1d50c07d999776c76259fadbdfd52c564fc (patch)
tree773e976333a6167cf3e378f36fdebac34268e93c /src/main/scala/firrtl/Utils.scala
parentc1504e2179e509632fa8d9ab44d87191b46cf851 (diff)
API Cleanup - PrimOp & PrimOps
Add simple documentation trait PrimOp -> abstract class PrimOp Move PrimOp case objects to object PrimOps Rename PrimOp case objects to match concrete syntax Overrwrite toString for more canonical serialization Update some PrimOps utility functions
Diffstat (limited to 'src/main/scala/firrtl/Utils.scala')
-rw-r--r--src/main/scala/firrtl/Utils.scala9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/scala/firrtl/Utils.scala b/src/main/scala/firrtl/Utils.scala
index 9f85949c..830018c6 100644
--- a/src/main/scala/firrtl/Utils.scala
+++ b/src/main/scala/firrtl/Utils.scala
@@ -42,6 +42,7 @@ import com.typesafe.scalalogging.LazyLogging
import WrappedExpression._
import firrtl.WrappedType._
import firrtl.Mappers._
+import firrtl.PrimOps._
import scala.collection.mutable.ArrayBuffer
import scala.collection.mutable.LinkedHashMap
//import scala.reflect.runtime.universe._
@@ -89,7 +90,7 @@ object Utils extends LazyLogging {
else if ((e1 == we(zero)) | (e2 == we(zero))) zero
else if (e1 == we(one)) e2.e1
else if (e2 == we(one)) e1.e1
- else DoPrim(AND_OP,Seq(e1.e1,e2.e1),Seq(),UIntType(IntWidth(1)))
+ else DoPrim(And,Seq(e1.e1,e2.e1),Seq(),UIntType(IntWidth(1)))
}
def OR (e1:WrappedExpression,e2:WrappedExpression) : Expression = {
@@ -97,13 +98,13 @@ object Utils extends LazyLogging {
else if ((e1 == we(one)) | (e2 == we(one))) one
else if (e1 == we(zero)) e2.e1
else if (e2 == we(zero)) e1.e1
- else DoPrim(OR_OP,Seq(e1.e1,e2.e1),Seq(),UIntType(IntWidth(1)))
+ else DoPrim(Or,Seq(e1.e1,e2.e1),Seq(),UIntType(IntWidth(1)))
}
- def EQV (e1:Expression,e2:Expression) : Expression = { DoPrim(EQUAL_OP,Seq(e1,e2),Seq(),tpe(e1)) }
+ def EQV (e1:Expression,e2:Expression) : Expression = { DoPrim(Eq,Seq(e1,e2),Seq(),tpe(e1)) }
def NOT (e1:WrappedExpression) : Expression = {
if (e1 == we(one)) zero
else if (e1 == we(zero)) one
- else DoPrim(EQUAL_OP,Seq(e1.e1,zero),Seq(),UIntType(IntWidth(1)))
+ else DoPrim(Eq,Seq(e1.e1,zero),Seq(),UIntType(IntWidth(1)))
}