jijingg / Spinal-bootcamp

SpinalHDL-tutorial based on Jupyter Notebook
126 stars 46 forks source link

A simple example for checking spinal-sim environment #2

Open jijingg opened 4 years ago

jijingg commented 4 years ago

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()
    }
}
AlkaidDoge commented 4 years ago

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 commented 4 years ago

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

AlkaidDoge commented 4 years ago

@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 commented 1 year ago

[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_hcf589bd40.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_h489055f60.o] Error 1 make: [/mingw64/share/verilator/include/verilated.mk:242: VSawtooth_024root__DepSet_hcf589bd40__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: VSawtooth024rootDepSet_h489055f60Slow.o] Error 1 make: [/mingw64/share/verilator/include/verilated.mk:239: VSawtoothTrace0.o] Error 1 make: [/mingw64/share/verilator/include/verilated.mk:239: VSawtooth.o] Error 1 make: [/mingw64/share/verilator/include/verilated.mk:242: VSawtoothTrace0__Slow.o] Error 1 make: [/mingw64/share/verilator/include/verilated.mk:245: verilated_threads.o] Error 1 make: *** [VSawtooth.mk:78: VSawtoothspinalWrapper.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