我用Dma模块编写了一个样本箱,该模块是esp凿子加速器中的一个子模块,但是当我运行sbt test或运行单个测试时,我得到了一个错误:method <init>()V not found代码是:
class QuickDMA_test extends FlatSpec with ChiselScalatestTester with Matchers{
behavior of "QuickDMAModule"
// test class body here
it should "read some number to tlb" in {
//test case body here
implicit val parames: Config = (new QuickDMAConfig).toInstance
test(new Wrapper()(parames)).withAnnotations(Seq(WriteVcdAnnotation )) { c =>
c.io.control.wen.poke(false.B)
......Dma模块是
object DmaSize {
private val enums = Enum(8)
val Seq(bytes, wordHalf, word, wordDouble, wordQuad, word8, word16, word32) = enums
def gen: UInt = chiselTypeOf(enums.head)
}
class DmaControl extends Bundle {
val index = UInt(32.W)
val length = UInt(32.W)
val size = DmaSize.gen
}
class DmaIO(val dmaWidth: Int) extends Bundle {
val Seq(readControl, writeControl) = Seq.fill(2)(Decoupled(new DmaControl))
val readChannel = Flipped(Decoupled(UInt(dmaWidth.W)))
val writeChannel = Decoupled(UInt(dmaWidth.W))
}
class DmaRequest(val memorySize: Int) extends Bundle {
val index = UInt(log2Up(memorySize).W)
val length = UInt(log2Up(memorySize).W)
val tpe = Bool()
}
object DmaRequest {
val read: Bool = false.B
val write: Bool = true.B
def init_(memorySize: Int) = {
val a = Wire(new Valid(new DmaRequest(memorySize)))
a.valid := false.B
a.bits.index := DontCare
a.bits.length := DontCare
a.bits.tpe := DontCare
a
}
}
class Dma[A <: Data](size: Int, gen: A, initFile: Option[String] = None) extends Module {
private val dmaWidth = gen.getWidth
val io = IO(Flipped(new DmaIO(dmaWidth)))
val req = RegInit(DmaRequest.init_(size))
/* Only one outstanding read or write request at a time */
Seq(io.readControl, io.writeControl).map(_.ready := !req.valid)
val arb = Module(new RRArbiter(new DmaControl, 2))
arb.io.in
.zip(Seq(io.readControl, io.writeControl))
.map{ case (a, b) => a <> b }我通过以下方式实例Dma模块
val dma = Module(new Dma(1024, UInt(bitwidth.W), Some("src/test/resource/linear-mem.txt")))而错误是
An exception or error caused a run to abort: treadle.stage.TreadleTesterPhase: method <init>()V not found
java.lang.NoSuchMethodError: treadle.stage.TreadleTesterPhase: method <init>()V not found
at chiseltest.backends.treadle.TreadleExecutive$.start(TreadleExecutive.scala:51)
at chiseltest.defaults.package$.createDefaultTester(defaults.scala:24)
at chiseltest.ChiselScalatestTester$TestBuilder.apply(ChiselScalatestTester.scala:33)
at QuickDMA_test.$anonfun$new$1(ANDtest.scala:105)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)
at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)
at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
at org.scalatest.Transformer.apply(Transformer.scala:22)
at org.scalatest.Transformer.apply(Transformer.scala:20)
at org.scalatest.FlatSpecLike$$anon$5.apply(FlatSpecLike.scala:1682)
at org.scalatest.TestSuite.withFixture(TestSuite.scala:196)
at org.scalatest.TestSuite.withFixture$(TestSuite.scala:195)
at QuickDMA_test.chiseltest$ChiselScalatestTester$$super$withFixture(ANDtest.scala:99)
at chiseltest.ChiselScalatestTester.$anonfun$withFixture$1(ChiselScalatestTester.scala:50)
at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
at chiseltest.ChiselScalatestTester.withFixture(ChiselScalatestTester.scala:50)
at chiseltest.ChiselScalatestTester.withFixture$(ChiselScalatestTester.scala:47)
at QuickDMA_test.withFixture(ANDtest.scala:99)
at org.scalatest.FlatSpecLike.invokeWithFixture$1(FlatSpecLike.scala:1680)
at org.scalatest.FlatSpecLike.$anonfun$runTest$1(FlatSpecLike.scala:1692)
at org.scalatest.SuperEngine.runTestImpl(Engine.scala:286)
at org.scalatest.FlatSpecLike.runTest(FlatSpecLike.scala:1692)
at org.scalatest.FlatSpecLike.runTest$(FlatSpecLike.scala:1674)
at org.scalatest.FlatSpec.runTest(FlatSpec.scala:1685)
at org.scalatest.FlatSpecLike.$anonfun$runTests$1(FlatSpecLike.scala:1750)
at org.scalatest.SuperEngine.$anonfun$runTestsInBranch$1(Engine.scala:393)
at scala.collection.immutable.List.foreach(List.scala:431)
at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:381)
at org.scalatest.SuperEngine.runTestsInBranch(Engine.scala:370)
at org.scalatest.SuperEngine.$anonfun$runTestsInBranch$1(Engine.scala:407)
at scala.collection.immutable.List.foreach(List.scala:431)
at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:381)
at org.scalatest.SuperEngine.runTestsInBranch(Engine.scala:376)
at org.scalatest.SuperEngine.runTestsImpl(Engine.scala:458)
at org.scalatest.FlatSpecLike.runTests(FlatSpecLike.scala:1750)
at org.scalatest.FlatSpecLike.runTests$(FlatSpecLike.scala:1749)
at org.scalatest.FlatSpec.runTests(FlatSpec.scala:1685)
at org.scalatest.Suite.run(Suite.scala:1124)
at org.scalatest.Suite.run$(Suite.scala:1106)
at org.scalatest.FlatSpec.org$scalatest$FlatSpecLike$$super$run(FlatSpec.scala:1685)
at org.scalatest.FlatSpecLike.$anonfun$run$1(FlatSpecLike.scala:1795)
at org.scalatest.SuperEngine.runImpl(Engine.scala:518)
at org.scalatest.FlatSpecLike.run(FlatSpecLike.scala:1795)
at org.scalatest.FlatSpecLike.run$(FlatSpecLike.scala:1793)
at org.scalatest.FlatSpec.run(FlatSpec.scala:1685)
at org.scalatest.tools.SuiteRunner.run(SuiteRunner.scala:45)
at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$13(Runner.scala:1349)
at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$13$adapted(Runner.scala:1343)
at scala.collection.immutable.List.foreach(List.scala:431)
at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1343)
at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24(Runner.scala:1033)
at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24$adapted(Runner.scala:1011)
at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1509)
at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1011)
at org.scalatest.tools.Runner$.run(Runner.scala:850)
at org.scalatest.tools.Runner.run(Runner.scala)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2or3(ScalaTestRunner.java:38)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:25)发布于 2021-12-27 17:06:36
Scala生态系统,所以有点期待:您有冲突的依赖关系。您的chiseltest.backends.treadle.TreadleExecutive$类文件包含对treadle.stage.TreadleTesterPhase类型的no-args构造函数的调用(这就是<init>()V的意思:这是JVM-ese表示的“具有零参数的构造函数”)。<init>是‘方法’的名称(构造函数在JVM级别上有这个名称),()包含参数(在此之间没有任何参数),V指示函数返回void,所有构造函数都是定义的。但是,treadle.stage.TreadleTesterPhase类型存在,但在其中没有一个非args构造函数。
对此的通常解释是,以前的版本中使用过,但现在已经不再使用了,您使用的chiseltest.backends库是针对仍然拥有它的旧版本进行编译的。
修复方法是将依赖项更新为最新版本。如果这样做仍然不起作用,那么scala生态系统往往会破坏很多东西,并且倾向于放弃项目,所以找出两者中哪一个是“旧的”。与网站等检查,该项目是否已被放弃,或他们只是缓慢地发布更新。
如果被遗弃了,就开始寻找替代方案。Scala并不是一个很好的生态系统,可以将废弃的项目作为代码库的一部分。如果不放弃,则将另一个降级,直到错误消失为止。
发布于 2021-12-27 17:54:23
这是一个链接错误,您的版本不同步.请参阅Chisel网站,以获得各种项目的哪些版本一起工作的文档:https://www.chisel-lang.org/chisel3/docs/appendix/versioning.html
特别是,该存储库似乎正在使用与Chisel3.2兼容的项目。您是否完全更改了构建,还是这只是一个本地构建?
https://stackoverflow.com/questions/70498102
复制相似问题