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

Method writeCont_assign

src/DesignCompile/UhdmWriter.cpp:2040–2250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2038};
2039
2040void UhdmWriter::writeCont_assign(Netlist* netlist, Serializer& s,
2041 DesignComponent* mod, any* m,
2042 std::vector<cont_assign*>* assigns) {
2043 FileSystem* const fileSystem = FileSystem::getInstance();
2044 if (netlist->cont_assigns()) {
2045 for (auto assign : *netlist->cont_assigns()) {
2046 const expr* lhs = assign->Lhs();
2047 const expr* rhs = assign->Rhs();
2048 const expr* delay = assign->Delay();
2049 const typespec* tps = nullptr;
2050 if (const ref_typespec* rt = lhs->Typespec()) {
2051 tps = rt->Actual_typespec();
2052 }
2053 bool simplified = false;
2054 bool cloned = false;
2055 if (delay && delay->UhdmType() == uhdmref_obj) {
2056 UHDM::any* var = m_helper.bindParameter(
2057 mod, netlist->getParent(), delay->VpiName(), m_compileDesign, true);
2058 ElaboratorContext elaboratorContext(&s, false, true);
2059 assign = (cont_assign*)UHDM::clone_tree(assign, &elaboratorContext);
2060 lhs = assign->Lhs();
2061 rhs = assign->Rhs();
2062 if (const ref_typespec* rt = lhs->Typespec()) {
2063 tps = rt->Actual_typespec();
2064 }
2065 delay = assign->Delay();
2066 ref_obj* ref = (ref_obj*)delay;
2067 ref->Actual_group(var);
2068 cloned = true;
2069 }
2070
2071 if (lhs->UhdmType() == uhdmref_obj) {
2072 UHDM::any* var =
2073 m_helper.bindVariable(mod, m, lhs->VpiName(), m_compileDesign);
2074 if (var) {
2075 if (rhs->UhdmType() == uhdmoperation) {
2076 if (cloned == false) {
2077 ElaboratorContext elaboratorContext(&s, false, true);
2078 const UHDM::any* pp = assign->VpiParent();
2079 assign =
2080 (cont_assign*)UHDM::clone_tree(assign, &elaboratorContext);
2081 if (pp != nullptr) assign->VpiParent(const_cast<UHDM::any*>(pp));
2082 lhs = assign->Lhs();
2083 rhs = assign->Rhs();
2084 m_helper.checkForLoops(true);
2085 bool invalidValue = false;
2086 any* rhstmp = m_helper.reduceExpr(
2087 (expr*)rhs, invalidValue, mod, m_compileDesign,
2088 netlist->getParent(),
2089 fileSystem->toPathId(
2090 rhs->VpiFile(),
2091 m_compileDesign->getCompiler()->getSymbolTable()),
2092 rhs->VpiLineNo(), assign, true);
2093 m_helper.checkForLoops(false);
2094 if (const ref_typespec* rt = lhs->Typespec()) {
2095 tps = rt->Actual_typespec();
2096 }
2097 if (expr* exp = any_cast<expr*>(var)) {

Callers

nothing calls this directly

Calls 15

cont_assignsMethod · 0.80
bindParameterMethod · 0.80
bindVariableMethod · 0.80
checkForLoopsMethod · 0.80
reduceExprMethod · 0.80
toPathIdMethod · 0.80
adjustSizeMethod · 0.80
unsizedDetectedMethod · 0.80

Tested by

no test coverage detected