On Mon, Oct 26, 2009 at 12:40 PM, Suraj Kurapati <sun...@gmail.com> wrote: > Thanks for the test case, I'll look at it tonight.
I ran your test case against all simulators I have access to. Both Mentor Modelsim and CVC Verilog simulator (CVer) ran your test case just fine, VCS almost reached the finish line, and all others crashed (see below). Also, CVer wasn't running your test case as-is, so I appended your test.v file to the example counter.v shipped with Ruby-VPI and copied your iteration & printing logic from test_loader.rb into counter_loader.rb to get it working. Interestingly, Icarus Verilog seems to indicate that the problem is a NULL pointer being passed to vpi_iterate(). If I were you, I would try converting your sample test case into a very simple C/C++ Verilog VPI application see if VCS still crashes. By the way, I've been tinkering with an alternate approach to embedding Ruby side-by-side with C here[1]. I'll see if this new approach solves the problem with your test case. Let me know if you have any more questions. Cheers. [1]: http://redmine.ruby-lang.org/issues/show/2294 ############################################################### # rake vsim ############################################################### (in /tmp/ruby-vpi/examples/defparam) (in /tmp/ruby-vpi/examples/defparam) ["vlib work", {:verbose=>:default, :noop=>false}] ["vlog", "test.v", {:verbose=>:default, :noop=>false}] Model Technology ModelSim SE-64 vlog 6.4c Compiler 2008.12 Dec 8 2008 -- Compiling module test -- Compiling module FD Top level modules: test ["vsim", "-c", "-do", "run -all; exit", "-pli", "/tmp/ruby-vpi/obj/vsim.so", "test", {:verbose=>:default, :noop=>false}] Reading /mada/software/mentor/modeltech/tcl/vsim/pref.tcl # 6.4c # vsim -do {run -all; exit} -c -pli /tmp/ruby-vpi/obj/vsim.so test # ** Note: (vsim-3812) Design is being optimized... # ** Note: (vsim-3865) Due to PLI being present, full design access is being specified. # Loading /tmp/ruby-vpi/obj/vsim.so # // ModelSim SE-64 6.4c Dec 8 2008 Linux 2.6.18-8.1.6.el5 # // # // Copyright 1991-2008 Mentor Graphics Corporation # // All Rights Reserved. # // # // THIS WORK CONTAINS TRADE SECRET AND # // PROPRIETARY INFORMATION WHICH IS THE PROPERTY # // OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS # // AND IS SUBJECT TO LICENSE TERMS. # // # Loading work.test(fast) # Loading work.FD(fast) # run -all # Instance Name: fd_inst # Module Name : FD #<VPI::Handle vpiPort name="d", fullName=nil, size=1, file="test.v", lineNo=3, hexStrVal=""> #<VPI::Handle vpiPort name="q", fullName=nil, size=1, file="test.v", lineNo=3, hexStrVal=""> #<VPI::Handle vpiPort name="clk", fullName=nil, size=1, file="test.v", lineNo=3, hexStrVal=""> # exit ############################################################### # rake cver ############################################################### (in /home/sun/tmp/ruby-vpi/examples/counter/xUnit) rake -f counter_runner.rake cver (in /home/sun/tmp/ruby-vpi/examples/counter/xUnit) ["cver", "+loadvpi=/home/sun/tmp/ruby-vpi/obj/cver.so:vlog_startup_routines_bootstrap", "+incdir+..", "../counter.v", {:noop=>false, :verbose=>:default}] cver +loadvpi=/home/sun/tmp/ruby-vpi/obj/cver.so:vlog_startup_routines_bootstrap +incdir+.. ../counter.v GPLCVER_2.12a of 05/16/07 (Linux-elf). Copyright (c) 1991-2007 Pragmatic C Software Corp. All Rights reserved. Licensed under the GNU General Public License (GPL). See the 'COPYING' file for details. NO WARRANTY provided. Today is Tue Oct 27 22:22:43 2009. Compiling source file "../counter.v" Highest level modules: counter test Instance Name: fd_inst Module Name : FD #<VPI::Handle vpiPort name="d", fullName=nil, size=1, file="../counter.v", lineNo=23, hexStrVal="z"> #<VPI::Handle vpiPort name="q", fullName=nil, size=1, file="../counter.v", lineNo=23, hexStrVal="z"> #<VPI::Handle vpiPort name="clk", fullName=nil, size=1, file="../counter.v", lineNo=24, hexStrVal="z"> Loaded suite ruby-vpi Started ... Finished in 0.104811 seconds. 3 tests, 35 assertions, 0 failures, 0 errors 202 simulation events and 3 declarative immediate assigns processed. 202 behavioral statements executed (68 procedural suspends). Times (in sec.): Translate 0.0, load/optimize 0.1, simulation 0.3. There were 23 error(s), 407 warning(s), and 14 inform(s). End of GPLCVER_2.12a at Tue Oct 27 22:22:44 2009 (elapsed 0.3 seconds). ############################################################### # rake vcs ############################################################### (in /tmp/ruby-vpi/examples/defparam) (in /tmp/ruby-vpi/examples/defparam) ["vcs", "-R", "+v2k", "+vpi", "+cli", "-P", "/tmp/ruby-vpi/lib/ruby-vpi/pli.tab", "-load", "/tmp/ruby-vpi/obj/vcs.so:vlog_startup_routines_bootstrap", "-full64", "test.v", {:verbose=>:default, :noop=>false}] Warning-[LNX_OS_VERUN] Unsupported Linux version Linux version 'CentOS release 5.4 (Final)' is not supported on 'x86_64' officially, assuming linux compatibility by default. Set VCS_ARCH_OVERRIDE to linux or suse32 to override. Please refer to release notes for information on supported platforms. Chronologic VCS (TM) Version C-2009.06_Full64 -- Tue Oct 27 22:00:33 2009 Copyright (c) 1991-2008 by Synopsys Inc. ALL RIGHTS RESERVED This program is proprietary and confidential information of Synopsys Inc. and may be used and disclosed only as authorized in a license agreement controlling such use and disclosure. Warning-[ACC_CLI_ON] ACC/CLI capabilities enabled ACC/CLI capabilities have been enabled for the entire design. For faster performance enable module specific capability in pli.tab file Parsing design file 'test.v' Top Level Modules: test No TimeScale specified Starting vcs inline pass... 1 module and 0 UDP read. recompiling module test gcc -pipe -O -I/mada/software/synopsys/vcs/include -c -o rmapats.o rmapats.c if [ -x ../simv ]; then chmod -x ../simv; fi g++ -o ../simv 5NrI_d.o 5NrIB_d.o gzYz_1_d.o rmapats_mop.o rmapats.o SIM_l.o /mada/software/synopsys/vcs/amd64/lib/libvirsim64.a /mada/software/synopsys/vcs/amd64/lib/liberrorinf.so /mada/software/synopsys/vcs/amd64/lib/libsnpsmalloc.so /mada/software/synopsys/vcs/amd64/lib/libvcsnew.so /mada/software/synopsys/vcs/amd64/lib/vcs_save_restore_new.o -ldl -lm -lc -lpthread -ldl ../simv up to date Chronologic VCS simulator copyright 1991-2008 Contains Synopsys proprietary information. Compiler version C-2009.06_Full64; Runtime version C-2009.06_Full64; Oct 27 22:00 2009 Instance Name: fd_inst Module Name : FD #<VPI::Handle vpiPort name="d", fullName=nil, size=1, file="test.v", lineNo=3, hexStrVal="z"> #<VPI::Handle vpiPort name="q", fullName=nil, size=1, file="test.v", lineNo=3, hexStrVal="z"> #<VPI::Handle vpiPort name="clk", fullName=nil, size=1, file="test.v", lineNo=3, hexStrVal="z"> Internal error in tool's source file "../vir/vir.cc" line 332. Please send these messages to vcs_supp...@synopsys.com.