MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / makeVar_

Method makeVar_

src/DesignCompile/ElaborationStep.cpp:1703–2359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1701}
1702
1703any* ElaborationStep::makeVar_(DesignComponent* component, Signal* sig,
1704 std::vector<UHDM::range*>* packedDimensions,
1705 int32_t packedSize,
1706 std::vector<UHDM::range*>* unpackedDimensions,
1707 int32_t unpackedSize, ModuleInstance* instance,
1708 UHDM::VectorOfvariables* vars,
1709 UHDM::expr* assignExp, UHDM::typespec* tps) {
1710 Serializer& s = m_compileDesign->getSerializer();
1711 const DataType* dtype = sig->getDataType();
1712 VObjectType subnettype = sig->getType();
1713
1714 const std::string_view signame = sig->getName();
1715 const FileContent* const fC = sig->getFileContent();
1716
1717 variables* obj = nullptr;
1718 bool found = false;
1719 while (dtype) {
1720 if (const TypeDef* tdef = datatype_cast<const TypeDef*>(dtype)) {
1721 if (tdef->getTypespec()) {
1722 tps = tdef->getTypespec();
1723 found = false;
1724 break;
1725 }
1726 } else if (const Enum* en = datatype_cast<const Enum*>(dtype)) {
1727 if (en->getTypespec()) {
1728 enum_var* stv = s.MakeEnum_var();
1729 if (typespec* ts = en->getTypespec()) {
1730 ref_typespec* tsRef = s.MakeRef_typespec();
1731 tsRef->VpiParent(stv);
1732 tsRef->Actual_typespec(ts);
1733 stv->Typespec(tsRef);
1734 }
1735 if (assignExp != nullptr) {
1736 stv->Expr(assignExp);
1737 assignExp->VpiParent(stv);
1738 }
1739 obj = stv;
1740 found = true;
1741 break;
1742 }
1743 } else if (const Struct* st = datatype_cast<const Struct*>(dtype)) {
1744 if (st->getTypespec()) {
1745 struct_var* stv = s.MakeStruct_var();
1746 if (typespec* ts = st->getTypespec()) {
1747 ref_typespec* tsRef = s.MakeRef_typespec();
1748 tsRef->VpiParent(stv);
1749 tsRef->Actual_typespec(ts);
1750 stv->Typespec(tsRef);
1751 }
1752 if (assignExp != nullptr) {
1753 stv->Expr(assignExp);
1754 assignExp->VpiParent(stv);
1755 }
1756 obj = stv;
1757 found = true;
1758 break;
1759 }
1760 } else if (const Union* un = datatype_cast<const Union*>(dtype)) {

Callers

nothing calls this directly

Calls 15

ExprMethod · 0.80
compileTypespecMethod · 0.80
elabTypespecMethod · 0.80
isConstMethod · 0.80
getPackedDimensionMethod · 0.80
populateCoreMembersMethod · 0.80
named_eventsMethod · 0.80
adjustSizeMethod · 0.80
attributesMethod · 0.80
getDataTypeMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected