OpenROAD icon indicating copy to clipboard operation
OpenROAD copied to clipboard

Add APIs for LEF macro ANTENNADIFFAREA and ANTENNAGATEAREA

Open kareefardi opened this issue 1 year ago • 7 comments

  • Add dbTechAntennaPinModel.hasGateArea
  • Add dbMTerm.hasDiffArea

The incentive behind this PR is to access the antenna information using python APIs. Currently, I was unable to call getDiffArea and getGateArea using the python APIs as they require passing a specific object which I was unable to create.

kareefardi avatar Mar 04 '24 10:03 kareefardi

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] avatar Mar 04 '24 10:03 github-actions[bot]

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] avatar Mar 04 '24 10:03 github-actions[bot]

It would be better to just fix the python API. This still doesn't get you access to the data.

maliberty avatar Mar 04 '24 21:03 maliberty

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] avatar Mar 05 '24 09:03 github-actions[bot]

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] avatar Mar 05 '24 09:03 github-actions[bot]

@maliberty I tried to do something like

bool dbTechAntennaPinModel::hasGateArea()
{
  vector<std::pair<double, dbTechLayer*>> gate_areas;
  gate_areas = getGateArea();
  return !gate_areas.empty();
}

but I would get warnings:

swig/python detected a memory leak of type 'std::vector< std::pair< double,odb::dbTechLayer * >,std::allocator< std::pair< double,odb::dbTechLayer * > > > *', no destructor found.

Furthermore, the returned object is still inaccessible <Swig Object of type 'std::vector< std::pair< double,odb::dbTechLayer * >,std::allocator< std::pair< double,odb::dbTechLayer * > > > *' at 0x7f815092aa30>.

In addition, I am not really after the data itself. I am only checking for it's existence. Having said that, I wouldn't mind fixing the APIs that returns the data for Python but it is not something I am good with so it would be nice if you can give me some pointers on doing that or I can leave it up to the OpenROAD team to handle it and close this PR.

kareefardi avatar Mar 05 '24 09:03 kareefardi

You would need to add a swig typemap to handle the collection. in odb/src/swig you can see how we have handled other such. In general messing with swig is headache but great when it finally works.

maliberty avatar Mar 06 '24 23:03 maliberty

Surpassed by https://github.com/The-OpenROAD-Project/OpenROAD/pull/5103

kareefardi avatar May 15 '24 12:05 kareefardi