首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用Verilator修复凿测试错误(应该使用verilator *失败*)?

如何使用Verilator修复凿测试错误(应该使用verilator *失败*)?
EN

Stack Overflow用户
提问于 2019-09-27 21:31:37
回答 1查看 205关注 0票数 2

我运行凿测试,并希望生成输出与校验器。我不能准确地找到错误的原因,但我认为这与verilator有关。这是执行测试的代码的一部分。它必须打印一些输出并生成仿真文件。

代码语言:javascript
复制
class ComplexMemoryLoadingSpec extends  FreeSpec with Matchers {
  "memory loading should be possible with complex memories" - {

    val targetDirName = "test_run_dir/complex_mem_test"
    FileUtils.makeDirectory(targetDirName)

    val path1 = Paths.get(targetDirName + "/mem_cameraman.bin")


    Files.copy(getClass.getResourceAsStream("/cameraman.bin"), path1, REPLACE_EXISTING)



    "should work with verilator" in {
      iotesters.Driver.execute(
        args = Array("--backend-name", "verilator", "--target-dir", targetDirName, "--top-name", "complex_mem_test"),
        dut = () => new HasComplexMemory(memoryDepth = 65536)
      ) { c =>
        new HasComplexMemoryTester(c)
      } should be(true)
    }
  }
}

它不工作,我得到了这个错误:

代码语言:javascript
复制
[info] Done compiling.
[info] [0.005] Elaborating design...
[info] [0.515] Done elaborating.
Total FIRRTL Compile Time: 1965.5 ms
cd /home/med/workspace/ChiselProjects/convolution/test_run_dir/complex_mem_test && verilator --cc HasComplexMemory.v --assert -Wno-fatal -Wno-WIDTH -Wno-STMTDLY -O1 --top-module HasComplexMemory +define+TOP_TYPE=VHasComplexMemory +define+PRINTF_COND=!HasComplexMemory.reset +define+STOP_COND=!HasComplexMemory.reset -CFLAGS "-Wno-undefined-bool-conversion -O1 -DTOP_TYPE=VHasComplexMemory -DVL_USER_FINISH -include VHasComplexMemory.h" -Mdir /home/med/workspace/ChiselProjects/convolution/test_run_dir/complex_mem_test -f /home/med/workspace/ChiselProjects/convolution/test_run_dir/complex_mem_test/firrtl_black_box_resource_files.f --exe /home/med/workspace/ChiselProjects/convolution/test_run_dir/complex_mem_test/HasComplexMemory-harness.cpp --trace
make: Entering directory '/home/med/workspace/ChiselProjects/convolution/test_run_dir/complex_mem_test'
g++  -I.  -MMD -I/usr/local/share/verilator/include -I/usr/local/share/verilator/include/vltstd -DVL_PRINTF=printf -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=1 -faligned-new -Wno-bool-operation -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow     -Wno-undefined-bool-conversion -O1 -DTOP_TYPE=VHasComplexMemory -DVL_USER_FINISH -include VHasComplexMemory.h   -c -o HasComplexMemory-harness.o /home/med/workspace/ChiselProjects/convolution/test_run_dir/complex_mem_test/HasComplexMemory-harness.cpp
g++  -I.  -MMD -I/usr/local/share/verilator/include -I/usr/local/share/verilator/include/vltstd -DVL_PRINTF=printf -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=1 -faligned-new -Wno-bool-operation -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow     -Wno-undefined-bool-conversion -O1 -DTOP_TYPE=VHasComplexMemory -DVL_USER_FINISH -include VHasComplexMemory.h   -c -o verilated.o /usr/local/share/verilator/include/verilated.cpp
g++  -I.  -MMD -I/usr/local/share/verilator/include -I/usr/local/share/verilator/include/vltstd -DVL_PRINTF=printf -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=1 -faligned-new -Wno-bool-operation -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow     -Wno-undefined-bool-conversion -O1 -DTOP_TYPE=VHasComplexMemory -DVL_USER_FINISH -include VHasComplexMemory.h   -c -o verilated_vcd_c.o /usr/local/share/verilator/include/verilated_vcd_c.cpp
/usr/bin/perl /usr/local/share/verilator/bin/verilator_includer -DVL_INCLUDE_OPT=include VHasComplexMemory.cpp VHasComplexMemory___024unit.cpp > VHasComplexMemory__ALLcls.cpp
/usr/bin/perl /usr/local/share/verilator/bin/verilator_includer -DVL_INCLUDE_OPT=include VHasComplexMemory__Trace.cpp VHasComplexMemory__Syms.cpp VHasComplexMemory__Trace__Slow.cpp > VHasComplexMemory__ALLsup.cpp
g++  -I.  -MMD -I/usr/local/share/verilator/include -I/usr/local/share/verilator/include/vltstd -DVL_PRINTF=printf -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=1 -faligned-new -Wno-bool-operation -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow     -Wno-undefined-bool-conversion -O1 -DTOP_TYPE=VHasComplexMemory -DVL_USER_FINISH -include VHasComplexMemory.h   -c -o VHasComplexMemory__ALLcls.o VHasComplexMemory__ALLcls.cpp
g++  -I.  -MMD -I/usr/local/share/verilator/include -I/usr/local/share/verilator/include/vltstd -DVL_PRINTF=printf -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=1 -faligned-new -Wno-bool-operation -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow     -Wno-undefined-bool-conversion -O1 -DTOP_TYPE=VHasComplexMemory -DVL_USER_FINISH -include VHasComplexMemory.h   -c -o VHasComplexMemory__ALLsup.o VHasComplexMemory__ALLsup.cpp
      Archiving VHasComplexMemory__ALL.a ...
