aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/passes/Checks.scala
diff options
context:
space:
mode:
authorJack2016-05-09 23:33:36 -0700
committerJack Koenig2016-06-10 16:32:50 -0700
commit26e33c343332c2f65bb45bc17b40a9cb7d22e2fd (patch)
treea02cead24db710db2f1832d0e3389ad256085600 /src/main/scala/firrtl/passes/Checks.scala
parent1eb8be78938721dd0d609f684c159bc1d1ddcfd6 (diff)
API Cleanup - Statement
trait Stmt -> abstract class Statement (to match Expression) abbrev. exp -> expr BulkConnect -> PartialConnect camelCase things that were snake_case case class Empty() -> case object EmptyStmt Change >120 character Statements to multiline
Diffstat (limited to 'src/main/scala/firrtl/passes/Checks.scala')
-rw-r--r--src/main/scala/firrtl/passes/Checks.scala31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/main/scala/firrtl/passes/Checks.scala b/src/main/scala/firrtl/passes/Checks.scala
index a88ad051..272c96ea 100644
--- a/src/main/scala/firrtl/passes/Checks.scala
+++ b/src/main/scala/firrtl/passes/Checks.scala
@@ -46,7 +46,7 @@ object CheckHighForm extends Pass with LazyLogging {
// Custom Exceptions
class NotUniqueException(name: String) extends PassException(s"${sinfo}: [module ${mname}] Reference ${name} does not have a unique name.")
class InvalidLOCException extends PassException(s"${sinfo}: [module ${mname}] Invalid connect to an expression that is not a reference or a WritePort.")
- class NegUIntException extends PassException(s"${sinfo}: [module ${mname}] UIntValue cannot be negative.")
+ class NegUIntException extends PassException(s"${sinfo}: [module ${mname}] UIntLiteral cannot be negative.")
class UndeclaredReferenceException(name: String) extends PassException(s"${sinfo}: [module ${mname}] Reference ${name} is not declared.")
class PoisonWithFlipException(name: String) extends PassException(s"${sinfo}: [module ${mname}] Poison ${name} cannot be a bundle type with flips.")
class MemWithFlipException(name: String) extends PassException(s"${sinfo}: [module ${mname}] Memory ${name} cannot be a bundle type with flips.")
@@ -197,7 +197,7 @@ object CheckHighForm extends Pass with LazyLogging {
e map (checkHighFormT)
e
}
- def checkHighFormS(s: Stmt): Stmt = {
+ def checkHighFormS(s: Statement): Statement = {
def checkName(name: String): String = {
if (names.contains(name)) errors.append(new NotUniqueException(name))
else names(name) = true
@@ -209,12 +209,8 @@ object CheckHighForm extends Pass with LazyLogging {
s map (checkHighFormT)
s map (checkHighFormE)
s match {
- case s: DefPoison => {
- if (hasFlip(s.tpe)) errors.append(new PoisonWithFlipException(s.name))
- checkHighFormT(s.tpe)
- }
case s: DefMemory => {
- if (hasFlip(s.data_type)) errors.append(new MemWithFlipException(s.name))
+ if (hasFlip(s.dataType)) errors.append(new MemWithFlipException(s.name))
if (s.depth <= 0) errors.append(new NegMemSizeException)
}
case s: WDefInstance => {
@@ -222,7 +218,7 @@ object CheckHighForm extends Pass with LazyLogging {
errors.append(new ModuleNotDefinedException(s.module))
}
case s: Connect => checkValidLoc(s.loc)
- case s: BulkConnect => checkValidLoc(s.loc)
+ case s: PartialConnect => checkValidLoc(s.loc)
case s: Print => checkFstring(s.string, s.args.length)
case _ => // Do Nothing
}
@@ -444,11 +440,11 @@ object CheckTypes extends Pass with LazyLogging {
}
}
- def check_types_s (s:Stmt) : Stmt = {
+ def check_types_s (s:Statement) : Statement = {
s map (check_types_e(get_info(s))) match {
- case (s:Connect) => if (wt(tpe(s.loc)) != wt(tpe(s.exp))) errors.append(new InvalidConnect(s.info, s.loc.serialize, s.exp.serialize))
+ case (s:Connect) => if (wt(tpe(s.loc)) != wt(tpe(s.expr))) errors.append(new InvalidConnect(s.info, s.loc.serialize, s.expr.serialize))
case (s:DefRegister) => if (wt(s.tpe) != wt(tpe(s.init))) errors.append(new InvalidRegInit(s.info))
- case (s:BulkConnect) => if (!bulk_equals(tpe(s.loc),tpe(s.exp),Default,Default) ) errors.append(new InvalidConnect(s.info, s.loc.serialize, s.exp.serialize))
+ case (s:PartialConnect) => if (!bulk_equals(tpe(s.loc),tpe(s.expr),Default,Default) ) errors.append(new InvalidConnect(s.info, s.loc.serialize, s.expr.serialize))
case (s:Stop) => {
if (wt(tpe(s.clk)) != wt(ClockType) ) errors.append(new ReqClk(s.info))
if (wt(tpe(s.en)) != wt(ut()) ) errors.append(new EnNotUInt(s.info))
@@ -587,12 +583,11 @@ object CheckGenders extends Pass {
e
}
- def check_genders_s (genders:HashMap[String,Gender])(s:Stmt) : Stmt = {
+ def check_genders_s (genders:HashMap[String,Gender])(s:Statement) : Statement = {
s map (check_genders_e(get_info(s),genders))
s map (check_genders_s(genders))
(s) match {
case (s:DefWire) => genders(s.name) = BIGENDER
- case (s:DefPoison) => genders(s.name) = MALE
case (s:DefRegister) => genders(s.name) = BIGENDER
case (s:DefNode) => {
check_gender(s.info,genders,MALE)(s.value)
@@ -602,7 +597,7 @@ object CheckGenders extends Pass {
case (s:WDefInstance) => genders(s.name) = MALE
case (s:Connect) => {
check_gender(s.info,genders,FEMALE)(s.loc)
- check_gender(s.info,genders,MALE)(s.exp)
+ check_gender(s.info,genders,MALE)(s.expr)
}
case (s:Print) => {
for (x <- s.args ) {
@@ -611,14 +606,14 @@ object CheckGenders extends Pass {
check_gender(s.info,genders,MALE)(s.en)
check_gender(s.info,genders,MALE)(s.clk)
}
- case (s:BulkConnect) => {
+ case (s:PartialConnect) => {
check_gender(s.info,genders,FEMALE)(s.loc)
- check_gender(s.info,genders,MALE)(s.exp)
+ check_gender(s.info,genders,MALE)(s.expr)
}
case (s:Conditionally) => {
check_gender(s.info,genders,MALE)(s.pred)
}
- case (s:Empty) => false
+ case EmptyStmt => false
case (s:Stop) => {
check_gender(s.info,genders,MALE)(s.en)
check_gender(s.info,genders,MALE)(s.clk)
@@ -687,7 +682,7 @@ object CheckWidths extends Pass {
}
e
}
- def check_width_s (s:Stmt) : Stmt = {
+ def check_width_s (s:Statement) : Statement = {
s map (check_width_s) map (check_width_e(get_info(s)))
def tm (t:Type) : Type = mapr(check_width_w(info(s)) _,t)
s map (tm)