Fix for svinterfaces
authorEddie Hung <eddie@fpgeh.com>
Mon, 30 Sep 2019 21:52:04 +0000 (14:52 -0700)
committerEddie Hung <eddie@fpgeh.com>
Mon, 30 Sep 2019 21:52:04 +0000 (14:52 -0700)
frontends/ast/ast.cc

index e4539f3032a40c986d18098b1a543086038f0d5d..37a69d8bf5a62e1dd0810066774e8792b894ebd8 100644 (file)
@@ -1398,11 +1398,17 @@ RTLIL::IdString AstModule::derive(RTLIL::Design *design, dict<RTLIL::IdString, R
                has_interfaces = true;
        }
 
+       std::string new_modname = modname;
        if (has_interfaces)
-               modname += "$interfaces$" + interf_info;
+               new_modname += "$interfaces$" + interf_info;
 
 
-       if (!design->has(modname)) {
+       if (!design->has(new_modname)) {
+               if (!new_ast) {
+                       auto mod = dynamic_cast<AstModule*>(design->module(modname));
+                       new_ast = mod->ast->clone();
+               }
+               modname = new_modname;
                new_ast->str = modname;
 
                // Iterate over all interfaces which are ports in this module: