From 54ce67d40e500df8463ae8d947ecb14c486962fb Mon Sep 17 00:00:00 2001 From: Dolu1990 Date: Sat, 30 Dec 2017 03:36:18 +0100 Subject: [PATCH] SpinalHDL 1.1.1 --- build.sbt | 4 ++-- src/main/scala/mylib/MyTopLevelSim.scala | 21 +++++++++------------ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/build.sbt b/build.sbt index c9f323f..e6bbcdd 100644 --- a/build.sbt +++ b/build.sbt @@ -7,8 +7,8 @@ scalaVersion := "2.11.6" EclipseKeys.withSource := true libraryDependencies ++= Seq( - "com.github.spinalhdl" % "spinalhdl-core_2.11" % "1.1.0", - "com.github.spinalhdl" % "spinalhdl-lib_2.11" % "1.1.0" + "com.github.spinalhdl" % "spinalhdl-core_2.11" % "1.1.1", + "com.github.spinalhdl" % "spinalhdl-lib_2.11" % "1.1.1" ) addCompilerPlugin("org.scala-lang.plugins" % "scala-continuations-plugin_2.11.6" % "1.0.2") diff --git a/src/main/scala/mylib/MyTopLevelSim.scala b/src/main/scala/mylib/MyTopLevelSim.scala index 4db12dd..4ea40f6 100644 --- a/src/main/scala/mylib/MyTopLevelSim.scala +++ b/src/main/scala/mylib/MyTopLevelSim.scala @@ -17,26 +17,23 @@ object MyTopLevelSim { var modelState = 0 var idx = 0 while(idx < 100){ - //Generate random values to drive the reference model and the dut - val cond0, cond1 = Random.nextBoolean() - - //Drive the dut inputs - dut.io.cond0 #= cond0 - dut.io.cond1 #= cond1 + //Drive the dut inputs with random values + dut.io.cond0 #= Random.nextBoolean() + dut.io.cond1 #= Random.nextBoolean() //Wait a rising edge on the clock dut.clockDomain.waitRisingEdge() - //Update the reference model values - if(cond0) { - modelState = (modelState + 1) & 0xFF - } - val modelFlag = modelState == 0 || cond1 - //Check that the dut values match with the reference model ones + val modelFlag = modelState == 0 || dut.io.cond1.toBoolean assert(dut.io.state.toInt == modelState) assert(dut.io.flag.toBoolean == modelFlag) + //Update the reference model value + if(dut.io.cond0.toBoolean) { + modelState = (modelState + 1) & 0xFF + } + idx += 1 } }