The-OpenROAD-Project / OpenROAD

OpenROAD's unified application implementing an RTL-to-GDS Flow. Documentation at https://openroad.readthedocs.io/en/latest/
https://theopenroadproject.org/
BSD 3-Clause "New" or "Revised" License
1.42k stars 497 forks source link

ant: OpenROAD and magic disagree on antenna violations #2187

Closed antonblanchard closed 1 year ago

antonblanchard commented 1 year ago

Using the following test case OpenROAD reports no antenna violations, but magic reports some quite large ones. An example:

Cell: fanout1050
Antenna violation detected at plane metal3
Effective antenna ratio 1584.67 > limit 400
Gate rect (15531 76759) to (15561 76887)
Antenna rect (36813 76739) to (36879 76742)

I'm not sure if OpenROAD or magic is wrong.

Test case: antenna.tar.gz

maliberty commented 1 year ago

Anton noticed a drop in antenna violations with your recent changes. Please investigate

antonblanchard commented 1 year ago

I don't see any THICKNESS properties in the TLEF file. Could be a bug in open_pdks. Investigating.

maliberty commented 1 year ago

They are there in sky130A.

antonblanchard commented 1 year ago

Recent shuttles are using sky130B, and that's where the issue is:

https://github.com/RTimothyEdwards/open_pdks/pull/272

ramezmoussa commented 1 year ago

@maliberty is there a defualt THICKNESS that should be used in cases like this? The current implementation uses 0 for the thickness and I can confirm that this is why no violations were reported. I experimented with various values for the THICKNESS and multiple violations arose.

antonblanchard commented 1 year ago

Since this was a problem in the LEF file, one option might be to just return an error. A default value could mask the issue.

antonblanchard commented 1 year ago

After fixing the tech LEF THICKNESS issues, I still see some rather large differences. In this example magic calculates the antenna violation to be about twice as much as OpenROAD:

magic:
Cell: final_adder.U$$49
Antenna violation detected at plane metal2
Effective antenna ratio 1479.6 > limit 400
OpenROAD:
  final_adder.U$$49/A (sky130_fd_sc_hd__ha_1)
    met2
    PAR:  759.75* Ratio:  400.00 (S.Area)

@rtimothyedwards I think there may be an error in how magic calculates antenna violations, at least if we want to match the tech LEF. The antenna rule is:

  ANTENNADIFFSIDEAREARATIO PWL ( ( 0 400 ) ( 0.0125 400 ) ( 0.0225 2609 ) ( 22.5 11600 ) ) ;

Which I think means we just sum up the side wall area of the layer in question, ignoring layers below it. Magic appears to sum up all connected layers, scaled by the antenna ratio limit for that layer:

                    for (i = 0; i < DBNumTypes; i++)
                    {
                        if (ExtCurStyle->exts_antennaRatio[i].ratioGate > 0)
                        {
                            anttotal += (double)antennaarea[i] /
                                    (double)ExtCurStyle->exts_antennaRatio[i].ratioGate;
                        }
                        if (ExtCurStyle->exts_antennaRatio[i].ratioGate > saveRatio)
                            saveRatio = ExtCurStyle->exts_antennaRatio[i].ratioGate;
                    }

The LEF spec was somewhat confusing to read through, so I might have misunderstood the ANTENNADIFFSIDEAREARATIO statement.

RTimothyEdwards commented 1 year ago

The magic technology file specifies the antenna calculation method as "partial", which is supposed to check only the layer under investigation and not all layers below it (which is method "cumulative"). Your result suggests that the method type in the tech file is not being handled correctly, perhaps.

maliberty commented 1 year ago

@ramezmoussa let's make it an error to not have THICKNESS specified as otherwise the analysis is meaningless.

antonblanchard commented 1 year ago

I think we can close this now: