[英]Reverse the input in Chisel3
I want to reverse the input signal in Chisel3. 我想反转Chisel3中的输入信号。 For instance, if the input is
12345678
, I want the output to be 87654321
. 例如,如果输入为
12345678
,我希望输出为87654321
。 Can anyone please help me with this? 谁能帮我这个忙吗?
Code: 码:
import chisel3._
import chisel3.util._
import chisel3.iotesters.{ChiselFlatSpec, Driver, PeekPokeTester}
import chisel3.util.Reverse
class Length extends Module {
val in = Input(UInt(64.W))
val out = Output(UInt(8.W))
out := Reverse(in.x)
} }
The solution which was discussed in comments: 评论中讨论的解决方案:
import chisel3._
import chisel3.util.Reverse
class Length extends Module {
val io = IO(
new Bundle {
val in = Input(UInt(64.W))
val out = Output(UInt(8.W))
}
)
io.out := Reverse(io.in)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.