Matlab crashing when invoking matlab code via a shared object from UVM testbench.

2 visualizaciones (últimos 30 días)
I am trying to integrate a matlab model in my UVM Testbench, for checker (scoreboard) purposes.
  • For this purpose I have compiled the matlab model in library compiler using C++ shared library and that created a shared object and a header file. No matter what's the content of the matlab code, there is no error at this stage, except for compilation errors.
  • Now I've coded a cpp function which calls the matlab model (whose definition is availabel in the .h and .so files of library compiler output). I have added this cpp function/file in the dut & testbench compilation and have also provided the necessary paths for compilation.
  • I am importing this cpp function into my scoreaboard as DPI-C import and calling it in the report phase of my UVM scoreboard.
Now matlab is crashing when it's getting invoked from scorebaord, when I run a testcase in my UVM Testbench. The crash dump is saying
  • Fault Count: 1
  • Abnormal termination:
  • Segmentation violation
  • Current Thread: 'MCR 0 interpret' id 46919396607744
  • Register State (from fault): <few lines>
  • Stack trace (from fault) : <few lines>
This crash is happening if the matlab code has constructs like
  • double(bitget())
  • double(bitsliceget())
  • boolean(bitget());
If I comment those lines, there is no crash. Is it possible that C++ shared library doens't support all matlab constructs? Is there any way around or am I missing anything? Any help is immensely appreciated.
Thanks,
Satya.
  1 comentario
Oded
Oded el 25 de Jun. de 2025
Did you find a solution? I have very similar issue when trying to use Matlab from my UVM env using DPI and c++
Sometimes I get 'Segmentation violation' when caling the fucnation named mclmcrInitialize();

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by