From: whitequark Date: Mon, 8 Jun 2020 19:18:11 +0000 (+0000) Subject: flatten: only prepend $flatten once per wire. X-Git-Tag: working-ls180~490^2~2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8d821dbbdb3ba68d4cd0fdb0d5857e77725275b9;p=yosys.git flatten: only prepend $flatten once per wire. --- diff --git a/passes/techmap/flatten.cc b/passes/techmap/flatten.cc index 669159167..e913b3059 100644 --- a/passes/techmap/flatten.cc +++ b/passes/techmap/flatten.cc @@ -32,8 +32,12 @@ IdString concat_name(RTLIL::Cell *cell, IdString object_name) { if (object_name[0] == '\\') return stringf("%s.%s", cell->name.c_str(), object_name.c_str() + 1); - else - return stringf("$flatten%s.%s", cell->name.c_str(), object_name.c_str()); + else { + std::string object_name_str = object_name.str(); + if (object_name_str.substr(0, 8) == "$flatten") + object_name_str.erase(0, 8); + return stringf("$flatten%s.%s", cell->name.c_str(), object_name_str.c_str()); + } } template