| 839 | } |
| 840 | |
| 841 | any *CompileHelper::getValue(std::string_view name, DesignComponent *component, |
| 842 | CompileDesign *compileDesign, Reduce reduce, |
| 843 | ValuedComponentI *instance, PathId fileId, |
| 844 | uint32_t lineNumber, any *pexpr, bool muteErrors) { |
| 845 | Serializer &s = compileDesign->getSerializer(); |
| 846 | Value *sval = nullptr; |
| 847 | any *result = nullptr; |
| 848 | if (loopDetected(fileId, lineNumber, compileDesign, instance)) { |
| 849 | return nullptr; |
| 850 | } |
| 851 | if (m_checkForLoops) { |
| 852 | m_stackLevel++; |
| 853 | } |
| 854 | if (name.find("::") != std::string::npos) { |
| 855 | std::vector<std::string_view> res; |
| 856 | StringUtils::tokenizeMulti(name, "::", res); |
| 857 | if (res.size() > 1) { |
| 858 | const std::string_view packName = res[0]; |
| 859 | const std::string_view varName = res[1]; |
| 860 | Design *design = compileDesign->getCompiler()->getDesign(); |
| 861 | if (Package *pack = design->getPackage(packName)) { |
| 862 | if (expr *val = pack->getComplexValue(varName)) { |
| 863 | result = val; |
| 864 | if (result && (result->UhdmType() == uhdmoperation)) { |
| 865 | operation *op = (operation *)result; |
| 866 | const UHDM::typespec *opts = nullptr; |
| 867 | if (ref_typespec *rt = op->Typespec()) { |
| 868 | opts = rt->Actual_typespec(); |
| 869 | } |
| 870 | UHDM::ExprEval eval; |
| 871 | if (expr *res = eval.flattenPatternAssignments( |
| 872 | s, opts, (UHDM::expr *)result)) { |
| 873 | if (res->UhdmType() == uhdmoperation) { |
| 874 | op->Operands(((operation *)res)->Operands()); |
| 875 | } |
| 876 | } |
| 877 | } |
| 878 | } |
| 879 | if (result == nullptr) { |
| 880 | if (Value *sval = pack->getValue(varName)) { |
| 881 | UHDM::constant *c = s.MakeConstant(); |
| 882 | c->VpiValue(sval->uhdmValue()); |
| 883 | setRange(c, sval, compileDesign); |
| 884 | c->VpiDecompile(sval->decompiledValue()); |
| 885 | c->VpiConstType(sval->vpiValType()); |
| 886 | c->VpiSize(sval->getSize()); |
| 887 | result = c; |
| 888 | } |
| 889 | } |
| 890 | |
| 891 | if (UHDM::VectorOfparam_assign *param_assigns = |
| 892 | pack->getParam_assigns()) { |
| 893 | for (param_assign *param : *param_assigns) { |
| 894 | if (param && param->Lhs()) { |
| 895 | const std::string_view param_name = param->Lhs()->VpiName(); |
| 896 | if (param_name == varName) { |
| 897 | if (substituteAssignedValue(param->Rhs(), compileDesign)) { |
| 898 | if (param->Rhs()->UhdmType() == uhdmoperation) { |
no test coverage detected