|
16 | 16 |
|
17 | 17 | #include "Liberty.hh" |
18 | 18 |
|
| 19 | +#include "Mutex.hh" |
19 | 20 | #include "EnumNameMap.hh" |
20 | 21 | #include "Report.hh" |
21 | 22 | #include "Debug.hh" |
@@ -1963,24 +1964,28 @@ void |
1963 | 1964 | LibertyCell::ensureVoltageWaveforms(const DcalcAnalysisPtSeq &dcalc_aps) |
1964 | 1965 | { |
1965 | 1966 | if (!have_voltage_waveforms_) { |
1966 | | - float vdd = 0.0; // shutup gcc |
1967 | | - bool vdd_exists; |
1968 | | - liberty_library_->supplyVoltage("VDD", vdd, vdd_exists); |
1969 | | - if (!vdd_exists || vdd == 0.0) |
1970 | | - criticalError(1120, "library missing vdd"); |
1971 | | - for (TimingArcSet *arc_set : timingArcSets()) { |
1972 | | - for (TimingArc *arc : arc_set->arcs()) { |
1973 | | - for (const DcalcAnalysisPt *dcalc_ap : dcalc_aps) { |
1974 | | - GateTableModel *model = arc->gateTableModel(dcalc_ap); |
1975 | | - if (model) { |
1976 | | - OutputWaveforms *output_waveforms = model->outputWaveforms(); |
1977 | | - if (output_waveforms) |
1978 | | - output_waveforms->ensureVoltageWaveforms(vdd); |
| 1967 | + LockGuard lock(waveform_lock_); |
| 1968 | + // Recheck with lock. |
| 1969 | + if (!have_voltage_waveforms_) { |
| 1970 | + float vdd = 0.0; // shutup gcc |
| 1971 | + bool vdd_exists; |
| 1972 | + liberty_library_->supplyVoltage("VDD", vdd, vdd_exists); |
| 1973 | + if (!vdd_exists || vdd == 0.0) |
| 1974 | + criticalError(1120, "library missing vdd"); |
| 1975 | + for (TimingArcSet *arc_set : timingArcSets()) { |
| 1976 | + for (TimingArc *arc : arc_set->arcs()) { |
| 1977 | + for (const DcalcAnalysisPt *dcalc_ap : dcalc_aps) { |
| 1978 | + GateTableModel *model = arc->gateTableModel(dcalc_ap); |
| 1979 | + if (model) { |
| 1980 | + OutputWaveforms *output_waveforms = model->outputWaveforms(); |
| 1981 | + if (output_waveforms) |
| 1982 | + output_waveforms->ensureVoltageWaveforms(vdd); |
| 1983 | + } |
1979 | 1984 | } |
1980 | 1985 | } |
1981 | 1986 | } |
| 1987 | + have_voltage_waveforms_ = true; |
1982 | 1988 | } |
1983 | | - have_voltage_waveforms_ = true; |
1984 | 1989 | } |
1985 | 1990 | } |
1986 | 1991 |
|
|
0 commit comments