Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A simple example for checking spinal-sim environment #2

Open
jijingg opened this issue May 20, 2020 · 4 comments
Open

A simple example for checking spinal-sim environment #2

jijingg opened this issue May 20, 2020 · 4 comments
Labels

Comments

@jijingg
Copy link
Owner

jijingg commented May 20, 2020

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()
    }
}
@jijingg jijingg added the FAQ label May 20, 2020
@AlkaidDoge
Copy link

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.

@jijingg
Copy link
Owner Author

jijingg commented May 25, 2020

@AlkaidDoge check the windows environment variable $PATH, make sure it's clean .
https://blog.csdn.net/htgoco/article/details/103940200

@AlkaidDoge
Copy link

@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.

@Mido-sun
Copy link

[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.(VerilatorBackend.scala:717)
at spinal.core.sim.SpinalVerilatorBackend$.apply(SimBootstraps.scala:139)
at spinal.core.sim.SpinalSimConfig.compile(SimBootstraps.scala:884)
at spinal.core.sim.SpinalSimConfig.compileCloned(SimBootstraps.scala:818)
at spinal.core.sim.SpinalSimConfig.compile(SimBootstraps.scala:795)
at EnvCheckSim$.delayedEndpoint$EnvCheckSim$1(demo9.scala:21)
at EnvCheckSim$delayedInit$body.apply(demo9.scala:4)
at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.collection.immutable.List.foreach(List.scala:392)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
at scala.App$class.main(App.scala:76)
at EnvCheckSim$.main(demo9.scala:4)
at EnvCheckSim.main(demo9.scala)

why "assertion failed: Verilator C++ model compilation failed" would happen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants