【问题标题】:Chisel not finding the implicit value of a parameter凿子没有找到参数的隐含值
【发布时间】: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
...
}

【问题讨论】:

标签: scala chisel


【解决方案1】:

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

尝试添加:

implicit val conf = new SodorConfiguration

在驱动程序调用之前。

注意 SodorConfiguration 定义在:https://github.com/ucb-bar/riscv-sodor/blob/master/src/common/configurations.scala

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-29
    • 2017-04-26
    • 2019-10-16
    • 1970-01-01
    相关资源
    最近更新 更多