【发布时间】:2016-12-07 03:57:22
【问题描述】:
我正在尝试在不同的项目中自定义和使用 Sodor 处理器/Rocket 内核的 ALU 源文件。所以我复制了包含configurations.scala文件的公共文件夹,希望使用添加到alu源文件中的参数。但是,当我运行 sbt "test-only..." 时,我收到以下错误,到目前为止我找不到解决方案。
[info] Compiling 1 Scala source to /home/isuru/fyp/ChiselProjects/RiscvIoT/target/scala-2.11/test-classes...
[error] /home/isuru/fyp/ChiselProjects/RiscvIoT/src/test/scala/core/aluTest.scala:42: could not find implicit value for parameter conf: Common.SodorConfiguration
[error] Driver(() => new ALU, backendName) {
[error] ^
[error] one error found
[error] (test:compileIncremental) Compilation failed
[error] Total time: 0 s, completed Dec 6, 2016 10:45:25 PM
这是包含隐式参数的源文件部分。由于全文很长,我只发布该部分。
class ALUIO(implicit conf: SodorConfiguration) extends Bundle {
val fn = Bits(INPUT, SZ_ALU_FN)
val in2 = UInt(INPUT, conf.xprlen)
val in1 = UInt(INPUT, conf.xprlen)
val out = UInt(OUTPUT, conf.xprlen)
val adder_out = UInt(OUTPUT, conf.xprlen)
}
class ALU(implicit conf: SodorConfiguration) extends Module
{
val io = new ALUIO
val msb = conf.xprlen-1
...
}
【问题讨论】:
-
您的测试员类中是否有
SodorConfiguration实例? docs.scala-lang.org/tutorials/FAQ/finding-implicits.html -
谢谢卡米亚。这解决了我的问题。我花了一些时间才明白你说的。