WriteSdcPvt.hh 8.78 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2019, Parallax Software, Inc.
// 
// 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/>.

#ifndef STA_WRITE_SDC_PVT_H
#define STA_WRITE_SDC_PVT_H

#include "DisallowCopyAssign.hh"

namespace sta {

class WriteSdcObject;

class WriteSdc : public StaState
{
public:
  WriteSdc(Instance *instance,
	   const char *filename,
	   const char *creator,
	   bool compatible,
	   int digits,
	   bool no_timestamp,
	   Sdc *sdc);
  virtual ~WriteSdc();
  void write();

  void openFile(const char *filename);
  void closeFile();
  void flush();
  virtual void writeHeader() const;
  void writeTiming() const;
  void writeDisables() const;
  void writeDisabledCells() const;
  void writeDisabledPorts() const;
  void writeDisabledLibPorts() const;
  void writeDisabledInstances() const;
  void writeDisabledPins() const;
  void writeDisabledEdges() const;
  void writeDisabledEdge(Edge *edge) const;
  void findMatchingEdges(Edge *edge,
			 EdgeSet &matches) const;
  bool edgeSenseIsUnique(Edge *edge,
			 EdgeSet &matches) const;
  void writeDisabledEdgeSense(Edge *edge) const;
  void writeClocks() const;
  void writeClock(Clock *clk) const;
  void writeGeneratedClock(Clock *clk) const;
  void writeClockPins(Clock *clk) const;
  void writeFloatSeq(FloatSeq *floats,
		     float scale) const;
  void writeIntSeq(IntSeq *ints) const;
  void writeClockSlews(Clock *clk) const;
  void writeClockUncertainty(Clock *clk) const;
  void writeClockUncertainty(Clock *clk,
			     const char *setup_hold,
			     float value) const;
  void writeClockUncertaintyPins() const;
  void writeClockUncertaintyPin(const Pin *pin,
				ClockUncertainties *uncertainties) const;
  void writeClockUncertaintyPin(const Pin *pin,
				const char *setup_hold,
				float value) const;
  void writeClockLatencies() const;
  void writeClockInsertions() const;
  void writeClockInsertion(ClockInsertion *insert,
			   WriteSdcObject &write_obj) const;
  void writeInterClockUncertainties() const;
  void writeInterClockUncertainty(InterClockUncertainty *uncertainty) const;
  void writePropagatedClkPins() const;
  void writeInputDelays() const;
  void writeOutputDelays() const;
  void writePortDelay(PortDelay *port_delay,
		      const char *sdc_cmd) const;
  void writePortDelay(PortDelay *port_delay,
		      float delay,
		      const TransRiseFallBoth *tr,
		      const MinMaxAll *min_max,
		      const char *sdc_cmd) const;
  void writeClockSenses() const;
  void writeClockSense(PinClockPair &pin_clk,
		       ClockSense sense) const;
  void writeClockGroups() const;
  void writeClockGroups(ClockGroups *clk_groups) const;
  void writeExceptions() const;
  void writeException(ExceptionPath *exception) const;
  void writeExceptionCmd(ExceptionPath *exception) const;
  void writeExceptionValue(ExceptionPath *exception) const;
  void writeExceptionFrom(ExceptionFrom *from) const;
  void writeExceptionTo(ExceptionTo *to) const;
  void writeExceptionFromTo(ExceptionFromTo *from_to,
			    const char *from_to_key) const;
  void writeExceptionThru(ExceptionThru *thru) const;
  void writeDataChecks() const;
  void writeDataCheck(DataCheck *check) const;
  void writeDataCheck(DataCheck *check,
		      TransRiseFallBoth *from_tr,
		      TransRiseFallBoth *to_tr,
		      SetupHold *setup_hold,
		      float margin) const;
  void writeEnvironment() const;
  void writeOperatingConditions() const;
  void writeWireload() const;
  void writePinLoads() const;
  void writePortLoads(Port *port) const;
  void writePortFanout(Port *port) const;
  void writeDriveResistances() const;
  void writeDrivingCells() const;
  void writeInputTransitions() const;
  void writeDrivingCell(Port *port,
			InputDriveCell *drive_cell,
			const TransRiseFall *tr,
			const MinMax *min_max) const;
  void writeConstants() const;
  virtual void writeConstant(Pin *pin) const;
  const char *setConstantCmd(Pin *pin) const;
  void writeCaseAnalysis() const;
  virtual void writeCaseAnalysis(Pin *pin) const;
  const char *caseAnalysisValueStr(Pin *pin) const;
  void sortedLogicValuePins(LogicValueMap *value_map,
			    PinSeq &pins) const;
  void writeNetResistances() const;
  void writeNetResistance(Net *net,
			  const MinMaxAll *min_max,
			  float res) const;
  void writeDesignRules() const;
  void writeMinPulseWidths() const;
  void writeMinPulseWidths(RiseFallValues *min_widths,
			   WriteSdcObject &write_obj) const;
  void writeMinPulseWidth(const char *hi_low,
			  float value,
			  WriteSdcObject &write_obj) const;
  void writeSlewLimits() const;
  void writeCapLimits() const;
  void writeCapLimits(const MinMax *min_max,
		      const char *cmd) const;
  void writeMaxArea() const;
  void writeFanoutLimits() const;
  void writeFanoutLimits(const MinMax *min_max,
			 const char *cmd) const;
  void writeLatchBorowLimits() const;
  void writeDeratings() const;
  void writeDerating(DeratingFactorsGlobal *factors) const;
  void writeDerating(DeratingFactorsCell *factors,
		     WriteSdcObject *write_obj) const;
  void writeDerating(DeratingFactors *factors,
		     TimingDerateType type,
		     const MinMax *early_late,
		     WriteSdcObject *write_obj) const;

