diff options
| author | jackkoenig | 2015-12-06 00:36:12 -0800 |
|---|---|---|
| committer | jackkoenig | 2015-12-06 00:36:12 -0800 |
| commit | c5cac5227cd164b17f2a6f02227a71dc89f8cde4 (patch) | |
| tree | 1f6d30b64a58103574bacb770bbc307f8d1e4bbe /src/main/scala/firrtl/Translator.scala | |
| parent | e8ac783706cca1f7ee65d799b5d8be445b6a5c5d (diff) | |
Working on generating SimTop, need to figure out how to split the top-level IO between the sim modules.
Diffstat (limited to 'src/main/scala/firrtl/Translator.scala')
| -rw-r--r-- | src/main/scala/firrtl/Translator.scala | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/main/scala/firrtl/Translator.scala b/src/main/scala/firrtl/Translator.scala index e7bd6821..9fe40af8 100644 --- a/src/main/scala/firrtl/Translator.scala +++ b/src/main/scala/firrtl/Translator.scala @@ -31,21 +31,20 @@ object Translator if( !it.hasNext ) throw new Exception("Empty file!") - //// Find circuit before starting scope checks - //var line = it.next - //while ( it.hasNext && !line._1.contains("circuit") ) { - // ret ++= line._1 + "\n" - // line = it.next - //} - //ret ++= line._1 + " { \n" - //if( !it.hasNext ) throw new Exception("No circuit in file!") + // Find circuit before starting scope checks + var line = it.next + while ( it.hasNext && !line._1.contains("circuit") ) { + ret ++= line._1 + "\n" + line = it.next + } + ret ++= line._1 + " { \n" + if( !it.hasNext ) throw new Exception("No circuit in file!") val scope = Stack[Int]() - scope.push(0) - var newScope = false - //scope.push(countSpaces(line._1)) - //var newScope = true // indicates if increasing scope spacing is legal on next line + val lowestScope = countSpaces(line._1) + scope.push(lowestScope) + var newScope = true // indicates if increasing scope spacing is legal on next line while( it.hasNext ) { it.next match { case (lineText, lineNum) => @@ -94,7 +93,7 @@ object Translator } // while( it.hasNext ) // Print any closing braces - while( scope.top > 0 ) { + while( scope.top > lowestScope ) { scope.pop() ret.deleteCharAt(ret.lastIndexOf("\n")) // Put on previous line ret ++= " }\n" |
