反转Chisel3中的输入

时间:2018-07-05 10:21:48

标签: scala reverse chisel

我想反转Chisel3中的输入信号。例如,如果输入为12345678,则我希望输出为87654321。有人可以帮我吗?

代码:

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)

}

1 个答案:

答案 0 :(得分:2)

评论中讨论的解决方案:

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)
}