diff options
author | whitequark <whitequark@whitequark.org> | 2020-04-18 03:43:15 +0000 |
---|---|---|
committer | whitequark <whitequark@whitequark.org> | 2020-04-18 03:47:28 +0000 |
commit | 41421f5dca3587172c870b548921331398a06c19 (patch) | |
tree | cb96823ce1559c8fd4f287e9ebb6572145ed1fd8 /backends | |
parent | 115fc261e60ebcd0456e26aac452942137db1ca9 (diff) | |
download | yosys-41421f5dca3587172c870b548921331398a06c19.tar.gz yosys-41421f5dca3587172c870b548921331398a06c19.tar.bz2 yosys-41421f5dca3587172c870b548921331398a06c19.zip |
ast, rpc: record original name of $paramod\* as \hdlname attribute.
The $paramod name mangling is not invertible (the \ character, which
separates the module name from the parameters, is valid in the module
name itself), which does not stop people from trying to invert it.
This commit makes it easy to invert the name mangling by storing
the original name explicitly, and fixes the firrtl backend to use
the newly introduced attribute.
Diffstat (limited to 'backends')
-rw-r--r-- | backends/firrtl/firrtl.cc | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/backends/firrtl/firrtl.cc b/backends/firrtl/firrtl.cc index fd7f20cc6..40d05a036 100644 --- a/backends/firrtl/firrtl.cc +++ b/backends/firrtl/firrtl.cc @@ -306,17 +306,8 @@ struct FirrtlWorker // If this is a parameterized module, its parent module is encoded in the cell type if (cell->type.begins_with("$paramod")) { - std::string::iterator it; - for (it = cell_type.begin(); it < cell_type.end(); it++) - { - switch (*it) { - case '\\': /* FALL_THROUGH */ - case '=': /* FALL_THROUGH */ - case '\'': /* FALL_THROUGH */ - case '$': instanceOf.append("_"); break; - default: instanceOf.append(1, *it); break; - } - } + log_assert(cell->has_attribute(ID::hdlname)); + instanceOf = cell->get_string_attribute(ID::hdlname); } else { |