3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-15 11:45:41 +00:00

Merge branch 'YosysHQ:main' into main

This commit is contained in:
Akash Levy 2025-11-13 18:11:04 -05:00 committed by GitHub
commit 55cd50f1a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 44 additions and 39 deletions

View file

@ -196,6 +196,7 @@ X($bweqx)
X($bwmux)
X($check)
X($concat)
X($connect)
X($cover)
X($demux)
X($dff)
@ -222,6 +223,7 @@ X($get_tag)
X($gt)
X($initstate)
X($input)
X($input_port)
X($lcu)
X($le)
X($live)

View file

@ -158,6 +158,7 @@ extern "C" {
void yosys_atexit()
{
RTLIL::OwningIdString::collect_garbage(false);
#if defined(YOSYS_ENABLE_READLINE) || defined(YOSYS_ENABLE_EDITLINE)
if (!yosys_history_file.empty()) {
#if defined(YOSYS_ENABLE_READLINE)
@ -706,11 +707,16 @@ int main(int argc, char **argv)
for (auto &it : pass_register)
if (it.second->call_counter) {
total_ns += it.second->runtime_ns + 1;
timedat.insert(make_tuple(it.second->runtime_ns + 1, it.second->call_counter, it.first));
auto pass_ns = it.second->runtime_ns + 1;
total_ns += pass_ns;
timedat.insert(make_tuple(pass_ns, it.second->call_counter, it.first));
}
timedat.insert(make_tuple(RTLIL::OwningIdString::garbage_collection_ns() + 1,
RTLIL::OwningIdString::garbage_collection_count(), "id_gc"));
{
auto gc_ns = RTLIL::OwningIdString::garbage_collection_ns() + 1;
total_ns += gc_ns;
timedat.insert(make_tuple(gc_ns,
RTLIL::OwningIdString::garbage_collection_count(), "id_gc"));
}
if (timing_details)
{

View file

@ -132,7 +132,7 @@ int RTLIL::IdString::really_insert(std::string_view p, std::unordered_map<std::s
#ifdef YOSYS_XTRACE_GET_PUT
if (yosys_xtrace)
log("#X# GET-BY-NAME '%s' (index %d, refcount %u)\n", global_id_storage_.at(idx), idx, refcount(idx));
log("#X# GET-BY-NAME '%s' (index %d, refcount %u)\n", global_id_storage_.at(idx).buf, idx, refcount(idx));
#endif
return idx;
}
@ -248,14 +248,15 @@ struct IdStringCollector {
int64_t RTLIL::OwningIdString::gc_ns;
int RTLIL::OwningIdString::gc_count;
void RTLIL::OwningIdString::collect_garbage()
void RTLIL::OwningIdString::collect_garbage(bool trace)
{
int64_t start = PerformanceTimer::query();
#ifndef YOSYS_NO_IDS_REFCNT
IdStringCollector collector;
for (auto &[idx, design] : *RTLIL::Design::get_all_designs()) {
collector.trace(*design);
}
if (trace)
for (auto &[idx, design] : *RTLIL::Design::get_all_designs()) {
collector.trace(*design);
}
int size = GetSize(global_id_storage_);
for (int i = static_cast<int>(StaticId::STATIC_ID_END); i < size; ++i) {
RTLIL::IdString::Storage &storage = global_id_storage_.at(i);

View file

@ -135,10 +135,6 @@ struct RTLIL::IdString
std::string_view str_view() const { return {buf, static_cast<size_t>(size)}; }
};
#undef YOSYS_XTRACE_GET_PUT
#undef YOSYS_SORT_ID_FREE_LIST
#undef YOSYS_NO_IDS_REFCNT
// the global id string cache
static bool destruct_guard_ok; // POD, will be initialized to zero
@ -178,7 +174,7 @@ struct RTLIL::IdString
if (global_id_storage_.at(idx).buf == nullptr)
log("#X# DB-DUMP index %d: FREE\n", idx);
else
log("#X# DB-DUMP index %d: '%s' (ref %u)\n", idx, refcount(idx).buf, refcount);
log("#X# DB-DUMP index %d: '%s' (ref %u)\n", idx, global_id_storage_.at(idx).buf, refcount(idx));
}
#endif
}
@ -578,7 +574,7 @@ struct RTLIL::OwningIdString : public RTLIL::IdString {
}
// Collect all non-owning references.
static void collect_garbage();
static void collect_garbage(bool trace = true);
static int64_t garbage_collection_ns() { return gc_ns; }
static int garbage_collection_count() { return gc_count; }