凿子没有找到参数的隐含值

时间:2016-12-07 03:57:23

标签: scala chisel

我正在尝试在不同的项目中自定义和使用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
...
}

1 个答案:

答案 0 :(得分:2)

正如Kamyar指出的那样,你需要在实例化ALU的范围内有一个隐式的SodorConfiguration。

尝试添加:

implicit val conf = new SodorConfiguration
在调用驱动程序之前

请注意,SodorConfiguration在以下内容中定义:https://github.com/ucb-bar/riscv-sodor/blob/master/src/common/configurations.scala