mirror of
https://github.com/SpinalHDL/SpinalTemplateSbt.git
synced 2025-10-22 23:58:44 +08:00
update 1.0.2
This commit is contained in:
@@ -7,8 +7,8 @@ scalaVersion := "2.11.6"
|
|||||||
EclipseKeys.withSource := true
|
EclipseKeys.withSource := true
|
||||||
|
|
||||||
libraryDependencies ++= Seq(
|
libraryDependencies ++= Seq(
|
||||||
"com.github.spinalhdl" % "spinalhdl-core_2.11" % "latest.release",
|
"com.github.spinalhdl" % "spinalhdl-core_2.11" % "1.0.2",
|
||||||
"com.github.spinalhdl" % "spinalhdl-lib_2.11" % "latest.release"
|
"com.github.spinalhdl" % "spinalhdl-lib_2.11" % "1.0.2"
|
||||||
)
|
)
|
||||||
|
|
||||||
addCompilerPlugin("org.scala-lang.plugins" % "scala-continuations-plugin_2.11.6" % "1.0.2")
|
addCompilerPlugin("org.scala-lang.plugins" % "scala-continuations-plugin_2.11.6" % "1.0.2")
|
||||||
|
@@ -20,8 +20,6 @@ package mylib
|
|||||||
|
|
||||||
import spinal.core._
|
import spinal.core._
|
||||||
import spinal.lib._
|
import spinal.lib._
|
||||||
import spinal.sim._
|
|
||||||
import spinal.core.SimManagedApi._
|
|
||||||
|
|
||||||
import scala.util.Random
|
import scala.util.Random
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@ package mylib
|
|||||||
|
|
||||||
import spinal.core._
|
import spinal.core._
|
||||||
import spinal.sim._
|
import spinal.sim._
|
||||||
import spinal.core.SimManagedApi._
|
import spinal.core.sim._
|
||||||
|
|
||||||
import scala.util.Random
|
import scala.util.Random
|
||||||
|
|
||||||
@@ -13,24 +13,14 @@ object MyTopLevelSim {
|
|||||||
SimConfig(new MyTopLevel).withWave.doManagedSim{dut =>
|
SimConfig(new MyTopLevel).withWave.doManagedSim{dut =>
|
||||||
|
|
||||||
//Fork a process to generate the reset and the clock on the dut
|
//Fork a process to generate the reset and the clock on the dut
|
||||||
fork{
|
dut.clockDomain.forkStimulus(period = 10)
|
||||||
dut.clockDomain.assertReset()
|
|
||||||
dut.clockDomain.fallingEdge()
|
|
||||||
sleep(10)
|
|
||||||
dut.clockDomain.disassertReset()
|
|
||||||
sleep(10)
|
|
||||||
while(true){
|
|
||||||
dut.clockDomain.clockToggle()
|
|
||||||
sleep(5)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
var modelState = 0
|
||||||
var idx = 0
|
var idx = 0
|
||||||
while(idx < 100){
|
while(idx < 100){
|
||||||
//Generate random values to drive the reference model and the dut
|
//Generate random values to drive the reference model and the dut
|
||||||
val cond0, cond1 = Random.nextBoolean()
|
val cond0, cond1 = Random.nextBoolean()
|
||||||
val oldState = dut.io.state.toInt
|
|
||||||
|
|
||||||
//Drive the dut inputs
|
//Drive the dut inputs
|
||||||
dut.io.cond0 #= cond0
|
dut.io.cond0 #= cond0
|
||||||
@@ -39,9 +29,11 @@ object MyTopLevelSim {
|
|||||||
//Wait a rising edge on the clock
|
//Wait a rising edge on the clock
|
||||||
dut.clockDomain.waitRisingEdge()
|
dut.clockDomain.waitRisingEdge()
|
||||||
|
|
||||||
//Calculate the reference model values
|
//Update the reference model values
|
||||||
val modelState = if(cond0) (oldState + 1) & 0xFF else oldState
|
|
||||||
val modelFlag = modelState == 0 || cond1
|
val modelFlag = modelState == 0 || cond1
|
||||||
|
if(cond0) {
|
||||||
|
modelState = (modelState + 1) & 0xFF
|
||||||
|
}
|
||||||
|
|
||||||
//Check that the dut values match with the reference model ones
|
//Check that the dut values match with the reference model ones
|
||||||
assert(dut.io.state.toInt == modelState)
|
assert(dut.io.state.toInt == modelState)
|
||||||
|
Reference in New Issue
Block a user