pysv
pysv copied to clipboard
Fatal Python error: init_fs_encoding:
Hi Dear Dev Team,
I'm having a hard time running simulations with linked Python scripts / pysv module, but I would really like to. I'm running command line UVM simulations with Vivado 2023.2 on Ubuntu 22.04.4 LTS. There is a AMD forum ticket with my problem, but this one is more focused on general Python script added to the SV code.
I did my best to followed your documentation and wrote a simple hello word script:
from pysv import sv, compile_lib, generate_sv_binding
@sv()
def hello_world():
print("hello world!")
# compile the a shared_lib into build folder
lib_path = compile_lib([hello_world], cwd="build")
# generate SV binding
generate_sv_binding([hello_world], filename="pysv_pkg.sv")
After running the example.py the output products / folders are successfully created.
This is how I pass the libaxis_dpi.so file to the xelab tool:
/tools/Xilinx/Vivado/2023.2/bin/unwrapped/lnx64.o/xelab -debug all -v 2 -dpi_absolute -sv_lib ../../model/build/libpysv -dpiheader dome_file.h -L uvm -debug typical -relax -stats -cov_db_name func_covdb -cc_db code_covdb -cc_type bcesfxt -top testbench -snapshot top_snapshot
compilation, elaboration succeeds, simulation stage starts, some UVM messages are printed to the log, but I get the following error when hello_world() is called:
`UVM_INFO /home/kolos/projects/flamingo/verification/common/axis_skid_buffer/uvm/env/predictor.svh(52) @ 135.000ns: uvm_test_top.ENV.PREDICTOR [PREDICTOR] Before hello_world
Python path configuration:
PYTHONHOME = '/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3'
PYTHONPATH = '/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3:/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3/bin:/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3/lib:/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3/lib/python3.8/site-packages:/tools/Xilinx/Vivado/2023.2/lib/lnx64.o/Ubuntu/22:/tools/Xilinx/Vivado/2023.2/lib/lnx64.o/Ubuntu:/tools/Xilinx/Vivado/2023.2/lib/lnx64.o:'
program name = 'python3'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3/bin/python3'
sys.base_prefix = '/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3'
sys.base_exec_prefix = '/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3'
sys.platlibdir = 'lib'
sys.executable = '/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3/bin/python3'
sys.prefix = '/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3'
sys.exec_prefix = '/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3'
sys.path = [
'/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3',
'/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3/bin',
'/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3/lib',
'/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3/lib/python3.8/site-packages',
'/tools/Xilinx/Vivado/2023.2/lib/lnx64.o/Ubuntu/22',
'/tools/Xilinx/Vivado/2023.2/lib/lnx64.o/Ubuntu',
'/tools/Xilinx/Vivado/2023.2/lib/lnx64.o',
'',
'/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3/lib/python310.zip',
'/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3/lib/python3.10',
'/tools/Xilinx/Vivado/2023.2/tps/lnx64/python-3.8.3/lib/python3.10/lib-dynload',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007057810af640 (most recent call first):
<no Python frame>
Command failed: Simulator command interrupted.
Simulation engine not responding`
I'm completely stuck with the problem and it is frustrating since I would like to create a UVM based FPGA dev framework with free/open source tools which come with Python DPI models to provide reference output for any SystemVerilog module during verification.
I'm also willing to pay 200 $ for the solution since I've invested too much of work in my UVM environment and other scripts to settle with C/C++ models.