ar r VHasComplexMemory__ALL.a VHasComplexMemory__ALLcls.o VHasComplexMemory__ALLsup.o
ranlib VHasComplexMemory__ALL.a
g++    HasComplexMemory-harness.o verilated.o verilated_vcd_c.o VHasComplexMemory__ALL.a    -o VHasComplexMemory -lm -lstdc++ 
make: Leaving directory '/home/med/workspace/ChiselProjects/convolution/test_run_dir/complex_mem_test'
sim start on Dell at Fri Sep 27 13:38:29 2019
inChannelName: 00008431.in
outChannelName: 00008431.out
cmdChannelName: 00008431.cmd
STARTING test_run_dir/complex_mem_test/VHasComplexMemory
Enabling waves..%Error: test_run_dir/complex_mem_test/mem_a:0: $readmem file not found
Aborting...
[info] ComplexMemoryLoadingSpec:
[info] memory loading should be possible with complex memories
[info] - should work with verilator *** FAILED ***
[info]   chisel3.iotesters.TestApplicationException: test application exit - exit code 134
[info]   at chisel3.iotesters.SimApiInterface.throwExceptionIfDead(SimApiInterface.scala:98)
[info]   at chisel3.iotesters.SimApiInterface.chisel3$iotesters$SimApiInterface$$mwhile(SimApiInterface.scala:107)
[info]   at chisel3.iotesters.SimApiInterface$$anonfun$start$3.apply$mcVI$sp(SimApiInterface.scala:268)
[info]   at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:160)
[info]   at chisel3.iotesters.SimApiInterface.start(SimApiInterface.scala:266)
[info]   at chisel3.iotesters.SimApiInterface.<init>(SimApiInterface.scala:325)
[info]   at chisel3.iotesters.VerilatorBackend.<init>(VerilatorBackend.scala:295)
[info]   at chisel3.iotesters.setupVerilatorBackend$.apply(VerilatorBackend.scala:284)
[info]   at chisel3.iotesters.Driver$$anonfun$execute$1$$anonfun$apply$mcZ$sp$1.apply$mcZ$sp(Driver.scala:56)
[info]   at chisel3.iotesters.Driver$$anonfun$execute$1$$anonfun$apply$mcZ$sp$1.apply(Driver.scala:39)
[info]   ...
[info] ScalaTest
[info] Run completed in 1 minute, 41 seconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0
[info] *** 1 TEST FAILED ***
[error] Failed: Total 1, Failed 1, Errors 0, Passed 0
[error] Failed tests:
[error]     util.ComplexMemoryLoadingSpec
[error] (Test / testOnly) sbt.TestsFailedException: Tests unsuccessful

有人能帮我吗?或者解释哪里出了问题

EN

回答 1

Stack Overflow用户

发布于 2019-09-28 06:15:23

我认为问题在于它找不到包含您想要加载到内存中的数据的文件。如果它是一个复杂的内存,那么对于内存中的每个不同项,您需要有一个单独的文件。

它找不到文件test_run_dir/complex_mem_test/mem_a我猜这两行

代码语言:javascript
复制
val path1 = Paths.get(targetDirName + "/mem_cameraman.bin")
Files.copy(getClass.getResourceAsStream("/cameraman.bin"), path1,REPLACE_EXISTING)

我试图将数据文件放在verilator可以找到的地方,但我不认为这与代码所说的文件将被找到的位置相匹配。

你能显示内存声明和你指定文件名的位置吗?这绝对是复杂的。在loading chisel memories上查看此文档

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58135596

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档