aboutsummaryrefslogtreecommitdiff
path: root/src/main/stanza/firrtl-test-main.stanza
diff options
context:
space:
mode:
authorjackbackrack2015-04-20 15:21:30 -0700
committerjackbackrack2015-04-20 15:21:30 -0700
commit6204b6d44aef2f47a8009ad06dfd4e09ce7ce950 (patch)
tree8795de870f20086b0615f7c402c234b79e6a71a0 /src/main/stanza/firrtl-test-main.stanza
parent5298af3dffcd0985922a2a8317fa6a67e192a9c0 (diff)
parent7617e33993abf9f6be357e0261755a4736c2e085 (diff)
merge
Diffstat (limited to 'src/main/stanza/firrtl-test-main.stanza')
-rw-r--r--src/main/stanza/firrtl-test-main.stanza27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/main/stanza/firrtl-test-main.stanza b/src/main/stanza/firrtl-test-main.stanza
index ca521ec2..54fcb7f9 100644
--- a/src/main/stanza/firrtl-test-main.stanza
+++ b/src/main/stanza/firrtl-test-main.stanza
@@ -26,21 +26,24 @@ defn set-printvars! (p:List<Char>) :
if contains(p,'g') : PRINT-GENDERS = true
if contains(p,'c') : PRINT-CIRCUITS = true
+;firrtl -i gcd.fir -o gcd.flo -x qabcefghipjklmno -p c
defn main () :
val args = commandline-arguments()
- val pathname = args[1]
- val lexed = lex-file(pathname)
+ var input = false
+ var output = false
+ var passes = "qabcefghipjklmno"
+ var printvars = ""
+ for (s in args, i in 0 to false) do :
+ if s == "-i" : input = args[i + 1]
+ if s == "-o" : output = args[i + 1]
+ if s == "-x" : passes = args[i + 1]
+ if s == "-p" : printvars = args[i + 1]
+ if input == false : error("No input file provided. Use -i flag")
+ if output == false : error("No output file provided. Use -o flag")
+ val lexed = lex-file(input as String)
val c = parse-firrtl(lexed)
- val dir = "." ;; could have dir arg
- val name = last(split(pathname,'/'))
- val basename = split(name,'.')[0]
- val outname = string-join([dir "/" basename ".flo"])
- if length(args) >= 4 :
- set-printvars!(to-list(args[3]))
- if length(args) >= 3 :
- run-passes(c,to-list(args[2]), outname)
- else :
- run-passes(c,to-list("qabcefghipjklmno"), outname)
+ set-printvars!(to-list(printvars))
+ run-passes(c,to-list(passes),output as String)
main()