Merge remote-tracking branch 'parallax/master'
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
This commit is contained in:
commit
aafee90f8a
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
#include "MinMax.hh"
|
#include "MinMax.hh"
|
||||||
#include "RiseFallMinMax.hh"
|
#include "RiseFallMinMax.hh"
|
||||||
#include "ConcreteLibrary.hh"
|
#include "ConcreteLibrary.hh"
|
||||||
|
|
@ -628,6 +630,7 @@ protected:
|
||||||
LibertyPgPortMap pg_port_map_;
|
LibertyPgPortMap pg_port_map_;
|
||||||
bool has_internal_ports_;
|
bool has_internal_ports_;
|
||||||
bool have_voltage_waveforms_;
|
bool have_voltage_waveforms_;
|
||||||
|
std::mutex waveform_lock_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class LibertyLibrary;
|
friend class LibertyLibrary;
|
||||||
|
|
|
||||||
|
|
@ -177,10 +177,6 @@ stringPrintTmp(const char *fmt,
|
||||||
|
|
||||||
char *
|
char *
|
||||||
makeTmpString(size_t length);
|
makeTmpString(size_t length);
|
||||||
void
|
|
||||||
initTmpStrings();
|
|
||||||
void
|
|
||||||
deleteTmpStrings();
|
|
||||||
bool
|
bool
|
||||||
isTmpString(const char *str);
|
isTmpString(const char *str);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "Liberty.hh"
|
#include "Liberty.hh"
|
||||||
|
|
||||||
|
#include "Mutex.hh"
|
||||||
#include "EnumNameMap.hh"
|
#include "EnumNameMap.hh"
|
||||||
#include "Report.hh"
|
#include "Report.hh"
|
||||||
#include "Debug.hh"
|
#include "Debug.hh"
|
||||||
|
|
@ -1963,24 +1964,28 @@ void
|
||||||
LibertyCell::ensureVoltageWaveforms(const DcalcAnalysisPtSeq &dcalc_aps)
|
LibertyCell::ensureVoltageWaveforms(const DcalcAnalysisPtSeq &dcalc_aps)
|
||||||
{
|
{
|
||||||
if (!have_voltage_waveforms_) {
|
if (!have_voltage_waveforms_) {
|
||||||
float vdd = 0.0; // shutup gcc
|
LockGuard lock(waveform_lock_);
|
||||||
bool vdd_exists;
|
// Recheck with lock.
|
||||||
liberty_library_->supplyVoltage("VDD", vdd, vdd_exists);
|
if (!have_voltage_waveforms_) {
|
||||||
if (!vdd_exists || vdd == 0.0)
|
float vdd = 0.0; // shutup gcc
|
||||||
criticalError(1120, "library missing vdd");
|
bool vdd_exists;
|
||||||
for (TimingArcSet *arc_set : timingArcSets()) {
|
liberty_library_->supplyVoltage("VDD", vdd, vdd_exists);
|
||||||
for (TimingArc *arc : arc_set->arcs()) {
|
if (!vdd_exists || vdd == 0.0)
|
||||||
for (const DcalcAnalysisPt *dcalc_ap : dcalc_aps) {
|
criticalError(1120, "library missing vdd");
|
||||||
GateTableModel *model = arc->gateTableModel(dcalc_ap);
|
for (TimingArcSet *arc_set : timingArcSets()) {
|
||||||
if (model) {
|
for (TimingArc *arc : arc_set->arcs()) {
|
||||||
OutputWaveforms *output_waveforms = model->outputWaveforms();
|
for (const DcalcAnalysisPt *dcalc_ap : dcalc_aps) {
|
||||||
if (output_waveforms)
|
GateTableModel *model = arc->gateTableModel(dcalc_ap);
|
||||||
output_waveforms->ensureVoltageWaveforms(vdd);
|
if (model) {
|
||||||
|
OutputWaveforms *output_waveforms = model->outputWaveforms();
|
||||||
|
if (output_waveforms)
|
||||||
|
output_waveforms->ensureVoltageWaveforms(vdd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
have_voltage_waveforms_ = true;
|
||||||
}
|
}
|
||||||
have_voltage_waveforms_ = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ Network::pathName(const Instance *instance) const
|
||||||
const Instance *inst = path_iter1.next();
|
const Instance *inst = path_iter1.next();
|
||||||
name_length += strlen(name(inst)) + 1;
|
name_length += strlen(name(inst)) + 1;
|
||||||
}
|
}
|
||||||
char *path_name = makeTmpString(name_length);
|
char *path_name = makeTmpString(name_length + 1);
|
||||||
char *path_ptr = path_name;
|
char *path_ptr = path_name;
|
||||||
// Top instance has null string name, so terminate the string here.
|
// Top instance has null string name, so terminate the string here.
|
||||||
*path_name = '\0';
|
*path_name = '\0';
|
||||||
|
|
@ -1047,8 +1047,7 @@ Network::findInstPinsHierMatching(const Instance *instance,
|
||||||
while (pin_iter->hasNext()) {
|
while (pin_iter->hasNext()) {
|
||||||
const Pin *pin = pin_iter->next();
|
const Pin *pin = pin_iter->next();
|
||||||
const char *port_name = name(port(pin));
|
const char *port_name = name(port(pin));
|
||||||
string pin_name;
|
string pin_name = inst_name + divider_ + port_name;
|
||||||
stringPrint(pin_name, "%s%c%s", inst_name.c_str(), divider_, port_name);
|
|
||||||
if (pattern->match(pin_name.c_str()))
|
if (pattern->match(pin_name.c_str()))
|
||||||
matches.push_back(pin);
|
matches.push_back(pin);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1034,8 +1034,9 @@ Pin *
|
||||||
SdfReader::findPin(const char *name)
|
SdfReader::findPin(const char *name)
|
||||||
{
|
{
|
||||||
if (path_) {
|
if (path_) {
|
||||||
string path_name;
|
string path_name = path_;
|
||||||
stringPrint(path_name, "%s%c%s", path_, divider_, name);
|
path_name += divider_;
|
||||||
|
path_name += name;
|
||||||
Pin *pin = network_->findPin(path_name.c_str());
|
Pin *pin = network_->findPin(path_name.c_str());
|
||||||
return pin;
|
return pin;
|
||||||
}
|
}
|
||||||
|
|
@ -1046,9 +1047,14 @@ SdfReader::findPin(const char *name)
|
||||||
Instance *
|
Instance *
|
||||||
SdfReader::findInstance(const char *name)
|
SdfReader::findInstance(const char *name)
|
||||||
{
|
{
|
||||||
string inst_name = name;
|
string inst_name;
|
||||||
if (path_)
|
if (path_) {
|
||||||
stringPrint(inst_name, "%s%c%s", path_, divider_, name);
|
inst_name = path_;
|
||||||
|
inst_name += divider_;
|
||||||
|
inst_name += name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
inst_name = name;
|
||||||
Instance *inst = network_->findInstance(inst_name.c_str());
|
Instance *inst = network_->findInstance(inst_name.c_str());
|
||||||
if (inst == nullptr)
|
if (inst == nullptr)
|
||||||
sdfWarn(195, "instance %s not found.", inst_name.c_str());
|
sdfWarn(195, "instance %s not found.", inst_name.c_str());
|
||||||
|
|
|
||||||
|
|
@ -713,13 +713,9 @@ getProperty(const LibertyCell *cell,
|
||||||
else if (stringEqual(property, "full_name")) {
|
else if (stringEqual(property, "full_name")) {
|
||||||
auto network = sta->cmdNetwork();
|
auto network = sta->cmdNetwork();
|
||||||
auto lib = cell->libertyLibrary();
|
auto lib = cell->libertyLibrary();
|
||||||
const char *lib_name = lib->name();
|
string lib_name = lib->name();
|
||||||
const char *cell_name = cell->name();
|
string cell_name = cell->name();
|
||||||
string full_name;
|
string full_name = lib_name + network->pathDivider() + cell_name;
|
||||||
stringPrint(full_name, "%s%c%s",
|
|
||||||
lib_name,
|
|
||||||
network->pathDivider(),
|
|
||||||
cell_name);
|
|
||||||
return PropertyValue(full_name);
|
return PropertyValue(full_name);
|
||||||
}
|
}
|
||||||
else if (stringEqual(property, "filename"))
|
else if (stringEqual(property, "filename"))
|
||||||
|
|
@ -748,14 +744,10 @@ getProperty(const Cell *cell,
|
||||||
|| stringEqual(property, "base_name"))
|
|| stringEqual(property, "base_name"))
|
||||||
return PropertyValue(network->name(cell));
|
return PropertyValue(network->name(cell));
|
||||||
else if (stringEqual(property, "full_name")) {
|
else if (stringEqual(property, "full_name")) {
|
||||||
auto lib = network->library(cell);
|
Library *lib = network->library(cell);
|
||||||
const char *lib_name = network->name(lib);
|
string lib_name = network->name(lib);
|
||||||
const char *cell_name = network->name(cell);
|
string cell_name = network->name(cell);
|
||||||
string full_name;
|
string full_name = lib_name + network->pathDivider() + cell_name;
|
||||||
stringPrint(full_name, "%s%c%s",
|
|
||||||
lib_name,
|
|
||||||
network->pathDivider(),
|
|
||||||
cell_name);
|
|
||||||
return PropertyValue(full_name);
|
return PropertyValue(full_name);
|
||||||
}
|
}
|
||||||
else if (stringEqual(property, "library"))
|
else if (stringEqual(property, "library"))
|
||||||
|
|
|
||||||
|
|
@ -1236,7 +1236,7 @@ use_default_arrival_clock()
|
||||||
void
|
void
|
||||||
set_use_default_arrival_clock(bool enable)
|
set_use_default_arrival_clock(bool enable)
|
||||||
{
|
{
|
||||||
return Sta::sta()->setUseDefaultArrivalClock(enable);
|
Sta::sta()->setUseDefaultArrivalClock(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,6 @@ initSta()
|
||||||
initElapsedTime();
|
initElapsedTime();
|
||||||
TimingRole::init();
|
TimingRole::init();
|
||||||
PortDirection::init();
|
PortDirection::init();
|
||||||
initTmpStrings();
|
|
||||||
initLiberty();
|
initLiberty();
|
||||||
initDelayConstants();
|
initDelayConstants();
|
||||||
registerDelayCalcs();
|
registerDelayCalcs();
|
||||||
|
|
@ -244,7 +243,6 @@ deleteAllMemory()
|
||||||
Sta::setSta(nullptr);
|
Sta::setSta(nullptr);
|
||||||
}
|
}
|
||||||
deleteDelayCalcs();
|
deleteDelayCalcs();
|
||||||
deleteTmpStrings();
|
|
||||||
TimingRole::destroy();
|
TimingRole::destroy();
|
||||||
PortDirection::destroy();
|
PortDirection::destroy();
|
||||||
deleteLiberty();
|
deleteLiberty();
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
#include "Machine.hh"
|
#include "Machine.hh"
|
||||||
#include "Mutex.hh"
|
#include "Mutex.hh"
|
||||||
|
|
@ -152,69 +153,43 @@ stringPrintTmp(const char *fmt,
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static int tmp_string_count_ = 100;
|
static constexpr size_t tmp_string_count = 256;
|
||||||
static char **tmp_strings_ = nullptr;
|
static constexpr size_t tmp_string_initial_length = 256;
|
||||||
static size_t *tmp_string_lengths_ = nullptr;
|
thread_local static std::array<char*, tmp_string_count> tmp_strings;
|
||||||
static int tmp_string_next_;
|
thread_local static std::array<size_t, tmp_string_count> tmp_string_lengths;
|
||||||
static std::mutex string_lock_;
|
thread_local static int tmp_string_next = 0;
|
||||||
|
|
||||||
void
|
|
||||||
initTmpStrings()
|
|
||||||
{
|
|
||||||
size_t initial_length = 100;
|
|
||||||
|
|
||||||
tmp_strings_ = new char*[tmp_string_count_];
|
|
||||||
tmp_string_lengths_ = new size_t[tmp_string_count_];
|
|
||||||
for (int i = 0; i < tmp_string_count_; i++) {
|
|
||||||
tmp_strings_[i] = new char[initial_length];
|
|
||||||
tmp_string_lengths_[i] = initial_length;
|
|
||||||
}
|
|
||||||
tmp_string_next_ = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
deleteTmpStrings()
|
|
||||||
{
|
|
||||||
if (tmp_strings_) {
|
|
||||||
for (int i = 0; i < tmp_string_count_; i++)
|
|
||||||
delete [] tmp_strings_[i];
|
|
||||||
delete [] tmp_strings_;
|
|
||||||
tmp_strings_ = nullptr;
|
|
||||||
|
|
||||||
delete [] tmp_string_lengths_;
|
|
||||||
tmp_string_lengths_ = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
getTmpString(// Return values.
|
getTmpString(// Return values.
|
||||||
char *&str,
|
char *&str,
|
||||||
size_t &length)
|
size_t &length)
|
||||||
{
|
{
|
||||||
LockGuard lock(string_lock_);
|
if (tmp_string_next == tmp_string_count)
|
||||||
if (tmp_string_next_ == tmp_string_count_)
|
tmp_string_next = 0;
|
||||||
tmp_string_next_ = 0;
|
str = tmp_strings[tmp_string_next];
|
||||||
str = tmp_strings_[tmp_string_next_];
|
length = tmp_string_lengths[tmp_string_next];
|
||||||
length = tmp_string_lengths_[tmp_string_next_];
|
if (str == nullptr) {
|
||||||
tmp_string_next_++;
|
str = tmp_strings[tmp_string_next] = new char[tmp_string_initial_length];
|
||||||
|
length = tmp_string_lengths[tmp_string_next] = tmp_string_initial_length;
|
||||||
|
}
|
||||||
|
tmp_string_next++;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
makeTmpString(size_t length)
|
makeTmpString(size_t length)
|
||||||
{
|
{
|
||||||
LockGuard lock(string_lock_);
|
if (tmp_string_next == tmp_string_count)
|
||||||
if (tmp_string_next_ == tmp_string_count_)
|
tmp_string_next = 0;
|
||||||
tmp_string_next_ = 0;
|
char *tmp_str = tmp_strings[tmp_string_next];
|
||||||
char *tmp_str = tmp_strings_[tmp_string_next_];
|
size_t tmp_length = tmp_string_lengths[tmp_string_next];
|
||||||
size_t tmp_length = tmp_string_lengths_[tmp_string_next_];
|
|
||||||
if (tmp_length < length) {
|
if (tmp_length < length) {
|
||||||
// String isn't long enough. Make a new one.
|
// String isn't long enough. Make a new one.
|
||||||
delete [] tmp_str;
|
delete [] tmp_str;
|
||||||
tmp_str = new char[length];
|
tmp_str = new char[length];
|
||||||
tmp_strings_[tmp_string_next_] = tmp_str;
|
tmp_strings[tmp_string_next] = tmp_str;
|
||||||
tmp_string_lengths_[tmp_string_next_] = length;
|
tmp_string_lengths[tmp_string_next] = length;
|
||||||
}
|
}
|
||||||
tmp_string_next_++;
|
tmp_string_next++;
|
||||||
return tmp_str;
|
return tmp_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -230,9 +205,9 @@ stringDeleteCheck(const char *str)
|
||||||
bool
|
bool
|
||||||
isTmpString(const char *str)
|
isTmpString(const char *str)
|
||||||
{
|
{
|
||||||
if (tmp_strings_) {
|
if (!tmp_strings.empty()) {
|
||||||
for (int i = 0; i < tmp_string_count_; i++) {
|
for (size_t i = 0; i < tmp_string_count; i++) {
|
||||||
if (str == tmp_strings_[i])
|
if (str == tmp_strings[i])
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue