power directory

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2022-10-27 15:43:47 -07:00
parent d1c899a5c3
commit 8ea2580566
15 changed files with 141 additions and 91 deletions

View File

@ -173,9 +173,7 @@ set(STA_SOURCE
search/PathRef.cc
search/PathVertex.cc
search/PathVertexRep.cc
search/Power.cc
search/Property.cc
search/ReadVcdActivities.cc
search/ReportPath.cc
search/Search.cc
search/SearchPred.cc
@ -184,14 +182,17 @@ set(STA_SOURCE
search/StaState.cc
search/Tag.cc
search/TagGroup.cc
search/Vcd.cc
search/VcdReader.cc
search/VertexVisitor.cc
search/VisitPathEnds.cc
search/VisitPathGroupVertices.cc
search/WorstSlack.cc
search/WritePathSpice.cc
power/Power.cc
power/ReadVcdActivities.cc
power/Vcd.cc
power/VcdReader.cc
util/Debug.cc
util/DispatchQueue.cc
util/Error.cc
@ -229,10 +230,10 @@ set(STA_TCL_FILES
tcl/Cmds.tcl
tcl/Variables.tcl
tcl/Sta.tcl
tcl/Power.tcl
tcl/Splash.tcl
dcalc/DelayCalc.tcl
parasitics/Parasitics.tcl
power/Power.tcl
sdf/Sdf.tcl
verilog/Verilog.tcl
)
@ -315,18 +316,20 @@ set_property(SOURCE ${STA_SWIG_FILE}
-I${STA_HOME}/sdf
-I${STA_HOME}/dcalc
-I${STA_HOME}/parasitics
-I${STA_HOME}/power
-I${STA_HOME}/verilog
)
set_property(SOURCE ${STA_SWIG_FILE}
PROPERTY DEPENDS
${STA_HOME}/dcalc/DelayCalc.i
${STA_HOME}/parasitics/Parasitics.i
${STA_HOME}/power/Power.i
${STA_HOME}/sdf/Sdf.i
${STA_HOME}/tcl/Exception.i
${STA_HOME}/tcl/StaTcl.i
${STA_HOME}/verilog/Verilog.i
${STA_HOME}/tcl/NetworkEdit.i
${STA_HOME}/sdf/Sdf.i
${STA_HOME}/parasitics/Parasitics.i
${STA_HOME}/dcalc/DelayCalc.i
${STA_HOME}/verilog/Verilog.i
)
swig_add_library(sta_swig

View File

@ -23,3 +23,4 @@
%include "Sdf.i"
%include "DelayCalc.i"
%include "Parasitics.i"
%include "Power.i"

View File

@ -41,8 +41,8 @@
#include "GraphDelayCalc.hh"
#include "Corner.hh"
#include "PathVertex.hh"
#include "Levelize.hh"
#include "Sim.hh"
#include "search/Levelize.hh"
#include "search/Sim.hh"
#include "Search.hh"
#include "Bfs.hh"
#include "ClkNetwork.hh"

124
power/Power.i Normal file
View File

@ -0,0 +1,124 @@
%module power
%{
// OpenSTA, Static Timing Analyzer
// Copyright (c) 2022, 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/>.
#include "Sta.hh"
#include "power/Power.hh"
#include "power/VcdReader.hh"
#include "power/ReadVcdActivities.hh"
namespace sta {
typedef FloatSeq TmpFloatSeq;
} // namespace
using namespace sta;
%}
%typemap(out) TmpFloatSeq* {
FloatSeq *floats = $1;
Tcl_Obj *list = Tcl_NewListObj(0, nullptr);
if (floats) {
for (unsigned i = 0; i < floats->size(); i++) {
Tcl_Obj *obj = Tcl_NewDoubleObj((*floats)[i]);
Tcl_ListObjAppendElement(interp, list, obj);
}
delete floats;
}
Tcl_SetObjResult(interp, list);
}
%inline %{
TmpFloatSeq *
design_power(const Corner *corner)
{
cmdLinkedNetwork();
PowerResult total, sequential, combinational, macro, pad;
Sta::sta()->power(corner, total, sequential, combinational, macro, pad);
FloatSeq *floats = new FloatSeq;
pushPowerResultFloats(total, floats);
pushPowerResultFloats(sequential, floats);
pushPowerResultFloats(combinational, floats);
pushPowerResultFloats(macro, floats);
pushPowerResultFloats(pad, floats);
return floats;
}
TmpFloatSeq *
instance_power(Instance *inst,
const Corner *corner)
{
cmdLinkedNetwork();
PowerResult power;
Sta::sta()->power(inst, corner, power);
FloatSeq *floats = new FloatSeq;
floats->push_back(power.internal());
floats->push_back(power.switching());
floats->push_back(power.leakage());
floats->push_back(power.total());
return floats;
}
void
set_power_global_activity(float activity,
float duty)
{
Sta::sta()->power()->setGlobalActivity(activity, duty);
}
void
set_power_input_activity(float activity,
float duty)
{
return Sta::sta()->power()->setInputActivity(activity, duty);
}
void
set_power_input_port_activity(const Port *input_port,
float activity,
float duty)
{
return Sta::sta()->power()->setInputPortActivity(input_port, activity, duty);
}
void
set_power_pin_activity(const Pin *pin,
float activity,
float duty)
{
return Sta::sta()->power()->setUserActivity(pin, activity, duty,
PwrActivityOrigin::user);
}
void
read_vcd_activities(const char *filename)
{
readVcdActivities(filename, Sta::sta());
}
void
report_vcd_waveforms(const char *filename)
{
reportVcdWaveforms(filename, Sta::sta());
}
%} // inline

View File

@ -30,7 +30,7 @@
#include "PathEnd.hh"
#include "PathExpanded.hh"
#include "PathRef.hh"
#include "Power.hh"
#include "power/Power.hh"
#include "Sta.hh"
namespace sta {

View File

@ -68,7 +68,7 @@
#include "VisitPathGroupVertices.hh"
#include "Genclks.hh"
#include "ClkNetwork.hh"
#include "Power.hh"
#include "power/Power.hh"
#include "VisitPathEnds.hh"
#include "PathExpanded.hh"
#include "MakeTimingModel.hh"

View File

@ -79,9 +79,6 @@
#include "search/CheckMinPulseWidths.hh"
#include "search/Levelize.hh"
#include "search/ReportPath.hh"
#include "search/Power.hh"
#include "search/VcdReader.hh"
#include "search/ReadVcdActivities.hh"
namespace sta {
@ -4948,75 +4945,6 @@ report_capacitance_limit_verbose(Pin *pin,
////////////////////////////////////////////////////////////////
TmpFloatSeq *
design_power(const Corner *corner)
{
cmdLinkedNetwork();
PowerResult total, sequential, combinational, macro, pad;
Sta::sta()->power(corner, total, sequential, combinational, macro, pad);
FloatSeq *floats = new FloatSeq;
pushPowerResultFloats(total, floats);
pushPowerResultFloats(sequential, floats);
pushPowerResultFloats(combinational, floats);
pushPowerResultFloats(macro, floats);
pushPowerResultFloats(pad, floats);
return floats;
}
TmpFloatSeq *
instance_power(Instance *inst,
const Corner *corner)
{
cmdLinkedNetwork();
PowerResult power;
Sta::sta()->power(inst, corner, power);
FloatSeq *floats = new FloatSeq;
floats->push_back(power.internal());
floats->push_back(power.switching());
floats->push_back(power.leakage());
floats->push_back(power.total());
return floats;
}
void
set_power_global_activity(float activity,
float duty)
{
Sta::sta()->power()->setGlobalActivity(activity, duty);
}
void
set_power_input_activity(float activity,
float duty)
{
return Sta::sta()->power()->setInputActivity(activity, duty);
}
void
set_power_input_port_activity(const Port *input_port,
float activity,
float duty)
{
return Sta::sta()->power()->setInputPortActivity(input_port, activity, duty);
}
void
set_power_pin_activity(const Pin *pin,
float activity,
float duty)
{
return Sta::sta()->power()->setUserActivity(pin, activity, duty,
PwrActivityOrigin::user);
}
void
read_vcd_activities(const char *filename)
{
readVcdActivities(filename, Sta::sta());
}
////////////////////////////////////////////////////////////////
EdgeSeq *
disabled_edges_sorted()
{
@ -5578,12 +5506,6 @@ endpoint_count()
return Sta::sta()->endpointCount();
}
void
report_vcd_waveforms(const char *filename)
{
reportVcdWaveforms(filename, Sta::sta());
}
%} // inline
////////////////////////////////////////////////////////////////