port_decl
authorTobias Platen <tplaten@posteo.de>
Sat, 26 Oct 2019 16:01:02 +0000 (18:01 +0200)
committerTobias Platen <tplaten@posteo.de>
Sat, 26 Oct 2019 16:01:02 +0000 (18:01 +0200)
absyn.py
parse_sv.py

index a1b3427..12f1c0a 100644 (file)
--- a/absyn.py
+++ b/absyn.py
@@ -34,6 +34,9 @@ class Absyn:
         return Leaf(token.DEDENT, '')
     def nl(self):
         return Leaf(token.NEWLINE, '\n')
+        
+    def port_decl(self,comment, dt, name):
+        return None # TODO
 
     def initPorts(self,params,ports):
         pass_stmt = Node(syms.pass_stmt ,[Leaf(token.NAME, "def __init__(self):#FIXME")])
@@ -86,7 +89,12 @@ class Absyn:
         stmts.children.append(self.indent(2))
         stmts.children.append(Leaf(token.STRING,"m = Module()"))
         stmts.children.append(self.nl())
-        ##                      
+        ##
+        for a in self.assign:
+            stmts.children.append(self.indent(2))
+            stmts.children.append(Leaf(token.STRING,"#FIXME_ASSIGN"+str(list(a[8]))))
+            stmts.children.append(self.nl())
+            
         stmts.children.append(self.indent(2))                      
         stmts.children.append(Leaf(token.STRING,"return m"))                      
         stmts.children.append(self.nl())
@@ -119,5 +127,5 @@ class Absyn:
 
     # combinatorical assign
     def cont_assign_1(self,p):
-       self.printpy("#ASSIGN"+str(list(p)))
+       #self.printpy("#ASSIGN"+str(list(p)))
        self.assign += [p]
index 3df4571..bd760f5 100644 (file)
@@ -109,7 +109,7 @@ class DataType:
         self.typ = typ
         self.signed = signed
 
-def port_decl(comment, dt, name):
+def port_decl_do_not_use(comment, dt, name):
     if dt is None or dt.dims is None:
         width = '' # width: 1
     else:
@@ -4758,9 +4758,8 @@ def p_list_of_port_declarations_5(p):
 def p_port_declaration_1(p):
     '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
     if(parse_debug): print('port_declaration_1 FIXME', list(p))
-    # XXX TODO: python AST
     comment, dt, name = p[2], p[4], p[5]
-    p[0] = port_decl(comment, dt, name)
+    p[0] = absyn.port_decl(comment, dt, name)
     # { Module::port_t*ptmp;
     #  perm_string name = lex_strings.make(p[5]);
     #  data_type_t*use_type = p[4];
@@ -4831,9 +4830,8 @@ def p_port_declaration_4(p):
 def p_port_declaration_5(p):
     '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
     if(parse_debug): print('port_declaration_5 FIXME', list(p))
-    # XXX TODO: python AST
     comment, dt, name = p[2], p[4], p[5]
-    p[0] = port_decl(comment, dt, name)
+    p[0] = absyn.port_decl(comment, dt, name)
     # { Module::port_t*ptmp;
     #  perm_string name = lex_strings.make(p[5]);
     #  data_type_t*use_dtype = p[4];