diff options
| author | Jack | 2016-05-10 01:23:10 -0700 |
|---|---|---|
| committer | Jack Koenig | 2016-06-10 16:33:08 -0700 |
| commit | 58d9f1d50c07d999776c76259fadbdfd52c564fc (patch) | |
| tree | 773e976333a6167cf3e378f36fdebac34268e93c /src/main/scala/firrtl/passes/Checks.scala | |
| parent | c1504e2179e509632fa8d9ab44d87191b46cf851 (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/passes/Checks.scala')
| -rw-r--r-- | src/main/scala/firrtl/passes/Checks.scala | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/src/main/scala/firrtl/passes/Checks.scala b/src/main/scala/firrtl/passes/Checks.scala index 1a11c0a4..5a4f613c 100644 --- a/src/main/scala/firrtl/passes/Checks.scala +++ b/src/main/scala/firrtl/passes/Checks.scala @@ -90,45 +90,45 @@ object CheckHighForm extends Pass with LazyLogging { def checkHighFormPrimop(e: DoPrim) = { def correctNum(ne: Option[Int], nc: Int) = { ne match { - case Some(i) => if(e.args.length != i) errors.append(new IncorrectNumArgsException(e.op.getString, i)) + case Some(i) => if(e.args.length != i) errors.append(new IncorrectNumArgsException(e.op.toString, i)) case None => // Do Nothing } - if (e.consts.length != nc) errors.append(new IncorrectNumConstsException(e.op.getString, nc)) + if (e.consts.length != nc) errors.append(new IncorrectNumConstsException(e.op.toString, nc)) } e.op match { - case ADD_OP => correctNum(Option(2),0) - case SUB_OP => correctNum(Option(2),0) - case MUL_OP => correctNum(Option(2),0) - case DIV_OP => correctNum(Option(2),0) - case REM_OP => correctNum(Option(2),0) - case LESS_OP => correctNum(Option(2),0) - case LESS_EQ_OP => correctNum(Option(2),0) - case GREATER_OP => correctNum(Option(2),0) - case GREATER_EQ_OP => correctNum(Option(2),0) - case EQUAL_OP => correctNum(Option(2),0) - case NEQUAL_OP => correctNum(Option(2),0) - case PAD_OP => correctNum(Option(1),1) - case AS_UINT_OP => correctNum(Option(1),0) - case AS_SINT_OP => correctNum(Option(1),0) - case AS_CLOCK_OP => correctNum(Option(1),0) - case SHIFT_LEFT_OP => correctNum(Option(1),1) - case SHIFT_RIGHT_OP => correctNum(Option(1),1) - case DYN_SHIFT_LEFT_OP => correctNum(Option(2),0) - case DYN_SHIFT_RIGHT_OP => correctNum(Option(2),0) - case CONVERT_OP => correctNum(Option(1),0) - case NEG_OP => correctNum(Option(1),0) - case NOT_OP => correctNum(Option(1),0) - case AND_OP => correctNum(Option(2),0) - case OR_OP => correctNum(Option(2),0) - case XOR_OP => correctNum(Option(2),0) - case AND_REDUCE_OP => correctNum(None,0) - case OR_REDUCE_OP => correctNum(None,0) - case XOR_REDUCE_OP => correctNum(None,0) - case CONCAT_OP => correctNum(Option(2),0) - case BITS_SELECT_OP => correctNum(Option(1),2) - case HEAD_OP => correctNum(Option(1),1) - case TAIL_OP => correctNum(Option(1),1) + case Add => correctNum(Option(2),0) + case Sub => correctNum(Option(2),0) + case Mul => correctNum(Option(2),0) + case Div => correctNum(Option(2),0) + case Rem => correctNum(Option(2),0) + case Lt => correctNum(Option(2),0) + case Leq => correctNum(Option(2),0) + case Gt => correctNum(Option(2),0) + case Geq => correctNum(Option(2),0) + case Eq => correctNum(Option(2),0) + case Neq => correctNum(Option(2),0) + case Pad => correctNum(Option(1),1) + case AsUInt => correctNum(Option(1),0) + case AsSInt => correctNum(Option(1),0) + case AsClock => correctNum(Option(1),0) + case Shl => correctNum(Option(1),1) + case Shr => correctNum(Option(1),1) + case Dshl => correctNum(Option(2),0) + case Dshr => correctNum(Option(2),0) + case Cvt => correctNum(Option(1),0) + case Neg => correctNum(Option(1),0) + case Not => correctNum(Option(1),0) + case And => correctNum(Option(2),0) + case Or => correctNum(Option(2),0) + case Xor => correctNum(Option(2),0) + case Andr => correctNum(None,0) + case Orr => correctNum(None,0) + case Xorr => correctNum(None,0) + case Cat => correctNum(Option(2),0) + case Bits => correctNum(Option(1),2) + case Head => correctNum(Option(1),1) + case Tail => correctNum(Option(1),1) } } @@ -318,38 +318,38 @@ object CheckTypes extends Pass with LazyLogging { } e.op match { - case AS_UINT_OP => {} - case AS_SINT_OP => {} - case AS_CLOCK_OP => {} - case DYN_SHIFT_LEFT_OP => is_uint(e.args(1)); all_ground(e.args) - case DYN_SHIFT_RIGHT_OP => is_uint(e.args(1)); all_ground(e.args) - case ADD_OP => all_ground(e.args) - case SUB_OP => all_ground(e.args) - case MUL_OP => all_ground(e.args) - case DIV_OP => all_ground(e.args) - case REM_OP => all_ground(e.args) - case LESS_OP => all_ground(e.args) - case LESS_EQ_OP => all_ground(e.args) - case GREATER_OP => all_ground(e.args) - case GREATER_EQ_OP => all_ground(e.args) - case EQUAL_OP => all_ground(e.args) - case NEQUAL_OP => all_ground(e.args) - case PAD_OP => all_ground(e.args) - case SHIFT_LEFT_OP => all_ground(e.args) - case SHIFT_RIGHT_OP => all_ground(e.args) - case CONVERT_OP => all_ground(e.args) - case NEG_OP => all_ground(e.args) - case NOT_OP => all_ground(e.args) - case AND_OP => all_ground(e.args) - case OR_OP => all_ground(e.args) - case XOR_OP => all_ground(e.args) - case AND_REDUCE_OP => all_ground(e.args) - case OR_REDUCE_OP => all_ground(e.args) - case XOR_REDUCE_OP => all_ground(e.args) - case CONCAT_OP => all_ground(e.args) - case BITS_SELECT_OP => all_ground(e.args) - case HEAD_OP => all_ground(e.args) - case TAIL_OP => all_ground(e.args) + case AsUInt => + case AsSInt => + case AsClock => + case Dshl => is_uint(e.args(1)); all_ground(e.args) + case Dshr => is_uint(e.args(1)); all_ground(e.args) + case Add => all_ground(e.args) + case Sub => all_ground(e.args) + case Mul => all_ground(e.args) + case Div => all_ground(e.args) + case Rem => all_ground(e.args) + case Lt => all_ground(e.args) + case Leq => all_ground(e.args) + case Gt => all_ground(e.args) + case Geq => all_ground(e.args) + case Eq => all_ground(e.args) + case Neq => all_ground(e.args) + case Pad => all_ground(e.args) + case Shl => all_ground(e.args) + case Shr => all_ground(e.args) + case Cvt => all_ground(e.args) + case Neg => all_ground(e.args) + case Not => all_ground(e.args) + case And => all_ground(e.args) + case Or => all_ground(e.args) + case Xor => all_ground(e.args) + case Andr => all_ground(e.args) + case Orr => all_ground(e.args) + case Xorr => all_ground(e.args) + case Cat => all_ground(e.args) + case Bits => all_ground(e.args) + case Head => all_ground(e.args) + case Tail => all_ground(e.args) } } |
