Hi all,
I’ve upgraded chiseltest from 0.3.3 of chisel-template to 0.5.0-RC1 to try out the iVerilog backend.
By adding .withAnnotations to GCDSpec in the chisel-template, both the treadle and iVerilog backend works as expected. However, the Verilator backend, which worked back in chiseltest 0.3.3, now fails with these errors:
/usr/bin/ld: ../verilated.o: relocation R_X86_64_PC32 against symbol `_ZN12VerilatedImp3s_sE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make: *** [VDecoupledGcd] Error 1
- should Gcd should calculate proper greatest common denominator in Verilator *** FAILED ***
os.SubprocessException: CommandResult 2
make: Entering directory '/local/samh/repos/dsk3.hkg/ssag/test_run_dir/should_Gcd_should_calculate_proper_greatest_common_denominator_in_Verilator/verilated'
g++ -I. -MMD -I/usr/local/share/verilator/include -I/usr/local/share/verilator/include/vltstd -DVM_COVERAGE=1 -DVM_SC=0 -DVM_TRACE=0 -faligned-new -Wno-bool-operation -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow -O1 -DVL_USER_FINISH -DTOP_TYPE=VDecoupledGcd -include VDecoupledGcd.h -fPIC -shared -I/usr/lib/jvm/java-11-openjdk-amd64/include -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux -fvisibility=hidden -c -o DecoupledGcd-harness.o ../DecoupledGcd-harness.cpp
g++ -I. -MMD -I/usr/local/share/verilator/include -I/usr/local/share/verilator/include/vltstd -DVM_COVERAGE=1 -DVM_SC=0 -DVM_TRACE=0 -faligned-new -Wno-bool-operation -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow -O1 -DVL_USER_FINISH -DTOP_TYPE=VDecoupledGcd -include VDecoupledGcd.h -fPIC -shared -I/usr/lib/jvm/java-11-openjdk-amd64/include -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux -fvisibility=hidden -c -o verilated_cov.o /usr/local/share/verilator/include/verilated_cov.cpp /usr/bin/perl /usr/local/share/verilator/bin/verilator_includer -DVL_INCLUDE_OPT=include VDecoupledGcd.cpp > VDecoupledGcd__ALLfast.cpp /usr/bin/perl /usr/local/share/verilator/bin/verilator_includer -DVL_INCLUDE_OPT=include VDecoupledGcd__Syms.cpp > VDecoupledGcd__ALLslow.cpp
g++ -I. -MMD -I/usr/local/share/verilator/include -I/usr/local/share/verilator/include/vltstd -DVM_COVERAGE=1 -DVM_SC=0 -DVM_TRACE=0 -faligned-new -Wno-bool-operation -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow -O1 -DVL_USER_FINISH -DTOP_TYPE=VDecoupledGcd -include VDecoupledGcd.h -fPIC -shared -I/usr/lib/jvm/java-11-openjdk-amd64/include -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux -fvisibility=hidden -c -o VDecoupledGcd__ALLfast.o VDecoupledGcd__ALLfast.cpp
g++ -I. -MMD -I/usr/local/share/verilator/include -I/usr/local/share/verilator/include/vltstd -DVM_COVERAGE=1 -DVM_SC=0 -DVM_TRACE=0 -faligned-new -Wno-bool-operation -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow -O1 -DVL_USER_FINISH -DTOP_TYPE=VDecoupledGcd -include VDecoupledGcd.h -fPIC -shared -I/usr/lib/jvm/java-11-openjdk-amd64/include -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux -fvisibility=hidden -c -o VDecoupledGcd__ALLslow.o VDecoupledGcd__ALLslow.cpp ar -cr VDecoupledGcd__ALL.a VDecoupledGcd__ALLfast.o VDecoupledGcd__ALLslow.o ranlib VDecoupledGcd__ALL.a
g++ DecoupledGcd-harness.o ../verilated.o verilated_cov.o VDecoupledGcd__ALL.a -shared -dynamiclib -fvisibility=hidden -o VDecoupledGcd
VDecoupledGcd.mk:65: recipe for target 'VDecoupledGcd' failed
make: Leaving directory '/local/samh/repos/dsk3.hkg/ssag/test_run_dir/should_Gcd_should_calculate_proper_greatest_common_denominator_in_Verilator/verilated'
at os.proc.call(ProcessOps.scala:85)
at chiseltest.simulator.VerilatorSimulator$.compileSimulation(VerilatorSimulator.scala:141)
at chiseltest.simulator.VerilatorSimulator$.createContextFromScratch(VerilatorSimulator.scala:113)
at chiseltest.simulator.VerilatorSimulator$.$anonfun$createContext$1(VerilatorSimulator.scala:69)
at chiseltest.simulator.Caching$.cacheSimulationBin(Caching.scala:22)
at chiseltest.simulator.VerilatorSimulator$.createContext(VerilatorSimulator.scala:69)
at chiseltest.internal.BackendExecutive$.start(BackendExecutive.scala:36)
at chiseltest.defaults.package$.createDefaultTester(defaults.scala:25)
at chiseltest.ChiselScalatestTester$TestBuilder.apply(ChiselScalatestTester.scala:37)
at gcd.GCDSpec.$anonfun$new$1(GCDSpec.scala:69)
The link error on the 1st line seemed odd, I did see the -fPIC flag being passed in in several places.
Any ideas?
Best regards,
Sam
Hi all,
Turns out the verilated.o was not compiled with -fPIC flag, so I just launched the test with
USER_CPPFLAGS="-fPIC" sbt "testOnly gcd.GCDSpec"
and things worked as expected.
Thanks,
Sam
--
You received this message because you are subscribed to the Google Groups "chisel-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chisel-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chisel-users/fd640f69-d008-478f-b027-d1c9c8c9ab1an%40googlegroups.com.