mirror of https://github.com/YosysHQ/yosys.git
abc: Improve name recovery
Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
parent
a01386c0e4
commit
5ce9113eda
|
@ -330,18 +330,31 @@ void extract_cell(RTLIL::Cell *cell, bool keepff)
|
||||||
std::string remap_name(RTLIL::IdString abc_name, RTLIL::Wire **orig_wire = nullptr)
|
std::string remap_name(RTLIL::IdString abc_name, RTLIL::Wire **orig_wire = nullptr)
|
||||||
{
|
{
|
||||||
std::string abc_sname = abc_name.substr(1);
|
std::string abc_sname = abc_name.substr(1);
|
||||||
if (abc_sname.substr(0, 5) == "ys__n") {
|
bool isnew = false;
|
||||||
|
if (abc_sname.substr(0, 4) == "new_")
|
||||||
|
{
|
||||||
|
abc_sname.erase(0, 4);
|
||||||
|
isnew = true;
|
||||||
|
}
|
||||||
|
if (abc_sname.substr(0, 5) == "ys__n")
|
||||||
|
{
|
||||||
bool inv = abc_sname.back() == 'v';
|
bool inv = abc_sname.back() == 'v';
|
||||||
if (inv) abc_sname.pop_back();
|
if (inv) abc_sname.pop_back();
|
||||||
abc_sname.erase(0, 5);
|
abc_sname.erase(0, 5);
|
||||||
if (abc_sname.find_last_not_of("012345689") == std::string::npos) {
|
if (std::isdigit(abc_sname.at(0)))
|
||||||
|
{
|
||||||
int sid = std::stoi(abc_sname);
|
int sid = std::stoi(abc_sname);
|
||||||
for (auto sig : signal_list) {
|
if (sid < GetSize(signal_list))
|
||||||
if (sig.id == sid && sig.bit.wire != nullptr) {
|
{
|
||||||
|
auto sig = signal_list.at(sid);
|
||||||
|
if (sig.bit.wire != nullptr)
|
||||||
|
{
|
||||||
std::stringstream sstr;
|
std::stringstream sstr;
|
||||||
sstr << "$abc$" << map_autoidx << "$" << sig.bit.wire->name.substr(1);
|
sstr << "$abc$" << map_autoidx << "$" << sig.bit.wire->name.substr(1);
|
||||||
if (sig.bit.wire->width != 1)
|
if (sig.bit.wire->width != 1)
|
||||||
sstr << "[" << sig.bit.offset << "]";
|
sstr << "[" << sig.bit.offset << "]";
|
||||||
|
if (isnew)
|
||||||
|
sstr << "_new";
|
||||||
if (inv)
|
if (inv)
|
||||||
sstr << "_inv";
|
sstr << "_inv";
|
||||||
if (orig_wire != nullptr)
|
if (orig_wire != nullptr)
|
||||||
|
|
Loading…
Reference in New Issue