StaTcl.i cleanup

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2024-07-22 11:42:34 -07:00
parent faded478a8
commit 8d625fc2c9
2 changed files with 113 additions and 111 deletions

View File

@ -556,6 +556,28 @@ net_load_pins(Net *net)
return pins;
}
const char *
pin_location(const Pin *pin)
{
Network *network = cmdNetwork();
double x, y;
bool exists;
network->location(pin, x, y, exists);
// return x/y as tcl list
if (exists)
return sta::stringPrintTmp("%f %f", x, y);
else
return "";
}
const char *
port_location(const Port *port)
{
Network *network = cmdNetwork();
const Pin *pin = network->findPin(network->topInstance(), port);
return pin_location(pin);
}
%} // inline
////////////////////////////////////////////////////////////////

View File

@ -209,6 +209,52 @@ git_sha1()
return STA_GIT_SHA1;
}
// Elapsed run time (in seconds).
double
elapsed_run_time()
{
return elapsedRunTime();
}
// User run time (in seconds).
double
user_run_time()
{
return userRunTime();
}
// User run time (in seconds).
unsigned long
cputime()
{
return static_cast<unsigned long>(userRunTime() + .5);
}
// Peak memory usage in bytes.
unsigned long
memory_usage()
{
return memoryUsage();
}
int
processor_count()
{
return processorCount();
}
int
thread_count()
{
return Sta::sta()->threadCount();
}
void
set_thread_count(int count)
{
Sta::sta()->setThreadCount(count);
}
////////////////////////////////////////////////////////////////
void
@ -307,8 +353,6 @@ log_end()
Sta::sta()->report()->logEnd();
}
////////////////////////////////////////////////////////////////
void
set_debug(const char *what,
int level)
@ -316,6 +360,8 @@ set_debug(const char *what,
Sta::sta()->setDebugLevel(what, level);
}
////////////////////////////////////////////////////////////////
bool
is_object(const char *obj)
{
@ -364,6 +410,49 @@ is_object_list(const char *list,
////////////////////////////////////////////////////////////////
// Initialize sta after delete_all_memory.
void
init_sta()
{
initSta();
}
void
clear_sta()
{
Sta::sta()->clear();
}
void
make_sta(Tcl_Interp *interp)
{
Sta *sta = new Sta;
Sta::setSta(sta);
sta->makeComponents();
sta->setTclInterp(interp);
}
Tcl_Interp *
tcl_interp()
{
return Sta::sta()->tclInterp();
}
void
clear_network()
{
Sta *sta = Sta::sta();
sta->network()->clear();
}
void
delete_all_memory()
{
deleteAllMemory();
}
////////////////////////////////////////////////////////////////
// format_unit functions print with fixed digits and suffix.
// Pass value arg as string to support NaNs.
const char *
@ -1827,93 +1916,6 @@ graph_required_count()
return Sta::sta()->graph()->requiredCount();
}
void
delete_all_memory()
{
deleteAllMemory();
}
Tcl_Interp *
tcl_interp()
{
return Sta::sta()->tclInterp();
}
// Initialize sta after delete_all_memory.
void
init_sta()
{
initSta();
}
void
clear_sta()
{
Sta::sta()->clear();
}
void
make_sta(Tcl_Interp *interp)
{
Sta *sta = new Sta;
Sta::setSta(sta);
sta->makeComponents();
sta->setTclInterp(interp);
}
void
clear_network()
{
Sta *sta = Sta::sta();
sta->network()->clear();
}
// Elapsed run time (in seconds).
double
elapsed_run_time()
{
return elapsedRunTime();
}
// User run time (in seconds).
double
user_run_time()
{
return userRunTime();
}
// User run time (in seconds).
unsigned long
cputime()
{
return static_cast<unsigned long>(userRunTime() + .5);
}
// Peak memory usage in bytes.
unsigned long
memory_usage()
{
return memoryUsage();
}
int
processor_count()
{
return processorCount();
}
int
thread_count()
{
return Sta::sta()->threadCount();
}
void
set_thread_count(int count)
{
Sta::sta()->setThreadCount(count);
}
void
arrivals_invalid()
{
@ -1928,28 +1930,6 @@ delays_invalid()
sta->delaysInvalid();
}
const char *
pin_location(const Pin *pin)
{
Network *network = cmdNetwork();
double x, y;
bool exists;
network->location(pin, x, y, exists);
// return x/y as tcl list
if (exists)
return sta::stringPrintTmp("%f %f", x, y);
else
return "";
}
const char *
port_location(const Port *port)
{
Network *network = cmdNetwork();
const Pin *pin = network->findPin(network->topInstance(), port);
return pin_location(pin);
}
int
endpoint_violation_count(const MinMax *min_max)
{