cocotb: Mixed language simulation doesn't work with Aldec Riviera

There’s a problem when trying to run mixed language simulation under Aldec Riviera. The problem can be reproduced even with the example in the repo. Apart from the already known issue with VHDL->Verilog access mentioned in #2921 , it seems that Verilog->VHDL also doesn’t work.

Here’s a last part of simulator output when trying to run it with make SIM=riviera COCOTB_DEBUG_LEVEL=trace:

# COUT:      0.00ns INFO     cocotb                             Running on Riviera-PRO version 2021.04.107.8106                                                                                                                                                                          
# COUT:      0.00ns INFO     cocotb                             Running tests with cocotb v1.7.0 from /home/adrian/.local/lib/python3.6/site-packages/cocotb                                                                                                                             
# COUT:      0.00ns INFO     cocotb                             Seeding Python random module with 1663159507                                                                                                                                                                             
# COUT:      0.00ns INFO     cocotb.regression                  pytest not found, install it to enable better AssertionError messages                                                                                                                                                    
# COUT:      0.00ns INFO     cocotb.regression                  Found test test_mixed_language.mixed_language_accessing_test                                                                                                                                                             
# COUT:      0.00ns INFO     cocotb.regression                  Found test test_mixed_language.mixed_language_functional_test                                                                                                                                                            
# COUT:      0.00ns INFO     cocotb.regression                  running mixed_language_accessing_test (1/2)                                                                                                                                                                              
# COUT:                                                           Try accessing handles and setting values in a mixed language environment.                                                                                                                                              
# COUT:    100.00ns INFO     cocotb.endian_swapper_mixed        Got: 'i_swapper_sv'                                                                                                                                                                                                      
# COUT:    100.00ns WARNING  gpi                                VPI: Simulator does not know this type (1029) via VPI                                                                                                                                                                    
# COUT: free(): invalid pointer                                                                                                                                                                                                                                                          
bash: line 1:  8315 Segmentation fault      (core dumped) GPI_EXTRA=/home/adrian/.local/lib/python3.6/site-packages/cocotb/libs/libcocotbvhpi_aldec.so:cocotbvhpi_entry_point TOPLEVEL_LANG=verilog MODULE=test_mixed_language TESTCASE= TOPLEVEL=endian_swapper_mixed /opt/aldec/riviera
pro/bin/vsimsa -do sim_build/runsim.tcl

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 31 (16 by maintainers)

Commits related to this issue

Most upvoted comments

The module loading error that you resolved by setting LIBPYTHON_LOC seems unrelated to the segfault issue that we discussed earlier. I’d suggest to keep this issue to the segfault; I opened https://github.com/cocotb/cocotb/issues/3097 for the other issue.

On the segfault: I can reproduce the issue on my side, but I haven’t yet found enough time to deep-dive into it. My first suspicion is that we’re freeing a piece of memory that was allocated by another libstdc++ (we link one statically into cocotb, Aldec ships its own version dynamically linked, and of course the operating system provides another one). But again, that’s a hypothesis which needs checking.