2016-12-07 36 views
1

我試圖自定義並在不同的項目中使用Sodor處理器/火箭核心的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 
... 
} 
+2

你有在範圍'SodorConfiguration'比如在你的測試類? http://docs.scala-lang.org/tutorials/FAQ/finding-implicits.html – Kamyar

+0

感謝Kamyar。這解決了我的問題。我花了一些時間才明白你的意思。 – isuru

回答

相關問題