  const char *pathName(const Pin *pin) const;
  const char *pathName(const Net *net) const;
  const char *pathName(const Instance *inst) const;
  void writeCommentSection(const char *line) const;
  void writeCommentSeparator() const;

  void writeGetTimingArcsOfOjbects(LibertyCell *cell) const;
  void writeGetTimingArcs(Edge *edge) const;
  void writeGetTimingArcs(Edge *edge,
			  const char *filter) const;
  const char *getTimingArcsCmd() const;
  void writeGetLibCell(const LibertyCell *cell) const;
  void writeGetLibPin(const LibertyPort *port) const;
  void writeGetClock(const Clock *clk) const;
  void writeGetClocks(ClockSet *clks) const;
  void writeGetClocks(ClockSet *clks,
		      bool multiple,
		      bool &first) const;
  virtual void writeGetPort(const Port *port) const;
  virtual void writeGetPin(const Pin *pin) const;
  virtual void writeGetNet(const Net *net) const;
  virtual void writeGetInstance(const Instance *inst) const;
  void writeGetPins(PinSet *pins) const;
  void writeGetPins(PinSeq *pins) const;
  void writeClockKey(const Clock *clk) const;
  float scaleTime(float time) const;
  float scaleCapacitance(float cap) const;
  float scaleResistance(float res) const;
  void writeFloat(float value) const;
  void writeTime(float time) const;
  void writeCapacitance(float cap) const;
  void writeResistance(float res) const;

  void writeClkSlewLimits() const;
  void writeClkSlewLimit(const char *clk_data,
			 const char *rise_fall,
			 const Clock *clk,
			 float limit) const;
  void writeRiseFallMinMaxTimeCmd(const char *sdc_cmd,
				  RiseFallMinMax *values,
				  WriteSdcObject &write_object) const;
  void writeRiseFallMinMaxCapCmd(const char *sdc_cmd,
				 RiseFallMinMax *values,
				 WriteSdcObject &write_object) const;
  void writeRiseFallMinMaxCmd(const char *sdc_cmd,
			      RiseFallMinMax *values,
			      float scale,
			      WriteSdcObject &write_object) const;
  void writeRiseFallMinMaxCmd(const char *sdc_cmd,
			      float value,
			      float scale,
			      const TransRiseFallBoth *tr,
			      const MinMaxAll *min_max,
			      WriteSdcObject &write_object) const;
  void writeMinMaxFloatValuesCmd(const char *sdc_cmd,
				 MinMaxFloatValues *values,
				 float scale,
				 WriteSdcObject &write_object) const;
  void writeMinMaxFloatCmd(const char *sdc_cmd,
			   float value,
			   float scale,
			   const MinMaxAll *min_max,
			   WriteSdcObject &write_object) const;
  void writeMinMaxIntValuesCmd(const char *sdc_cmd,
			       MinMaxIntValues *values,
			       WriteSdcObject &write_object) const;
  void writeMinMaxIntCmd(const char *sdc_cmd,
			 int value,
			 const MinMaxAll *min_max,
			 WriteSdcObject &write_object) const;
  void writeSetupHoldFlag(const MinMaxAll *min_max) const;
  void writeVariables() const;
  void writeCmdComment(SdcCmdComment *cmd) const;

  FILE *stream() const { return stream_; }

protected:
  Instance *instance_;
  const char *filename_;
  const char *creator_;
  bool compatible_;
  int digits_;
  bool no_timestamp_;
  bool top_instance_;
  size_t instance_name_length_;
  Cell *cell_;
  FILE *stream_;

private:
  DISALLOW_COPY_AND_ASSIGN(WriteSdc);
};

} // namespace
#endif