Proper scope naming from FST
authorMiodrag Milanovic <mmicko@gmail.com>
Wed, 30 Mar 2022 13:55:15 +0000 (15:55 +0200)
committerMiodrag Milanovic <mmicko@gmail.com>
Wed, 30 Mar 2022 13:55:15 +0000 (15:55 +0200)
kernel/fstdata.cc
kernel/fstdata.h

index 6cf28625c0b50ab1586f319f20a82d09122ce143..c99bc61c3ceb46583d726345b2a309d3534f39b8 100644 (file)
@@ -94,20 +94,16 @@ static std::string remove_spaces(std::string str)
 void FstData::extractVarNames()
 {
        struct fstHier *h;
-       intptr_t snum = 0;
+       std::string fst_scope_name;
 
        while ((h = fstReaderIterateHier(ctx))) {
                switch (h->htyp) {
                        case FST_HT_SCOPE: {
-                               snum++;
-                               std::string fst_scope_name = fstReaderPushScope(ctx, h->u.scope.name, (void *)(snum));
-                               if (h->u.scope.typ == FST_ST_VCD_MODULE)
-                                       scopes.push_back(fst_scope_name);
+                               fst_scope_name = fstReaderPushScope(ctx, h->u.scope.name, NULL);
                                break;
                        }
                        case FST_HT_UPSCOPE: {
-                               fstReaderPopScope(ctx);
-                               snum = fstReaderGetCurrentScopeLen(ctx) ? (intptr_t)fstReaderGetCurrentScopeUserInfo(ctx) : 0;
+                               fst_scope_name = fstReaderPopScope(ctx);
                                break;
                        }
                        case FST_HT_VAR: {
@@ -116,7 +112,7 @@ void FstData::extractVarNames()
                                var.is_alias = h->u.var.is_alias;
                                var.is_reg = (fstVarType)h->u.var.typ == FST_VT_VCD_REG;
                                var.name = remove_spaces(h->u.var.name);
-                               var.scope = scopes.back();
+                               var.scope = fst_scope_name;
                                var.width = h->u.var.length;
                                vars.push_back(var);
                                if (!var.is_alias)
index 0e9d27e2ca385ec7f3b3b383e1dcae5878ea2d48..d8dca5fb0a33362f7f599c82121a1771ca91199b 100644 (file)
@@ -60,7 +60,6 @@ private:
        void extractVarNames();
 
        struct fstReaderContext *ctx;
-       std::vector<std::string> scopes;
        std::vector<FstVar> vars;
        std::map<fstHandle, FstVar> handle_to_var;
        std::map<std::string, fstHandle> name_to_handle;