mirror of https://github.com/YosysHQ/yosys.git
Add a unique argument to pmgen's nusers()
This commit is contained in:
parent
8ecfd55d5a
commit
1d88887cfd
|
@ -458,12 +458,16 @@ with open(outfile, "w") as f:
|
|||
print(" }", file=f)
|
||||
print("", file=f)
|
||||
|
||||
print(" int nusers(const SigSpec &sig) {", file=f)
|
||||
print(" int nusers(const SigSpec &sig, bool unique=true) {", file=f)
|
||||
print(" int i = 0;", file=f)
|
||||
print(" pool<Cell*> users;", file=f)
|
||||
print(" for (auto bit : sigmap(sig))", file=f)
|
||||
print(" for (auto user : sigusers[bit])", file=f)
|
||||
print(" users.insert(user);", file=f)
|
||||
print(" return GetSize(users);", file=f)
|
||||
print(" if (unique)", file=f);
|
||||
print(" i += GetSize(sigusers[bit]);", file=f);
|
||||
print(" else", file=f);
|
||||
print(" for (auto user : sigusers[bit])", file=f)
|
||||
print(" users.insert(user);", file=f)
|
||||
print(" return unique ? GetSize(users) : i;", file=f)
|
||||
print(" }", file=f)
|
||||
print("", file=f)
|
||||
|
||||
|
|
Loading…
Reference in New Issue