mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-03 03:15:42 +00:00
Merge pull request #989 from YosysHQ/dave/abc_name_improve
ABC name recovery fixes
This commit is contained in:
commit
c0782d8390
1 changed files with 21 additions and 8 deletions
|
@ -330,20 +330,33 @@ 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;
|
||||||
bool inv = abc_sname.back() == 'v';
|
if (abc_sname.substr(0, 4) == "new_")
|
||||||
if (inv) abc_sname.pop_back();
|
{
|
||||||
|
abc_sname.erase(0, 4);
|
||||||
|
isnew = true;
|
||||||
|
}
|
||||||
|
if (abc_sname.substr(0, 5) == "ys__n")
|
||||||
|
{
|
||||||
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) {
|
size_t postfix_start = abc_sname.find_first_not_of("0123456789");
|
||||||
if (sig.id == sid && sig.bit.wire != nullptr) {
|
std::string postfix = postfix_start != std::string::npos ? abc_sname.substr(postfix_start) : "";
|
||||||
|
|
||||||
|
if (sid < GetSize(signal_list))
|
||||||
|
{
|
||||||
|
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 (inv)
|
if (isnew)
|
||||||
sstr << "_inv";
|
sstr << "_new";
|
||||||
|
sstr << postfix;
|
||||||
if (orig_wire != nullptr)
|
if (orig_wire != nullptr)
|
||||||
*orig_wire = sig.bit.wire;
|
*orig_wire = sig.bit.wire;
|
||||||
return sstr.str();
|
return sstr.str();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue