[英]Chisel not finding the implicit value of a parameter
I am trying to customize and use the ALU source file of Sodor processor/Rocket core in a different project. 我正在尝试在其他项目中自定义和使用Sodor处理器/火箭核心的ALU源文件。 So I copied the common folder that contains configurations.scala file hoping to use the parameters added to that in the alu source file.
因此,我复制了包含configurations.scala文件的公用文件夹,希望使用添加到alu源文件中的参数。 However, when I run sbt "test-only..." I get the following error which I couldn't find a solution for up to now.
但是,当我以“仅测试...”方式运行sbt时,出现以下错误,到目前为止,我仍然找不到解决方案。
[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
This the section of the source file that includes implicit parameters. 这是源文件中包含隐式参数的部分。 I am posting only that section since the complete text is very long.
我只发布该部分,因为全文非常长。
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
...
}
As Kamyar pointed out, you need to have an implicit SodorConfiguration in scope where you instantiate the ALU. 正如Kamyar指出的,您需要在实例化ALU的范围内具有隐式SodorConfiguration。
Try adding: 尝试添加:
implicit val conf = new SodorConfiguration
before the Driver invocation. 在驱动程序调用之前。
Note that SodorConfiguration is defined in: https://github.com/ucb-bar/riscv-sodor/blob/master/src/common/configurations.scala 请注意,SodorConfiguration在以下位置定义: https : //github.com/ucb-bar/riscv-sodor/blob/master/src/common/configurations.scala
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.