Files
OpenSTA/search/MakeTimingModelPvt.hh
T

128 lines
4.1 KiB
C++
Raw Normal View History

2023-04-06 07:42:50 -07:00
// OpenSTA, Static Timing Analyzer
2026-03-10 13:21:17 -07:00
// Copyright (c) 2026, Parallax Software, Inc.
2023-04-06 07:42:50 -07:00
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
2025-01-21 18:54:33 -07:00
//
// The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software.
//
// Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
//
// This notice may not be removed or altered from any source distribution.
2023-04-06 07:42:50 -07:00
#pragma once
#include <map>
2026-03-28 19:13:35 -07:00
#include <string>
#include <string_view>
2023-04-06 07:42:50 -07:00
2026-04-13 14:58:16 -07:00
#include "Delay.hh"
2023-04-06 07:42:50 -07:00
#include "LibertyClass.hh"
2026-04-13 14:58:16 -07:00
#include "NetworkClass.hh"
#include "RiseFallMinMax.hh"
#include "Scene.hh"
2023-04-06 07:42:50 -07:00
#include "SdcClass.hh"
#include "SearchClass.hh"
#include "StaState.hh"
namespace sta {
class Sta;
class LibertyBuilder;
class OutputDelays
{
public:
OutputDelays();
TimingSense timingSense() const;
RiseFallMinMax delays;
// input edge -> output edge path exists for unateness
bool rf_path_exists[RiseFall::index_count][RiseFall::index_count];
};
2026-01-03 16:59:35 -08:00
using ClockEdgeDelays = std::map<const ClockEdge*, RiseFallMinMax>;
using OutputPinDelays = std::map<const Pin *, OutputDelays>;
2023-04-06 07:42:50 -07:00
class MakeTimingModel : public StaState
{
public:
2026-03-28 19:13:35 -07:00
MakeTimingModel(std::string_view lib_name,
std::string_view cell_name,
std::string_view filename,
2026-01-03 16:59:35 -08:00
const Scene *scene,
2023-04-06 07:42:50 -07:00
Sta *sta);
2026-04-13 14:58:16 -07:00
~MakeTimingModel() override;
2023-04-06 07:42:50 -07:00
LibertyLibrary *makeTimingModel();
private:
void makeLibrary();
void makeCell();
2024-03-01 09:23:23 -07:00
float findArea();
2023-04-06 07:42:50 -07:00
void makePorts();
void checkClock(Clock *clk);
void findTimingFromInputs();
void findTimingFromInput(Port *input_port);
void findClkedOutputPaths();
void findClkTreeDelays();
void makeClkTreePaths(LibertyPort *lib_port,
const MinMax *min_max,
TimingSense sense,
const ClkDelays &delays);
2023-04-06 07:42:50 -07:00
void findOutputDelays(const RiseFall *input_rf,
OutputPinDelays &output_pin_delays);
void makeSetupHoldTimingArcs(const Pin *input_pin,
const ClockEdgeDelays &clk_margins);
void makeInputOutputTimingArcs(const Pin *input_pin,
OutputPinDelays &output_pin_delays);
TimingModel *makeScalarCheckModel(float value,
ScaleFactorType scale_factor_type,
2023-10-04 14:33:09 -07:00
const RiseFall *rf);
2023-04-06 07:42:50 -07:00
TimingModel *makeGateModelScalar(Delay delay,
Slew slew,
2023-10-04 14:33:09 -07:00
const RiseFall *rf);
TimingModel *makeGateModelScalar(Delay delay,
const RiseFall *rf);
2023-04-06 07:42:50 -07:00
TimingModel *makeGateModelTable(const Pin *output_pin,
Delay delay,
2023-10-04 14:33:09 -07:00
const RiseFall *rf);
2023-04-07 07:37:05 -07:00
TableTemplate *ensureTableTemplate(const TableTemplate *drvr_template,
2026-04-13 14:58:16 -07:00
const TableAxisPtr &load_axis);
2023-12-12 15:32:30 -07:00
const TableAxis *loadCapacitanceAxis(const TableModel *table);
2023-04-06 07:42:50 -07:00
LibertyPort *modelPort(const Pin *pin);
void saveSdc();
void restoreSdc();
2024-04-23 12:57:06 -07:00
void swapSdcWithBackup();
2023-04-06 07:42:50 -07:00
2026-03-28 19:13:35 -07:00
std::string lib_name_;
std::string cell_name_;
std::string filename_;
2026-01-03 16:59:35 -08:00
const Scene *scene_;
SceneSet scenes_;
2023-04-06 07:42:50 -07:00
LibertyLibrary *library_;
2026-04-13 14:58:16 -07:00
LibertyCell *cell_{nullptr};
2025-03-30 15:27:53 -07:00
const MinMax *min_max_;
2023-04-06 07:42:50 -07:00
LibertyBuilder *lib_builder_;
2023-04-07 07:37:05 -07:00
// Output driver table model template to model template.
2026-01-03 16:59:35 -08:00
std::map<const TableTemplate*, TableTemplate*> template_map_;
2026-04-13 14:58:16 -07:00
int tbl_template_index_{1};
2026-01-03 16:59:35 -08:00
Sdc *sdc_;
2026-04-13 14:58:16 -07:00
Sdc *sdc_backup_{nullptr};
2023-04-06 07:42:50 -07:00
Sta *sta_;
};
2026-04-13 14:58:16 -07:00
} // namespace sta