凿3分配到位范围

Luí*_*ues 3 chisel

这似乎在凿子2中有效,但现在不起作用:

class TestX extends Module
{
    val io = IO(new Bundle {
        val a = Output(UInt(width=2))
    })

    io.a(1, 0) := UInt(0)
}
Run Code Online (Sandbox Code Playgroud)

错误:[模块TestX]表达式T_4用作FEMALE,但只能用作MALE。

此更改的解决方法是什么?

Jac*_*nig 6

Chisel3当前不支持子字分配。该错误消息虽然毫无帮助,但我提出了一个问题:https : //github.com/ucb-bar/chisel3/issues/399

您可以通过使用提取和串联来解决此问题:

class TestX extends Module {
  val io = IO(new Bundle {
    val a = Input(UInt(4.W))
    val b = Output(UInt(4.W))
  })
  io.b := Cat(io.a(3, 2), 0.U(2.W))  
}
Run Code Online (Sandbox Code Playgroud)

编辑:用现代语法更新