Skip to content

Commit

Permalink
Merge branch 'parallaxsw:master' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
akashlevy authored Nov 10, 2024
2 parents 5ef5ce0 + 3166392 commit 86f7ff2
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 27 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,8 @@ set(CXX_FLAGS -Wall -Wextra -pedantic -Wcast-qual -Wredundant-decls -Wformat-sec

if(USE_SANITIZE)
message(STATUS "Sanitize: ${USE_SANITIZE}")
set(CXX_FLAGS "${CXX_FLAGS};-fsanitize=address;-fno-omit-frame-pointer;-fno-common")
set(CMAKE_EXE_LINKER_FLAGS "-fsanitize=address")
set(CXX_FLAGS "${CXX_FLAGS};-fsanitize=thread")
set(CMAKE_EXE_LINKER_FLAGS "-fsanitize=thread")
endif()

target_compile_options(OpenSTA
Expand Down
1 change: 0 additions & 1 deletion include/sta/LibertyClass.hh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class TableAxis;
class GateTimingModel;
class CheckTimingModel;
class ScaleFactors;
class Group;
class Wireload;
class WireloadSelection;
class TimingArcSet;
Expand Down
2 changes: 2 additions & 0 deletions include/sta/Search.hh
Original file line number Diff line number Diff line change
Expand Up @@ -583,12 +583,14 @@ protected:
// Entries in tags_ may be missing where previous filter tags were deleted.
TagIndex tag_capacity_;
Tag **tags_;
Tag **tags_prev_;
TagIndex tag_next_;
// Holes in tags_ left by deleting filter tags.
std::vector<TagIndex> tag_free_indices_;
std::mutex tag_lock_;
TagGroupSet *tag_group_set_;
TagGroup **tag_groups_;
TagGroup **tag_groups_prev_;
TagGroupIndex tag_group_next_;
// Holes in tag_groups_ left by deleting filter tag groups.
std::vector<TagIndex> tag_group_free_indices_;
Expand Down
19 changes: 19 additions & 0 deletions liberty/LibertyReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ LibertyReader::defineVisitors()
defineAttrVisitor("index_2", &LibertyReader::visitIndex2);
defineAttrVisitor("index_3", &LibertyReader::visitIndex3);

defineGroupVisitor("technology",
&LibertyReader::beginTechnology,
&LibertyReader::endTechnology);
defineGroupVisitor("rise_transition_degradation",
&LibertyReader::beginRiseTransitionDegredation,
&LibertyReader::endRiseFallTransitionDegredation);
Expand Down Expand Up @@ -655,6 +658,7 @@ LibertyReader::beginLibrary(LibertyGroup *group)
library_->units()->currentUnit()->setScale(current_scale_);
library_->units()->distanceUnit()->setScale(distance_scale_);

library_->setDelayModelType(DelayModelType::cmos_linear);
scale_factors_ = new ScaleFactors("");
library_->setScaleFactors(scale_factors_);
}
Expand Down Expand Up @@ -1335,6 +1339,21 @@ LibertyReader::visitSlewDerateFromLibrary(LibertyAttr *attr)

////////////////////////////////////////////////////////////////

void
LibertyReader::beginTechnology(LibertyGroup *group)
{
if (library_) {
const char *tech = group->firstName();
if (stringEq(tech, "fpga"))
library_->setDelayModelType(DelayModelType::cmos_linear);
}
}

void
LibertyReader::endTechnology(LibertyGroup *)
{
}

void
LibertyReader::beginTableTemplateDelay(LibertyGroup *group)
{
Expand Down
2 changes: 2 additions & 0 deletions liberty/LibertyReaderPvt.hh
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ public:
RiseFall *rf);
virtual void visitSlewDerateFromLibrary(LibertyAttr *attr);

virtual void beginTechnology(LibertyGroup *group);
virtual void endTechnology(LibertyGroup *group);
virtual void beginTableTemplateDelay(LibertyGroup *group);
virtual void beginTableTemplateOutputCurrent(LibertyGroup *group);
virtual void beginTableTemplate(LibertyGroup *group,
Expand Down
2 changes: 1 addition & 1 deletion parasitics/ConcreteParasitics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -946,9 +946,9 @@ ConcreteParasitics::findPiElmore(const Pin *drvr_pin,
const RiseFall *rf,
const ParasiticAnalysisPt *ap) const
{
LockGuard lock(lock_);
if (!drvr_parasitic_map_.empty()) {
int ap_rf_index = parasiticAnalysisPtIndex(ap, rf);
LockGuard lock(lock_);
ConcreteParasitic **parasitics = drvr_parasitic_map_.findKey(drvr_pin);
if (parasitics) {
ConcreteParasitic *parasitic = parasitics[ap_rf_index];
Expand Down
11 changes: 8 additions & 3 deletions search/PathGroup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,25 +95,30 @@ PathGroup::~PathGroup()
bool
PathGroup::savable(PathEnd *path_end)
{
float threshold;
{
LockGuard lock(lock_);
threshold = threshold_;
}
bool savable = false;
if (compare_slack_) {
// Crpr increases the slack, so check the slack
// without crpr first because it is expensive to find.
Slack slack = path_end->slackNoCrpr(sta_);
if (!delayIsInitValue(slack, min_max_)
&& delayLessEqual(slack, threshold_, sta_)
&& delayLessEqual(slack, threshold, sta_)
&& delayLessEqual(slack, slack_max_, sta_)) {
// Now check with crpr.
slack = path_end->slack(sta_);
savable = delayLessEqual(slack, threshold_, sta_)
savable = delayLessEqual(slack, threshold, sta_)
&& delayLessEqual(slack, slack_max_, sta_)
&& delayGreaterEqual(slack, slack_min_, sta_);
}
}
else {
const Arrival &arrival = path_end->dataArrivalTime(sta_);
savable = !delayIsInitValue(arrival, min_max_)
&& delayGreaterEqual(arrival, threshold_, min_max_, sta_);
&& delayGreaterEqual(arrival, threshold, min_max_, sta_);
}
return savable;
}
Expand Down
36 changes: 20 additions & 16 deletions search/Search.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,10 @@ Search::init(StaState *sta)
clk_info_set_ = new ClkInfoSet(ClkInfoLess(sta));
tag_next_ = 0;
tags_ = new Tag*[tag_capacity_];
tags_prev_ = nullptr;
tag_group_capacity_ = 127;
tag_groups_ = new TagGroup*[tag_group_capacity_];
tag_groups_prev_ = nullptr;
tag_group_next_ = 0;
tag_group_set_ = new TagGroupSet(tag_group_capacity_);
pending_latch_outputs_ = new VertexSet(graph_);
Expand Down Expand Up @@ -270,7 +272,9 @@ Search::~Search()
delete tag_set_;
delete clk_info_set_;
delete [] tags_;
delete [] tags_prev_;
delete [] tag_groups_;
delete [] tag_groups_prev_;
delete tag_group_set_;
delete search_adj_;
delete eval_pred_;
Expand Down Expand Up @@ -2647,15 +2651,15 @@ Search::findTagGroup(TagGroupBldr *tag_bldr)
// std::vector doesn't seem to follow this protocol so multi-thread
// search fails occasionally if a vector is used for tag_groups_.
if (tag_group_next_ == tag_group_capacity_) {
TagGroupIndex new_capacity = nextMersenne(tag_group_capacity_);
TagGroup **new_tag_groups = new TagGroup*[new_capacity];
memcpy(new_tag_groups, tag_groups_,
TagGroupIndex tag_capacity = tag_group_capacity_ * 2;
TagGroup **tag_groups = new TagGroup*[tag_capacity];
memcpy(tag_groups, tag_groups_,
tag_group_capacity_ * sizeof(TagGroup*));
TagGroup **old_tag_groups = tag_groups_;
tag_groups_ = new_tag_groups;
tag_group_capacity_ = new_capacity;
delete [] old_tag_groups;
tag_group_set_->reserve(new_capacity);
delete [] tag_groups_prev_;
tag_groups_prev_ = tag_groups_;
tag_groups_ = tag_groups;
tag_group_capacity_ = tag_capacity;
tag_group_set_->reserve(tag_capacity);
}
if (tag_group_next_ > tag_group_index_max)
report_->critical(1510, "max tag group index exceeded");
Expand Down Expand Up @@ -2888,14 +2892,14 @@ Search::findTag(const RiseFall *rf,
// std::vector doesn't seem to follow this protocol so multi-thread
// search fails occasionally if a vector is used for tags_.
if (tag_next_ == tag_capacity_) {
TagIndex new_capacity = nextMersenne(tag_capacity_);
Tag **new_tags = new Tag*[new_capacity];
memcpy(new_tags, tags_, tag_capacity_ * sizeof(Tag*));
Tag **old_tags = tags_;
tags_ = new_tags;
delete [] old_tags;
tag_capacity_ = new_capacity;
tag_set_->reserve(new_capacity);
TagIndex tag_capacity = tag_capacity_ * 2;
Tag **tags = new Tag*[tag_capacity];
memcpy(tags, tags_, tag_capacity_ * sizeof(Tag*));
delete [] tags_prev_;
tags_prev_ = tags_;
tags_ = tags;
tag_capacity_ = tag_capacity;
tag_set_->reserve(tag_capacity);
}
if (tag_next_ == tag_index_max)
report_->critical(1511, "max tag index exceeded");
Expand Down
2 changes: 1 addition & 1 deletion test/regression.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ proc run_test_valgrind { test cmd_file log_file } {
}
file delete $vg_cmd_file
cleanse_logfile $test $log_file
lappend error_msg [cleanse_valgrind_logfile $test $log_file]
set error_msg [concat $error_msg [cleanse_valgrind_logfile $test $log_file]]
return $error_msg
}

Expand Down
9 changes: 6 additions & 3 deletions util/StringUtil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@
#include <cctype>
#include <cstdio>
#include <array>
#include <algorithm>

#include "Machine.hh"
#include "Mutex.hh"

namespace sta {

using std::max;

static void
stringPrintTmp(const char *fmt,
va_list args,
Expand Down Expand Up @@ -158,7 +161,6 @@ stringPrintTmp(const char *fmt,

if (tmp_length >= tmp_length1) {
tmp_length1 = tmp_length + 1;
stringDelete(tmp);
tmp = makeTmpString(tmp_length1);
va_copy(args_copy, args);
tmp_length = vsnprint(tmp, tmp_length1, fmt, args_copy);
Expand Down Expand Up @@ -200,9 +202,10 @@ makeTmpString(size_t length)
if (tmp_length < length) {
// String isn't long enough. Make a new one.
delete [] tmp_str;
tmp_str = new char[length];
tmp_length = max(tmp_string_initial_length, length);
tmp_str = new char[tmp_length];
tmp_strings[tmp_string_next] = tmp_str;
tmp_string_lengths[tmp_string_next] = length;
tmp_string_lengths[tmp_string_next] = tmp_length;
}
tmp_string_next++;
return tmp_str;
Expand Down

0 comments on commit 86f7ff2

Please sign in to comment.