| 1955 | } |
| 1956 | |
| 1957 | bool CompileHelper::compileTask(DesignComponent* component, |
| 1958 | const FileContent* fC, NodeId nodeId, |
| 1959 | CompileDesign* compileDesign, Reduce reduce, |
| 1960 | ValuedComponentI* instance, bool isMethod) { |
| 1961 | UHDM::Serializer& s = compileDesign->getSerializer(); |
| 1962 | std::vector<UHDM::task_func*>* task_funcs = component->getTask_funcs(); |
| 1963 | if (task_funcs == nullptr) { |
| 1964 | component->setTask_funcs(s.MakeTask_funcVec()); |
| 1965 | task_funcs = component->getTask_funcs(); |
| 1966 | } |
| 1967 | std::string name; |
| 1968 | NodeId task_decl = setFuncTaskQualifiers(fC, nodeId, nullptr); |
| 1969 | NodeId Task_body_declaration; |
| 1970 | if (fC->Type(task_decl) == VObjectType::paTask_body_declaration) |
| 1971 | Task_body_declaration = task_decl; |
| 1972 | else |
| 1973 | Task_body_declaration = fC->Child(task_decl); |
| 1974 | NodeId task_name = fC->Child(Task_body_declaration); |
| 1975 | if (fC->Type(task_name) == VObjectType::slStringConst) |
| 1976 | name = fC->SymName(task_name); |
| 1977 | else if (fC->Type(task_name) == VObjectType::paClass_scope) { |
| 1978 | NodeId Class_type = fC->Child(task_name); |
| 1979 | name.assign(fC->SymName(fC->Child(Class_type))) |
| 1980 | .append("::") |
| 1981 | .append(fC->SymName(fC->Sibling(task_name))); |
| 1982 | task_name = fC->Sibling(task_name); |
| 1983 | } |
| 1984 | |
| 1985 | UHDM::task* task = nullptr; |
| 1986 | for (auto f : *component->getTask_funcs()) { |
| 1987 | if (f->VpiName() == name) { |
| 1988 | task = reinterpret_cast<UHDM::task*>(f); |
| 1989 | break; |
| 1990 | } |
| 1991 | } |
| 1992 | if (task == nullptr) { |
| 1993 | // make placeholder first |
| 1994 | task = s.MakeTask(); |
| 1995 | task->VpiName(name); |
| 1996 | fC->populateCoreMembers(task_decl, task_decl, task); |
| 1997 | task_funcs->push_back(task); |
| 1998 | return true; |
| 1999 | } |
| 2000 | if (task->Io_decls() || task->Variables() || task->Stmt()) return true; |
| 2001 | setFuncTaskQualifiers(fC, nodeId, task); |
| 2002 | task->VpiMethod(isMethod); |
| 2003 | fC->populateCoreMembers(nodeId, task_decl, task); |
| 2004 | NodeId Tf_port_list = fC->Sibling(task_name); |
| 2005 | NodeId Statement_or_null; |
| 2006 | if (fC->Type(Tf_port_list) == VObjectType::paTf_port_list) { |
| 2007 | Statement_or_null = fC->Sibling(Tf_port_list); |
| 2008 | task->Io_decls( |
| 2009 | compileTfPortList(component, task, fC, Tf_port_list, compileDesign)); |
| 2010 | } else if (fC->Type(Tf_port_list) == VObjectType::paTf_item_declaration) { |
| 2011 | NodeId Block_item_declaration = fC->Child(Tf_port_list); |
| 2012 | if (fC->Type(Block_item_declaration) != |
| 2013 | VObjectType::paBlock_item_declaration) { |
| 2014 | compileTfPortDecl(component, task, fC, Tf_port_list, compileDesign); |
no test coverage detected