A simple example for checking spinal-sim environment
copy and paste the following code to your project, then make sure this pure simple case work on your env.
import spinal.core._
import spinal.core.sim._
object EnvCheckSim extends App{
class Sawtooth extends Component{
val io = new Bundle{
val inc = in Bool()
val sawtooth = out UInt(5 bits)
}
val myReg = Reg(UInt(5 bits)) init 0
when(io.inc){
myReg := myReg + 1
}
io.sawtooth := myReg
}
SimConfig
.allOptimisation
.workspacePath("./simWorkspace")
.withFstWave
.compile(new Sawtooth)
.doSimUntilVoid("Sawtooth") { dut =>
dut.clockDomain.forkStimulus(2)
sleep(10)
dut.io.inc #= false
dut.clockDomain.waitSampling(10)
dut.io.inc #= true
sleep(1000)
simSuccess()
}
}
Bug:
Failed to execute simulation and log showed :
Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\Project\SpinalHDL\SpinalHDLSimTest\simWorkspace\Sawtooth\verilator\verilator_1.dll: 找不到指定的程序。
Environment:
PC1
OS:WIN10 Intellij IDEA:2019.3.3 JDK:1.13(then 1.8 instead of 1.13) Verilator:4.032 2020-04-04 rev UNKNOWN_REV (mod)
PC2
OS:WIN10 Intellij IDEA:2019.3.3 JDK:1.8 Verilator:4.032 2020-04-04 rev UNKNOWN_REV (mod)
Description
I installed MSYS2 and Verilator correctly according to the tutorial, but it showed the bug mentioned above when run the simulation on PC1 , but it worked normally on PC2.The steps to install MSYS2 and Verilator were the same for both.The previous JDK for PC1 was 1.13. , which I later changed to 1.8, but the emulation still did not run correctly.
@AlkaidDoge check the windows environment variable $PATH, make sure it's clean . https://blog.csdn.net/htgoco/article/details/103940200
@AlkaidDoge check the windows environment variable $PATH, make sure it's clean . https://blog.csdn.net/htgoco/article/details/103940200 I am sure the PATH is clean and the PATH of PC2 could be even messier.
[Progress] Simulation workspace in D:\scala project\demo1.\simWorkspace\Sawtooth
[Progress] Verilator compilation started
make: *** [/mingw64/share/verilator/include/verilated.mk:239: VSawtooth___024root__DepSet_hcf589bd4__0.o] Error 1
make: *** 正在等待未完成的任务....
make: *** [/mingw64/share/verilator/include/verilated.mk:242: VSawtooth__Syms.o] Error 1
make: *** [/mingw64/share/verilator/include/verilated.mk:239: VSawtooth___024root__DepSet_h489055f6__0.o] Error 1
make: *** [/mingw64/share/verilator/include/verilated.mk:242: VSawtooth___024root__DepSet_hcf589bd4__0__Slow.o] Error 1
make: *** [/mingw64/share/verilator/include/verilated.mk:242: VSawtooth___024root__Slow.o] Error 1
make: *** [/mingw64/share/verilator/include/verilated.mk:242: VSawtooth___024root__DepSet_h489055f6__0__Slow.o] Error 1
make: *** [/mingw64/share/verilator/include/verilated.mk:239: VSawtooth__Trace__0.o] Error 1
make: *** [/mingw64/share/verilator/include/verilated.mk:239: VSawtooth.o] Error 1
make: *** [/mingw64/share/verilator/include/verilated.mk:242: VSawtooth__Trace__0__Slow.o] Error 1
make: *** [/mingw64/share/verilator/include/verilated.mk:245: verilated_threads.o] Error 1
make: *** [VSawtooth.mk:78: VSawtooth__spinalWrapper.o] Error 1
make: *** [/mingw64/share/verilator/include/verilated.mk:245: verilated.o] Error 1
make: *** [/mingw64/share/verilator/include/verilated.mk:245: verilated_fst_c.o] Error 1
Exception in thread "main" java.lang.AssertionError: assertion failed: Verilator C++ model compilation failed
at scala.Predef$.assert(Predef.scala:170)
at spinal.sim.VerilatorBackend$$anonfun$compileVerilator$2.apply$mcV$sp(VerilatorBackend.scala:635)
at spinal.sim.VerilatorBackend.cacheSynchronized(VerilatorBackend.scala:74)
at spinal.sim.VerilatorBackend.compileVerilator(VerilatorBackend.scala:600)
at spinal.sim.VerilatorBackend.
why "assertion failed: Verilator C++ model compilation failed" would happen