首页 > 解决方案 > firrtl_interpreter.InterpreterException: error: ConcreteSInt(303, 9) bad width 9 需要 10

问题描述

我有一个生成以下 FIRRTL 的模块

module Deep_1 : 
    input clock : Clock
    input reset : UInt<1>
    output io : {in : {flip data : SInt<8>[4]}, constIn : {flip data : SInt<8>[4]}, ...}
    ...
    ... (elided)
    ...
    wire inputData : SInt<8>[4] @[Deep.scala 32:23]
    wire constInputData : SInt<8>[4] @[Deep.scala 33:28]
    reg outputData : SInt<8>[4], clock @[Deep.scala 34:23]
    inputData[2] <= io.in.data[2] @[Deep.scala 37:18]
    constInputData[2] <= io.constIn.data[2] @[Deep.scala 38:23]
    node _T_209 = add(inputData[2], constInputData[2]) @[package.scala 32:44]
    node _T_210 = tail(_T_209, 1) @[package.scala 32:44]
    node _T_211 = asSInt(_T_210) @[package.scala 32:44]
    outputData[2] <= _T_211 @[Deep.scala 39:19]
    ...
    ... (elided)
    ...

但是当我尝试通过 firrtl 解释器运行测试时,我得到了

Exception during evaluation: error: ConcreteSInt(303, 9) bad width 9 needs 10  @[package.scala 32:44:@82.4]
Expression Evaluation stack
   0 dut.outputData_2:Reg -> dut._T_211
   1 dut._T_211:Node -> asSInt(dut._T_210)
   2 dut._T_210:Node -> tail(dut._T_209, 1)
   3 dut._T_209:Node -> add(dut.inputData_2, dut.constInputData_2)

如果我理解正确的话,就是说宽度outputData[2]是 9 但需要 10。但是,据我所见,两者的宽度outputData[2]应该_T_211是 8,第一个是定义的,第二个是应用了add()andtail()操作的结果。

我错过了什么?

标签: chisel

解决方案


你的软件有多流行?我无法重现当前版本的解释器的问题。我在 gist Attempt 中使用了以下 firrtl 测试来重现我未省略的 firrtl-interpreter 宽度错误。正如@Kamyar 所说,您可以尝试使用 Treadle 后端吗?在这一点上,它比解释器更现代,得到更好的支持。


推荐阅读