mirror of
https://github.com/The-OpenROAD-Project/OpenSTA.git
synced 2026-08-22 05:57:30 +02:00
delay_calcs use std::string
Signed-off-by: James Cherry <[email protected]>
This commit is contained in:
+13
-15
@@ -25,6 +25,7 @@
|
|||||||
#include "DelayCalc.hh"
|
#include "DelayCalc.hh"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "ContainerHelpers.hh"
|
#include "ContainerHelpers.hh"
|
||||||
#include "StringUtil.hh"
|
#include "StringUtil.hh"
|
||||||
@@ -37,9 +38,9 @@
|
|||||||
|
|
||||||
namespace sta {
|
namespace sta {
|
||||||
|
|
||||||
typedef std::map<const char*, MakeArcDelayCalc, CharPtrLess> DelayCalcMap;
|
typedef std::map<std::string, MakeArcDelayCalc> DelayCalcMap;
|
||||||
|
|
||||||
static DelayCalcMap *delay_calcs = nullptr;
|
static DelayCalcMap delay_calcs;
|
||||||
|
|
||||||
void
|
void
|
||||||
registerDelayCalcs()
|
registerDelayCalcs()
|
||||||
@@ -54,26 +55,23 @@ registerDelayCalcs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
registerDelayCalc(const char *name,
|
registerDelayCalc(const std::string &name,
|
||||||
MakeArcDelayCalc maker)
|
MakeArcDelayCalc maker)
|
||||||
{
|
{
|
||||||
if (delay_calcs == nullptr)
|
delay_calcs[name] = maker;
|
||||||
delay_calcs = new DelayCalcMap;
|
|
||||||
(*delay_calcs)[name] = maker;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
deleteDelayCalcs()
|
deleteDelayCalcs()
|
||||||
{
|
{
|
||||||
delete delay_calcs;
|
delay_calcs.clear();
|
||||||
delay_calcs = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ArcDelayCalc *
|
ArcDelayCalc *
|
||||||
makeDelayCalc(const char *name,
|
makeDelayCalc(const std::string &name,
|
||||||
StaState *sta)
|
StaState *sta)
|
||||||
{
|
{
|
||||||
MakeArcDelayCalc maker = findKey(delay_calcs, name);
|
MakeArcDelayCalc maker = findKey(&delay_calcs, name);
|
||||||
if (maker)
|
if (maker)
|
||||||
return maker(sta);
|
return maker(sta);
|
||||||
else
|
else
|
||||||
@@ -81,16 +79,16 @@ makeDelayCalc(const char *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isDelayCalcName(const char *name)
|
isDelayCalcName(const std::string &name)
|
||||||
{
|
{
|
||||||
return delay_calcs->contains(name);
|
return delay_calcs.contains(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
StringSeq
|
StdStringSeq
|
||||||
delayCalcNames()
|
delayCalcNames()
|
||||||
{
|
{
|
||||||
StringSeq names;
|
StdStringSeq names;
|
||||||
for (const auto [name, make_dcalc] : *delay_calcs)
|
for (const auto &[name, make_dcalc] : delay_calcs)
|
||||||
names.push_back(name);
|
names.push_back(name);
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
|
|
||||||
StringSeq
|
StdStringSeq
|
||||||
delay_calc_names()
|
delay_calc_names()
|
||||||
{
|
{
|
||||||
return sta::delayCalcNames();
|
return sta::delayCalcNames();
|
||||||
|
|||||||
@@ -24,7 +24,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "StringSeq.hh"
|
#include <string>
|
||||||
|
|
||||||
|
#include "StringUtil.hh"
|
||||||
|
|
||||||
namespace sta {
|
namespace sta {
|
||||||
|
|
||||||
@@ -38,18 +40,18 @@ void
|
|||||||
registerDelayCalcs();
|
registerDelayCalcs();
|
||||||
// Register a delay calculator for the set_delay_calc command.
|
// Register a delay calculator for the set_delay_calc command.
|
||||||
void
|
void
|
||||||
registerDelayCalc(const char *name,
|
registerDelayCalc(const std::string &name,
|
||||||
MakeArcDelayCalc maker);
|
MakeArcDelayCalc maker);
|
||||||
bool
|
bool
|
||||||
isDelayCalcName(const char *name);
|
isDelayCalcName(const std::string &name);
|
||||||
StringSeq
|
StdStringSeq
|
||||||
delayCalcNames();
|
delayCalcNames();
|
||||||
void
|
void
|
||||||
deleteDelayCalcs();
|
deleteDelayCalcs();
|
||||||
|
|
||||||
// Make a registered delay calculator by name.
|
// Make a registered delay calculator by name.
|
||||||
ArcDelayCalc *
|
ArcDelayCalc *
|
||||||
makeDelayCalc(const char *name,
|
makeDelayCalc(const std::string &name,
|
||||||
StaState *sta);
|
StaState *sta);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user