作为tile,如何在Chisel3中以正确的方式将UInt转换为SInt值?IG:
val opC = RegInit(0.U(64.W))
val result = RegInit(0.U(64.W))
result := Mux(opC.toSInt > 0.S, opC, 0.U)
Run Code Online (Sandbox Code Playgroud) 作为标题,我想将 Vec(Bool()) 转换为 UInt 值。
例如
class MyModule extends Module {
val io = IO(new Bundle {
val in_data = Input (Vec (3, Bool() )
val result = Output(UInt(5.W))
})
//how can I convert io.in_data to Uint and the assign to io.result
//I will get io.result = 7 when in_data(1, 1, 1)
}
Run Code Online (Sandbox Code Playgroud)