Support TERMUX (#7559). [Laurent CHARRIER]

Fixes #7559.
This commit is contained in:
Wilson Snyder 2026-05-10 08:20:32 -04:00
parent 2bc294ccad
commit 303615bb37
4 changed files with 11 additions and 0 deletions

View File

@ -21,6 +21,7 @@ Verilator 5.049 devel
* Support procedural continuous assign/deassign (#7493). [Artur Bieniek, Antmicro Ltd.]
* Support randsequence production function ports (#7522). [Yilou Wang]
* Support followed-by operators `#-#` and `#=#` in properties (#7523). [Yilou Wang]
* Support TERMUX (#7559). [Laurent CHARRIER]
* Add peak memory usage to `--stats`. [Geza Lore, Testorrent USA, Inc.]
* Improve `--coverage-fsm` (#7490) (#7529). [Yogish Sekhar]
* Change `+verilator+seed` to default to 1, and 0 to randomly select (#7325) (#7516). [Miguel]

View File

@ -165,6 +165,7 @@ Krzysztof Sychla
Kuba Ober
Lan Zongwei
Larry Doolittle
Laurent CHARRIER
Leela Pakanati
Liam Braun
Luca Colagrande

View File

@ -268,8 +268,13 @@ std::string VlThreadPool::numaAssign(VerilatedContext* contextp) {
}
status += ";";
#ifdef __TERMUX__
const int rc = sched_setaffinity(m_workers[thread]->m_cthread.native_handle(),
sizeof(cpu_set_t), &cpuset);
#else
const int rc = pthread_setaffinity_np(m_workers[thread]->m_cthread.native_handle(),
sizeof(cpu_set_t), &cpuset);
#endif
if (rc != 0) return "%Warning: pthread_setaffinity_np failed";
}
// std::cout << "Status: " << status << std::endl;

View File

@ -118,7 +118,11 @@ unsigned getProcessAvailableParallelism() VL_MT_SAFE {
#if defined(__linux) || defined(CPU_ZERO) // Linux-like; assume we have pthreads etc
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
#ifdef __TERMUX__
const int rc = sched_getaffinity(pthread_self(), sizeof(cpuset), &cpuset);
#else
const int rc = pthread_getaffinity_np(pthread_self(), sizeof(cpuset), &cpuset);
#endif
if (rc == 0) {
unsigned nCpus = 0;
for (int i = 0; i < CPU_SETSIZE; ++i) {