@@ -1287,6 +1287,10 @@ static void simplify_sv(AST::AstNode *current_node, AST::AstNode *parent_node)
12871287 if (current_node->str == " $display" || current_node->str == " $write" )
12881288 simplify_format_string (current_node);
12891289 break ;
1290+ case AST::AST_FCALL:
1291+ std::cout << " simplifying fcall\n " ;
1292+ // simplify(current_node, true, false, false, 1, -1, false, false);
1293+ break ;
12901294 case AST::AST_COND:
12911295 case AST::AST_CONDX:
12921296 case AST::AST_CONDZ:
@@ -1970,6 +1974,33 @@ AST::AstNode *UhdmAst::find_ancestor(const std::unordered_set<AST::AstNodeType>
19701974 return nullptr ;
19711975}
19721976
1977+ static void replace_ids_typedefs (AST::AstNode *tree) {
1978+ if (!tree) return ;
1979+
1980+ if (tree->type == AST::AST_IDENTIFIER) {
1981+ std::cout << " identifier: \n " ;
1982+ tree->dumpAst (nullptr , " +" );
1983+
1984+ if (!tree->id2ast ) {
1985+ if (AST_INTERNAL::current_scope.count (tree->str ))
1986+ tree->id2ast = AST_INTERNAL::current_scope[tree->str ];
1987+ else
1988+ return ;
1989+ }
1990+
1991+ if (tree->id2ast ->type == AST::AST_TYPEDEF) {
1992+ tree->id2ast = tree->id2ast ->children [0 ];
1993+ tree->id2ast ->dumpAst (nullptr , " >" );
1994+ } else {
1995+ std::cout << " Has no id2ast!\n " ;
1996+ }
1997+ std::cout << std::endl;
1998+ }
1999+ for (auto child: tree->children ) {
2000+ replace_ids_typedefs (child);
2001+ }
2002+ }
2003+
19732004void UhdmAst::process_design ()
19742005{
19752006 current_node = make_ast_node (AST::AST_DESIGN);
@@ -2016,6 +2047,7 @@ void UhdmAst::process_design()
20162047 check_memories (pair.second );
20172048 setup_current_scope (shared.top_nodes , pair.second );
20182049 simplify_sv (pair.second , nullptr );
2050+ // replace_ids_typedefs(pair.second);
20192051 clear_current_scope ();
20202052 current_node->children .push_back (pair.second );
20212053 }
@@ -2027,7 +2059,8 @@ void UhdmAst::process_design()
20272059 pair.second = nullptr ;
20282060 }
20292061 }
2030- // simplify_sv(current_node, nullptr);
2062+ std::cout << " tree after plugins job is done:\n " ;
2063+ current_node->dumpAst (nullptr , " " );
20312064}
20322065
20332066void UhdmAst::simplify_parameter (AST::AstNode *parameter, AST::AstNode *module_node)
@@ -4299,26 +4332,8 @@ void UhdmAst::process_logic_var()
42994332
43004333void UhdmAst::process_sys_func_call ()
43014334{
4302- const uhdm_handle *const handle = (const uhdm_handle *)obj_h;
4303- const auto *tfcall = (const UHDM::tf_call *)handle->object ;
4304-
4305- std::cout << " \n tfcall:\n " ;
4306- UHDM::visit_object (NewVpiHandle (tfcall), std::cout);
4307-
4308- UHDM::expr * result = reduce_expression (tfcall, tfcall, tfcall->VpiParent ());
4309- std::cout << " \n after reduce_expr:\n " ;
4310-
4311- vpi_release_handle (obj_h);
4312- obj_h = NewVpiHandle (result);
4313- UHDM::visit_object (obj_h, std::cout);
4314-
4315- if (result->VpiType () != vpiSysFuncCall) {
4316- current_node = process_object (obj_h);
4317- return ;
4318- }
43194335
43204336 current_node = make_ast_node (AST::AST_FCALL);
4321- current_node->dumpAst (nullptr , " ++++" );
43224337
43234338 std::string task_calls[] = {" \\ $display" , " \\ $monitor" , " \\ $write" , " \\ $time" , " \\ $readmemh" , " \\ $readmemb" , " \\ $finish" , " \\ $stop" };
43244339
@@ -5170,8 +5185,6 @@ AST::AstNode *UhdmAst::process_object(vpiHandle obj_handle)
51705185 break ;
51715186 case vpiSysFuncCall: {
51725187 process_sys_func_call ();
5173- std::cout<< " func call processed:\n " ;
5174- current_node->dumpAst (nullptr , " " );
51755188 break ;
51765189 }
51775190 case vpiFuncCall:
0 commit comments