wire assignments
[sv2nmigen.git] / parse_sv.py
index 2f70c5945ba6caf90c792ad8e7339776e46526f6..c1c0a9ca68e874ed4cafa0f897e9627abb0af71e 100644 (file)
@@ -25,8 +25,8 @@ from lib2to3.pytree import Node, Leaf
 from lib2to3.pgen2 import token
 from lib2to3.pygram import python_symbols as syms
 
-yacc1_debug = 1
-yacc2_debug = 1
+yacc1_debug = 0
+yacc2_debug = 0
 parse_debug = 1
 
 
@@ -1035,6 +1035,7 @@ def p_data_type_or_implicit_3(p):
     '''data_type_or_implicit : dimensions '''
     if(parse_debug):
         print('data_type_or_implicit_3', list(p))
+    p[0] = list(p)
 
     # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, p[1]);
     #  tmp->implicit_flag = true;
@@ -5541,7 +5542,10 @@ def p_expression_25(p):
     #  FILE_NAME(tmp, @2);
     #  p[0] = tmp;
     #       }
-    p[0] = Node(syms.atom, [p[1], Leaf(token.MINUS, '-'), p[4]])
+    try:
+        p[0] = Node(syms.atom, [p[1], Leaf(token.MINUS, '-'), p[4]])
+    except:
+        p[0] = "bad input in p_expression_25"
 
 
 ()
@@ -8044,6 +8048,9 @@ def p_module_item_2(p):
     if(parse_debug):
         print('module_item_2', list(p))
 
+    p[0] = absyn.module_item_2(p[2], p[3], p[5])
+    #p[0] = ["module_item_2"]+list(p)
+
     # { data_type_t*data_type = p[3];
     #  if (data_type == 0) {
     #        data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
@@ -9169,10 +9176,12 @@ def p_bit_logic_opt_2(p):
 
 def p_net_type_1(p):
     '''net_type : K_wire '''
-    if(parse_debug):
+    if(parse_debug > 2):
         print('net_type_1', list(p))
 
-    # { p[0] = NetNet::WIRE; }
+    p[0] = "wire"
+
+
 ()
 
 
@@ -10078,22 +10087,27 @@ def p_register_variable_list_2(p):
 
 def p_net_variable_1(p):
     '''net_variable : IDENTIFIER dimensions_opt '''
-    if(parse_debug):
+    if(parse_debug > 2):
         print('net_variable_1', list(p))
 
+    #p[0]= ('net_variable_1', list(p))
+
     # { perm_string name = lex_strings.make(p[1]);
     #  pform_makewire(@1, name, NetNet::IMPLICIT,
     #                 NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
     #  pform_set_reg_idx(name, p[2]);
-    #  p[0] = p[1];
+    p[0] = [p[1], p[2]]
+
+
     #       }
 ()
 
 
 def p_net_variable_list_1(p):
     '''net_variable_list : net_variable '''
-    if(parse_debug):
+    if(parse_debug > 2):
         print('net_variable_list_1', list(p))
+    p[0] = [p[1]]
 
     # { list<perm_string>*tmp = new list<perm_string>;
     #            tmp->push_back(lex_strings.make(p[1]));
@@ -10105,8 +10119,9 @@ def p_net_variable_list_1(p):
 
 def p_net_variable_list_2(p):
     '''net_variable_list : net_variable_list ',' net_variable '''
-    if(parse_debug):
+    if(parse_debug > 2):
         print('net_variable_list_2', list(p))
+    p[0] = p[1]+[p[3]]
 
     # { list<perm_string>*tmp = p[1];
     #            tmp->push_back(lex_strings.make(p[3]));