diff options
| author | Adam Izraelevitz | 2016-06-07 16:35:48 -0700 |
|---|---|---|
| committer | Adam Izraelevitz | 2016-06-07 16:35:48 -0700 |
| commit | e7ca89642342a10fc1780cc13b88c9bba91ae875 (patch) | |
| tree | ca8a4497b92b4ec13748f8b613a7131a88cc40c5 /src | |
| parent | 9db37d37b76583a9feaf1959317c375589a28a21 (diff) | |
| parent | 10b392e117682b0868de29b42f9e4e49cf6569d5 (diff) | |
Merge pull request #153 from ucb-bar/update-check-high-form
Update check high form
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/scala/firrtl/passes/Checks.scala | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/main/scala/firrtl/passes/Checks.scala b/src/main/scala/firrtl/passes/Checks.scala index 15f17453..23613e65 100644 --- a/src/main/scala/firrtl/passes/Checks.scala +++ b/src/main/scala/firrtl/passes/Checks.scala @@ -45,7 +45,6 @@ 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 IsPrefixException(prefix: String) extends PassException(s"${sinfo}: [module ${mname}] Symbol ${prefix} is a prefix.") 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 UndeclaredReferenceException(name: String) extends PassException(s"${sinfo}: [module ${mname}] Reference ${name} is not declared.") @@ -63,35 +62,6 @@ object CheckHighForm extends Pass with LazyLogging { class BadPrintfTrailingException extends PassException(s"${sinfo}: [module ${mname}] Bad printf format: trailing " + "\"%\"") class BadPrintfIncorrectNumException extends PassException(s"${sinfo}: [module ${mname}] Bad printf format: incorrect number of arguments") - // Trie Datastructure for prefix checking - case class Trie(var children: HashMap[String, Trie], var end: Boolean) { - def empty: Boolean = children.isEmpty - def add(ls: Seq[String]): Boolean = { - var t: Trie = this - var sawEnd = false - for (x <- ls) { - if (t.end) sawEnd = true - if (t.contains(x)) t = t.children(x) - else { - val temp = new Trie(HashMap[String,Trie](),false) - t.children(x) = temp - t = temp - } - } - t.end = true - sawEnd | !t.empty - } - def contains(s: String): Boolean = children.contains(s) - def contains(ls: Seq[String]): Boolean = { - var t: Trie = this - for (x <- ls) { - if (t.contains(x)) t = t.children(x) - else return false - } - t.end - } - } - // Utility functions def hasFlip(t: Type): Boolean = { var has = false @@ -202,7 +172,6 @@ object CheckHighForm extends Pass with LazyLogging { def checkHighFormM(m: Module): Module = { val names = HashMap[String, Boolean]() val mnames = HashMap[String, Boolean]() - val tries = Trie(HashMap[String, Trie](),false) def checkHighFormE(e: Expression): Expression = { def validSubexp(e: Expression): Expression = { e match { @@ -232,8 +201,6 @@ object CheckHighForm extends Pass with LazyLogging { def checkName(name: String): String = { if (names.contains(name)) errors.append(new NotUniqueException(name)) else names(name) = true - val ls: Seq[String] = name.split('$') - if (tries.add(ls)) errors.append(new IsPrefixException(name)) name } sinfo = s.getInfo |
