1

我根据https://github.com/freechipsproject/chisel-testers/wiki/Using-the-Hardware-IO-Testers用 SteppedHWIOTester 编写了一个加法器,但有一些问题:

import chisel3._
import chisel3.iotesters.{SteppedHWIOTester, ChiselFlatSpec}

class Adder (val w:Int) extends Module {
  val io = IO(new Bundle {
    val in0 = Input(UInt(w.W))
    val in1 = Input(UInt(w.W))
    val out = Output(UInt(w.W))
  })
  io.out := io.in0 + io.in1
}


class AdderTests extends SteppedHWIOTester {
  val device_under_test = Module( new Adder(10) )
  val c = device_under_test
  enable_all_debug = true

  rnd.setSeed(0L)
  for(i<-0 until 10) {
    val in0 = rnd.nextInt(1 << c.w)
    val in1 = rnd.nextInt(1 << c.w)
    poke(c.io.in0, in0)
    poke(c.io.in1, in1)
    expect(c.io.out, (in0 + in1) & ((1 << c.w) - 1))

    step(1)
  }
}

class AdderTester extends ChiselFlatSpec {
  "Adder" should "compile and run without incident" in {
     assertTesterPasses { new AdderTests }
  }
}

错误是:

> test-only AdderTester
[info] [0.004] Elaborating design...
[info] AdderTester:
[info] Adder
[info] Exception encountered when attempting to run a suite with class name: AdderTester *** ABORTED ***
[info]   java.lang.NoSuchMethodError: chisel3.core.Bool.do_unary_$bang(Lchisel3/internal/sourceinfo/SourceInfo;Lchisel3/core/CompileOptions;)Lchisel3/core/Bool;
[info]   at chisel3.iotesters.SteppedHWIOTester.finish(SteppedHWIOTester.scala:179)
[info]   at chisel3.testers.TesterDriver$$anonfun$finishWrapper$1.apply(TesterDriver.scala:58)
[info]   at chisel3.testers.TesterDriver$$anonfun$finishWrapper$1.apply(TesterDriver.scala:56)
[info]   at chisel3.core.Module$.do_apply(Module.scala:42)
[info]   at chisel3.Driver$$anonfun$elaborate$1.apply(Driver.scala:92)
[info]   at chisel3.Driver$$anonfun$elaborate$1.apply(Driver.scala:92)
[info]   at chisel3.internal.Builder$$anonfun$build$1.apply(Builder.scala:240)
[info]   at chisel3.internal.Builder$$anonfun$build$1.apply(Builder.scala:238)
[info]   at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
[info]   at chisel3.internal.Builder$.build(Builder.scala:238)
[info]   ...
[info] ScalaCheck
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] ScalaTest
[info] Run completed in 249 milliseconds.
[info] Total number of tests run: 0
[info] Suites: completed 0, aborted 1
[info] Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
[info] *** 1 SUITE ABORTED ***
[error] Error: Total 1, Failed 0, Errors 1, Passed 0
[error] Error during tests:
[error]     AdderTester
[error] (test:testOnly) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 11 s, completed Jun 14, 2017 10:09:14 PM

那么我应该怎么做才能修复它呢?非常感谢!

4

1 回答 1

0

这听起来像是一个不匹配的库问题。您能否尝试清除常春藤缓存中的凿子库并重新运行。要清除 unix-y 类型机器上的缓存,只需运行即可。

rm -rf ~/.ivy2/cache/edu.berkeley.cs/*

如果您在本地构建了任何凿子套件,我建议您从存储库中提取最新版本并重新发布它们。

于 2017-06-16T18:42:00.827 回答