X-Git-Url: https://git.libre-soc.org/?p=sv2nmigen.git;a=blobdiff_plain;f=parse_sv.py;h=4973540dc4d55dc366c0d1034203623088f90462;hp=627aa03121bdb1e073abe7debafe6429b4706820;hb=e2973c57aa90034c4fb3bff4a1de95b0fd1c9ccc;hpb=71d1f25d91fd5bfa2396591c0833dfa56f3f6f3a diff --git a/parse_sv.py b/parse_sv.py index 627aa03..4973540 100644 --- a/parse_sv.py +++ b/parse_sv.py @@ -25,7 +25,7 @@ from lib2to3.pygram import python_symbols as syms yacc1_debug = 0 yacc2_debug = 0 -parse_debug = 1 +parse_debug = 0 from ply import yacc, lex @@ -109,18 +109,6 @@ class DataType: self.typ = typ self.signed = signed -def port_decl(comment, dt, name): - if dt is None or dt.dims is None: - width = '' # width: 1 - else: - width = dt.dims - # XXX TODO, better checking, should be using data structure... *sigh* - width = width[1:-1] # strip brackets - width = width.split(':') - assert width[0] == '0' - width = width[1] - return 'self.%s = Signal(%s) # %s' % (name, width, comment) - # -------------- RULES ---------------- () def p_source_text_1(p): @@ -4758,9 +4746,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 +4818,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]; @@ -5019,7 +5005,8 @@ def p_lpvalue_4(p): () def p_cont_assign_1(p): '''cont_assign : lpvalue '=' expression ''' - if(parse_debug): print('cont_assign_1 TODO', list(p)) + if(parse_debug): print('cont_assign_1', list(p)) + absyn.cont_assign_1(p) # { list*tmp = new list; # tmp->push_back(p[1]); # tmp->push_back(p[3]);