cleanup, add example output
[sv2nmigen.git] / absyn.py
index d52250206719fbefcd53b2dba3c660b529f8ef9a..6ccbb0529944f48fcc57d1578f573bfcd8cffd10 100644 (file)
--- a/absyn.py
+++ b/absyn.py
@@ -39,8 +39,8 @@ class Assignment:
         self.right = right
 
 class Absyn:
-    def __init__(self):
-        self.outputfile = open("output.py","w")
+    def __init__(self,outputfn):
+        self.outputfile = open(outputfn,"w")
         self.outputfile.write(preamble)
         self.assign = []
         self.ports = []
@@ -147,7 +147,12 @@ class Absyn:
         print(str(clsdecl))
         return clsdecl
 
+    def appendComments(self,data):
+        lines = data.split("\n")
+        for line in lines:
+            self.printpy("#"+line)
+
     # combinatorical assign
     def cont_assign_1(self,p):
-       print("#ASSIGN:BROKEN"+str(list(p)))
+       print("#ASSIGN:BROKEN"+str(list(p)))
        self.assign += [Assignment(p[1],p[2],p[3])]