Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

odb/cdl: Handle top-level pins wired to nets of different name #6040

Merged
merged 2 commits into from
Nov 23, 2024

Conversation

smunaut
Copy link
Contributor

@smunaut smunaut commented Oct 28, 2024

ATM the code seem to assume that for each top level pin, the net name is equal to the pin name.

That's not always the case and this produces an incorect netlist.

To solve that, during pin name enumeration when creating the subckt line, we create a mapping from "net name" -> "pin name" for each pin connected to a net of a different name. Then when outputting the connections between sub blocks, we use the pin name instead of the DB net name.

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@maliberty
Copy link
Member

Please add a unit test that demonstrates this use case.

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@maliberty
Copy link
Member

I don't see a full test, just

image

If no ok needs updating it means this change has no effect on any test.

@smunaut
Copy link
Contributor Author

smunaut commented Nov 19, 2024

@maliberty Yes, I changed the input file so that it now triggers the bad behavior. With the new input file and without the code change the resulting CDL would be invalid and not match the ok golden file. With the code fix applied, it generates the same correct netlist as before.

auto pin_name_match = net2pin.find(net_name);
if (pin_name_match != net2pin.end()) {
return pin_name_match->second;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than build net2pin and lookup, you could just handle the bterm here, eg

dbBTerm* bterm = net->get1stBTerm();
if (bterm) {
  return bterm->getName();
}
return net->getName();

ATM the code seem to assume that for each top level pin, the
net name is equal to the pin name.

That's not always the case and this produces an incorect netlist.

To solve that, if a net is connected to a pin, we use the pin name
instead of the DB net name.

Signed-off-by: Sylvain Munaut <[email protected]>
Without the previous patch fixing CDL output the tests
dump_netlists / dump_netlists_withfill and the output CDL is invalid.

With the path applied, the internal net name is ignored and the pin
name is used instead.

Signed-off-by: Sylvain Munaut <[email protected]>
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@smunaut
Copy link
Contributor Author

smunaut commented Nov 23, 2024

  • Rebased to master
  • Implemented the more elegant method above
  • Checked that the new test doesn't pass without the patch and passes with the patch.

@maliberty maliberty merged commit 8300b52 into The-OpenROAD-Project:master Nov 23, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants