csail-csg / pyverilator

Python wrapper for verilator model
MIT License
78 stars 34 forks source link

pyverilator does not work with latest verilator #17

Open namin opened 2 years ago

namin commented 2 years ago

I have a program (from https://github.com/namin/bluespec-sandbox) that works with verilator 4.200 but not verilator 4.218.

The error is

clang++  -I.  -MMD -I/usr/local/Cellar/verilator/4.218/share/verilator/include -I/usr/local/Cellar/verilator/4.218/share/verilator/include/vltstd -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=1 -DVM_TRACE_FST=0 -faligned-new -fbracket-depth=4096 -fcf-protection=none -Qunused-arguments -Wno-bool-operation -Wno-tautological-bitwise-compare -Wno-parentheses-equality -Wno-sign-compare -Wno-uninitialized -Wno-unused-parameter -Wno-unused-variable -Wno-shadow     -fPIC -shared --std=c++11 -DVL_USER_FINISH  -std=gnu++14 -Os -c -o pyverilator_wrapper.o ../obj_dir/pyverilator_wrapper.cpp
../obj_dir/pyverilator_wrapper.cpp:113:14: error: expected ';' after top level declarator
uint32_t get_&RDY_put(Vmachine01* top){return top->&RDY_put;}
             ^
             ;
1 error generated.
make: *** [pyverilator_wrapper.o] Error 1
Traceback (most recent call last):
  File "/Users/namin/code/blu/bluespec-sandbox/testbench.py", line 3, in <module>
    sim = PyVerilator.build('machine01.v')
  File "/Users/namin/opt/anaconda3/lib/python3.9/site-packages/pyverilator/pyverilator.py", line 493, in build
    call_process(make_args, quiet=quiet)
  File "/Users/namin/opt/anaconda3/lib/python3.9/site-packages/pyverilator/pyverilator.py", line 345, in call_process
    subprocess.check_call(args)
  File "/Users/namin/opt/anaconda3/lib/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make', '-C', 'obj_dir', '-f', 'Vmachine01.mk', 'LDFLAGS=-fPIC -shared']' returned non-zero exit status 2.

Let me know if I can provide more information.

Thanks!

maltanar commented 2 years ago

Hello, I ran into this as well and it looks like the issue is the ampersand characters that appear in the generated function names.I have a quick fix here that worked for me (essentially just stripping the ampersand character from the generated macro calls):

https://github.com/maltanar/pyverilator/pull/5

bat52 commented 1 year ago

I made a fork that deals with this issue ( https://github.com/bat52/pyverilator ) and is available over pypi as pyverilator-mm

Kreijstal commented 3 months ago

I made a fork that deals with this issue ( https://github.com/bat52/pyverilator ) and is available over pypi as pyverilator-mm

add issues and discussions on your fork

bat52 commented 3 months ago

I made a fork that deals with this issue ( https://github.com/bat52/pyverilator ) and is available over pypi as pyverilator-mm

add issues and discussions on your fork

Done