mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-13 04:28:18 +00:00
Merge pull request #3260 from YosysHQ/micko/proper_scopename
Proper scope naming from FST
This commit is contained in:
commit
0921e5b9a4
|
@ -94,20 +94,16 @@ static std::string remove_spaces(std::string str)
|
||||||
void FstData::extractVarNames()
|
void FstData::extractVarNames()
|
||||||
{
|
{
|
||||||
struct fstHier *h;
|
struct fstHier *h;
|
||||||
intptr_t snum = 0;
|
std::string fst_scope_name;
|
||||||
|
|
||||||
while ((h = fstReaderIterateHier(ctx))) {
|
while ((h = fstReaderIterateHier(ctx))) {
|
||||||
switch (h->htyp) {
|
switch (h->htyp) {
|
||||||
case FST_HT_SCOPE: {
|
case FST_HT_SCOPE: {
|
||||||
snum++;
|
fst_scope_name = fstReaderPushScope(ctx, h->u.scope.name, NULL);
|
||||||
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);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FST_HT_UPSCOPE: {
|
case FST_HT_UPSCOPE: {
|
||||||
fstReaderPopScope(ctx);
|
fst_scope_name = fstReaderPopScope(ctx);
|
||||||
snum = fstReaderGetCurrentScopeLen(ctx) ? (intptr_t)fstReaderGetCurrentScopeUserInfo(ctx) : 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FST_HT_VAR: {
|
case FST_HT_VAR: {
|
||||||
|
@ -116,7 +112,7 @@ void FstData::extractVarNames()
|
||||||
var.is_alias = h->u.var.is_alias;
|
var.is_alias = h->u.var.is_alias;
|
||||||
var.is_reg = (fstVarType)h->u.var.typ == FST_VT_VCD_REG;
|
var.is_reg = (fstVarType)h->u.var.typ == FST_VT_VCD_REG;
|
||||||
var.name = remove_spaces(h->u.var.name);
|
var.name = remove_spaces(h->u.var.name);
|
||||||
var.scope = scopes.back();
|
var.scope = fst_scope_name;
|
||||||
var.width = h->u.var.length;
|
var.width = h->u.var.length;
|
||||||
vars.push_back(var);
|
vars.push_back(var);
|
||||||
if (!var.is_alias)
|
if (!var.is_alias)
|
||||||
|
|
|
@ -60,7 +60,6 @@ private:
|
||||||
void extractVarNames();
|
void extractVarNames();
|
||||||
|
|
||||||
struct fstReaderContext *ctx;
|
struct fstReaderContext *ctx;
|
||||||
std::vector<std::string> scopes;
|
|
||||||
std::vector<FstVar> vars;
|
std::vector<FstVar> vars;
|
||||||
std::map<fstHandle, FstVar> handle_to_var;
|
std::map<fstHandle, FstVar> handle_to_var;
|
||||||
std::map<std::string, fstHandle> name_to_handle;
|
std::map<std::string, fstHandle> name_to_handle;
|
||||||
|
|
Loading…
Reference in a new issue